navigate to home when press chat tab on chat screen

--- src/status_im/ui/components/tabbar/core.cljs
+++ src/status_im/ui/components/tabbar/core.cljs
@@ -75,16 +75,16 @@
 (def tabs
   (reagent/adapt-react-class
    (fn [props]
-     (let [{:keys [navigate index route state]} (bean props)
+     (let [{:keys [navigate index route state popToTop]} (bean props)
            {:keys [keyboard-shown]
             :or   {keyboard-shown false}} (when platform/android? (rn/use-keyboard))
-           {:keys [bottom]}               (safe-area/use-safe-area)
-           animated-visible               (animated/use-timing-transition
-                                           (main-tab? (keyword route))
-                                           {:duration 150})
-           keyboard-visible               (animated/use-timing-transition
-                                           keyboard-shown
-                                           {:duration 200})]
+           {:keys [bottom]} (safe-area/use-safe-area)
+           animated-visible (animated/use-timing-transition
+                             (main-tab? (keyword route))
+                             {:duration 150})
+           keyboard-visible (animated/use-timing-transition
+                             keyboard-shown
+                             {:duration 200})]
        (reagent/as-element
         [animated/view {:style          (tabs.styles/tabs-wrapper keyboard-shown keyboard-visible)
                         :pointer-events (if keyboard-shown "none" "auto")}
@@ -99,10 +99,12 @@
             [tab
              {:icon                icon
               :label               title
-              :on-press            #(let [view-id (navigation/get-index-route-name route-index (bean state))]
-                                      (re-frame/dispatch-sync [:screens/tab-will-change view-id])
-                                      (reagent/flush)
-                                      (navigate (name nav-stack)))
+              :on-press            #(if (= (str index) (str route-index))
+                                      (popToTop)
+                                      (let [view-id (navigation/get-index-route-name route-index (bean state))]
+                                        (re-frame/dispatch-sync [:screens/tab-will-change view-id])
+                                        (reagent/flush)
+                                        (navigate (name nav-stack))))
               :accessibility-label accessibility-label
               :count-subscription  count-subscription
               :active?             (= (str index) (str route-index))
@@ -112,10 +114,12 @@

 (defn tabbar [props]
   (let [navigate (oget props "navigation" "navigate")
-        state    (bean (oget props "state"))
-        index    (get state :index)]
+        pop-to-top (oget props "navigation" "popToTop")
+        state (bean (oget props "state"))
+        index (get state :index)]
     (reagent/as-element
      [tabs {:navigate navigate
             :state    (oget props "state")
+            :popToTop pop-to-top
             :route    (navigation/get-active-route-name state)
             :index    index}])))


Update generator.clj

Update generator.clj

--- src/swagger_gen/examples/scala/generator.clj
+++ src/swagger_gen/examples/scala/generator.clj
@@ -22,5 +22,5 @@
         (fn [spec]
           (merge params
             {:definitions (->> (:definitions spec)
-                          (map expand-def)
-                          (sort-by :name))}))))))
+                               (map expand-def)
+                               (sort-by :name))}))))))


CMR-6318 addressed PR comments

CMR-6318 addressed PR comments

--- system-int-test/test/cmr/system_int_test/search/autocomplete/suggestion_reindex_test.clj
+++ system-int-test/test/cmr/system_int_test/search/autocomplete/suggestion_reindex_test.clj
@@ -69,38 +69,10 @@
              :Fees "None currently"
              :Format "NetCDF-3"}]})

-(defn autocomplete-reindex-fixture
-  [f]
-  (let [coll1 (d/ingest "PROV1"
-                        (dc/collection
-                         {:DataCenters [(data-umm-spec/data-center {:Roles ["ARCHIVER"] :ShortName "DOI/USGS/CMG/WHSC"})]
-                          :ArchiveAndDistributionInformation gdf1
-                          :SpatialKeywords ["DC" "Miami"]
-                          :ProcessingLevelId (:ProcessingLevelId (fu/processing-level-id "PL1"))
-                          :Projects [(:Projects (fu/projects "proj1" "PROJ2"))]
-                          :Platforms [(:Platforms (fu/platforms fu/FROM_KMS 2 2 1))]
-                          :ScienceKeywords [(:ScienceKeywords (fu/science-keywords sk1 sk2))]}))
-
-        coll2 (fu/make-coll 2 "PROV1"
-                            (fu/science-keywords sk1 sk3)
-                            (fu/projects "proj1" "PROJ2")
-                            (fu/platforms fu/FROM_KMS 2 2 1)
-                            (fu/processing-level-id "PL1")
-                            {:DataCenters [(data-umm-spec/data-center {:Roles ["ARCHIVER"] :ShortName "DOI/USGS/CMG/WHSC"})]
-                             :ScienceKeywords [(:ScienceKeywords (fu/science-keywords sk1 sk2))]})
-
-        coll3 (d/ingest-concept-with-metadata-file "CMR-6287/C1000000029-EDF_OPS.xml"
-                                                   {:provider-id "PROV1"
-                                                    :concept-type :collection
-                                                    :format-key :echo10})
-        _ (index/wait-until-indexed)]
-    (f)))
-
 (use-fixtures :each (join-fixtures
-                     [(ingest/reset-fixture {"provguid1" "PROV1"})
-                      hu/grant-all-humanizers-fixture
-                      hu/save-sample-humanizers-fixture
-                      autocomplete-reindex-fixture]))
+                      [(ingest/reset-fixture {"provguid1" "PROV1"})
+                       hu/grant-all-humanizers-fixture
+                       hu/save-sample-humanizers-fixture]))

 (deftest reindex-suggestions-test
   (testing "verify no results come back before reindexing has occurred"
@@ -109,19 +81,44 @@
       (is (= 0 (count before)))))

   (testing "after running a reindex values should exist"
-    (let [_ (index/reindex-suggestions)
+    (let [coll1 (d/ingest "PROV1"
+                          (dc/collection
+                            {:DataCenters [(data-umm-spec/data-center {:Roles ["ARCHIVER"] :ShortName "DOI/USGS/CMG/WHSC"})]
+                             :ArchiveAndDistributionInformation gdf1
+                             :SpatialKeywords ["DC" "Miami"]
+                             :ProcessingLevelId (:ProcessingLevelId (fu/processing-level-id "PL1"))
+                             :Projects [(:Projects (fu/projects "proj1" "PROJ2"))]
+                             :Platforms [(:Platforms (fu/platforms fu/FROM_KMS 2 2 1))]
+                             :ScienceKeywords [(:ScienceKeywords (fu/science-keywords sk1 sk2))]}))
+
+          coll2 (fu/make-coll
+                  2
+                  "PROV1"
+                  (fu/science-keywords sk1 sk3)
+                  (fu/projects "proj1" "PROJ2")
+                  (fu/platforms fu/FROM_KMS 2 2 1)
+                  (fu/processing-level-id "PL1")
+                  {:DataCenters [(data-umm-spec/data-center {:Roles ["ARCHIVER"] :ShortName "DOI/USGS/CMG/WHSC"})]
+                   :ScienceKeywords [(:ScienceKeywords (fu/science-keywords sk1 sk2))]})
+
+          coll3 (d/ingest-concept-with-metadata-file "CMR-6287/C1000000029-EDF_OPS.xml"
+                                                     {:provider-id "PROV1"
+                                                      :concept-type :collection
+                                                      :format-key :echo10})
+          _ (index/wait-until-indexed)
+          _ (index/reindex-suggestions)
           _ (index/wait-until-indexed)
           data (search/get-autocomplete-json "q=sol")
           results (get-in data [:feed :entry])]
       ;; Verify results are returned after re-indexing, ignore scores because they may be subject to change
       (compare-autocomplete-results
-       results
-       [{:score 1.4852101
-         :type "science_keywords"
-         :value "Solar Irradiance"
-         :fields "Sun-Earth Interactions:Solar Activity:Solar Irradiance"}
-        {:score 1.4239408
-         :type "science_keywords"
-         :value "Solar Irradiance"
-         :fields "Atmosphere:Atmospheric Radiation:Solar Irradiance"}]))))
+        results
+        [{:score 1.4852101
+          :type "science_keywords"
+          :value "Solar Irradiance"
+          :fields "Sun-Earth Interactions:Solar Activity:Solar Irradiance"}
+         {:score 1.4239408
+          :type "science_keywords"
+          :value "Solar Irradiance"
+          :fields "Atmosphere:Atmospheric Radiation:Solar Irradiance"}]))))


Removing duplicate :approved keys in data_set.clj

--- src/foreclojure/data_set.clj
+++ src/foreclojure/data_set.clj
@@ -189,7 +189,6 @@
               :title "Last Element"
               :times-solved 0
               :restricted ["last"]
-              :approved true
               :description "Write a function which returns the last element in a sequence."
               :tags ["easy" "seqs" "core-functions"]
               :approved true
@@ -954,7 +953,6 @@
             :description "A power set is the set of all subsets of a given set. Given a list, produce a set of sublists while preserving the order of elements."
             :approved true
             :tags ["hard" "seqs"]
-	    :approved true
             :tests ["(= (__ '(1 :a)) '#{(1 :a) (:a) () (1)})"
                     "(= (__ '()) '#{()})"
                     "(= (__ '(1 2 3)) '#{() (1) (2) (3) (1 2) (1 3) (2 3) (1 2 3)})"


Add tags to problem details page

Add tags to problem details page

--- src/foreclojure/problems.clj
+++ src/foreclojure/problems.clj
@@ -93,6 +93,9 @@
     [:div
      [:span {:id "prob-title"} (problem :title)]
      [:hr]
+     [:div {:id "tags"} "Tags: "
+      (s/join " " (problem :tags))]
+     [:br]
      [:div {:id "prob-desc"}
       (problem :description)[:br]
       [:div {:class "testcases"}


Added licence notice

Added licence notice

--- src/freecoin/translation.clj
+++ src/freecoin/translation.clj
@@ -1,3 +1,26 @@
+;; Freecoin - digital social currency toolkit
+
+;; part of Decentralized Citizen Engagement Technologies (D-CENT)
+;; R&D funded by the European Commission (FP7/CAPS 610349)
+
+;; Copyright (C) 2016 Dyne.org foundation
+
+;; Sourcecode designed, written and maintained by
+;; Denis Roio <jaromil@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
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU Affero General Public License for more details.
+
+;; You should have received a copy of the GNU Affero General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
 (ns freecoin.translation
   (:require
    [clojure.tools.logging :as log]


Add test for querying multiple accumulators in a single query.

--- src/test/clojure/clara/test_accumulators.clj
+++ src/test/clojure/clara/test_accumulators.clj
@@ -87,3 +87,17 @@

     (comment (is (= #{{:?t #{ 80 90}}}
                     (set (query session distinct-field)))))))
+
+(deftest test-max-min-avg
+  ;; Tests a single query that gets the maximum, minimum, and average temperatures.
+  (let [max-min-avg (mk-query [] [[?max <- (acc/max :temperature) from [Temperature]]
+                                  [?min <- (acc/min :temperature) from [Temperature]]
+                                  [?avg <- (acc/average :temperature) from [Temperature]]])
+
+        session (-> (mk-rulebase max-min-avg)
+                    (mk-session)
+                    (insert (->Temperature 30 "MCI")
+                            (->Temperature 10 "MCI")
+                            (->Temperature 80 "MCI")))]
+
+    (is (= {:?max 80 :?min 10 :?avg 40} (first (query session max-min-avg))))))


Don't show buildable parallelism until we know it

Previously we would show either "x" or "0x" as the buildable parallelism
until the plan loaded. Now we don't display it at all until the plan
loads.

--- src-cljs/frontend/components/pages/projects.cljs
+++ src-cljs/frontend/components/pages/projects.cljs
@@ -25,13 +25,14 @@
                         :type #{:right :shrink}
                         :cell-fn #(html
                                     (let [parallelism (project-model/parallelism %)
-                                          buildable-parallelism (project-model/buildable-parallelism plan %)
+                                          buildable-parallelism (when plan (project-model/buildable-parallelism plan %))
                                           vcs-url (:vcs_url %)]
                                       [:a {:href (routes/v1-project-settings-path {:vcs_type (-> vcs-url vcs-url/vcs-type routes/->short-vcs)
                                                                                :org (vcs-url/org-name vcs-url)
                                                                                :repo (vcs-url/repo-name vcs-url)
                                                                                :_fragment "parallel-builds"})}
-                                       parallelism "x out of " buildable-parallelism "x"]))}
+                                       parallelism "x"
+                                       (when buildable-parallelism (str " out of " buildable-parallelism "x"))]))}

                        {:header "Team"
                         :type #{:right :shrink}


Add ^:no-doc metadata

Add ^:no-doc metadata

--- src/grafter/rdf4j/sparql.clj
+++ src/grafter/rdf4j/sparql.clj
@@ -20,7 +20,7 @@

     :else nil))

-(defn var-key-matcher [k]
+(defn ^:no-doc var-key-matcher [k]
   (cond (keyword? k)
         (let [k (str "\\?" (-> k
                                name
@@ -30,7 +30,7 @@
         (sequential? k) (str "\\s*\\(\\s*" (str/join "\\s+" (map var-key-matcher k)) "\\s*\\)")
         :else (assert false "Error replacement not expected type")))

-(defn key->replacer [k]
+(defn ^:no-doc key->replacer [k]
   (let [whitespace-pat "\\s+"
         values-pat "(?i)values"
         var-pat (var-key-matcher k)


Рефакторинг, расстановка коментариев...

Рефакторинг, расстановка коментариев...


fix definition of strict and non-strict

fix definition of strict and non-strict

--- src/main/clojure/conexp/fca/graph.clj
+++ src/main/clojure/conexp/fca/graph.clj
@@ -10,7 +10,8 @@

 (defn lattice->graph
   "Converts a lattice to a directed graph.
-  For concepts u,v, there will be an edge u->v iff v <= u."
+  For concepts u,v, there will be an edge u->v iff v <= u.
+  (This implies that the only loops will be u->u for all u.)"
   [lat]
   (let
     [<= (lat/order lat)
@@ -70,14 +71,14 @@
   [<=]
   (fn
     <
-    [x y] (and (<= x y) (not= x y))
-    [vec] (< (first vec) (second vec))))
+    ([x y] (and (<= x y) (not= x y)))
+    ([vec] (< (first vec) (second vec)))))

 (defn non-strict
   "Make a non-strict ordering <= of a strict ordering <."
   [<]
   (fn
     <=
-    [x y] (or (< x y) (= x y))
-    [vec] (< (first vec) (second vec))))
+    ([x y] (or (< x y) (= x y)))
+    ([vec] (< (first vec) (second vec)))))


comment reload, not found in hosting

comment reload, not found in hosting

--- src/annual_weather/routes.clj
+++ src/annual_weather/routes.clj
@@ -9,7 +9,7 @@
             [ring.adapter.jetty :as jetty]
             [ring.middleware.json :as json]
             [ring.middleware.logger :as logger]
-            [ring.middleware.reload :as reload]
+            ; [ring.middleware.reload :as reload]
             [ring.middleware.keyword-params :as keyword-params]
             [ring.util.codec :as rcodec]
             [ring.util.response :as rresponse]
@@ -50,7 +50,7 @@
 (def app
   (-> main-routes
       (logger/wrap-with-logger)
-      (reload/wrap-reload reload-on-request)
+      ; (reload/wrap-reload reload-on-request)
       (keyword-params/wrap-keyword-params)
       (wrap-base-url)))


Remove a dead comment

Remove a dead comment

--- src/catalog/layout/common.clj
+++ src/catalog/layout/common.clj
@@ -6,8 +6,6 @@
             [endophile.core :as endophile])
   (:import java.util.Locale))

-;; editorial and recommendations/recommendation are just added so that
-;; toc generation can also order these nodes
 (def formats [:hörbuch :braille :grossdruck :e-book :hörfilm :ludo])
 (def genres [:belletristik :sachbücher :kinder-und-jugendbücher])
 (def movie-genres [:spielfilm :mundartfilm :dokumentarfilm])


cleaning up

cleaning up

--- src/celestial/persistency.clj
+++ src/celestial/persistency.clj
@@ -166,5 +166,3 @@
        (increase-use  ~'id ~spec)
        ~@body)))

-;; (add-type celestial.fixtures/redis-type)
-;; (get-type "redis")


Persist exclusive_resources and priority fields

--- src/cider_ci/builder/task.clj
+++ src/cider_ci/builder/task.clj
@@ -22,11 +22,12 @@
 (defn create-db-task [_raw-spec]
   (let [raw-spec (clojure.walk/keywordize-keys _raw-spec)
         db-task-spec (spec/get-or-create-task-spec (dissoc raw-spec
-                                                            :execution_id))
+                                                           :execution_id))
         execution-id (:execution_id raw-spec)
-        task-row (conj (select-keys raw-spec [:name :state :error])
+        task-row (conj (select-keys raw-spec [:name :state :error :priority])
                        {:execution_id execution-id
                         :traits (spec-map-to-array (or (:traits raw-spec) {}))
+                        :exclusive_resources (spec-map-to-array (or (:exclusive_resources raw-spec) {}))
                         :task_spec_id (:id db-task-spec)
                         :id (util/idid2id execution-id (:id db-task-spec))
                         })]


Add edn-response fn from url-shortener

Add edn-response fn from url-shortener

--- src/clj/comic_reader/core.clj
+++ src/clj/comic_reader/core.clj
@@ -4,6 +4,11 @@
             [ring.middleware.params :refer [wrap-params]]
             [compojure.core  :as c]
             [compojure.route :as route]))
+
+(defn edn-response [data & [status]]
+  {:status (or status 200)
+   :headers {"Content-Type" "application/edn"}
+   :body (pr-str data)})

 (c/defroutes routes
   (c/GET "/" [] "Hello World!")


removed brepl

removed brepl

--- src/clj/funstructor/brepl.clj
+++ src/clj/funstructor/brepl.clj
@@ -1,8 +0,0 @@
-(ns funstructor.brepl
-  (:require
-   [cemerick.piggieback]
-   [cljs.repl.browser]))
-
-(defn brepl []
-  (cemerick.piggieback/cljs-repl
-   :repl-env (cljs.repl.browser/repl-env :port 9000)))


clean up Sealed Vault context menu and messages

--- src/clj/game/cards-assets.clj
+++ src/clj/game/cards-assets.clj
@@ -435,11 +435,11 @@
    {:abilities [{:label "Store any number of [Credits] on Sealed Vault" :cost [:credit 1]
                  :prompt "How many [Credits]?" :choices :credit :msg (msg "store " target " [Credits]")
                  :effect (effect (add-prop card :counter target))}
-                {:label "Spend [Click] to move any number of [Credits] to your credit pool"
+                {:label "Move any number of [Credits] to your credit pool"
                  :cost [:click 1] :prompt "How many [Credits]?"
-                 :choices :counter :msg (msg "spend [Click] to gain " target " [Credits]")
+                 :choices :counter :msg (msg "gain " target " [Credits]")
                  :effect (effect (gain :credit target))}
-                {:label "Trash Sealed Vault to move any number of [Credits] to your credit pool"
+                {:label "[Trash]: Move any number of [Credits] to your credit pool"
                  :prompt "How many [Credits]?" :choices :counter
                  :msg (msg "trash it and gain " target " [Credits]")
                  :effect (effect (gain :credit target) (trash card))}]}
@@ -596,7 +596,7 @@
    "Victoria Jenkins"
    {:effect (effect (lose :runner :click-per-turn 1)) :leave-play (effect (gain :runner :click-per-turn 1))
     :trash-effect {:req (req (:access @state)) :effect (effect (as-agenda :runner card 2))}}
-
+
    "Worlds Plaza"
    {:abilities [{:label "Install an asset on Worlds Plaza"
                  :req (req (< (count (:hosted card)) 3)) :cost [:click 1]


caching needs to be aware of macros

caching needs to be aware of macros

--- src/clj/shadow/cljs/build.clj
+++ src/clj/shadow/cljs/build.clj
@@ -704,13 +704,26 @@
   [{:keys [cache-dir] :as state} {:keys [name] :as rc}]
   (io/file cache-dir "ana" (str name "." cache-file-version ".cache.transit.json")))

+
+(defn get-max-last-modified-for-source [state source-name]
+  (let [{:keys [last-modified macros] :as rc} (get-in state [:sources source-name])]
+
+    (transduce
+      (map #(get-in state [:macros % :last-modified]))
+      (completing
+        (fn [a b]
+          (Math/max a b)))
+      last-modified
+      macros
+      )))
+
 (defn make-age-map
   "procudes a map of {source-name last-modified} for caching to identify
    whether a cache is safe to use (if any last-modifieds to not match if is safer to recompile)"
   [state ns]
   (reduce
     (fn [age-map source-name]
-      (let [last-modified (get-in state [:sources source-name :last-modified])]
+      (let [last-modified (get-max-last-modified-for-source state source-name)]
         ;; zero? is a pretty ugly indicator for deps that should not affect cache
         ;; eg. runtime-setup
         (if (pos? last-modified)


add test for Corporate Scandal

add test for Corporate Scandal

--- src/clj/test/cards-events.clj
+++ src/clj/test/cards-events.clj
@@ -160,6 +160,31 @@
       (run-continue state)
       (run-jack-out state)
       (run-on state "Archives"))))
+
+(deftest corporate-scandal
+  "Corporate Scandal - Corp has 1 additional bad pub even with 0"
+  (do-game
+    (new-game (default-corp [(qty "Elizabeth Mills" 1)])
+              (default-runner [(qty "Corporate Scandal" 1) (qty "Activist Support" 1)
+                               (qty "Raymond Flint" 1) (qty "Investigative Journalism" 1)]))
+    (play-from-hand state :corp "Elizabeth Mills" "New remote")
+    (take-credits state :corp)
+    (core/gain state :runner :credit 5 :click 1)
+    (play-from-hand state :runner "Raymond Flint")
+    (play-from-hand state :runner "Corporate Scandal")
+    (is (empty? (:prompt (get-runner))) "No BP taken, so no HQ access from Raymond")
+    (play-from-hand state :runner "Investigative Journalism")
+    (is (= "Investigative Journalism" (:title (get-in @state [:runner :rig :resource 1]))) "IJ able to be installed")
+    (run-on state "HQ")
+    (is (= 1 (:run-credit (get-runner))) "1 run credit from bad publicity")
+    (run-jack-out state)
+    (play-from-hand state :runner "Activist Support")
+    (take-credits state :runner)
+    (let [em (get-content state :remote1 0)]
+      (core/rez state :corp em)
+      (is (= 1 (:has-bad-pub (get-corp))) "Corp still has BP")
+      (take-credits state :corp)
+      (is (= 0 (:bad-publicity (get-corp))) "Corp has BP, didn't take 1 from Activist Support"))))

 (deftest demolition-run
   "Demolition Run - Trash at no cost"


fix reflection warnings

fix reflection warnings

--- src/clj_http_hystrix/core.clj
+++ src/clj_http_hystrix/core.clj
@@ -1,11 +1,15 @@
 (ns clj-http-hystrix.core
   (:require [clj-http.client :as http]
-            [clojure.set :as set]
             [clojure.tools.logging :refer [warn error]]
             [robert.hooke :as hooke]
             [slingshot.slingshot :refer [get-thrown-object]]
             [slingshot.support :refer [wrap stack-trace]])
-  (:import [com.netflix.hystrix HystrixCommand HystrixThreadPoolProperties HystrixCommandProperties HystrixCommand$Setter HystrixCommandGroupKey$Factory HystrixCommandKey$Factory]
+  (:import [com.netflix.hystrix HystrixCommand
+                                HystrixThreadPoolProperties
+                                HystrixCommandProperties
+                                HystrixCommand$Setter
+                                HystrixCommandGroupKey$Factory
+                                HystrixCommandKey$Factory]
            [com.netflix.hystrix.exception HystrixBadRequestException]
            [org.slf4j MDC]))

@@ -25,7 +29,7 @@

 (defn ^:private handle-exception
   [f req]
-  (let [raw-response (try (f) (catch Exception e e))
+  (let [^Exception raw-response (try (f) (catch Exception e e))
         resp (if (instance? HystrixBadRequestException raw-response)
                (get-thrown-object (.getCause raw-response))
                raw-response)]
@@ -58,7 +62,7 @@
         (.andCommandPropertiesDefaults command-configurator)
         (.andThreadPoolPropertiesDefaults thread-pool-configurator))))

-(defn ^:private log-error [command-name context]
+(defn ^:private log-error [command-name ^HystrixCommand context]
   (let [message (format "Failed to complete %s %s" command-name (.getExecutionEvents context))]
     (if-let [exception (.getFailedExecutionException context)]
       (warn exception message)
@@ -92,13 +96,13 @@
                                                                                :stack-trace (stack-trace)})))
                                            resp))
           wrap-exception-reponse (fn [resp] ((http/wrap-exceptions (constantly resp)) (assoc req :throw-exceptions true)))
-          configurator (configurator req)
+          ^HystrixCommand$Setter configurator (configurator req)
           logging-context (or (MDC/getCopyOfContextMap) {})
           command (proxy [HystrixCommand] [configurator]
                     (getFallback []
                       (MDC/setContextMap logging-context)
                       (log-error (:hystrix/command-key req) this)
-                      (let [exception (.getFailedExecutionException this)
+                      (let [exception (.getFailedExecutionException ^HystrixCommand this)
                             response (when exception (get-thrown-object exception))]
                         (fallback req response)))
                     (run []


add budget end date to index

add budget end date to index

--- src/clj_money/web/budgets.clj
+++ src/clj_money/web/budgets.clj
@@ -30,6 +30,7 @@
    [:td (:period budget)]
    [:td.text-right (:period-count budget)]
    [:td.text-right (format-date (:start-date budget))]
+   [:td.text-right (format-date (:end-date budget))]
    [:td
     [:div.btn-group
      (glyph-button :pencil
@@ -62,6 +63,7 @@
          [:th "Period"]
          [:th.text-right "Period count"]
          [:th.text-right "Start date"]
+         [:th.text-right "End date"]
          [:th " "]]
         (map budget-row (budgets/select-by-entity-id (env :db) entity-id))]
        [:a.btn.btn-primary {:href (format "/entities/%s/budgets/new" entity-id)}


Fix thrown item combat message

Fix thrown item combat message

--- src/cljc/robinson/combat.cljc
+++ src/cljc/robinson/combat.cljc
@@ -154,6 +154,11 @@
               [:human :*       ranged-weapon? :shell    :dead] (format "You %s the %s in the shell ripping to peices and it dies." (rand-ranged-hit-verb) defender-name)
               [:human :*       ranged-weapon? :tentacle :dead] (format "You %s the %s in the tentacle shredding it and it dies." (rand-ranged-hit-verb) defender-name)
               [:human :*       ranged-weapon? :*        :dead] (format "You %s the %s causing massive injuries and it dies." (rand-ranged-hit-verb) defender-name)
+              [:human :*       :*             :*        :dead] (format "You %s the %s in the %s with the %s killing it." (rand-ranged-hit-verb) (name defender-race)
+                                                                                (name defender-body-part) (name attack))
+              [:human :*       :*             :*        :hit]  (format "You %s the %s in the %s with the %s." (rand-ranged-hit-verb) (name defender-race)
+                                                                                (name defender-body-part) (name attack))
+              [:human :*       :*             :*        :miss] (format "You throw the %s at the %s, but miss." (name attack) (name defender-race))
               [:*     :human   :bite          :*        :miss] (format "The %s lunges at you with its mouth but misses." attacker-name)
               [:*     :human   :bite-venom    :*        :miss] (format "The %s snaps at you its mouth but misses." attacker-name)
               [:*     :human   :claw          :*        :miss] (format "The %s claws at you and narrowly misses." attacker-name)
@@ -181,7 +186,7 @@
               [:trap  :*       :poisonous-gas :*        :dead] (format "The poisonous gas suffocates the %s killing it." defender-name)
               [:trap  :*       :poisonous-gas :*        :miss] (format "The poisonous gas waffs over the %s." defender-name)
               [:trap  :*       :poisonous-gas :*        :hit] (format "The poisonous gas enters the %s's body." defender-name)
-              [:*     :*       :*             :*        :*  ]  (format "The %s hits you." attacker-name))]
+              [:*     :*       :*             :*        :*  ]  (assert false (format "Missing combat message %s %s %s %s %s." attacker-race defender-race attack defender-body-part damage-type)))]
      (log/debug "attack message" msg)
      msg))

@@ -280,7 +285,9 @@
         defender-speed     (dcp/get-speed defender state)
         attacker-size      (dcp/get-size attacker state)
         defender-size      (dcp/get-size defender state)
-        attack-toughness   (attack->toughness (get attack :id))
+        attack-toughness   (attack->toughness (if (= attack-type :thrown-item)
+                                                :thrown-item
+                                                (get attack :id)))
         defender-toughness (dcp/get-toughness defender state)]
     (* attacker-dexterity
        (/ (+ 5 (rr/uniform-double (* 10 attacker-dexterity))) (+ 15 defender-speed))
@@ -340,7 +347,7 @@
          (vector? (get-in state [:world :npcs]))]
    :post [(some? %)
           (vector? (get-in % [:world :npcs]))]}
-  (log/info "attacker-or-path" attacker-or-path "defender-path" defender-path)
+  (log/info "attacker-or-path" attacker-or-path "defender-path" defender-path "attack" attack)
   (let [defender             (get-in state defender-path)
         ;;
         attacker             (attacker-or-path->attacker state attacker-or-path)
@@ -358,7 +365,6 @@
                                attack)
         shot-poisoned-arrow  (when thrown-item
                                (ig/arrow-poison-tipped? state thrown-item))
-
         defender-body-part   (rr/rand-nth (vec (get defender :body-parts)))
         {x :x y :y}          (get defender :pos)
         hp                   (get defender :hp)


Lulz #fail

Lulz #fail

--- src/clojure/picard/server.clj
+++ src/clojure/picard/server.clj
@@ -309,7 +309,7 @@
      (fn [^State current-state]
        (if (.responded? current-state)
          (finalize-exchange state current-state msg)
-         (write-msg state next-up msg current-state))))))
+         (write-msg state current-state msg))))))

 (defn- handle-err
   [state err ^State current-state]


Changed the connection so that it only creates the pool when started.

--- src/cmr/oracle/connection.clj
+++ src/cmr/oracle/connection.clj
@@ -23,15 +23,34 @@
                (j/query oracle-store "select 1 a from dual"))
     (throw (Exception. "Could not select data from database."))))

+(defn pool
+  [spec]
+  (doto (ComboPooledDataSource.)
+    (.setDriverClass (:classname spec))
+    (.setJdbcUrl (str "jdbc:" (:subprotocol spec) ":" (:subname spec)))
+    (.setUser (:user spec))
+    (.setPassword (:password spec))
+    ;; expire excess connections after 30 minutes of inactivity:
+    (.setMaxIdleTimeExcessConnections (* 30 60))
+    ;; expire connections after 3 hours of inactivity:
+    (.setMaxIdleTime (* 3 60 60))))

-(defrecord OracleStore [db]
+(defrecord OracleStore
+  [
+   ;; The database spec.
+   spec
+
+   ;; The database pool of connections
+   datasource
+   ]

   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   lifecycle/Lifecycle

   (start [this system]
-         (test-db-connection! this)
-         this)
+         (let [this (assoc this :datasource (pool spec))]
+           (test-db-connection! this)
+           this))

   (stop [this system]
         this))
@@ -39,20 +58,7 @@

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

-(defn pool
-  [spec]
-  (let [cpds (doto (ComboPooledDataSource.)
-               (.setDriverClass (:classname spec))
-               (.setJdbcUrl (str "jdbc:" (:subprotocol spec) ":" (:subname spec)))
-               (.setUser (:user spec))
-               (.setPassword (:password spec))
-               ;; expire excess connections after 30 minutes of inactivity:
-               (.setMaxIdleTimeExcessConnections (* 30 60))
-               ;; expire connections after 3 hours of inactivity:
-               (.setMaxIdleTime (* 3 60 60)))]
-    {:datasource cpds}))
-
 (defn create-db
   "Creates and returns the database connection pool."
-  [db-spec]
-  (map->OracleStore (pool db-spec)))
+  [spec]
+  (->OracleStore spec nil))


Implemented signing our messages.

Implemented signing our messages.

--- src/ipython_clojure/core.clj
+++ src/ipython_clojure/core.clj
@@ -47,14 +47,14 @@
 ;  (println "Sending message " msg)
   (zmq/send socket (.getBytes msg)))

-(defn kernel-info-reply [message socket]
+(defn kernel-info-reply [message socket signer]
   (let [header (kernel-info-header message)
         parent_header (cheshire/generate-string (:header message))
         metadata (cheshire/generate-string {})
         content  (cheshire/generate-string kernel-info-content)]
     (send-message-piece socket (get-in message [:header :session]))
     (send-message-piece socket "<IDS|MSG>")
-    (send-message-piece socket "")
+    (send-message-piece socket (signer header parent_header metadata content))
     (send-message-piece socket header)
     (send-message-piece socket parent_header)
     (send-message-piece socket metadata)
@@ -105,14 +105,14 @@
       (println "Their signature:" signature)
       (= our-signature signature))))

-(defn send-message [socket msg_type content parent_header metadata session-id]
+(defn send-message [socket msg_type content parent_header metadata session-id signer]
   (let [header (cheshire/generate-string (new-header msg_type session-id))
         parent_header (cheshire/generate-string parent_header)
         metadata (cheshire/generate-string metadata)
         content (cheshire/generate-string content)]
     (send-message-piece socket session-id)
     (send-message-piece socket "<IDS|MSG>")
-    (send-message-piece socket "")
+    (send-message-piece socket (signer header parent_header metadata content))
     (send-message-piece socket header)
     (send-message-piece socket parent_header)
     (send-message-piece socket metadata)
@@ -138,14 +138,14 @@

 (defn execute-request-handler [shell-socket iopub-socket executer]
   (let [execution-count (atom 0N)]
-    (fn [message]
+    (fn [message signer]
       (let [session-id (get-in message [:header :session])
             parent-header (:header message)]
         (swap! execution-count inc)
         (send-message iopub-socket "status" (status-content "busy")
-                      parent-header {} session-id)
+                      parent-header {} session-id signer)
         (send-message iopub-socket "pyin" (pyin-content @execution-count message)
-                      parent-header {} session-id)
+                      parent-header {} session-id signer)
         (send-message shell-socket "execute_reply"
                       {:status "ok"
                        :execution_count @execution-count
@@ -156,12 +156,12 @@
                       {:dependencies_met "True"
                        :engine session-id
                        :status "ok"
-                       :started (now)} session-id)
+                       :started (now)} session-id signer)
         (send-message iopub-socket "pyout"  (pyout-content @execution-count
                                                            message executer)
-                      parent-header {} session-id)
+                      parent-header {} session-id signer)
         (send-message iopub-socket "status" (status-content "idle")
-                      parent-header {} session-id)))))
+                      parent-header {} session-id signer)))))

 (defn execute
   "evaluates s-forms"
@@ -188,19 +188,19 @@
          (binding [*ns* user-ns] (eval (read-string request)))
          (catch Exception e (.getLocalizedMessage e)))))))

-(defn history-reply [message]
+(defn history-reply [message signer]
   "returns REPL history, not implemented for now and returns a dummy message"
   {:history []})

-(defn configure-shell-handler [shell-socket iopub-socket]
+(defn configure-shell-handler [shell-socket iopub-socket signer]
   (let [execute-request (execute-request-handler shell-socket iopub-socket
                                                  (get-executer))]
     (fn [message]
       (let [msg-type (get-in message [:header :msg_type])]
         (case msg-type
-          "kernel_info_request" (kernel-info-reply message shell-socket)
-          "execute_request" (execute-request message)
-          "history_request" (history-reply message)
+          "kernel_info_request" (kernel-info-reply message shell-socket signer)
+          "execute_request" (execute-request message signer)
+          "history_request" (history-reply message signer)
           (do
             (println "Message type" msg-type "not handled yet. Exiting.")
             (println "Message dump:" message)
@@ -223,7 +223,7 @@
                        (zmq/bind shell-addr))
         iopub-socket (doto (zmq/socket context :pub)
                        (zmq/bind iopub-addr))
-        shell-handler (configure-shell-handler shell-socket iopub-socket)]
+        shell-handler (configure-shell-handler shell-socket iopub-socket signer)]
     (while (not (.. Thread currentThread isInterrupted))
       (let [message (read-raw-message shell-socket)
             parsed-message (parse-message message)]


Fixed month creator and cleaned up old code

--- src/journal_creator/core.clj
+++ src/journal_creator/core.clj
@@ -3,44 +3,6 @@
            [clj-time.local    :as l]
            [clj-time.periodic :as p]
            [clj-time.format   :as f]))
-
-(def days {0 "Saturday"
-           1 "Sunday"
-           2 "Monday"
-           3 "Tuesday"
-           4 "Wednesday"
-           5 "Thursday"
-           6 "Friday"})
-
-(defn compare-jan-or-feb [x] (or (= x 01) (= x 02)))
-(defn convert-month
-  [m]
-  (if (compare-jan-or-feb m)
-    (+ m 12)
-    m))
-
-(defn convert-year [m y] (if (> m 12) (dec y) y))
-
-(defn zeller-congruence [year month day]
-  (let [J (quot year 100)
-        K (mod year 100)]
-    (mod (+ day
-            (quot (* 13 (inc month)) 5)
-            K
-            (quot K 4)
-            (quot J 4)
-            (* 5 J))
-         7)))
-
-(defn calculate-zeller-congruence
-  [year month day]
-  (let [m (convert-month month)
-        y (convert-year m year)
-        d day]
-    (zeller-congruence y m d)))
-
-(defn get-day-of-week [y m d]
-  (get days (zeller-congruence y m d) "Unknown"))

 (defn time-range
   [start end step]
@@ -57,7 +19,6 @@
   (let [current-date (t/date-time year month)
         end-date     (t/plus current-date (t/months 1))]
     (month-seq current-date end-date (t/days 1))))
-

 (defn get-today []
   (t/to-time-zone (t/now) (t/default-time-zone)))
@@ -87,12 +48,11 @@

 (defn get-filename-extension [date]
   (file-format (convert-to-filename-extension date)))
-
-(defn -main
-  [& args]
-  (println "Today is: " (get-journal-header (get-today)))
-  (println "file format is: " (get-filename-extension (get-today)))
-  (loop [days (number-of-days-in-month 2017 03)]
+
+;; incrediblepoems.com - heaven wont be heaven
+
+(defn generate-journal-files-for-month [year month]
+  (loop [days (number-of-days-in-month year month)]
     (when (seq days)
       (let [day (first days)
             journal-header (get-journal-header day)
@@ -102,3 +62,8 @@
         (spit filename journal-header)
         (recur (rest days))))))

+(defn -main
+  [& args]
+  (println "Today is: " (get-journal-header (get-today)))
+  (println "file format is: " (get-filename-extension (get-today)))
+  (generate-journal-files 2017 03))


only attempt to update dependencies when we actually get back non-null dependencies.

--- src/metabase/events/dependencies.clj
+++ src/metabase/events/dependencies.clj
@@ -37,7 +37,7 @@
             id      (events/object->model-id topic object)]
         ;; entity must support dependency tracking to continue
         (when (satisfies? IDependent entity)
-          (let [deps (dependency/dependencies entity id object)]
+          (when-let [deps (dependency/dependencies entity id object)]
             (dependency/update-dependencies entity id deps)))))
     (catch Throwable e
       (log/warn (format "Failed to process dependencies event. %s" (:topic dependency-event)) e))))


Perf: eliminate double lookup of ack value in state

--- src/onyx/messaging/acking_daemon.clj
+++ src/onyx/messaging/acking_daemon.clj
@@ -15,30 +15,34 @@
       (try
         (Thread/sleep interval)
         (let [t (now)
-              snapshot @state
+              snapshot (:state @state)
               dead (map first (filter (fn [[k v]] (>= (- t (:timestamp v)) timeout)) snapshot))]
           (doseq [k dead]
-            (swap! state dissoc k)))
+            (swap! state update-in [:state] dissoc k)))
         (catch InterruptedException e
           (throw e))
         (catch Throwable e
           (timbre/fatal e)))
       (recur))))

+(defrecord AckState [state last-action])
+
 (defn ack-segment [ack-state completion-ch message-id completion-id ack-val]
   (let [rets
         (swap!
           ack-state
-          (fn [state]
-            (if-let [ack (get state message-id)]
-              (let [updated-ack-val (bit-xor ^long (:ack-val ack) ^long ack-val)]
-                (if (zero? updated-ack-val)
-                  (dissoc state message-id)
-                  (assoc state message-id (assoc ack :ack-val updated-ack-val))))
-              (if (zero? ^long ack-val)
-                state
-                (assoc state message-id (->Ack nil completion-id ack-val (now)))))))]
-    (when-not (get rets message-id)
+          (fn [as]
+            (let [state (:state as)
+                  ack (get state message-id)]
+              (if ack
+                (let [updated-ack-val (bit-xor ^long (:ack-val ack) ^long ack-val)]
+                  (if (zero? updated-ack-val)
+                    (->AckState (dissoc state message-id) :completed)
+                    (->AckState (assoc state message-id (assoc ack :ack-val updated-ack-val)) :updated)))
+                (if (zero? ^long ack-val)
+                  (->AckState state :completed)
+                  (->AckState (assoc state message-id (->Ack nil completion-id ack-val (now))) :initialised))))))]
+    (when (= :completed (:last-action rets))
       (>!! completion-ch
            {:id message-id :peer-id completion-id}))))

@@ -59,7 +63,7 @@
           completion-ch (chan completion-buffer-size)
           acking-buffer-size (arg-or-default :onyx.messaging/completion-buffer-size opts)
           acking-ch (chan acking-buffer-size)
-          state (atom {})
+          state (atom (->AckState {} nil))
           ack-segments-fut (future (ack-segments-loop state acking-ch completion-ch))
           timeout-fut (future (clear-messages-loop state opts))]
       (assoc component


yasuo crit

yasuo crit

--- src/lolitemsets/overlay.cljs
+++ src/lolitemsets/overlay.cljs
@@ -82,3 +82,9 @@
     (* (min 1 (/ mana session-mana-cost))
        damage
        60)))
+
+; Yasuo has double crit chance TODO: and 10% reduced crit damage
+(defmethod algo/build-stat ["Yasuo" :crit] [base-name lvl-name item-flat item-percent champ level build]
+  (* 2 (algo/build-stat* base-name lvl-name item-flat item-percent champ level build)))
+
+


Minor

Minor

--- frontend/src/cruncher/views.cljs
+++ frontend/src/cruncher/views.cljs
@@ -7,6 +7,7 @@
             [cruncher.communication.main :as com]
             [cruncher.communication.progress :as progress]
             [cruncher.communication.evolutions :as evolutions]
+            [cruncher.moves.main :as moves]
             [cruncher.selections :as selections]
             [cruncher.shredder.main :as shredder]
             [cruncher.utils.extensions]
@@ -161,7 +162,7 @@
                                      (map #(poketable-entry (lib/merge-react-key %)) (lib/inventory-pokemon))
                                      (map #(poketable-entry-details (lib/merge-react-key %)) (lib/inventory-pokemon)))))
              #_(let [jquery (js* "$")]
-                 (.stickyTableHeaders (jquery "#poketable"))))))
+               (.stickyTableHeaders (jquery "#poketable"))))))
 (def poketable (om/factory PokeTable {}))


Add placeholder slide on channels

Add placeholder slide on channels

--- src-cljs/qcon/main.cljs
+++ src-cljs/qcon/main.cljs
@@ -111,6 +111,8 @@

           {:title "Quick tutorial"}

+          {:subtitle "channels (TODO)"}
+
           {:subtitle "put and take"
            :custom (PutAndTakeSlide. {:buffer-size 7 :font-size "72pt" :radius 50})}


fixed broken indexing with mapdb

fixed broken indexing with mapdb

--- src/help_me_im_dumb/index.clj
+++ src/help_me_im_dumb/index.clj
@@ -3,7 +3,6 @@
             [clojure.data.json :as json]
             [clojure.string :as s]
             [spicerack.core :as spicerack]))
-

 (def DICTIONARY-FILENAME "resources/dictionary.txt")
 (def POSTINGS-LIST-FILENAME "resources/postings.txt")
@@ -111,8 +110,9 @@
   Dictionary file: term\tdocument_frequency
   Postings list file: term\tpost1;post2;"
   [term-postings-mapping]
-  (with-open [dictionary-file (io/writer DICTIONARY-FILENAME)]
-    (let [postings-list-map (spicerack/open-hashmap MAPDB POSTINGS-LIST-DB)]
+  (with-open [dictionary-file (io/writer DICTIONARY-FILENAME)
+              db (spicerack/open-database MAPDB-FILENAME)]
+    (let [postings-list-map (spicerack/open-hashmap db POSTINGS-LIST-DB)]
       (doseq [[term postings] term-postings-mapping]
         (.write dictionary-file
                 (str term "\t" (count (distinct postings)) "\n"))
@@ -120,9 +120,10 @@

 (defn write-url-mapping-to-file
   [url-seq]
-  (let [url-map (spicerack/open-hashmap MAPDB URL-MAPPING-DB)]
-    (doseq [[doc-id url] url-seq]
-      (spicerack/put! url-map doc-id url))))
+  (with-open [db (spicerack/open-database MAPDB-FILENAME)]
+    (let [url-map (spicerack/open-hashmap db URL-MAPPING-DB)]
+     (doseq [[doc-id url] url-seq]
+       (spicerack/put! url-map doc-id url)))))

 (defn create-url-seq
   [doc-seq]
@@ -132,6 +133,7 @@
   "Main function for creating indicies.
    Reads in datafile, tokenizes, sorts, and writes to files"
   [jsonfile]
+  (io/delete-file MAPDB-FILENAME)
   (let [docs (doc-seq-from-file jsonfile)
         token-seq (token-seq-from-docs docs)
         url-seq (create-url-seq docs)]


(PDB-3355) Refer to unable-to-commit via ::stock/

The previous :stock/ reference wasn't the keyword we were looking for.

--- src/puppetlabs/puppetdb/queue.clj
+++ src/puppetlabs/puppetdb/queue.clj
@@ -279,7 +279,7 @@
                 (:command-stream command-req)
                 (serialize-metadata received command-req))

-   (catch [:kind ::unable-to-commit] {:keys [stream-data]}
+   (catch [:kind ::stock/unable-to-commit] {:keys [stream-data]}
      ;; stockpile has saved all of the data in command-stream to
      ;; stream-data, but was unable to finish (e.g. the rename
      ;; failed).  Try to delete the (possibly large) temp file and


Made own component for a rounds panel

Made own component for a rounds panel

--- src/tango/cljs/adjudicator/core.cljs
+++ src/tango/cljs/adjudicator/core.cljs
@@ -122,6 +122,20 @@
 ;; - Show participant number
 ;; - Command to set mark on participant for the specific round for this judge
 ;; - Command to inc/dec the judges 'point' for a participant
+(defui AdjudicatorSelection
+  static om/IQuery
+  (query [_]
+    [:adjudicator-panel/name
+     :adjudicator-panel/id
+     {:adjudicator-panel/adjudicators [:adjudicator/name
+                                       :adjudicator/id]}])
+  Object
+  (render [this]
+    (log "Render Panels")
+    (let [panel (om/props this)]
+      (log panel)
+      (dom/h3 nil "Panels"))))
+
 (defui MainComponent
   static om/IQuery
   (query [_]
@@ -129,17 +143,16 @@
       [:activity/id :activity/name
        :round/recall :round/heats :round/name
        {:round/starting [:participant/number :participant/id]}
-       {:round/panel [:adjudicator-panel/name
-                      :adjudicator-panel/id
-                      {:adjudicator-panel/adjudicators [:adjudicator/name
-                                                        :adjudicator/id]}]}]}])
+       {:round/panel (om/get-query AdjudicatorSelection)}]}])
   Object
   (render
     [this]
     (let [app (om/props this)
           status (:app/status app)
           next-status (if (not= status :on) :on :off)
-          selected-activity (:app/selected-activity (om/props this))]
+          selected-activity (:app/selected-activity (om/props this))
+          panel (:round/panel selected-activity)
+          adjudicators (:adjudicator-panel/adjudicators panel)]
       (log "Rendering MainComponent")
       ;(log app)
       (dom/div nil
@@ -151,9 +164,9 @@
         (dom/h3 nil (str "Panel for this round : " (:adjudicator-panel/name
                                                      (:round/panel selected-activity))))
         (dom/h3 nil (str "Select judge :"))
-        (dom/ul nil
-          (dom/li nil (:adjudicator/name
-                        (first (:adjudicator-panel/adjudicators (:round/panel selected-activity))))))
+        ((om/factory AdjudicatorSelection) panel)
+        ;(dom/ul nil
+        ;  (map #(dom/li #js {:onClick (fn [e] (log (str "Click " (:adjudicator/name %))))} (:adjudicator/name %)) adjudicators))
         (dom/h3 nil (str "Judge : " "TODO"))
         (dom/h3 nil (:activity/name selected-activity))
         (dom/h3 nil (:round/name selected-activity))


Remove unnecessary indirection

Remove unnecessary indirection

--- src/taoensso/carmine/connections.clj
+++ src/taoensso/carmine/connections.clj
@@ -12,8 +12,7 @@
 (enc/declare-remote
   taoensso.carmine/ping
   taoensso.carmine/auth
-  taoensso.carmine/select
-  taoensso.carmine/parse)
+  taoensso.carmine/select)

 ;;; Outline/nomenclature
 ;; connection -> Connection object.
@@ -35,7 +34,7 @@
     (try
       (let [resp
             (protocol/with-context this
-              (taoensso.carmine/parse nil
+              (protocol/parse nil
                 (protocol/with-replies
                   (taoensso.carmine/ping))))]


Expand model helper

Expand model helper

--- src/rdf_path_examples/json_ld.clj
+++ src/rdf_path_examples/json_ld.clj
@@ -1,8 +1,11 @@
 (ns rdf-path-examples.json-ld
-  (:require [clojure.java.io :as io])
+  (:require [clojure.java.io :as io]
+            [cheshire.core :as json]
+            [yesparql.sparql :refer [model->json-ld]])
   (:import [java.util LinkedHashMap]
            [com.github.jsonldjava.core JsonLdOptions JsonLdProcessor]
-           [com.github.jsonldjava.utils JsonUtils]))
+           [com.github.jsonldjava.utils JsonUtils]
+           [org.apache.jena.rdf.model Model]))

 (defonce ^:private
   json-ld-options
@@ -23,6 +26,16 @@
       :or {options json-ld-options}}]
   (JsonLdProcessor/expand json-ld options))

+(defn expand-model
+  "Expand RDF `model` into JSON-LD."
+  [^Model model]
+  (->> model
+       model->json-ld
+       JsonUtils/fromString
+       expand
+       JsonUtils/toString
+       json/parse-string))
+
 (def load-resource
   "Load JSON resource from `resource-path`."
   (comp #(JsonUtils/fromInputStream %) io/input-stream io/resource))


Adding error handling and logging on the server

--- src/time_tracker/timers/handlers.clj
+++ src/time_tracker/timers/handlers.clj
@@ -55,5 +55,11 @@
                                       :status         status})
                            (pubsub-state/remove-channel! channel)))
       (http-kit/on-receive channel (fn [data]
-                                     (pubsub/dispatch-command! channel
-                                                               (json/decode data keyword)))))))
+                                     (try
+                                       (log/debug {:event ::received-data
+                                                   :data  data})
+                                       (pubsub/dispatch-command! channel
+                                                                 (json/decode data keyword))
+                                       (catch Throwable e
+                                         (log/error e {:error ::websockets-error
+                                                       :data data}))))))))


clean up ugen metadata

clean up ugen metadata

--- src/overtone/sc/machinery/ugen/metadata/trig.clj
+++ src/overtone/sc/machinery/ugen/metadata/trig.clj
@@ -317,7 +317,8 @@

    {:name "Sweep"
     :summary "Triggered linear ramp"
-    :doc "outputs a linear increasing signal by rate/second when trig input crosses from non-positive to positive"
+    :doc "outputs a linear increasing signal by rate/second when trig
+          input crosses from non-positive to positive"

     :args [{:name "trig"
             :doc "trigger input"


Fix brokenImage path on k8s

Fix brokenImage path on k8s

--- src/vignette/util/image_response.clj
+++ src/vignette/util/image_response.clj
@@ -12,7 +12,8 @@
             [vignette.storage.protocols :refer :all]
             [vignette.util.thumbnail :refer :all]
             [ring.util.codec :refer [url-encode]]
-            [io.clj.logging :as log]))
+            [io.clj.logging :as log])
+  (:use [environ.core]))

 (declare create-image-response
          add-content-disposition-header
@@ -25,7 +26,7 @@
    (if val
      (header resp key val) resp)))

-(def error-image-file (io/file "public/brokenImage.jpg"))
+(def error-image-file (io/file (env :vignette-broken-image "public/brokenImage.jpg")))

 (defmulti error-image (fn [map]
                         (:request-type map)))


Fix extraneous argument

Fix extraneous argument

--- src/app/datasource.cljs
+++ src/app/datasource.cljs
@@ -66,7 +66,7 @@
 (defn toggle-muted [wordlist]
  (swap! wordlists (fn [list]
                       (vec (map #(if (= % wordlist)
-                                   (assoc % :muted? (not (:muted? %) item))
+                                   (assoc % :muted? (not (:muted? %)))
                                    %) list)))))

 (defn delete-wordlist [wordlist]


boodie mam

boodie mam

--- sound-tracker/src/sound_tracker/handler.clj
+++ sound-tracker/src/sound_tracker/handler.clj
@@ -8,16 +8,16 @@

 (defroutes app-routes
   (GET "/" [] (pages/home))
-  (GET "/out" (data/get-logs))
+  (GET "/out" [] (data/get-logs))
   (POST "/in" req
         (let [params (:params req)
               source (get params :source)
-              time (java.sql.Date. (System/currentTimeMillis))
-              level (get params :level)]
+              time (java.sql.Timestamp. (System/currentTimeMillis))
+              level (java.lang.Float/parseFloat (get params :level))]
           (println (str "New in " source " " time " " level))
           (data/log source time level)))
   (route/resources "/")
   (route/not-found "404 Not Found"))

 (def app
-  (wrap-defaults app-routes site-defaults))
+  (wrap-defaults app-routes (assoc-in site-defaults [:security :anti-forgery] false)))


Checkpoint

Checkpoint

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

--- src/obcc/build/interface.clj
+++ src/obcc/build/interface.clj
@@ -9,7 +9,7 @@
 ;; types to map to java objects that string template expects.
 ;;

-;;(deftype Field    [^String modifier ^String type ^String name ^Int index])
+(deftype Field    [^String modifier ^String type ^String name ^String index])
 (deftype Message  [^String name ^ArrayList fields])

 (def grammar (insta/parser (io/resource "parsers/interface/grammar.bnf")
@@ -73,7 +73,7 @@
 ;;-----------------------------------------------------------------
 (defn buildfields [ast]
   (let [rawfields (getfields ast)]
-      rawfields))
+    (map (fn [[index {:keys [modifier type fieldName]}]] (->Field modifier type fieldName index)) rawfields)))

 (defn buildmessage [ast]
   (let [name (->> ast zip/right zip/node)


Change buffer strategy

Change buffer strategy

--- src/orbitingnews/twitter.clj
+++ src/orbitingnews/twitter.clj
@@ -89,7 +89,7 @@
 (defn firehose []
   ; We want tweets with the word tweet in them
   (let [stream (oauth-stream-authorized-twitter)
-        c (chan)]
+        c (chan (sliding-buffer 50))]
     (.addListener stream (status-listener c))
     (.sample stream)
     c))


Flush cache on SIGTERM signal.

Flush cache on SIGTERM signal.

--- src/org/spootnik/cyanite.clj
+++ src/org/spootnik/cyanite.clj
@@ -1,10 +1,11 @@
 (ns org.spootnik.cyanite
   "Main cyanite namespace"
   (:gen-class)
-  (:require [org.spootnik.cyanite.carbon :as carbon]
-            [org.spootnik.cyanite.http   :as http]
-            [org.spootnik.cyanite.config :as config]
-            [clojure.tools.cli           :refer [cli]]))
+  (:require [org.spootnik.cyanite.carbon      :as carbon]
+            [org.spootnik.cyanite.http        :as http]
+            [org.spootnik.cyanite.config      :as config]
+            [clojure.tools.cli                :refer [cli]]
+            [org.spootnik.cyanite.store_cache :as cache]))

 (require 'beckon)

@@ -23,6 +24,10 @@
         (println "Could not parse arguments: " (.getMessage e)))
       (System/exit 1))))

+(defn install-flusher
+ [{:keys [store-cache]}]
+ (reset! (beckon/signal-atom "TERM") [#(cache/flush! store-cache)]))
+
 (defn -main
   "Our main function, parses args and launches appropriate services"
   [& args]
@@ -39,6 +44,7 @@
                 (config/load-blacklist-config (:path blacklist))))]
         (reset! (beckon/signal-atom "HUP") #{load-configs})
         (load-configs))
+      (install-flusher config)
       (when (:enabled carbon)
         (carbon/start config))
       (when (:enabled http)


toss a contact link in there

toss a contact link in there

--- src/strifescript/views/common.clj
+++ src/strifescript/views/common.clj
@@ -5,7 +5,14 @@
             [noir.session :as session])
   (:use [noir.core :only [defpartial]]
         [hiccup.page :only [include-css include-js html5]]
-        [hiccup.element :only [link-to]]))
+        [hiccup.element :only [link-to mail-to]]))
+
+(defpartial row [& content] [:div.row-fluid content])
+(defpartial span12 [& content] [:div.span12 content])
+(defpartial span6 [& content] [:div.span6 content])
+(defpartial spanoffset6 [& content] (list (span6) (span6 content)))
+(defpartial span3 [& content] [:div.span3 content])
+(defpartial row12 [& content] (row (span12 content)))

 (defpartial layout [& content]
             (html5
@@ -18,14 +25,8 @@
                (include-js "/js/strifescript.js")]
               [:body
                [:div.container-fluid
-                content]]))
-
-(defpartial row [& content] [:div.row-fluid content])
-(defpartial span12 [& content] [:div.span12 content])
-(defpartial span6 [& content] [:div.span6 content])
-(defpartial spanoffset6 [& content] (list (span6) (span6 content)))
-(defpartial span3 [& content] [:div.span3 content])
-(defpartial row12 [& content] (row (span12 content)))
+                content
+                (row12 (mail-to "jon@inklesspen.com" "Contact Maintainer"))]]))

 (defn current-user []
   (when-let [session-username (session/get :username)]


Updated unit test.

Updated unit test.

--- test/cmr/search/test/services/aql/conversion.clj
+++ test/cmr/search/test/services/aql/conversion.clj
@@ -158,6 +158,7 @@

 (deftest aql-datetime-validation-test
   (testing "aql datetime validation"
-    (is (thrown? clojure.lang.ExceptionInfo
-                 (a/date-time-from-strings "2014" "13" "22" nil nil nil)))))
+    (is (thrown-with-msg? clojure.lang.ExceptionInfo
+                          #"Value 13 for monthOfYear must be in the range \[1,12\]"
+                          (a/date-time-from-strings "2014" "13" "22" nil nil nil)))))


Rule output is no longer zipped.

Rule output is no longer zipped.

Seeing if this makes a difference with Stardog load

--- src/kabob/build/run_rules.clj
+++ src/kabob/build/run_rules.clj
@@ -83,8 +83,10 @@

 ;;TODO change this to default to gzip files
 (defn rule-output-kb [base-dir rule]
-  (let [output-file (str base-dir (:name rule) ".nt.gz")]
-    (zipped-output-kb output-file)))
+  (let [output-file (str base-dir (:name rule) ".nt")]
+    (output-kb output-file)))
+  ;(let [output-file (str base-dir (:name rule) ".nt.gz")]
+  ;  (zipped-output-kb output-file)))

 ;;; --------------------------------------------------------
 ;;; rules


First pass at Kandan schema

First pass at Kandan schema

--- src/kandan/datomic/schema.clj
+++ src/kandan/datomic/schema.clj
@@ -33,21 +33,82 @@
 (def schema-2
   (vec
    (concat
-    ;; TodoMVC Types
-    [(enum :kandan.types/task)
-     (enum :kandan.types/user)]
+    ;; Kandan Types
+    [(enum :kandan.types/org)
+     (enum :kandan.types/user)
+     (enum :kandan.types/channel)
+     (enum :kandan.types/msg)
+     (enum :kandan.types/file)
+     (enum :kandan.types/notification-setting)]
+
+    ;; Orgs
+    [(attribute :org/name       :db.type/string :db/unique :db.unique/value)
+     (attribute :org/icon       :db.type/uri)
+     (attribute :org/users      :db.type/ref
+                :db/cardinality :db.cardinality/many)
+     (attribute :org/admins     :db.type/ref
+                :db/cardinality :db.cardinality/many)
+     (attribute :org/channels   :db.type/ref
+                :db/cardinality :db.cardinality/many)]

     ;; Users
-    [(attribute :user/id          :db.type/uuid :db/unique :db.unique/identity)
+    [(attribute :user/disabled?   :db.type/boolean)
      (attribute :user/email       :db.type/string :db/unique :db.unique/identity)
+     (attribute :user/nick        :db.type/string)
      (attribute :user/given-name  :db.type/string)
-     (attribute :user/family-name :db.type/string)]
+     (attribute :user/family-name :db.type/string)
+     (attribute :user/avatar      :db.type/uri)
+     (attribute :user/notification-settings :db.type/ref
+                :db/cardinality :db.cardinality/many
+                :db/isComponent true)]

-    ;; Tasks
-    [(attribute :task/user  :db.type/ref)
-     (attribute :task/title :db.type/string)
-     (attribute :task/completed? :db.type/boolean)
-     (attribute :task/order :db.type/long)])))
+    ;; Channels
+    [(attribute :channel/title   :db.type/string)
+     (attribute :channel/topic   :db.type/string)
+     (attribute :channel/created-at   :db.type/instant)
+     (attribute :channel/admins  :db.type/ref
+                :db/cardinality  :db.cardinality/many)
+     (attribute :channel/members :db.type/ref
+                :db/cardinality  :db.cardinality/many)
+     (attribute :channel/msgs    :db.type/ref
+                :db/cardinality  :db.cardinality/many
+                :db/isComponent  true)
+     (attribute :channel/files   :db.type/ref
+                :db/cardinality  :db.cardinality/many
+                :db/isComponent  true)
+     (attribute :channel/notification-settings :db.type/ref
+                :db/cardinality :db.cardinality/many
+                :db/isComponent true)]
+
+    [(enum :notification.level/all)
+     (enum :notification.level/me)
+     (enum :notification.level/none)]
+
+    ;; Notification setting
+    [(attribute :notification/general           :db.type/ref)
+     (attribute :notification/everyone-and-here :db.type/ref)
+     (attribute :notification/muted?            :db.type/boolean)]
+
+    ;; Messages
+    [(attribute :msg/body       :db.type/string)
+     (attribute :msg/at         :db.type/instant)
+     (attribute :msg/user       :db.type/ref)
+     (attribute :msg/pinned?    :db.type/boolean)
+     (attribute :msg/file       :db.type/ref
+                :db/isComponent true)]
+
+    ;; File
+    [(attribute :file/name               :db.type/string)
+     (attribute :file/comment            :db.type/string)
+     (attribute :file/failed?            :db.type/boolean)
+     (attribute :file/last-modified      :db.type/long)
+     (attribute :file/last-modified-date :db.type/instant)
+     (attribute :file/size               :db.type/long)
+     (attribute :file/type               :db.type/ref)
+     (attribute :file/mime               :db.type/string)
+     (attribute :file/src                :db.type/uri)
+     (attribute :file/progress           :db.type/long)])))
+

 (defonce schema-ents
   (atom nil))
@@ -82,3 +143,64 @@
   (ensure-schema))

 ;; (init)
+
+(comment
+  ;; Client-side
+  (dato/transact! dato :msg-created
+                  [{:db/id       (d/tempid :db.part/user)
+                    :dato/guid   (d/squuid)
+                    ;; ??? Should msg/at be enforced server-side?
+                    :msg/at      (js/Date.)
+                    :msg/user    {:db/id (:db/id me)}
+                    :msg/channel {:db/id (:db/id channel)}}])
+
+  (dato/transact! dato :msg-created
+                  (let [msg-eid (d/tempid :db.part/user)]
+                    [{:db/id         msg-eid
+                      :dato/guid     (d/squuid)
+                      ;; ??? Should msg/at be enforced server-side?
+                      :msg/at        (js/Date.)
+                      :user/_msgs    [{:db/id msg-eid}]
+                      :channel/_msgs [{:db/id msg-eid}]}])))
+
+(comment
+  ;; msg component
+  (render [_]
+    (let [msg  data
+          user (:user/_msgs msg)]
+      (dom/li {:react-key (:db/id channel)}
+              (dom/div {:class "avatar"}
+                       (dom/img {:src (:user/avatar user)}))
+              (:msg/body msg))))
+
+  ;; channel component
+  (render [_]
+    (let [channel (d/entity db channel-eid)
+          msgs    (:channel/msgs channel)]
+      (dom/div
+       (dom/ul
+        ;; Possible filter here if search is on
+        (for [msg (sort-by :msg/at msgs)]
+          (om/build msg-com msg)))))))
+
+(comment
+  ;; All messages for a user
+  (dsu/qes-by db :msg/_user (:db/id user))
+
+  ;; msg component
+  (render [_]
+    (let [msg  data
+          user (:msg/user msg)]
+      (dom/li {:react-key (:db/id channel)}
+              (dom/div {:class "avatar"}
+                       (dom/img {:src (:user/avatar user)}))
+              (:msg/body msg))))
+
+  ;; channel component
+  (render [_]
+    (let [msgs (dsu/qes-by db :message/channel channel-eid)]
+      (dom/div
+       (dom/ul
+        ;; Possible filter here if search is on
+        (for [msg (sort-by :msg/at msgs)]
+          (om/build msg-com msg)))))))


remove extra let definition

remove extra let definition

--- frontend/controllers/post_controls.cljs
+++ frontend/controllers/post_controls.cljs
@@ -133,7 +133,6 @@
         parent-scroll-left (.-scrollLeft parent)
         current-container (sel1 target (str "#container_" current-container-id))
         current-container-scroll-left (int (.-x (goog.style.getContainerOffsetToScrollInto current-container parent)))
-        parent-scroll-left (.-scrollLeft parent)
         ;; XXX stop making (count containers) queries on each scroll
         containers (sort-by (fn [c] (Math/abs (- parent-scroll-left (.-x (goog.style.getContainerOffsetToScrollInto c parent)))))
                             (sel parent ".container-view"))


Use deftype instead of defrecord in page events.

--- frontend/src/uxbox/main/data/pages.cljs
+++ frontend/src/uxbox/main/data/pages.cljs
@@ -105,7 +105,7 @@

 ;; --- Pages Fetched

-(defrecord PagesFetched [pages]
+(deftype PagesFetched [pages]
   ptk/UpdateEvent
   (update [_ state]
     (as-> state $
@@ -118,7 +118,7 @@

 ;; --- Fetch Pages (by project id)

-(defrecord FetchPages [projectid]
+(deftype FetchPages [projectid]
   ptk/WatchEvent
   (watch [_ state s]
     (->> (rp/req :fetch/pages-by-project {:project projectid})
@@ -130,7 +130,7 @@

 ;; --- Page Created

-(defrecord PageCreated [data]
+(deftype PageCreated [data]
   ptk/UpdateEvent
   (update [_ state]
     (-> state
@@ -147,7 +147,7 @@

 ;; --- Create Page

-(defrecord CreatePage [name project width height layout]
+(deftype CreatePage [name project width height layout]
   ptk/WatchEvent
   (watch [this state s]
     (let [params {:name name
@@ -164,13 +164,13 @@
   (s/keys :req-un [::name ::project ::width ::height ::layout]))

 (defn create-page
-  [data]
+  [{:keys [name project width height layout] :as data}]
   {:pre [(us/valid? ::create-page-event data)]}
-  (map->CreatePage data))
+  (->CreatePage name project width height layout))

 ;; --- Page Persisted

-(defrecord PagePersisted [data]
+(deftype PagePersisted [data]
   ptk/UpdateEvent
   (update [_ state]
     ;; TODO: update only the version instead of complete unpacking
@@ -191,7 +191,7 @@

 ;; --- Persist Page

-(defrecord PersistPage [id]
+(deftype PersistPage [id]
   ptk/WatchEvent
   (watch [this state s]
     (let [page (get-in state [:pages id])]
@@ -212,7 +212,7 @@

 ;; --- Page Metadata Persisted

-(defrecord MetadataPersisted [id data]
+(deftype MetadataPersisted [id data]
   ptk/UpdateEvent
   (update [_ state]
     ;; TODO: page-data update
@@ -232,7 +232,7 @@
 ;; that does not sends the heavyweiht `:data` attribute
 ;; and only serves for update other page data.

-(defrecord PersistMetadata [id]
+(deftype PersistMetadata [id]
   ptk/WatchEvent
   (watch [_ state stream]
     (let [page (get-in state [:pages id])]
@@ -247,7 +247,7 @@

 ;; --- Update Page Options

-(defrecord UpdateMetadata [id metadata]
+(deftype UpdateMetadata [id metadata]
   IMetadataUpdate
   ptk/UpdateEvent
   (update [this state]
@@ -260,7 +260,7 @@

 ;; --- Update Page

-(defrecord UpdatePage [id name width height layout]
+(deftype UpdatePage [id name width height layout]
   ptk/UpdateEvent
   (update [this state]
     (-> state
@@ -283,7 +283,7 @@

 ;; --- Delete Page (by id)

-(defrecord DeletePage [id callback]
+(deftype DeletePage [id callback]
   ptk/WatchEvent
   (watch [_ state s]
     (letfn [(on-success [_]


use (pmap) over candidate parents within (defn candidate-parents)

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -359,23 +359,23 @@
   "find subset of _rules_ for which each member unifies successfully with _spec_"
   (log/trace (str "candidate-parents: spec: " (strip-refs spec)))
   (filter #(not (= :fail %))
-          (mapfn (fn [rule]
-                   (log/trace (str "candidate-parents: rule: " (:rule rule)))
-                   (if (and (not (fail? (unifyc (get-in rule [:synsem :cat] :top)
-                                                (get-in spec [:synsem :cat] :top))))
-                            (not (fail? (unifyc (get-in rule [:synsem :infl] :top)
-                                                (get-in spec [:synsem :infl] :top))))
-                            (not (fail? (unifyc (get-in rule [:synsem :sem :tense] :top)
-                                                (get-in spec [:synsem :sem :tense] :top))))
-                            (not (fail? (unifyc (get-in rule [:synsem :modified] :top)
-                                                (get-in spec [:synsem :modified] :top)))))
-                     (let [result
+          (pmap (fn [rule]
+                  (log/trace (str "candidate-parents: rule: " (:rule rule)))
+                  (if (and (not (fail? (unifyc (get-in rule [:synsem :cat] :top)
+                                               (get-in spec [:synsem :cat] :top))))
+                           (not (fail? (unifyc (get-in rule [:synsem :infl] :top)
+                                               (get-in spec [:synsem :infl] :top))))
+                           (not (fail? (unifyc (get-in rule [:synsem :sem :tense] :top)
+                                               (get-in spec [:synsem :sem :tense] :top))))
+                           (not (fail? (unifyc (get-in rule [:synsem :modified] :top)
+                                               (get-in spec [:synsem :modified] :top)))))
+                    (let [result
                            (unifyc spec rule)]
-                       (if (fail? result)
-                         :fail
-                         result))
-                     :fail))
-                 rules)))
+                      (if (fail? result)
+                        :fail
+                        result))
+                    :fail))
+                rules)))

 (defn lazy-shuffle [seq]
   (lazy-seq (shuffle seq)))


filter potential phrasal head children by comparing with parent's [:synsem :cat]

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -136,9 +136,12 @@
 (defn parent-with-head-1 [spec depth parent-rules]
   (if (not (empty? parent-rules))
     (let [parent-rule (first parent-rules)
+          parent-cat (u/get-in parent-rule [:synsem :cat])
           phrases-with-phrasal-head #(map (fn [child]
                                             (u/assoc-in parent-rule [:head] child))
-                                          grammar)
+                                          (filter (fn [grammar-rule]
+                                                    (= parent-cat (u/get-in grammar-rule [:synsem :cat])))
+                                                  grammar))
           phrases-with-lexical-heads #(map (fn [child]
                                              (u/assoc-in parent-rule [:head] child))
                                            (get-lexemes (unify


Clean up metrics

Clean up metrics

--- src/beehive/metrics.clj
+++ src/beehive/metrics.clj
@@ -17,21 +17,23 @@
             [beehive.enums :as enums])
   (:import (beehive.java EmptyEnum ToCLJ)
            (net.uncontended.precipice.metrics Metrics Rolling IntervalIterator)
-           (net.uncontended.precipice.metrics.counts PartitionedCount
+           (net.uncontended.precipice.metrics.counts CountRecorder
                                                      NoOpCounter
-                                                     TotalCounts
-                                                     RollingCounts CountRecorder)
-           (net.uncontended.precipice.metrics.latency TotalLatency
+                                                     PartitionedCount
+                                                     RollingCounts
+                                                     TotalCounts)
+           (net.uncontended.precipice.metrics.latency ConcurrentHistogram
+                                                      LatencyRecorder
                                                       NoOpLatency
-                                                      ConcurrentHistogram
-                                                      PartitionedLatency LatencyRecorder)
+                                                      PartitionedLatency
+                                                      TotalLatency)
            (net.uncontended.precipice.metrics.tools Recorder)
            (java.util.concurrent TimeUnit)
            (java.util Iterator NoSuchElementException)))

 (set! *warn-on-reflection* true)

-(declare counter-to-map)
+(declare counter-to-map latency-to-map)

 (defn- current-millis []
   (System/currentTimeMillis))
@@ -153,26 +155,12 @@
            (.bucketCount (int slots-to-track))
            (.bucketResolution (long resolution) time-unit)))))))

-(defn- latency-to-map [^PartitionedLatency latency start-millis end-millis]
-  {:latencies
-   (persistent!
-     (reduce (fn [acc ^ToCLJ e]
-               (assoc!
-                 acc
-                 (.keyword e)
-                 {:10 (.getValueAtPercentile latency e 1.0)
-                  :50 (.getValueAtPercentile latency e 5.0)
-                  :90 (.getValueAtPercentile latency e 90.0)
-                  :99 (.getValueAtPercentile latency e 99.0)
-                  :99.9 (.getValueAtPercentile latency e 99.9)
-                  :99.99 (.getValueAtPercentile latency e 99.99)
-                  :99.999 (.getValueAtPercentile latency e 99.999)}))
-             (transient {})
-             (.getEnumConstants (.getMetricClazz latency))))
+(defn- next-latencies-fn [^PartitionedLatency latency start-millis end-millis]
+  {:latencies (latency-to-map latency)
    :start-millis start-millis
    :end-millis end-millis})

-(defn- latency-to-latency-fn [metric]
+(defn- get-next-latency-fn [metric]
   (fn [^PartitionedLatency latency start-millis end-millis]
     {:start-millis start-millis
      :end-millis end-millis
@@ -185,37 +173,53 @@
                :99.99 (.getValueAtPercentile latency metric 99.99)
                :99.999 (.getValueAtPercentile latency metric 99.999)})}))

-(defn get-latency [{:keys [precipice-metrics key->enum] :as metrics} metric]
+(defn latency-to-map [^PartitionedLatency latency]
+  (persistent!
+    (reduce (fn [acc ^ToCLJ e]
+              (assoc!
+                acc
+                (.keyword e)
+                {:10 (.getValueAtPercentile latency e 1.0)
+                 :50 (.getValueAtPercentile latency e 5.0)
+                 :90 (.getValueAtPercentile latency e 90.0)
+                 :99 (.getValueAtPercentile latency e 99.0)
+                 :99.9 (.getValueAtPercentile latency e 99.9)
+                 :99.99 (.getValueAtPercentile latency e 99.99)
+                 :99.999 (.getValueAtPercentile latency e 99.999)}))
+            (transient {})
+            (.getEnumConstants (.getMetricClazz latency)))))
+
+(defn latency-seq [{:keys [precipice-metrics key->enum] :as metrics} metric]
   (let [^Metrics precipice-metrics precipice-metrics
         current-millis (current-millis)]
     (iterator-seq
       (if (instance? Rolling precipice-metrics)
         (->RollingIterator
           current-millis
-          (latency-to-latency-fn (get key->enum metric))
-          (.intervals ^Rolling precipice-metrics))
-        (let [{:keys [interval-start metrics]} (prep-metrics current-millis metrics)]
-          (->SingleIterator
-            current-millis
-            interval-start
-            (latency-to-latency-fn (get key->enum metric))
-            metrics
-            false))))))
-
-(defn get-latencies [metrics]
+          (get-next-latency-fn (get key->enum metric))
+          (.intervals ^Rolling precipice-metrics))
+        (let [{:keys [interval-start metrics]} (prep-metrics current-millis metrics)]
+          (->SingleIterator
+            current-millis
+            interval-start
+            (get-next-latency-fn (get key->enum metric))
+            metrics
+            false))))))
+
+(defn latencies-seq [metrics]
   (let [{:keys [precipice-metrics]} metrics
         current-millis (current-millis)]
     (iterator-seq
       (if (instance? Rolling precipice-metrics)
         (->RollingIterator
           current-millis
-          latency-to-map
-          (.intervals ^Rolling precipice-metrics))
-        (let [{:keys [interval-start metrics]} (prep-metrics current-millis metrics)]
-          (->SingleIterator
-            current-millis
-            interval-start
-            latency-to-map
+          next-latencies-fn
+          (.intervals ^Rolling precipice-metrics))
+        (let [{:keys [interval-start metrics]} (prep-metrics current-millis metrics)]
+          (->SingleIterator
+            current-millis
+            interval-start
+            next-latencies-fn
             metrics
             false))))))


http headers may be keywords as well as strings

--- src/buddy/auth/http.clj
+++ src/buddy/auth/http.clj
@@ -53,7 +53,7 @@
   "Looks up a header in a headers map case insensitively,
   returning the header map entry, or nil if not present."
   [headers ^String header-name]
-  (first (filter #(.equalsIgnoreCase header-name (key %)) headers)))
+  (first (filter #(.equalsIgnoreCase header-name (name (key %))) headers)))

 (extend-protocol IRequest
   clojure.lang.IPersistentMap


moving to config file

moving to config file

--- src/celestial/redis.clj
+++ src/celestial/redis.clj
@@ -1,5 +1,6 @@
 (ns celestial.redis
   (:use
+    [celestial.common :only (config)]
     [clojure.core.strint :only (<<)]
     [slingshot.slingshot :only  [throw+]]
     [taoensso.timbre :only (debug trace info error warn)])
@@ -10,8 +11,7 @@

 (def pool (car/make-conn-pool))

-; TODO move to config file
-(def spec-server1 (car/make-conn-spec :host "localhost"))
+(def spec-server1 (car/make-conn-spec :host (get-in config [:redis :host])))

 (defmacro wcar [& body] `(car/with-conn pool spec-server1 ~@body))


Added in enumerable slices and concepts

Added in enumerable slices and concepts

--- src/cfpb/qu/swagger.clj
+++ src/cfpb/qu/swagger.clj
@@ -42,9 +42,15 @@

 (defn- api-param
   [data-type param-name & {:as m}]
-  (merge {:dataType (name data-type)
-          :name (name param-name)}
-         m))
+  (let [enum (:enum m)
+        m (if enum
+            (assoc m :allowableValues {:valueType "LIST"
+                                       :values enum})
+            m)
+        m (dissoc m :enum)]
+    (-> {:dataType (name data-type)
+         :name (name param-name)}
+        (merge m))))

 (defn data-declaration
   [req]
@@ -67,36 +73,42 @@

 (defn dataset-declaration
   [dataset req]
-  (-> {:resourcePath (urls/dataset-path :dataset dataset)
-       :produces ["application/json" "application/xml"]
-       :models []
-       :apis [(get-api :path (urls/dataset-path :dataset dataset)
-                       :nickname (str "getDataset" (capitalize dataset))
-                       :summary "Get metadata for this dataset."
-                       :parameters [])
-              (get-api :path (urls/concept-path :dataset dataset :concept "{concept}")
-                       :nickname (str "getConcept" (capitalize dataset))
-                       :summary "Get information about a particular concept in this dataset."
-                       :parameters [(api-param :string "concept"
-                                               :paramType "path"
-                                               :description "Name of concept"
-                                               :required true)])
-              (get-api :path (urls/slice-query-path :dataset dataset :slice "{slice}")
-                       :nickname (str "querySlice" (capitalize dataset))
-                       :summary "Query a slice in this dataset."
-                       :parameters [(api-param :string "slice"
-                                               :paramType "path"
-                                               :description "Name of slice"
-                                               :required true)])
-              (get-api :path (urls/slice-metadata-path :dataset dataset :slice "{slice}")
-                       :nickname (str "getSliceMetadata" (capitalize dataset))
-                       :summary "Get the metadata for a slice in this dataset."
-                       :parameters [(api-param :string "slice"
-                                               :paramType "path"
-                                               :description "Name of slice"
-                                               :required true)])]}
-      (versions)
-      (base-path req)))
+  (let [metadata (data/get-metadata dataset)
+        slices (sort (map name (keys (:slices metadata))))
+        concepts (sort (map name (keys (:concepts metadata))))]
+    (-> {:resourcePath (urls/dataset-path :dataset dataset)
+         :produces ["application/json" "application/xml"]
+         :models []
+         :apis [(get-api :path (urls/dataset-path :dataset dataset)
+                         :nickname (str "getDataset" (capitalize dataset))
+                         :summary "Get metadata for this dataset."
+                         :parameters [])
+                (get-api :path (urls/concept-path :dataset dataset :concept "{concept}")
+                         :nickname (str "getConcept" (capitalize dataset))
+                         :summary "Get information about a particular concept in this dataset."
+                         :parameters [(api-param :string "concept"
+                                                 :paramType "path"
+                                                 :description "Name of concept"
+                                                 :required true
+                                                 :enum concepts)])
+                (get-api :path (urls/slice-query-path :dataset dataset :slice "{slice}")
+                         :nickname (str "querySlice" (capitalize dataset))
+                         :summary "Query a slice in this dataset."
+                         :parameters [(api-param :string "slice"
+                                                 :paramType "path"
+                                                 :description "Name of slice"
+                                                 :required true
+                                                 :enum slices)])
+                (get-api :path (urls/slice-metadata-path :dataset dataset :slice "{slice}")
+                         :nickname (str "getSliceMetadata" (capitalize dataset))
+                         :summary "Get the metadata for a slice in this dataset."
+                         :parameters [(api-param :string "slice"
+                                                 :paramType "path"
+                                                 :description "Name of slice"
+                                                 :required true
+                                                 :enum slices)])]}
+        (versions)
+        (base-path req))))

 (defn resource-listing-json
   [req]


Making the inspector output readable.

Making the inspector output readable.

--- src-cljs/frontend/components/inspector.cljs
+++ src-cljs/frontend/components/inspector.cljs
@@ -11,4 +11,4 @@
     om/IRender
     (render [_]
       (html
-       [:code {:style {:flex "0 0 40%"}} (om/build ankha/inspector (dissoc app :comms))]))))
+       [:code {:style {:flex "0 0 40%" :overflow "scroll"}} (om/build ankha/inspector (dissoc app :comms))]))))


Use underscored keys for destructuring org-data

--- src-cljs/frontend/controllers/controls.cljs
+++ src-cljs/frontend/controllers/controls.cljs
@@ -870,7 +870,7 @@
   (let [stripe-ch (chan)
         uuid frontend.async/*uuid*
         api-ch (get-in current-state [:comms :api])
-        {org-name :name, vcs-type :vcs-type} (get-in current-state state/org-data-path)]
+        {org-name :name, vcs-type :vcs_type} (get-in current-state state/org-data-path)]
     (utils/mlog "calling stripe/open-checkout")
     (stripe/open-checkout {:price price :description description} stripe-ch)
     (go (let [[message data] (<! stripe-ch)]
@@ -903,7 +903,7 @@
   (let [stripe-ch (chan)
         uuid frontend.async/*uuid*
         api-ch (get-in current-state [:comms :api])
-        {org-name :name, vcs-type :vcs-type} (get-in current-state state/org-data-path)]
+        {org-name :name, vcs-type :vcs_type} (get-in current-state state/org-data-path)]

     (utils/mlog "calling stripe/open-checkout")
     (stripe/open-checkout {:price price :description description} stripe-ch)
@@ -965,7 +965,7 @@
   [target message {:keys [containers]} previous-state current-state]
   (let [uuid frontend.async/*uuid*
         api-ch (get-in current-state [:comms :api])
-        {org-name :name, vcs-type :vcs-type} (get-in current-state state/org-data-path)
+        {org-name :name, vcs-type :vcs_type} (get-in current-state state/org-data-path)
         login (get-in current-state state/user-login-path)]
     (go
      (let [api-result (<! (ajax/managed-ajax
@@ -984,7 +984,7 @@
   [target message {:keys [plan-type]} previous-state current-state]
   (let [uuid frontend.async/*uuid*
         api-ch (get-in current-state [:comms :api])
-        {org-name :name, vcs-type :vcs-type} (get-in current-state state/org-data-path)]
+        {org-name :name, vcs-type :vcs_type} (get-in current-state state/org-data-path)]
     (go
       (let [api-result (<! (ajax/managed-ajax
                              :put
@@ -1002,7 +1002,7 @@
   [target message plan-template previous-state current-state]
   (let [uuid frontend.async/*uuid*
         api-ch (get-in current-state [:comms :api])
-        {org-name :name, vcs-type :vcs-type} (get-in current-state state/org-data-path)]
+        {org-name :name, vcs-type :vcs_type} (get-in current-state state/org-data-path)]
     (go
       (let [api-result (<! (ajax/managed-ajax
                              :post
@@ -1190,7 +1190,7 @@
   [target message _ previous-state current-state]
   (let [uuid frontend.async/*uuid*
         api-ch (get-in current-state [:comms :api])
-        {org-name :name, vcs-type :vcs-type} (get-in current-state state/org-data-path)
+        {org-name :name, vcs-type :vcs_type} (get-in current-state state/org-data-path)
         settings (state-utils/merge-inputs (get-in current-state state/org-plan-path)
                                            (get-in current-state state/inputs-path)
                                            [:billing_email :billing_name :extra_billing_data])]


:sparkles: Hide "Copy link" until link is actually created

--- frontend/src/uxbox/main/ui/viewer/header.cljs
+++ frontend/src/uxbox/main/ui/viewer/header.cljs
@@ -107,10 +107,11 @@
        [:span.share-link-title (t locale "viewer.header.share.title")]
        [:div.share-link-input
         (if (string? token)
-          [:span.link link]
-          [:span.link-placeholder (t locale "viewer.header.share.placeholder")])
-        [:span.link-button {:on-click copy-link}
-         (t locale "viewer.header.share.copy-link")]]
+          [:*
+            [:span.link link]
+            [:span.link-button {:on-click copy-link}
+             (t locale "viewer.header.share.copy-link")]]
+          [:span.link-placeholder (t locale "viewer.header.share.placeholder")])]

        [:span.share-link-subtitle (t locale "viewer.header.share.subtitle")]
        [:div.share-link-buttons


Optimize floating graph. Step 2.

Optimize floating graph. Step 2.

--- src/cljs/main/quil_site/examples/floating_graph.cljs
+++ src/cljs/main/quil_site/examples/floating_graph.cljs
@@ -71,14 +71,6 @@
         (update-in [n1-label :siblings] conj n2-label)
         (update-in [n2-label :siblings] conj n1-label))))

-(defn extract-edges
-  "get a set of edges given a node-map"
-  [nodes]
-  (set (for [node nodes
-             sibling-label (:siblings node)]
-         #{(:label node) sibling-label})))
-
-
 ;;;
 ;;; quil state manipulation and drawing
 ;;;
@@ -129,8 +121,8 @@
                     (range node-count))
         nodes (into {} (for [label labels]
                          [label (create-random-node label)]))
-        create-random-edge #(take 2 (shuffle labels))
-        edges (repeatedly edge-count create-random-edge)
+        create-random-edge #(->> labels shuffle (take 2) sort)
+        edges (distinct (repeatedly edge-count create-random-edge))
         nodes (reduce add-edge nodes edges)
         state (infer-new-search-state :dfs nodes)]
     (assoc state
@@ -140,7 +132,8 @@
                     :bfs (q/color 225 150 225)
                     :visiting (q/color 0)
                     :edge (q/color 240 150)
-                    :untouched (q/color 240 150)})))
+                    :untouched (q/color 240 150)}
+           :edges edges)))

 (defn update-movement
   "apply changes to velocity, position, and size"
@@ -216,8 +209,7 @@
   (-> state update-movement update-colors))

 (defn draw-edges [state]
-  (let [{:keys [nodes colors]} state
-        edges (extract-edges (vals nodes))]
+  (let [{:keys [nodes colors edges]} state]
     (q/fill (:edge colors)) ; set fill as edge color
     ;; draw each edge as a quad. Determine points using some mathematical math.
     (doseq [edge edges]


accept custom sections keys in stakeholder update validation schema

--- src/open_company/resources/common.clj
+++ src/open_company/resources/common.clj
@@ -137,7 +137,8 @@
           :title schema/Str
           :sections [SectionName]
           :created-at schema/Str
-          :author Author} ; user that created the update
+          :author Author ; user that created the update
+          schema/Keyword schema/Any}
         InlineSections))

 (def User


Added test for live updating. Currently fails.

--- test/clj/elephantdb/service_test.clj
+++ test/clj/elephantdb/service_test.clj
@@ -274,3 +274,105 @@
                ))
           )
         ))))
+
+(deftest test-live-updating
+  (with-local-tmp [lfs local-dir]
+    (with-fs-tmp [fs dtmp1 dtmp2 gtmp]
+      (let [domain-spec {:num-shards 4 :persistence-factory (JavaBerkDB.)}
+            local-config (mk-local-config local-dir)]
+        (write-clj-config! {:replication 1
+                            :hosts [(local-hostname)]
+                            :domains {"domain1" dtmp1 "domain2" dtmp2}}
+                           fs
+                           gtmp)
+
+        ;; create version 1 for domain1
+        (mk-sharded-domain fs dtmp1 domain-spec
+                           (domain-data 0 [0 0]
+                                        1 [1 1]
+                                        2 [2 2]
+                                        3 [3 3]) :version 1)
+
+        ;; create version 1 for domain2
+        (mk-sharded-domain fs dtmp2 domain-spec
+                           (domain-data 0 [10 10]
+                                        1 [20 20]
+                                        2 [30 30]
+                                        3 [40 40]) :version 1)
+
+        ;; start up edb service
+        (let [handler (mk-service-handler (read-global-config gtmp local-config "111") local-dir "111" nil)]
+
+          ;; create version 2 for domain2
+          (mk-sharded-domain fs dtmp2 domain-spec
+                             (domain-data 0 [11 11]
+                                          1 [22 22]
+                                          2 [33 33]
+                                          3 [44 44]) :version 2)
+
+          ;; domain1 should not have changed
+          (expected-domain-data handler "domain1"
+                                0 [0 0]
+                                1 [1 1]
+                                2 [2 2]
+                                3 [3 3])
+
+          ;; domain2 should not have changed either
+          (expected-domain-data handler "domain2"
+                                0 [10 10]
+                                1 [20 20]
+                                2 [30 30]
+                                3 [40 40])
+
+          ;; nothing should happen for domain1
+          (.update handler "domain1")
+
+          ;; domain1 should not have changed
+          (expected-domain-data handler "domain1"
+                                0 [0 0]
+                                1 [1 1]
+                                2 [2 2]
+                                3 [3 3])
+
+          ;; updating domain2 should cause update and new values being returned
+          (.update handler "domain2")
+
+          ;; domain2 should have changed
+          (expected-domain-data handler "domain2"
+                                0 [11 11]
+                                1 [21 21]
+                                2 [31 31]
+                                3 [41 41])
+
+          ;; create version 2 for domain1
+          (mk-sharded-domain fs dtmp1 domain-spec
+                             (domain-data 0 [1 1]
+                                          1 [2 2]
+                                          2 [3 3]
+                                          3 [4 4]) :version 2)
+
+          ;; create version 3 for domain2
+          (mk-sharded-domain fs dtmp2 domain-spec
+                             (domain-data 0 [12 12]
+                                          1 [23 23]
+                                          2 [34 34]
+                                          3 [45 45]) :version 3)
+
+          ;; force update of all domains
+          (.updateAll handler)
+
+          ;; domain1 and domain 2 should have changed
+          (expected-domain-data handler "domain1"
+                                0 [1 1]
+                                1 [2 2]
+                                2 [3 3]
+                                3 [4 4])
+
+          (expected-domain-data handler "domain2"
+                                0 [12 12]
+                                1 [23 23]
+                                2 [34 34]
+                                3 [45 45])
+
+          (.shutdown handler))
+        ))))


Missed one

Missed one

--- test/doctopus/doctopus/head_test.clj
+++ test/doctopus/doctopus/head_test.clj
@@ -11,10 +11,11 @@
   (:import [doctopus.doctopus.head Head]))

 (use-fixtures :once database-fixture)
-
+(def one-head (map->Head {:name "main"}))
 ;; (storage/set-backend! :temp-fs)

 (deftest head-test
+  (db/save-head! one-head)
   (testing "Can we bootstrap a Head's tentacles?"
     (let [head (map->Head (db/get-head "main"))
           tentacles (list-tentacles head {})]


Fix webview toggle crash ios

Fix webview toggle crash ios

Signed-off-by: Andrea Maria Piana <39e16ece3c2d27e1889178b15ddb376e524032f8@gmail.com>

--- src/status_im/multiaccounts/core.cljs
+++ src/status_im/multiaccounts/core.cljs
@@ -9,6 +9,7 @@
             [status-im.utils.theme :as utils.theme]
             [status-im.theme.core :as theme]
             [status-im.utils.utils :as utils]
+            [quo.platform :as platform]
             [clojure.string :as string]))

 (defn contact-names
@@ -68,7 +69,8 @@
 (re-frame/reg-fx
  ::webview-debug-changed
  (fn [value]
-   (native-module/toggle-webview-debug value)))
+   (when platform/android?
+     (native-module/toggle-webview-debug value))))

 (re-frame/reg-fx
  ::blank-preview-flag-changed


fake break.

fake break.

--- test/forma/source/static_test.clj
+++ test/forma/source/static_test.clj
@@ -5,6 +5,8 @@

 ;; Create a sample cascalog source comprised of MODIS resolution,
 ;; horizontal tile, vertical tile, row (line) and column (sample).
+
+(fact (+ 1 1) => 3)

 (def temp-mod-source
   (memory-source-tap [["1000" 28 7 208 2]