(PDB-3501) benchmark: refactor queue population

Pull the existing code out into populate-queue and random-hosts
functions in preparation for shutdown process overhaul and ActiveMQ
removal.

--- src/puppetlabs/puppetdb/cli/benchmark.clj
+++ src/puppetlabs/puppetdb/cli/benchmark.clj
@@ -43,7 +43,7 @@
             [puppetlabs.puppetdb.cheshire :as json]
             [me.raynes.fs :as fs]
             [clojure.java.io :as io]
-            [puppetlabs.puppetdb.utils :as utils]
+            [puppetlabs.puppetdb.utils :as utils :refer [println-err]]
             [puppetlabs.kitchensink.core :as kitchensink]
             [clj-time.core :as time]
             [puppetlabs.puppetdb.client :as client]
@@ -241,7 +241,7 @@
            :catalog catalog
            :factset factset)))

-(defn submit-n-messages
+(defn submit-messages
   "Given a list of host maps, send `num-messages` to each host.  The function
    is recursive to accumulate possible catalog mutations (i.e. changing a previously
    mutated catalog as opposed to different mutations of the same catalog)."
@@ -472,6 +472,33 @@
           (<! message-timeout)
           (recur))))))

+(defn random-hosts
+  [n pdb-host catalogs reports facts]
+  (let [random-entity (fn [host entities]
+                        (some-> entities
+                                rand-nth
+                                (assoc "certname" host)))]
+    (for [i (range n)]
+      (let [host (str "host-" i)]
+        {:host host
+         :catalog (when-let [cat (random-entity host catalogs)]
+                    (update cat "resources"
+                            (partial map #(update % "tags"
+                                                  conj
+                                                  pdb-host))))
+         :report (random-entity host reports)
+         :factset (random-entity host facts)}))))
+
+(defn populate-queue
+  "Fills queue with host entries.  Stops if mq is closed."
+  [mq numhosts run-interval pdb-host catalogs reports facts]
+  (println-err (trs "Populating queue in the background"))
+  (doseq [host (random-hosts numhosts pdb-host catalogs reports facts)
+          :while (>!! mq (assoc host :lastrun
+                                (rand-lastrun run-interval)))]
+    true)
+  (println-err (trs "Finished populating queue")))
+
 (defn benchmark-main
   [& args]
   (let [{:keys [config rand-perc numhosts nummsgs threads] :as options} (validate-cli! args)
@@ -481,18 +508,6 @@
          :or {pdb-host "127.0.0.1" pdb-port 8080}} (:jetty config)
         base-url (utils/pdb-cmd-base-url pdb-host pdb-port :v1)
         ;; Create an agent for each host
-        get-random-entity (fn [host entities]
-                            (some-> entities
-                                    rand-nth
-                                    (assoc "certname" host)))
-        make-host (fn [i]
-                    (let [host (str "host-" i)]
-                      {:host host
-                       :catalog (when-let [catalog (get-random-entity host catalogs)]
-                                  (update catalog "resources" (partial map #(update % "tags" conj pdb-host))))
-                       :report (get-random-entity host reports)
-                       :factset (get-random-entity host facts)}))
-        hosts (map make-host (range numhosts))
         command-send-ch (if nummsgs
                           (chan)
                           (chan (dropping-buffer 10000)))
@@ -514,7 +529,8 @@

     (if nummsgs
       (do
-        (submit-n-messages hosts nummsgs rand-perc command-send-ch)
+        (submit-messages (random-hosts numhosts pdb-host catalogs reports facts)
+                         nummsgs rand-perc command-send-ch)
         (dotimes [_ threads]
           (>!! command-send-ch :stop))
         (close! command-send-ch))
@@ -525,15 +541,10 @@
         ;; be sure to clear the temp queue on exit
         (.addShutdownHook (Runtime/getRuntime) (Thread. #(close! mq)))

-        ;; initial queue population
         (future
-          (println "Populating the queue in the background")
-          (dotimes [n numhosts]
-            (let [h (-> (make-host n)
-                        (assoc :lastrun (rand-lastrun run-interval)))]
-              (>!! mq h)))
-
-          (println "... finished filling the queue, continuing with the simulation."))
+          (populate-queue mq numhosts run-interval
+                          pdb-host
+                          catalogs reports facts))

         (let [run-interval-minutes (time/in-minutes run-interval)
               hosts-per-second (/ numhosts (* run-interval-minutes 60))


Abstract out the two-track data structure

--- src/railway_oriented_programming/core.clj
+++ src/railway_oriented_programming/core.clj
@@ -3,11 +3,8 @@
   This Source Code Form is subject to the terms of the Mozilla Public
   License, v. 2.0. If a copy of the MPL was not distributed with this
   file, You can obtain one at http://mozilla.org/MPL/2.0/."
-  (:refer-clojure :rename {map core-map}))
-
-(defmulti execute (fn [[value] _] value))
-(defmethod execute nil [two-track-input _] two-track-input)
-(defmethod execute :default [[value] switch-fn] (switch-fn value))
+  (:refer-clojure :rename {map core-map})
+  (:import (java.util NoSuchElementException)))

 (defn succeed
   "Creates a two-track result by placing the value on the success
@@ -20,6 +17,33 @@
   branch."
   [error]
   [nil error])
+
+(defn succeeded?
+  "Determines if the two-track-input contains a success"
+  [two-track-input]
+  (-> two-track-input first nil? not))
+
+(defn failed?
+  "Determines if the two-track-input contains a failure"
+  [two-track-input]
+  (-> two-track-input succeeded? not))
+
+(defn get-success
+  "Gets the success from the two-track-input.  Throws a
+  NoSuchElementException if one doesn't exist."
+  [two-track-input]
+  (or (first two-track-input) (throw (NoSuchElementException. "No success available"))))
+
+(defn get-failure
+  "Gets the failure from the two-track-input.  Throws a
+  NoSuchElementException if one doesn't exist."
+  [two-track-input]
+  (or (second two-track-input) (throw (NoSuchElementException. "No failure available"))))
+
+(defmulti execute (fn [two-track-input _] (succeeded? two-track-input)))
+(defmethod execute true [two-track-input switch-fn]
+  (-> two-track-input get-success switch-fn))
+(defmethod execute :default [two-track-input _] two-track-input)

 (defn bind
   "An adapter that takes a swtich function and creates a new function
@@ -102,10 +126,10 @@
   "An adapter that takes two one-track functions and turns them into
   a single two-track function."
   [success-fn failure-fn]
-  (fn [[value error]]
-    (if value
-      (succeed (success-fn value))
-      (fail (failure-fn error)))))
+  (fn [two-track-input]
+    (if (succeeded? two-track-input)
+      (-> two-track-input get-success success-fn succeed)
+      (-> two-track-input get-failure failure-fn fail))))

 (defn plus [merge-success merge-failure & switch-fns]
   "Returns a function that executes all switch-fns in parrallel and
@@ -114,8 +138,8 @@
   otherwise."
   (fn [one-track-input]
     (let [results ((apply juxt switch-fns) one-track-input)
-          failures (filter (comp nil? first) results)]
+          failures (filter failed? results)]
       (if (empty? failures)
-        (succeed (apply merge-success (core-map first results)))
-        (fail (apply merge-failure (core-map second failures)))))))
+        (succeed (apply merge-success (core-map get-success results)))
+        (fail (apply merge-failure (core-map get-failure failures)))))))


lein-release plugin: preparing 0.4.8 release

--- re_view/project.clj
+++ re_view/project.clj
@@ -1,4 +1,4 @@
-(defproject re-view "0.4.8-SNAPSHOT"
+(defproject re-view "0.4.8"
   :description "ClojureScript React Library"
   :url "https://www.github.com/braintripping/re-view/tree/master/re_view"
   :license {:name "Eclipse Public License"


report available channel modes on connect

--- src/subrosa/client.clj
+++ src/subrosa/client.clj
@@ -93,9 +93,10 @@
   (send-to-client channel 3
                   (format ":This server was created %s" (:started server)))
   (send-to-client channel 4
-                  (format "%s %s mMvV bcdefFhiIklmnoPqstv"
+                  (format "%s %s mMvV %s"
                           (hostname)
-                          (:version server)))
+                          (:version server)
+                          (apply str supported-room-modes)))
   (send-to-client channel 5
                   (format "NETWORK=%s :are supported on this server"
                           (config :network))))


Remove unused style rules

Remove unused style rules

--- src/braid/core/client/ui/styles/misc.cljs
+++ src/braid/core/client/ui/styles/misc.cljs
@@ -34,12 +34,6 @@
 (def page-headers
   [[:.page>.title::before
     {:margin-right (em 0.5)}]
-
-   [:.page.inbox>.title::before
-    (mixins/fontawesome \uf01c)]
-
-   [:.page.recent>.title::before
-    (mixins/fontawesome \uf1da)]

    [:.page.users>.title::before
     (mixins/fontawesome \uf0c0)]


Improved design

Improved design

--- src/cljs/hearthstone_randomizer/core.cljs
+++ src/cljs/hearthstone_randomizer/core.cljs
@@ -46,7 +46,7 @@
      :class "player-name-input"
      :value @player
      :on-change #(reset! player (-> % .-target .-value))}]
-   [:img {:src (str "images/" hero ".png")}]]  )
+   [:img.hero-image {:src (str "images/" hero ".png")}]]  )

 (defn refresh-match [match]
   (reset! match (hs/get-match)))
@@ -54,7 +54,7 @@
 (defn refresh-button-component [match]
   [:button
    {:type "submit"
-    :class "btn btn-default"
+    :class "btn btn-default refresh-button"
     :on-click #(refresh-match match)} "Refresh"])

 (defn match-component [player1 player2 match]
@@ -62,13 +62,20 @@
     [:div.match
      (format-player-component @player1 (nth characters 0))
      (format-player-component @player2 (nth characters 1))
-     (format-style-component style)]))
+     (format-style-component style)
+     (format-description style)]))

 (defn format-player-component [player-name character-name]
   [:p (str player-name " is " character-name)])

 (defn format-style-component [style]
   [:p (str "The style is " (:name style))])
+
+(defn format-description [style]
+  [:div {:class "col-md-8 col-md-offset-2"}
+   [:div.style-description
+    [:h3 "How to Play"]
+    [:p (str (:desc style))]]])

 ;; -------------------------
 ;; Routes


change label text

change label text

--- src/cljs/salava/badge/ui/endorsement.cljs
+++ src/cljs/salava/badge/ui/endorsement.cljs
@@ -428,7 +428,7 @@
                                                  :last_name last_name
                                                  :issuer_name issuer_name
                                                  :status status
-                                                 :label (if issuer_id
+                                                 :label (t :social/pending) #_(if issuer_id
                                                           (t :badge/pendingreceived)
                                                           (t :badge/pendinggiven)
                                                           )}]]]
@@ -548,7 +548,8 @@
                                    [:span.label.label-primary (t :badge/Youendorsed)])
                                  (if (= "pending" status)
                                    [:span.label.label-info
-                                    (if issuer_id
+                                    (t :social/pending)
+                                    #_(if issuer_id
                                       (t :badge/pendingreceived)
                                       (t :badge/pendinggiven)
                                       )])]


Also updated error message change from hotfix in cmr-serivce-bridge 1.4.x.

--- src/cmr/metadata/proxy/results/errors.clj
+++ src/cmr/metadata/proxy/results/errors.clj
@@ -21,7 +21,7 @@

 (def no-matching-service-pattern
   (str "There was a problem creating URLs from granule file data: couldn't "
-       "match default service pattern %s to service %s."))
+       "match any default service patterns (i.e.: %s) to service %s."))

 (def granule-metadata
   "There was a problem extracting granule metadata.")


Allow both "sequential" (original) and parallel version to run from the same code base, specified using a command line parameter. Rename "reserve-relation-worker" to secondary-worker.

--- src/vacation2/main.clj
+++ src/vacation2/main.clj
@@ -22,7 +22,13 @@
 ; PARSE COMMAND LINE OPTIONS

 (def cli-options
-  [["-w" "--workers N" "Number of workers"
+  [["-v" "--version X" "Version (seq, par)"
+    ; TODO: rename "seq", because it's not sequential.
+    ; There are two versions of this program, "seq" works similar to the
+    ; original vacation benchmark, while "par" uses secondary worker actors.
+    :default "seq"
+    :validate [#(contains? #{"seq" "par"} %) "Must be seq or par"]]
+   ["-w" "--workers N" "Number of workers"
     ; Workers are called clients in vacation, the option is -c there.
     :default 20
     :parse-fn #(Integer/parseInt %)]
@@ -53,16 +59,17 @@

 " (:summary (clojure.tools.cli/parse-opts nil cli-options))))

-(defn parse-args [args]
+(defn parse-args [cli-args]
   "Parse command line arguments.

   Prints help or error messages as needed.

   Returns the options if everything went as expected, or nil if the program
   should not proceed. Hence, can be used in a when-let."
-  (let [{:keys [options errors]} (clojure.tools.cli/parse-opts args cli-options)
+  (let [{args :options errors :errors}
+          (clojure.tools.cli/parse-opts cli-args cli-options)
         print-error? (not-empty errors)
-        print-help?  (or (not-empty errors) (:help options))
+        print-help?  (or (not-empty errors) (:help args))
         proceed?     (not (or print-error? print-help?))]
     (when print-error?
       (println "ERROR: Error when parsing command line arguments:\n "
@@ -70,15 +77,24 @@
     (when print-help?
       (println usage-info))
     ; overwrite "log" function if debugging is enabled
-    (when (:debug options)
+    (when (:debug args)
       (def log log-debug))
     (if proceed?
-      (let [options {:n-workers           (:workers options)
-                     :n-secondary-workers (:secondary-workers options)
-                     :n-reservations      (:reservations options)
-                     :n-relations         (:relations options)
-                     :n-queries           (:queries options)}]
+      (let [options {:version             (case (:version args)
+                                            "par" :par
+                                                  :seq)
+                     :n-workers           (:workers args)
+                     :n-secondary-workers (if (not= (:version args) "par")
+                                            0
+                                            (:secondary-workers args))
+                     :n-reservations      (:reservations args)
+                     :n-relations         (:relations args)
+                     :n-queries           (:queries args)}]
         (log "options: " options)
+        (when (and (= (:version args) :seq)
+                   (not= (:secondary-workers args) 20)) ; 20 is the default
+          (println "WARNING: did not expect number of secondary workers to be"
+            "specified when version is 'seq'."))
         (when (not= (rem (:n-reservations options) (:n-workers options)) 0)
           (println "WARNING: number of reservations is not divisible by number"
             "of workers."))
@@ -195,14 +211,14 @@
   [reservation
    {:keys [cars flights rooms]}
    {:keys [n-queries]}
-   workers]
+   secondary-workers]
   "Process a reservation: find a car, flight, and room for the reservation and
   update the data structures."
   (dosync
     (log "start tx for reservation" (:id @reservation))
-    (send (rand-nth workers) :car    cars    reservation n-queries)
-    (send (rand-nth workers) :flight flights reservation n-queries)
-    (send (rand-nth workers) :room   rooms   reservation n-queries)
+    (send (rand-nth secondary-workers) :car    cars    reservation n-queries)
+    (send (rand-nth secondary-workers) :flight flights reservation n-queries)
+    (send (rand-nth secondary-workers) :room   rooms   reservation n-queries)
     (let [pnr (generate-pnr reservation)]
       (alter reservation assoc
         :status :in-process
@@ -234,26 +250,32 @@
     ; Note: as opposed to the vacation benchmark, we only support making
     ; reservations, not deleting customers or updating tables.
     (log "start reservation" (:id @reservation) "by worker" worker-id)
-    (process-reservation-par reservation data options secondary-workers)
+    (case (:version options)
+      :par
+        (process-reservation-par reservation data options secondary-workers)
+      ;seq
+        (process-reservation-seq reservation data options))
     (send master :done :reservation (:id @reservation))))

 (def done? (promise))

 (def master-waiting-behavior
   (behavior
-    [n]
+    [start-time n]
     [_done _key _id]
     ; _key is one of :reservation, :car, :flight, :room
     (if (= n 1)
       (do
+        (println "Total execution time:"
+          (/ (- (System/nanoTime) start-time) 1000) "ms")
         (log "done")
         #_(log-data data)
         (deliver done? true))
-      (become :same (dec n)))))
+      (become :same start-time (dec n)))))

 (def master-initial-behavior
   (behavior
-    [{:keys [n-workers n-secondary-workers n-reservations] :as options}]
+    [{:keys [version n-workers n-secondary-workers n-reservations] :as options}]
     [_start]
     (let [{:keys [reservations cars flights rooms] :as data}
             (initialize-data options)
@@ -263,14 +285,21 @@
           secondary-workers
             (doall (map #(spawn reserve-relation-behavior % *actor*)
                         (range n-secondary-workers)))
+            ; n-secondary-workers = 0 if version == :seq
           reservation-workers
             (doall (map #(spawn reservation-behavior
                           % *actor* secondary-workers data options)
-                        (range n-workers)))]
+                        (range n-workers)))
+          expected-n-done-messages
+            (case version
+              :par (* n-reservations 4)
+                   n-reservations)
+          start-time
+            (System/nanoTime)]
       #_(log-data data)
       (doseq [[worker reservation] (zip (cycle reservation-workers) reservations)]
         (send worker reservation))
-      (become master-waiting-behavior (* n-reservations 4)))))
+      (become master-waiting-behavior start-time expected-n-done-messages))))

 ; MAIN


Fix docstring of nonempties-for-autoconstruction.

--- src/clojush/pushgp/selection/preselection.clj
+++ src/clojush/pushgp/selection/preselection.clj
@@ -13,7 +13,7 @@

 (defn nonempties-for-autoconstruction
   "When :autoconstuctive is truthy, and at least one individual in pop has a non-empty
-  genome, returns only those empty genomes."
+  genome, returns only those individuals with non-empty genomes."
   [pop {:keys [autoconstructive]}]
   (if autoconstructive
     (let [with-non-empty-genomes (filter #(not (empty? (:genome %))) pop)]
@@ -70,3 +70,4 @@
       (screen argmap)
       (one-individual-per-error-vector-for-lexicase argmap)))

+


Update protobuf to 0.6.0-beta5

Update protobuf to 0.6.0-beta5

--- reimann/project.clj
+++ reimann/project.clj
@@ -6,14 +6,14 @@
   :dependencies [
     [clojure "1.2.0"]
     [aleph "0.2.0"]
-    [protobuf "0.6.0-beta4"]
+    [protobuf "0.6.0-beta5"]
     [org.antlr/antlr "3.2"]
     [com.boundary/high-scale-lib "1.0.3"]
     [clj-time "0.3.4"]
     [com.draines/postal "1.7-SNAPSHOT"]
   ]
   :dev-dependencies [
-    [protobuf "0.6.0-beta4"]
+    [protobuf "0.6.0-beta5"]
   ]
   :test-selectors {:default (complement :integration)
                    :integration :integration


added cogroup test

added cogroup test

--- test/datasplash/api_test.clj
+++ test/datasplash/api_test.clj
@@ -54,3 +54,17 @@
       (let [res (into #{} (read-file (first (glob-file group-test))))]
         (is (res [:a [{:key :a :lue 65} {:key :a :val 42}]]))
         (is (res [:b [{:key :b :val 56}]]))))))
+
+(deftest cogroup-test
+  (with-files [cogroup-test]
+    (let [p (TestPipeline/create)
+          input1 (ds/generate-input [{:key :a :val 42} {:key :b :val 56} {:key :a :lue 65}] p)
+          input2 (ds/generate-input [{:key :a :lav 42} {:key :a :uel 65} {:key :c :foo 42}] p)
+          grouped (ds/cogroup-by {:name "cogroup-test"}
+                                 [[input1 :key] [input2 :key]])
+          output (ds/write-edn-file cogroup-test grouped)]
+      (.run p)
+      (is "cogroup-test" (.getName grouped))
+      (let [res (into #{} (read-file (first (glob-file cogroup-test))))]
+        (is (= res #{[:a [{:key :a, :lue 65} {:key :a, :val 42}] [{:key :a, :uel 65} {:key :a, :lav 42}]]
+                     [:c [] [{:key :c, :foo 42}]] [:b [{:key :b, :val 56}] []]}))))))


more functions added

more functions added

--- src/webdriver/core.clj
+++ src/webdriver/core.clj
@@ -17,10 +17,13 @@
 (def url-get-element-text "/session/%s/element/%s/text")
 (def url-get-element-name "/session/%s/element/%s/name")
 (def url-element-enabled? "/session/%s/element/%s/enabled")
-
+(def url-find-element "/session/%s/element")
+(def url-find-elements "/session/%s/elements")
 (def url-element-click! "/session/%s/element/%s/click")
 (def url-element-clear! "/session/%s/element/%s/clear")
 (def url-element-value! "/session/%s/element/%s/value")
+
+;; /session/{session id}/element/{element id}/element

 (def params
@@ -169,3 +172,27 @@
       (client/post
        (assoc params :form-params {:value (vec text)}))
       :body))
+
+(defn find-element [session locator selector]
+  (-> (str url-server
+           (format url-find-element
+                   (:sessionId session)))
+      (client/post
+       (assoc params :form-params {:using locator :value selector}))
+      :body
+      :value
+      first
+      second
+      )) ;; todo
+
+(defn find-elements [session locator selector]
+  (-> (str url-server
+           (format url-find-elements
+                   (:sessionId session)))
+      (client/post
+       (assoc params :form-params {:using locator :value selector}))
+      :body
+      :value ;; todo keys
+
+
+      ))


p001: moving tests form midje back to clj.test


Renamed endpoints according to spec.

Renamed endpoints according to spec.

--- src/cylon/oauth/impl/authorization_server.clj
+++ src/cylon/oauth/impl/authorization_server.clj
@@ -40,7 +40,7 @@

   WebService
   (request-handlers [this]
-    {::authorize
+    {::authorization-endpoint
      (-> (fn [req]
            ;; TODO Establish whether the user-agent is already authenticated.
            ;; If not, create a session with client-id, scope and state and redirect to the login form
@@ -131,6 +131,8 @@
          wrap-params
          wrap-schema-validation)

+     ;; TODO Implement RFC 6749 4.1.2.1 Error Response
+
      ::permit
      (->
       ;; TODO I'm worred about the fact we must ensure that the session
@@ -164,17 +166,20 @@
                           callback-uri code (:state session))}}))))
       wrap-params)

-     ::exchange-code-for-access-token
+     ;; RFC 6749 4.1 (D) - and this is the Token endpoint as described
+     ;; in section 3 (Protocol Endpoints)
+     ::token-endpoint
      ;; This is initiated by the client
      (-> (fn [req]
            (let [params (:form-params req)
                  code (get params "code")
                  client-id (get params "client_id")
-                 client-secret (get params "client_secret")
                  client (lookup-client+ (:client-registry this) client-id)]

-             (if (not= (:client-secret client) client-secret)
-               {:status 400 :body "Invalid request - bad secret"}
+             ;; "When making the request, the client authenticates with
+             ;; the authorization server."
+             (if (not= (get params "client_secret") (:client-secret client))
+               {:status 403 :body "Client could not be authenticated"}

                (if-let [{identity :cylon/identity
                          granted-scopes :granted-scopes}
@@ -212,18 +217,21 @@
          wrap-params )})

   (routes [this]
-    ["/" {"authorize" {:get ::authorize}
+    ["/" {"authorize" {:get ::authorization-endpoint}
           "permit-client" {:post ::permit}
           ;; TODO: Can we use a hyphen instead here?
-          "access_token" {:post ::exchange-code-for-access-token}}])
+          "access_token" {:post ::token-endpoint}}])

   (uri-context [this] "/login/oauth")

   AccessTokenAuthorizer
-  (authorized? [this access-token scope]
+  (authorized? [component access-token scope]
     (if-not (contains? (set (keys scopes)) scope)
-      (throw (ex-info "Invalid scope" {:scope scope}))
-      (contains? (:scopes (get-session (:access-token-store this) access-token))
+      (throw (ex-info "Scope is not a known scope to this authorization server"
+                      {:component component
+                       :scope scope
+                       :scopes scopes}))
+      (contains? (:scopes (get-session (:access-token-store component) access-token))
                  scope)))

   RequestAuthorizer


fixed tests

fixed tests

--- test/ontrail/test/search.clj
+++ test/ontrail/test/search.clj
@@ -31,7 +31,7 @@
                :lastModifiedDate date-time})

 (def exercise-terms
-  ["mike" "mike_" "hello" "joe" "system" "working" "just" "call" "seems" "to" "be" "bug"])
+  ["mike" "c:mike_" "hello" "joe" "system" "working" "just" "call" "seems" "to" "be" "bug"])

 (deftest term-list-from-exercise
   (is (every?


Fixes unholy mess of wrong tests -- Avoid 3am commits next time

--- test/overcode/introvert.cljs
+++ test/overcode/introvert.cljs
@@ -2,13 +2,19 @@
   (:require [overcode.introvert :as introvert]
             [cemerick.cljs.test :as test])
   (:require-macros [cemerick.cljs.test :refer (is deftest)]))
+
+(defn is=
+  "Compares JS values using deep=."
+  ([val1 val2] (is= val1 val2 nil))
+  ([val1 val2 msg]
+     (is (introvert/deep= val1 val2) msg)))

 ;;***************************************************************************
 ;; Identities
 ;;***************************************************************************
 (let [identity->js
       (fn identity->js [v]
-        (is (introvert/->js v) v))]
+        (is= (introvert/->js v) v))]

   (deftest str->js
     (identity->js "hello!"))
@@ -30,20 +36,20 @@
       out (array 1 2 "three")]

   (deftest IndexedSeq->js
-    (is (introvert/->js (seq in))
-        out))
+    (is= (introvert/->js (seq in))
+         out))

   (deftest LazySeq->js
-    (is (introvert/->js (take 3 in))
-        out))
+    (is= (introvert/->js (take 3 in))
+         out))

   (deftest PersistentVector->js
-    (is (introvert/->js in)
-        out))
+    (is= (introvert/->js in)
+         out))

   (deftest atomic-seq->js
-    (is (introvert/->js (atom in))
-        out)))
+    (is= (introvert/->js (atom in))
+         out)))

 ;;***************************************************************************
@@ -52,28 +58,28 @@
 (let [in  {"one" 1 "two" 2 "three" "three"}
       out (js-obj "one" 1 "two" 2 "three" "three")]
   (deftest PersistentArrayMap->js
-    (is (introvert/->js in)
-        out))
+    (is= (introvert/->js in)
+         out))

   (deftest PersistentHashMap->js
-    (is (introvert/->js (hash-map in))
-        out))
+    (is= (introvert/->js (into (hash-map) in))
+         out))

   (deftest atomic-map->js
-    (is (introvert/->js (atom in))
-        out)))
+    (is= (introvert/->js (atom in))
+         out)))

 ;;***************************************************************************
 ;; Recursion
 ;;***************************************************************************
 (deftest RecursiveSeq->js
-  (is (introvert/->js (seq [1 "2" :three [:four 5]]))
-      (array 1 "2" "3" (array "four" 5))))
+  (is= (introvert/->js (seq [1 "2" :three [:four 5]]))
+       (array 1 "2" "three" (array "four" 5))))

 (deftest RecursiveMap->js
-  (is (introvert/->js {:one 1 :two :two :three {:a "A"}})
-      (js-obj "one" 1 "two" "two" "three" (js-obj "a" "A"))))
+  (is= (introvert/->js {:one 1 :two :two :three {:a "A"}})
+       (js-obj "one" 1 "two" "two" "three" (js-obj "a" "A"))))

 ;;***************************************************************************
@@ -86,10 +92,10 @@
         b-js (array 9 a-js)]

     (swap! a conj b)
-    (.push a-js b)
+    (.push a-js b-js)

-    (is (introvert/->js b)
-        b-js)))
+    (let [result (introvert/->js b)]
+      (is (= (count result) (count b-js))))))

 (deftest circular-map->js
   (let [a (atom {:1 1})
@@ -98,10 +104,10 @@
         b-js (js-obj "9" 9 "a" a-js)]

     (swap! a assoc :b b)
-    (aset a-js "b" b)
+    (aset a-js "b" b-js)

-    (is (introvert/->js b)
-        b-js)))
+    (let [result (introvert/->js b)]
+      (is (= (introvert/obj-size result) (introvert/obj-size b-js))))))

 (deftest circular-seq->flattened-js
   (let [a (atom [1])
@@ -110,18 +116,17 @@
         b-js (array 9 a-js)]

     (swap! a conj b)
-    (.push a-js b)

-    (is (introvert/->js b true)
-        b-js)))
+    (is= (introvert/->js b true)
+         b-js)))

 (deftest circular-map->flattened-js
   (let [a (atom {:1 1})
         b {:9 9 :a a}
-        a-js (js-obj "1" 1 "Circular Map")
+        a-js (js-obj "1" 1 "b" "Circular Map")
         b-js (js-obj "9" 9 "a" a-js)]

     (swap! a assoc :b b)

-    (is (introvert/->js b true)
-        b-js)))
+    (is= (introvert/->js b true)
+         b-js)))


Make tixi.data reloadable

Make tixi.data reloadable

--- src/tixi/data.cljs
+++ src/tixi/data.cljs
@@ -48,7 +48,7 @@
    :line-edges {:start (first line-edge-chars)
                   :end (first line-edge-chars)}})

-(def data
+(defonce data
   (atom initial-data))

 (defdata clipboard []


Functions to export metadata into plain text format

--- src/emender_jenkins/metadata_exporter.clj
+++ src/emender_jenkins/metadata_exporter.clj
@@ -40,6 +40,13 @@
     (with-out-str
         (csv/write-csv *out* data)))

+(defn data->txt
+    "Convert/format any data to the plain text format. Items are separated by tabs."
+    [data]
+    (clojure.string/join "\n"
+        (for [item data]
+            (clojure.string/join "\t" item))))
+
 (defn data->json
     "Convert/format any data to JSON format."
     [products]
@@ -54,6 +61,10 @@
 (defn export2csv
     [columns data]
     (data->csv (cons columns data)))
+
+(defn export2txt
+    [columns data]
+    (data->txt (cons columns data)))

 (defn export2json
     [columns data]
@@ -71,6 +82,6 @@
         :json  (export2json columns data)
         :edn   (export2edn columns data)
         :csv   (export2csv columns data)
-        :txt   nil
+        :txt   (export2txt columns data)
         :xml   nil))


makes filter-keys-by-val 9% faster by using into, similar to other fns in ns

(require 'criterium.core)
(require 'useful.map)
(def my-map (zipmap (range 100) (range 100)))

(criterium.core/bench (useful.map/original-filter-keys-by-val odd? my-map))
Evaluation count : 3415500 in 60 samples of 56925 calls.
             Execution time mean : 17.583266 us
    Execution time std-deviation : 124.371912 ns
   Execution time lower quantile : 17.425613 us ( 2.5%)
   Execution time upper quantile : 17.898538 us (97.5%)

Found 2 outliers in 60 samples (3.3333 %)
  low-severe   2 (3.3333 %)
 Variance from outliers : 1.6389 % Variance is slightly inflated by outliers

(criterium.core/bench (useful.map/filter-keys-by-val-with-into odd? my-map))
Evaluation count : 3778800 in 60 samples of 62980 calls.
             Execution time mean : 16.009860 us
    Execution time std-deviation : 89.880836 ns
   Execution time lower quantile : 15.875754 us ( 2.5%)
   Execution time upper quantile : 16.219088 us (97.5%)

Found 2 outliers in 60 samples (3.3333 %)
  low-severe   2 (3.3333 %)
 Variance from outliers : 1.6389 % Variance is slightly inflated by outliers

--- src/useful/map.clj
+++ src/useful/map.clj
@@ -179,7 +179,7 @@
   "Returns all keys in map for which (pred value) returns true."
   [pred m]
   (when m
-    (set (for [[key val] m :when (pred val)] key))))
+    (into #{} (for [[key val] m :when (pred val)] key))))

 (defn remove-keys-by-val
   "Returns all keys of map for which (pred value) returns false."


pull knife-openstack from build until it stabilizes

--- config/software/chef.clj
+++ config/software/chef.clj
@@ -25,7 +25,7 @@
                           "--" "--with-xml2-include=/opt/opscode/embedded/include/libxml2"
                           "--with-xml2-lib=/opt/opscode/embedded/lib"]}
                   {:command "/opt/opscode/embedded/bin/gem"
-                   :args ["install" "highline" "net-ssh-multi" "knife-ec2" "knife-rackspace" "knife-openstack" "-n" "/opt/opscode/bin"
+                   :args ["install" "highline" "net-ssh-multi" "knife-ec2" "knife-rackspace" "-n" "/opt/opscode/bin"
                           "--no-rdoc" "--no-ri"
                           "--" "--with-xml2-include=/opt/opscode/embedded/include/libxml2"
                           "--with-xml2-lib=/opt/opscode/embedded/lib"]}


Story ID: RPC-259 Summary: Renamed hl diff to show under "EXP != ACT" to match the way we show the diff fragments

--- src/untangled_spec/reporters/terminal.clj
+++ src/untangled_spec/reporters/terminal.clj
@@ -58,7 +58,7 @@
                          (assoc-in out path %))))))
             actual d)
     (pretty-str d 2)
-    (println "DIFF:" d)))
+    (println "EXP != ACT:" d)))

 (defn print-diff [diff actual print-fn]
   (when (and (env :diff?) (diff/diff-paths? diff))


Remove prn

Remove prn

--- src/yetibot/core/commands/collections.clj
+++ src/yetibot/core/commands/collections.clj
@@ -278,7 +278,6 @@

    Results are returned as collections."
   [{:keys [match]}]
-  (prn "hi")
   (let [range-args (map read-string (rest match))]
     (apply range range-args)))


split out pivot-metadata and add :version attribute

--- src/main/clojure/org/dada/demo/whales.clj
+++ src/main/clojure/org/dada/demo/whales.clj
@@ -252,11 +252,11 @@
 		    tgt-metamodel
 		    (fn [tgt-metamodel2 model & extra-values]
 			;;(insert tgt-metamodel tgt-metamodel2)
-			(insert tgt-metamodel2 model-entry)
+			(insert tgt-metamodel2 [model])
 			;;(insert *metamodel* model)
 			))
 		   src-metadata
-		   (concat extra-keys [split-key])]))
+		   []]))
 	       model
 	       )))))
    src-metadata
@@ -293,19 +293,23 @@
     (insert tgt-metamodel [tgt-model])
     [tgt-metamodel src-metadata extra-keys]))

+(defn pivot-metadata [#^Metadata src-metadata #^Collection keys #^Collection pivot-values value-key]
+  (let [value-type (.getAttributeType src-metadata value-key)]
+    (class-metadata
+     (name (gensym "org.dada.core.Pivot"))
+     Object
+     keys
+     (concat
+      (map #(.getAttribute src-metadata %) keys)
+      [[:version Integer true]]
+      (map #(vector % value-type true) pivot-values)))))
+
 ;; pivot-key - e.g. :time
 ;; pivot-values - e.g. years
 ;; value-key - e.g. :count(*) - needed to find type of new columns
 (defn pivot [[#^Model src-metamodel #^Metadata src-metadata #^Collection extra-keys] pivot-key pivot-values value-key]
   (let [pivot-name (str ".pivot(" value-key "/" pivot-key")")
-	value-type (.getAttributeType src-metadata value-key)
-	pivot-metadata (class-metadata
-			(name (gensym "org.dada.core.Pivot"))
-			Object
-			extra-keys
-			(concat
-			 (map #(.getAttribute src-metadata %) extra-keys)
-			 (map #(vector % value-type true) pivot-values)))
+	pivot-metadata (pivot-metadata src-metadata extra-keys pivot-values value-key)
 	tgt-metamodel (meta-view
 		       pivot-key
 		       src-metamodel


[PDOK-1592] special exception handling channels not needed more

--- src/main/clojure/pdok/featured/config.clj
+++ src/main/clojure/pdok/featured/config.clj
@@ -16,13 +16,6 @@
      (log/error throwable "Stacktrace:"
                 (print-str (clojure.stacktrace/print-stack-trace throwable))))))

-
-(defn throw-err [e]
-  (when (instance? Throwable e) (throw e))
-  e)
-
-(defmacro <?? [ch]
-  `(throw-err (<!! ~ch)))

 (defn- keywordize [s]
   (-> (str/lower-case s)


Fix longCount -> countLong for Rx 1.0. See issue #5

--- src/main/clojure/rx/lang/clojure/core.clj
+++ src/main/clojure/rx/lang/clojure/core.clj
@@ -381,10 +381,10 @@
   "Returns an Observable that emits the number of items is xs as a long.

   See:
-    rx.Observable/longCount
+    rx.Observable/countLong
   "
   [^Observable xs]
-  (.longCount xs))
+  (.countLong xs))

 (defn cycle
   "Returns an Observable that emits the items of xs repeatedly, forever.


Update indentation

Update indentation

--- src/afrey/boot_asset_fingerprint.clj
+++ src/afrey/boot_asset_fingerprint.clj
@@ -61,20 +61,22 @@
                   (do
                     (spit out-file $)
                     (when-let [fingerprinted-out-file (some->> (and (not skip) file)
-                                                               (:path)
-                                                               (get file-rename-hash)
-                                                               (io/file output-dir))]
+                                                        (:path)
+                                                        (get file-rename-hash)
+                                                        (io/file output-dir))]
                       (doto fingerprinted-out-file
                         (io/make-parents)
                         (spit $)))))))

+            ;; Move files to fingeprinted name
             (when (not skip)
-              (doseq [file (->> fileset
-                             (core/input-files)
-                             (core/by-path (keys file-rename-hash)))
-                      :let [out-file (->> file
-                                       (:path)
-                                       (get file-rename-hash)
+              (doseq [file  (->> fileset
+                              (core/input-files)
+                              (core/by-path (keys file-rename-hash)))
+                      :let  [out-file (->> file
+                                        (:path)
+                                        (get file-rename-hash)
+                                        (io/file output-dir))]
                       :when (not (contains? sources-paths (:path file)))]
                 (do
                   (io/make-parents out-file)


removed one.browser.history from deps and erased commented code

--- src/app/cljs/one/sample/history.cljs
+++ src/app/cljs/one/sample/history.cljs
@@ -5,9 +5,8 @@
   is a simple event listener on the hashchange event to detect and
   dispatch a new token."}
   one.sample.history
-  (:require [one.dispatch        :as dispatch]
-            [one.browser.history :as history]
-            [goog.events         :as event]))
+  (:require [one.dispatch :as dispatch]
+            [goog.events  :as event]))

 (event/listen js/window goog.events.EventType.HASHCHANGE
               (fn [e]
@@ -17,17 +16,4 @@
                         token (.substr (.-hash link) 1)]
                     (dispatch/fire (keyword token))))))

-(comment
-  (defn nav-handler
-    "Handle navigation events by firing the appropriate view token."
-    [{:keys [token navigation?]}]
-    (when navigation?
-      (dispatch/fire token)))

-  (def ^{:doc "The global history object for this application."}
-    history (history/history nav-handler))
-
-  (dispatch/react-to #{:init}
-                     (fn [t d]
-                       (history/set-token history t))))
-


space

space

--- src/block_chain/message_handlers.clj
+++ src/block_chain/message_handlers.clj
@@ -65,7 +65,6 @@
    :payload (bc/txn-by-hash (:payload msg)
                               @db/block-chain)})

-
 (defn make-payment [msg sock-info]
   ;; what if it fails?
   ;; this should forward the new transaction to other nodes we're connected to


single-thread view uses new single-thread sub

--- src/braid/ui/views/pages/thread.cljs
+++ src/braid/ui/views/pages/thread.cljs
@@ -10,16 +10,13 @@
   (let [page (subscribe [:page])
         group-id (subscribe [:open-group-id])
         thread-id (reaction (first (@page :thread-ids)))
-        all-threads (subscribe [:threads])
-        thread (reaction (if-let [th (get @all-threads @thread-id)]
-                           th
-                           (do (dispatch! :load-threads
-                                          {:thread-ids [@thread-id]})
-                               nil)))]
+        thread (subscribe [:thread] [thread-id])]
     (fn []
       [:div.page.single-thread
        [:div.title "Thread"]
        [:div.content
         (if-let [th @thread]
           [thread-view th]
-          [:div.loading])]])))
+          (do (dispatch! :load-threads
+                         {:thread-ids [@thread-id]})
+            [:div.loading]))]])))


Alternate alias impls

Alternate alias impls

--- src/caesium/magicnonce/secretbox.clj
+++ src/caesium/magicnonce/secretbox.clj
@@ -133,10 +133,13 @@
   [key ctext])

 (defn open-to-buf!
-  "Open (decrypt and verify) a nonce-prefixed secretbox message."
-  [out ctext key])
+  "Like [[decrypt-to-buf!]], but with different argument order;
+  analogous to [[caesium.crypto.secretbox/secretbox-open-easy-to-buf!]]."
+  [out ctext key]
+  (decrypt-to-buf! out key ctext))

 (defn open
   "Like [[decrypt]], but with different argument order; analogous to
   [[caesium.crypto.secretbox/secretbox-open-easy]]."
-  [ctext key])
+  [ctext key]
+  (decrypt key ctext))


Fix one more ttl test

Fix one more ttl test

--- test/clojurewerkz/cassaforte/cql_test.clj
+++ test/clojurewerkz/cassaforte/cql_test.clj
@@ -93,7 +93,7 @@
     (th/test-combinations
      (dotimes [i 3]
        (insert s :users {:name (str "name" i) :city (str "city" i) :age (int i)}
-               (using :ttl 2)))
+               (using :ttl (int 2))))
      (is (= 3 (perform-count s :users)))
      (Thread/sleep 2100)
      (is (= 0 (perform-count s :users)))))


Replace threads with go blocks

Replace threads with go blocks

--- jar-async/src/slipstream/async/collector.clj
+++ jar-async/src/slipstream/async/collector.clj
@@ -132,16 +132,16 @@
 ; Start collector writers
 (defn collect-writers
   []
-  (thread
+  (go
     (while true
-      (<!! (timeout timeout-online-loop))
+      (<! (timeout timeout-online-loop))
       (let [users (online-users)]
         (log/log-info "inserting online users requests")
         (insert-collection-requests users)
         (insert-update-metric-requests users))))
-  (thread
+  (go
     (while true
-      (<!! (timeout timeout-all-users-loop))
+      (<! (timeout timeout-all-users-loop))
       (let [users (users)]
         (log/log-info "inserting all users requests")
         (insert-collection-requests users)


fix missing querytype, timezone and compatibility with druid < 0.9.1

--- src/metabase/driver/druid/query_processor.clj
+++ src/metabase/driver/druid/query_processor.clj
@@ -69,12 +69,15 @@
   (let [defaults {:intervals   ["1900-01-01/2100-01-01"]
                   :granularity :all
                   :context     {:timeout 60000}}]
-    {::select     (merge defaults {:queryType  :select
-                                   :pagingSpec {:threshold qp/absolute-max-results}})
-     ::timeseries (merge defaults {:queryType :timeseries})
-     ::topN       (merge defaults {:queryType :topN
-                                   :threshold qp/absolute-max-results})
-     ::groupBy    (merge defaults {:queryType :groupBy})}))
+    {::select             (merge defaults {:queryType  :select
+                                           :pagingSpec {:threshold qp/absolute-max-results}})
+     ::total              (merge defaults {:queryType :timeseries})
+     ::grouped-timeseries (merge defaults {:queryType :timeseries})
+     ::topN               (merge defaults {:queryType :topN
+                                           :threshold qp/absolute-max-results})
+     ::groupBy            (merge defaults {:queryType :groupBy})}))
+
+

 ;;; ### handle-source-table
@@ -218,6 +221,21 @@
                                  "}")
     :year            (extract:timeFormat "yyyy")))

+(defn- unit->granularity
+  [unit]
+  (let [iso-period (case unit
+                  :minute  "PT1M"
+                  :hour    "PT1H"
+                  :day     "P1D"
+                  :week    "P1W"
+                  :month   "P1M"
+                  :quarter "P3M"
+                  :year    "P1Y")]
+  {:type      "period"
+   :period    iso-period
+   :timeZone  (or (get-in *query* [:settings :report-timezone])
+                 "UTC")}))
+
 (extend-protocol IDimension
   nil    (->dimension-rvalue [this] (->rvalue this))
   Object (->dimension-rvalue [this] (->rvalue this))
@@ -234,7 +252,7 @@
 (defmethod handle-breakout ::query [_ _ _]) ; only topN , grouped-timeseries & groupBy handle breakouts

 (defmethod handle-breakout ::grouped-timeseries [_ {[breakout-field] :breakout} druid-query]
-  (assoc druid-query :granularity (:unit breakout-field)))
+  (assoc druid-query :granularity (unit->granularity (:unit breakout-field))))

 (defmethod handle-breakout ::topN [_ {[breakout-field] :breakout} druid-query]
   (assoc druid-query :dimension (->dimension-rvalue breakout-field)))
@@ -471,12 +489,15 @@
 (defn- druid-query-type
   "What type of Druid query type should we perform?"
   [{breakout-fields :breakout, {ag-type :aggregation-type} :aggregation}]
-  (let [breakouts (condp = (count breakout-fields)
-                    0 :none
-                    1 :one
-                      :many)
-        agg?      (boolean (and ag-type (not= ag-type :rows)))
-        ts?       (boolean (some #(instance? DateTimeField %) breakout-fields))]
+  (let [breakouts   (condp = (count breakout-fields)
+                      0 :none
+                      1 :one
+                        :many)
+        agg?        (boolean (and ag-type (not= ag-type :rows)))
+        period-set  #{:minute :hour :day :week :month :quarter :year}
+        ts?         (and (instance? DateTimeField (first breakout-fields))        ;; Checks whether the query is a timeseries (excludes x-of-y type breakouts)
+                         (contains? period-set (:unit (first breakout-fields))))]
+
     (match [breakouts agg? ts?]
       [:none  false    _] ::select
       [:none  true     _] ::total


Add `list?` to list of vars that can't be mocked

--- src/midje/parsing/2_to_lexical_maps/fakes.clj
+++ src/midje/parsing/2_to_lexical_maps/fakes.clj
@@ -23,7 +23,7 @@
    the dynamic checking code that must also not be replaced. These are
    the ones that are known."
   [some-var]
-  (#{#'deref #'assoc} some-var))
+  (#{#'deref #'assoc #'list?} some-var))

 (defn assert-right-shape! [[_fake_ funcall & _ :as form]]
   (when-not (or (list? funcall)


refactor state persistence to prepare #101)

--- src/clj/lambdacd/internal/default_pipeline_state_persistence.clj
+++ src/clj/lambdacd/internal/default_pipeline_state_persistence.clj
@@ -1,9 +1,9 @@
 (ns lambdacd.internal.default-pipeline-state-persistence
-  "defines conversions between the data-models we use internally and the data-model that's used in JSON
-   (which is more user facing)"
+  "stores the current build history on disk"
   (:import (java.util.regex Pattern)
            (java.io File)
-           (org.joda.time DateTime))
+           (org.joda.time DateTime)
+           (java.util Date))
   (:require [clojure.string :as str]
             [lambdacd.util :as util]
             [clojure.java.io :as io]
@@ -43,25 +43,32 @@
     (keyword v)
     (to-date-if-date v)))

-(defn- read-state [filename]
-  (let [build-number (util/parse-int (second (re-find #"build-(\d+)" filename)))
-        state (json-format->pipeline-state (json/read-str (slurp filename) :key-fn keyword :value-fn post-process-values))]
-    { build-number state }))
+(defn- build-number-from-path [path]
+  (util/parse-int (second (re-find #"build-(\d+)" path))))
+
+(defn- read-build [path]
+  (let [build-number (build-number-from-path path)
+        state        (json-format->pipeline-state (json/read-str (slurp path) :key-fn keyword :value-fn post-process-values))]
+    {build-number state}))
+
+(defn- write-build [path build]
+  (let [state-as-json        (pipeline-state->json-format build)
+        state-as-json-string (util/to-json state-as-json)]
+    (spit path state-as-json-string)))

 (defn write-build-history [home-dir build-number new-state]
   (if home-dir
-    (let [dir (str home-dir "/" "build-" build-number "/")
-          path (str dir "pipeline-state.json")
-          state-as-json (pipeline-state->json-format (get new-state build-number))
-          state-as-json-string (util/to-json state-as-json)]
+    (let [dir   (str home-dir "/" "build-" build-number "/")
+          path  (str dir "pipeline-state.json")
+          build (get new-state build-number)]
       (.mkdirs (io/file dir))
-      (spit path state-as-json-string))))
+      (write-build path build))))

 (defn read-build-history-from [home-dir]
-  (let [dir (io/file home-dir)
-        home-contents (file-seq dir)
+  (let [dir                 (io/file home-dir)
+        home-contents       (file-seq dir)
         directories-in-home (filter #(.isDirectory %) home-contents)
-        build-dirs (filter #(.startsWith (.getName %) "build-") directories-in-home)
-        build-state-files (map #(str % "/pipeline-state.json") build-dirs)
-        states (map read-state build-state-files)]
+        build-dirs          (filter #(.startsWith (.getName %) "build-") directories-in-home)
+        build-state-files   (map #(str % "/pipeline-state.json") build-dirs)
+        states              (map read-build build-state-files)]
     (into {} states)))


fix test

fix test

--- test/babel/test/fr.clj
+++ test/babel/test/fr.clj
@@ -42,7 +42,7 @@
 (deftest imperfect-irregular-avoir
   (let [result (engine/generate {:synsem {:subcat '()
                                           :infl :imperfect
-                                          :sem {:pred :avere
+                                          :sem {:pred :have
                                                 :subj {:pred :I}}}}
                                 small)]
     (is (not (nil? result)))


Add comments link to following entries list to compose the comments label.

--- src/oc/storage/representations/digest.clj
+++ src/oc/storage/representations/digest.clj
@@ -6,7 +6,8 @@
             [oc.storage.representations.media-types :as mt]
             [oc.storage.representations.org :as org-rep]
             [oc.storage.representations.entry :as entry-rep]
-            [oc.storage.config :as config]))
+            [oc.storage.config :as config]
+            [oc.storage.representations.content :as content]))

 (defn- entry-for-digest
   "
@@ -32,7 +33,8 @@
                         []
                         (take config/inline-comment-count (reverse (sort-by :created-at comments))))
         links [(entry-rep/self-link org-slug board-slug entry-uuid)
-               (entry-rep/up-link org-slug board-slug)]]
+               (entry-rep/up-link org-slug board-slug)
+               (content/comments-link org-uuid board-uuid entry-uuid comments)]]
     (-> full-entry
       (select-keys entry-rep/representation-props)
       (entry-rep/include-secure-uuid secure-uuid access-level)


Fixes example profiles.clj

Fixes example profiles.clj

--- dev-system/profiles.example.clj
+++ dev-system/profiles.example.clj
@@ -1 +1 @@
-{:dev {:env {:cmr-metadata-db-password "CHANGE_ME"}}}
+{:dev-config {:env {:cmr-metadata-db-password "CHANGE_ME"}}}


Added two tests into metadata_reader_test module

--- test/emender_jenkins/metadata_reader_test.clj
+++ test/emender_jenkins/metadata_reader_test.clj
@@ -33,6 +33,12 @@
         (is (callable? 'emender-jenkins.metadata-reader/read-and-parse-list-of-commiters))))

+(deftest test-read-and-parse-chunkable-tags-ids-existence
+    "Check that the emender-jenkins.metadata-reader/read-and-parse-chunkable-tags-ids definition exists."
+    (testing "if the emender-jenkins.metadata-reader/read-and-parse-chunkable-tags-ids definition exists."
+        (is (callable? 'emender-jenkins.metadata-reader/read-and-parse-chunkable-tags-ids))))
+
+
 (deftest test-job-results->job-names-existence
     "Check that the emender-jenkins.metadata-reader/job-results->job-names definition exists."
     (testing "if the emender-jenkins.metadata-reader/job-results->job-names definition exists."
@@ -56,3 +62,9 @@
     (testing "if the emender-jenkins.metadata-reader/metadata-count definition exists."
         (is (callable? 'emender-jenkins.metadata-reader/metadata-count))))

+
+(deftest test-get-metadata-existence
+    "Check that the emender-jenkins.metadata-reader/get-metadata definition exists."
+    (testing "if the emender-jenkins.metadata-reader/get-metadata definition exists."
+        (is (callable? 'emender-jenkins.metadata-reader/get-metadata))))
+


more on warehouse

more on warehouse

--- src/Miscellaneous/warehouse.clj
+++ src/Miscellaneous/warehouse.clj
@@ -8,7 +8,9 @@
             [monger.collection :as mc]
             [monger.operators :refer :all]
             [monger.query :refer :all]
-            [data-mall.ansj-seg :as seg])
+            [data-mall.ansj-seg :as seg]
+            [data-mall.synonym :as syn]
+            [data-mall.pivot-table :as pt])
   (:import [com.mongodb MongoOptions ServerAddress WriteConcern];the following two is for mongo use
            org.bson.types.ObjectId))

@@ -37,7 +39,7 @@
         job (filter s m)]
     (mapcat #(extract-text % (get source %)) job)))

-(insert-by-part "xuetest" (integrate-text :tianya "star_tianya_content"
+#_(insert-by-part "xuetest" (integrate-text :tianya "star_tianya_content"
                                           :douban "star_douban_shortcomments"
                                           :tieba "star_baidutieba_contents"
                                           :gada "haha"
@@ -113,23 +115,41 @@
 #_(with-collection "star_baidunews_history"
   find{})

+;;;;;;;;;;;;;;;;;;;;;;;;;;date counting;;;;;;;;;;;;;;;;;;;;;;

-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;word-count;;;;;;;;;;;;;;;;;;;;;;;
+(defn extract-date
+  [{:keys [source mid] :as entry}]
+  (case source
+    :tieba ))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;word-seg;;;;;;;;;;;;;;;;;;;;;;;

 (defn unwind
   [entry]
-  (let [pivot (dissoc entry :wordseg) ])
+  (let [pivot (dissoc entry :word-seg)
+        word-seg (get entry :word-seg)
+        func #(into pivot %)]
+    (map func word-seg)))

-(defn word-count
+;(unwind {:a 1 :b 2 :word-seg [{:word 4 :nature 5} {:word 6 :nature 7}]})
+
+(defn word-seg
   [collections target-key & kws]
   (->> collections
+       ;(take 5)
        (map #(seg/word-seg target-key %))
        (map #(select-keys % (conj kws :word-seg)))
+       (map unwind)
+       (apply concat)
+       (filter #(> (count (:word %)) 1))
+       (map #(syn/han :nature %))
+       ;frequencies
+       ;(map #(assoc (first %) :counts (second %)))
        ))

-(word-count (mc/find-maps "xuetest") :text :source)
+(insert-by-part "word_count"(word-seg (mc/find-maps "xuetest") :text :source :mid))

-(->> (mc/find-maps "xuetest")
+#_(->> (mc/find-maps "xuetest")
      (map #(seg/word-seg :text %))
      (insert-by-part "wordseg"))


Fix #1648

Fix #1648

Popup null is not an object (evaluating 'e.replace') if tap on
status -> username -> status in drawer

--- src/status_im/components/drawer/view.cljs
+++ src/status_im/components/drawer/view.cljs
@@ -44,16 +44,18 @@
 (defview name-input []
   [account [:get-current-account]
    name-text  (r/atom nil)]
-  (let [previous-name (:name account)]
+  (let [previous-name (:name account)
+        public-key (:public-key account)
+        placeholder (gfycat/generate-gfy public-key)]
     [view st/name-input-wrapper
      [text-input
-      {:placeholder    (gfycat/generate-gfy public-key)
+      {:placeholder    placeholder
        :style          (st/name-input-text (s/valid? ::profile.db/name @name-text))
        :font           :medium
        :default-value  (or @name-text previous-name)
        :on-change-text #(reset! name-text %)
        :on-end-editing #(if (s/valid? ::profile.db/name @name-text)
-                          (rf/dispatch [:account-update {:name (utils/clean-text @name-text)}])
+                          (rf/dispatch [:account-update {:name (utils/clean-text (or @name-text placeholder))}])
                           (reset! name-text previous-name))}]]))

 (defview status-input []


level size

level size

--- clojure/src/dnd/level.cljs
+++ clojure/src/dnd/level.cljs
@@ -12,7 +12,7 @@
             :visible true
             })

-(def width  100)
+(def width  40)
 (def height 40)

 (defn make-block [x y]


the base route should return the index.html file

--- src/clj/baconator/server/handler.clj
+++ src/clj/baconator/server/handler.clj
@@ -64,8 +64,8 @@
 ;; Basic ring/compojure code

 (defroutes app-routes
+  (GET "/" [] (resource-response "index.html" {:root "public"}))
   (GET "/checkins" [] checkins)
-  (GET "/venues" [] "Venues")
   (route/resources "/")
   (route/not-found "Not Found"))


Connect metadata values to their categories

--- src/clj/cglossa/data_import/core.clj
+++ src/clj/cglossa/data_import/core.clj
@@ -25,11 +25,15 @@
               (filter #(seq (val %)) (zipmap attr-names row))))  ;ignore empty strings
       {:from-path path})))

-(defn- create-metadata-value-maps [val-id-map categories]
-  (for [category-vals val-id-map
-        [val id] category-vals]
-    {:db/id (d/tempid :db.part/glossa (- -1 id))
-     :metadata-value/text-value val}))
+(defn- create-metadata-value-maps [val-id-maps headers categories]
+  (mapcat (fn [category-vals header]
+            (let [category (first (filter #(= (:metadata-category/short-name %) header)
+                                          categories))]
+              (for [[val id] category-vals]
+                {:db/id                     (d/tempid :db.part/glossa (- -1 id))
+                 :metadata-value/text-value val
+                 :metadata-category/_values (:db/id category)})))
+          val-id-maps headers))

 (defn import-corpora []
   (tsv->tx-data (str data-path "/corpora.tsv") :corpus))
@@ -43,9 +47,11 @@

 (defn import-metadata-values [corpus-short-name db]
   (let [path (str data-path "/metadata_values/" corpus-short-name ".tsv")]
-    (let [categories (d/pull db
-                             '[{:metadata-categories [:db/id :metadata-category/short-name]}]
-                             [:corpus/short-name corpus-short-name])
+    (let [categories (:corpus/metadata-categories
+                      (d/pull db
+                              '[{:corpus/metadata-categories
+                                 [:db/id :metadata-category/short-name]}]
+                              [:corpus/short-name corpus-short-name]))
           rows (tsv->rows path)
           headers (first rows)
           data (rest rows)
@@ -53,13 +59,13 @@
           unique-vals (map set cols)
           tids (first unique-vals)
           nrows (count tids)
-          val-id-map (map-indexed (fn [index cat-vals]
-                                    (let [first-id (* index nrows)]
-                                      (into {}
-                                            (map (fn [tid id] [tid id])
-                                                 cat-vals
-                                                 (map #(+ % first-id) (range nrows))))))
-                                  unique-vals)]
+          val-id-maps (map-indexed (fn [index cat-vals]
+                                     (let [first-id (* index nrows)]
+                                       (into {}
+                                             (map (fn [val id] [val id])
+                                                  cat-vals
+                                                  (map #(+ % first-id) (range nrows))))))
+                                   unique-vals)]
       (when-not (= (first headers) "tid")
         (throw (Exception. (str "The first column should be tid, not " (first headers) "!"))))
       (for [row data
@@ -68,4 +74,4 @@
                {:db/id (d/tempid :db.part/glossa)
                 :metadata_value value})
              headers fields))
-      (create-metadata-value-maps val-id-map categories))))
+      (create-metadata-value-maps val-id-maps headers categories))))


fix old merge conflict

fix old merge conflict

--- src/cljs/phonecat_re_frame/core.cljs
+++ src/cljs/phonecat_re_frame/core.cljs
@@ -69,13 +69,24 @@
   (fn []
     [:input {:on-change #(re-frame/dispatch [:search-input-entered (-> % .-target .-value)])}]))

+(defn phones-component
+  []
+  (let [phones (re-frame/subscribe [:phones])]
+    (fn []
+      [:ul (doall  (map (fn [phone] ^{:key phone} [phone-component (:name phone) (:snippet phone)]) @phones))])))
+
 (defn home-page []
+  [phones-component])
   [:div {:class "container-fluid"}
    [:div {:class "row"}
     [:div {:class "col-md-2"}
      [search-component]]]
-   [:div {:class "col-md-10"}
-    [phones-component]]])
+   [:div {:class "row"}
+    [:div {:class "col-md-6"}
+     [order-by-component]]]
+   [:div {:class "row"}
+    [:div {:class "col-md-10"}
+     [phones-component]]]])

 (defn current-page []
   [:div [(session/get :current-page)]])


remove dead code reference

remove dead code reference

--- src/babel/italiano/lexicon.cljc
+++ src/babel/italiano/lexicon.cljc
@@ -9,7 +9,7 @@

    #?(:clj [clojure.tools.logging :as log])
    #?(:cljs [babel.logjs :as log])
-   [babel.italiano.morphology :refer [agreement essere-default exception-generator
+   [babel.italiano.morphology :refer [agreement exception-generator
                                       phonize2]]

    [clojure.edn :as edn]


+studente

+studente

--- src/babel/italiano/lexicon.cljc
+++ src/babel/italiano/lexicon.cljc
@@ -1938,6 +1938,10 @@
    "studiare"  {:synsem {:cat :verb
                       :sem {:pred :study}}}

+   "studente"  {:synsem {:agr {:gender :masc}
+                         :cat :noun
+                         :sem {:pred :student}}}
+
    "suonare"  {:synsem {:cat :verb
                       :sem {:subj {:human true}
                             :pred :suonare}}}


Style "archived" threads with grey bar on top

--- src/braid/ui/styles/thread.cljs
+++ src/braid/ui/styles/thread.cljs
@@ -19,9 +19,32 @@

    [:&.new
     {:z-index 99}]
+
    [:&:before ; switch to :after to align at top
     {:content "\"\""
      :flex-grow 1}]
+
+   [:&.archived :&.limbo :&.private
+    [:.head:before
+     {:content "\"\""
+      :display "block"
+      :width "100%"
+      :height (px 5)
+      :position "absolute"
+      :top 0
+      :left 0}]
+
+      [:&.private
+       [:.head:before
+        {:background "#5f7997"}]]
+
+      [:&.limbo
+       [:.head:before
+        {:background "#CA1414"}]]
+
+      [:&.archived
+       [:.head:before
+        {:background "#AAAAAA"}]]]

    [:.card
     mixins/flex
@@ -50,21 +73,9 @@
     [:.card
      {; needs to be a better way
       ; which is based on the height of the notice
-      :max-height "85%"}]
-
-    [:.head:before
-     {:content "\"\""
-      :display "block"
-      :width "100%"
-      :height (px 5)
-      :position "absolute"
-      :top 0
-      :left 0}]]
+      :max-height "85%"}]]

    [:&.private
-    [:.head:before
-     {:background "#5f7997"}]
-
     [:.notice
      {:background "#D2E7FF"
       :color "#5f7997"}
@@ -73,9 +84,6 @@
       (mixins/fontawesome \uf21b)]]]

    [:&.limbo
-    [:.head:before
-     {:background "#CA1414"}]
-
     [:.notice
      {:background "#ffe4e4"
       :color "#CA1414"}


removed extra namespace declarations from static.

--- src/clj/forma/source/static.clj
+++ src/clj/forma/source/static.clj
@@ -1,18 +1,12 @@
 (ns forma.source.static
   (:use cascalog.api
-        [forma.matrix.utils :only (idx->colrow)]
-        [forma.hadoop.io :only (chunk-tap)]
+        [forma.hadoop.io :only (chunk-tap)]
+        [forma.reproject :only (modis-sample)]
+        [clojure.string :only (split)]
         [forma.hadoop.predicate :only (sparse-windower
-                                       pixel-generator)]
-        [forma.reproject :only (wgs84-index
-                                dimensions-at-res
-                                modis-sample)]
-        [forma.source.modis :only (modis->latlon
-                                   latlon->modis
-                                   pixels-at-res
-                                   hv->tilestring)]
-        [clojure.string :only (split)])
+                                       pixel-generator)])
   (:require [cascalog.ops :as c]
+            [forma.source.modis :as m]
             [cascalog.io :as io]
             [clojure.contrib.duck-streams :as duck])
   (:gen-class))
@@ -150,7 +144,7 @@
   into modis characteristics at resolution `m-res`."
   [m-res ascii-info row col]
   (->> (rowcol->latlon ascii-info row col)
-       (apply latlon->modis m-res)))
+       (apply m/latlon->modis m-res)))

 (defn high-res-sample
   "This query is for a point grid at higher resolution than the reference
@@ -201,7 +195,7 @@
   [src]
   (<- [?dataset ?m-res ?t-res ?tilestring ?sample ?line ?val]
       (src ?dataset ?m-res ?t-res ?mod-h ?mod-v ?sample ?line ?val)
-      (hv->tilestring ?mod-h ?mod-v :> ?tilestring)))
+      (m/hv->tilestring ?mod-h ?mod-v :> ?tilestring)))

 (defn static-chunker
   "Last thing we need is the chunk-tap!"


Implement Heartbeat

Implement Heartbeat

--- src/clj/game/cards-hardware.clj
+++ src/clj/game/cards-hardware.clj
@@ -158,6 +158,18 @@
    {:effect (effect (gain :memory 2)) :leave-play (effect (lose :memory 2))
     :events {:runner-install {:req (req (has? target :subtype "Virus"))
                               :effect (effect (add-prop target :counter 1))}}}
+
+   "Heartbeat"
+   {:effect (effect (gain :memory 1)) :leave-play (effect (lose :memory 1))
+    :prevent {:damage [:meat :net :brain]}
+    :abilities [{:msg "prevent 1 damage"
+                 :choices {:req #(and (= (:side %) "Runner") (:installed %))}
+                 :priority true
+                 :effect (effect (trash target {:cause :ability-cost})
+                                 (damage-prevent :brain 1)
+                                 (damage-prevent :meat 1)
+                                 (damage-prevent :net 1))}]}
+
    "HQ Interface"
    {:effect (effect (gain :hq-access 1)) :leave-play (effect (lose :hq-access 1))}


Added missing route for badge deletion

Added missing route for badge deletion

--- src/clj/salava/badge/routes.clj
+++ src/clj/salava/badge/routes.clj
@@ -115,4 +115,9 @@
                    :auth-rules access/authenticated
                    (ok (b/save-badge-settings! context badgeid visibility evidence-url rating tags)))

-            ))
+            (DELETE* "/:badgeid" []
+                     :path-params [badgeid :- Long]
+                     :summary "Delete badge"
+                     :components [context]
+                     :auth-rules access/authenticated
+                     (ok (str (b/delete-badge! context badgeid))))))


Change to Foundation buttons instead of form buttons

--- src/cljs/comic_reader/main.cljs
+++ src/cljs/comic_reader/main.cljs
@@ -27,15 +27,16 @@
         :as data}]
     ^{:key id}
     [:li
-     [:input {:type "button"
-              :value name
-              :on-click (partial on-click data)}]]))
+     [:a.large.button
+      {:on-click (partial on-click data)}
+      name]]))

 (defn site-list []
   (let [site-list (rf/subscribe [:site-list])]
     (fn []
       (when-let [site-list @site-list]
         [:div
+         [:h1 "Manga Sites"]
          [:ul (map (id-btn-for-callback
                     #(r/go-to (r/comics-path
                                {:site (name (:id %))})))


Add item id to firebase channel helper function

--- src/cljs/hacker_agent/core.cljs
+++ src/cljs/hacker_agent/core.cljs
@@ -35,6 +35,9 @@
                      (keyword (.key snapshot))
                      (js->clj (.val snapshot))])))
      c)))
+
+(defn- id->fb-chan [id]
+  (fb->chan (id->fbref id)))

 (defn- fb->atom [fbref]
   (let [c (fb->chan fbref)


Show task text

Show task text

--- src/cljs/learn_specter/app.cljs
+++ src/cljs/learn_specter/app.cljs
@@ -42,19 +42,20 @@
 (defn excercise-interaction
   []
   (let [current-task (subscribe [:current-task])]
-    ;; TODO: subscribe to excercise state
     (fn [tasks]
-      [:div
-       [:div.space-before.space-after
-        [:ul.nav.nav-tabs
-         (doall
-           (map-indexed
+      (let [task (get tasks (:active-task @current-task))]
+        [:div
+         [:div.space-before.space-after
+          [:ul.nav.nav-tabs
+           (doall
+            (map-indexed
              (fn [i _]
                [(if (= i (:active-task @current-task)) :li.active :li) {:key i}
                 [:a {:href "#" :on-click #(dispatch [:task-switched i])} (inc i)]])
              tasks))]]
-       [editor]
-       [eval-button]])))
+         [:div.space-before.space-after (:text task)]
+        [editor]
+        [eval-button]]))))

 (defn excercises
   [excercises]


More prominent cookie acceptance button

More prominent cookie acceptance button

--- src/clojure/staircase/views.clj
+++ src/clojure/staircase/views.clj
@@ -109,12 +109,13 @@
    [:div.panel.panel-info
     [:div.panel-heading "Cookies"]
     [:div.panel-body
-     [:button.btn.pull-right {:ng-click "showCookieMessage = false"} "Do not show again"]
+     [:button.btn.btn-warning.pull-right {:ng-click "showCookieMessage = false"} "understood"]
      [:p
       "This site uses cookies to provide essential functionality, such as remembering your
       identity. You can find out details of what information we store here "
       (link-to "/cookies" "here")
-      "."]
+      ". By dismissing this message you agree to let this application store the data it needs
+      to operate."]
      ]]])

 (defn common


forgot to switch all caching to transit

forgot to switch all caching to transit


Add fn to return pluralized versions of word if needed


Make kibit happy.

Make kibit happy.


Include job-name in fetched metrics tag.

--- src/onyx/metrics_endpoint.clj
+++ src/onyx/metrics_endpoint.clj
@@ -3,7 +3,8 @@
             [clojure.java.jmx :as jmx]))

 (def extractions
-  {:job-id #"(?:[.]|=)job[.]([^_]+)"
+  {:job-id #"(?:[.]|=)job-id[.]([^_]+)"
+   :job-name #"(?:[.]|=)job-name[.]([^_]+)"
    :task #"(?:[.]|=)task[.]([^_]+)"
    :slot-id #"(?:[.]|=)slot-id[.]([^_]+)"
    :peer-id #"(?:[.]|=)peer-id[.]([^_]+)"})
@@ -31,7 +32,7 @@
     (cond (nil? p)
           {:tags tags :metric metric}

-          (#{"task" "job" "peer-id" "slot-id"} p)
+          (#{"task" "job-id" "job-name" "peer-id" "slot-id"} p)
           (recur (rest ps)
                  (conj tags p (first ps))
                  metric)


Fix case where coordinator thread failed out, and messenger was not stopped.

--- src/onyx/peer/coordinator.clj
+++ src/onyx/peer/coordinator.clj
@@ -185,8 +185,10 @@
         true
         (assoc :messenger messenger)))))

-(defn shutdown [{:keys [messenger] :as state}]
-  (assoc state :messenger (component/stop messenger)))
+(defn shutdown [{:keys [messenger peer-id] :as state}]
+  (let [st (assoc state :messenger (component/stop messenger))]
+    (info "Stopped coordinator piggybacked on:" peer-id)
+    st))

 (defn initialise-state [{:keys [log messenger job-id tenancy-id curr-replica] :as state}]
   (let [write-version (assume-checkpoint-coordinate log tenancy-id job-id)
@@ -305,26 +307,27 @@
 (defn start-coordinator!
   [{:keys [allocation-ch shutdown-ch peer-config job-config] :as state}]
   (thread
-    (try
-     (let [coordinator-max-sleep-ns (ms->ns (arg-or-default :onyx.peer/coordinator-max-sleep-ms peer-config))
-           barrier-period-ns (barrier-period job-config peer-config)
-           heartbeat-ns (ms->ns (arg-or-default :onyx.peer/heartbeat-ms peer-config))
-           result (loop [state (initialise-state state)]
-                    (if-let [scheduler-event (poll! shutdown-ch)]
-                      (do (shutdown (assoc state :scheduler-event scheduler-event))
-                          :shutdown)
-                      (if-let [new-replica (poll! allocation-ch)]
-                        ;; Set up reallocation barriers. Will be sent on next recur through :offer-barriers
-                        (recur (next-replica state barrier-period-ns new-replica))
-                        (recur (coordinator-iteration state
-                                                      coordinator-max-sleep-ns
-                                                      barrier-period-ns
-                                                      heartbeat-ns)))))]
-       (when-not (= result :shutdown)
-         (throw (Exception. "Coordinator not properly shutdown"))))
-      (catch Throwable e
-        (>!! (:group-ch state) [:restart-vpeer (:peer-id state)])
-        (fatal e "Error in coordinator")))))
+   (try
+    (let [coordinator-max-sleep-ns (ms->ns (arg-or-default :onyx.peer/coordinator-max-sleep-ms peer-config))
+          barrier-period-ns (barrier-period job-config peer-config)
+          heartbeat-ns (ms->ns (arg-or-default :onyx.peer/heartbeat-ms peer-config))
+          result (loop [state (initialise-state state)]
+                   (if-let [scheduler-event (poll! shutdown-ch)]
+                     (do (shutdown (assoc state :scheduler-event scheduler-event))
+                         :shutdown)
+                     (if-let [new-replica (poll! allocation-ch)]
+                       ;; Set up reallocation barriers. Will be sent on next recur through :offer-barriers
+                       (recur (next-replica state barrier-period-ns new-replica))
+                       (recur (coordinator-iteration state
+                                                     coordinator-max-sleep-ns
+                                                     barrier-period-ns
+                                                     heartbeat-ns)))))]
+      (when-not (= result :shutdown)
+        (throw (ex-info "Coordinator not properly shutdown." {}))))
+    (catch Throwable e
+      (shutdown (assoc state :scheduler-event :coordinator-exception))
+      (>!! (:group-ch state) [:restart-vpeer (:peer-id state)])
+      (fatal e "Error in coordinator on peer" (:peer-id state))))))

 (defprotocol Coordinator
   (start [this])
@@ -354,7 +357,7 @@
             messenger group-ch allocation-ch shutdown-ch coordinator-thread]
   Coordinator
   (start [this]
-    (info "Piggybacking coordinator on peer:" peer-id)
+    (info (format "Starting coordinator for job-id: %s, piggybacking on peer: %s." job-id peer-id))
     (let [initial-replica (onyx.log.replica/starting-replica peer-config)
           messenger (-> (m/build-messenger peer-config messenger-group monitoring [:coordinator peer-id] {})
                         (start-messenger initial-replica job-id))


Changed layouts now get scaled

Changed layouts now get scaled

and thus fit more nicely on the screen.

Signed-off-by: Daniel Borchmann <25857343a15bf1edafebc2912e82ecf775c585c1@mailbox.tu-dresden.de>

--- src/conexp/contrib/draw/lattices.clj
+++ src/conexp/contrib/draw/lattices.clj
@@ -20,6 +20,8 @@
         [conexp.layouts
          :only (*standard-layout-function*,
                 inf-additive-layout)]
+        [conexp.layouts.util
+         :only (scale-layout)]
         [conexp.layouts.base
          :only (lattice,
                 annotation)]
@@ -126,7 +128,9 @@
                      layout-fn (get layouts selected)]
                  (update-layout-of-scene
                   scn
-                  (layout-fn (lattice (get-layout-from-scene scn)))))))
+                  (scale-layout [0.0 0.0]
+                                [100.0 100.0]
+                                (layout-fn (lattice (get-layout-from-scene scn))))))))

   ;; move mode
   (let [move-modes {"single" (single-move-mode),


Test the Kleene star separately.

Test the Kleene star separately.

--- test/kolmogorov_music/test/kolmogorov.clj
+++ test/kolmogorov_music/test/kolmogorov.clj
@@ -58,13 +58,17 @@
     (conj s e)))

 (defn kleene* [elements]
-  (->> (kleene* elements)
+  (->> (lazy-seq (kleene* elements))
        (extend-with elements)
-       lazy-seq
        (cons [])))

 (defn subsequence [start end s]
   (->> s (drop start) (take (- end start))))
+
+(fact "The Kleene star describes all possible sequences of a set of elements."
+  (->> #{} kleene* (subsequence 0 1)) => [[]]
+  (->> #{true} kleene* (subsequence 0 5)) => [[] [true] [true true] [true true true] [true true true true]]
+  (->> #{true false} kleene* (subsequence 0 5)) => [[] [true] [false] [true true] [true false]])

 (defn lexicon []
   (->> ascii


(PDB-3114) Move test redef up to replace-catalog!

Redef replace-catalog! instead of replace-existing-catalog in the
concurrent catalog tests, since replace-catalog! is still be within the
broader transaction, and doing so avoids the possibility that
replace-catalog! might not invoke replace-existing-catalog.

--- test/puppetlabs/puppetdb/command_test.clj
+++ test/puppetlabs/puppetdb/command_test.clj
@@ -1206,7 +1206,7 @@
                      :payload wire-catalog}

             latch (java.util.concurrent.CountDownLatch. 2)
-            orig-replace-existing-catalog scf-store/replace-existing-catalog]
+            orig-replace-catalog! scf-store/replace-catalog!]

         (jdbc/with-db-transaction []
           (scf-store/add-certname! certname)
@@ -1214,10 +1214,10 @@

         (with-redefs [quick-retry-count 0
                       command-delay-ms 1
-                      scf-store/replace-existing-catalog
+                      scf-store/replace-catalog!
                       (fn [& args]
                         (.countDown latch)
-                        (apply orig-replace-existing-catalog args))]
+                        (apply orig-replace-catalog! args))]
           (let [first-message? (atom false)
                 second-message? (atom false)
                 fut (future
@@ -1257,7 +1257,7 @@
                      :payload wire-catalog}

             latch (java.util.concurrent.CountDownLatch. 2)
-            orig-replace-existing-catalog scf-store/replace-existing-catalog]
+            orig-replace-catalog! scf-store/replace-catalog!]

         (jdbc/with-db-transaction []
           (scf-store/add-certname! certname)
@@ -1265,10 +1265,10 @@

         (with-redefs [quick-retry-count 0
                       command-delay-ms 1
-                      scf-store/replace-existing-catalog
+                      scf-store/replace-catalog!
                       (fn [& args]
                         (.countDown latch)
-                        (apply orig-replace-existing-catalog args))]
+                        (apply orig-replace-catalog! args))]
           (let [first-message? (atom false)
                 fut (future
                       (handle-message (store-command' q command))


fix tests

fix tests

--- test/reader_clojure_web_app/core_test.clj
+++ test/reader_clojure_web_app/core_test.clj
@@ -1,7 +1,7 @@
 (ns reader-clojure-web-app.core-test
   (:require [clojure.test :refer :all]
-            [reader-clojure-web-app.core :refer :all]))
+            [reader-web-app.core :refer :all]))

 (deftest a-test
-  (testing "FIXME, I fail."
-    (is (= 0 1))))
+  (testing "Basic env."
+    (is (= 1 1))))


Fix minor formatting issues

Fix minor formatting issues

--- clojure/cljsearch/src/cljsearch/searcher.clj
+++ clojure/cljsearch/src/cljsearch/searcher.clj
@@ -76,8 +76,8 @@
   (let [lines (get-matching-lines settings)]
     (log-msg
       (if (:uniquelines settings)
-        (format"\nUnique lines with matches (%d):" (count lines))
-        (format"\nLines with matches (%d):" (count lines))))
+        (format "\nUnique lines with matches (%d):" (count lines))
+        (format "\nLines with matches (%d):" (count lines))))
     (doseq [l lines] (log-msg l))))

 (defn validate-settings [settings]


CMR-2579 Made the data results handler more clean.

--- access-control-app/src/cmr/access_control/data/group_json_results_handler.clj
+++ access-control-app/src/cmr/access_control/data/group_json_results_handler.clj
@@ -19,5 +19,5 @@
 (defmethod qs/search-results->response [:access-group :json]
   [context query results]
   (let [results (select-keys results [:hits :took :items])
-        converted-items (map util/map-keys->snake_case (:items results))]
-  (json/generate-string (assoc results :items converted-items))))
+        converted-items (util/map-keys->snake_case results)]
+  (json/generate-string converted-items)))


lower default iothreads

lower default iothreads

--- kafka-clj/src/kafka_clj/client.clj
+++ kafka-clj/src/kafka_clj/client.clj
@@ -378,7 +378,7 @@
   (:metadata-error-ch connector))

-(defn create-connector [bootstrap-brokers {:keys [acks batch-fail-message-over-limit batch-byte-limit blacklisted-expire producer-retry-strategy topic-auto-create io-threads] :or {blacklisted-expire 1000 acks 0 batch-fail-message-over-limit true batch-byte-limit 10485760 producer-retry-strategy :default topic-auto-create true :io-threads 8} :as conf}]
+(defn create-connector [bootstrap-brokers {:keys [acks batch-fail-message-over-limit batch-byte-limit blacklisted-expire producer-retry-strategy topic-auto-create io-threads] :or {blacklisted-expire 1000 acks 0 batch-fail-message-over-limit true batch-byte-limit 10485760 producer-retry-strategy :default topic-auto-create true :io-threads 3} :as conf}]
   (let [
         ;all connector channels will use this shared pool for listening on write read events. 3 threads was tested with over 120 k messages per second
         async-ctx (fthreads/shared-threads (if (number? io-threads) (inc io-threads) 4))


Getting rid of carmine related error

Getting rid of carmine related error

--- jvm-runner/project.clj
+++ jvm-runner/project.clj
@@ -8,7 +8,7 @@
                  [com.h2database/h2 "1.3.170"] ; In Memory Database
                  [org.xerial/sqlite-jdbc "3.7.15-M1"] ; SQLite
                  [com.novemberain/monger "2.0.0"] ; Monger
-                 [com.taoensso/carmine "2.7.0"] ; Carmine
+                 [com.taoensso/carmine "2.7.0" :exclusions [org.clojure/clojure]] ; Carmine
                  [org.clojure/core.async "0.1.346.0-17112a-alpha"] ; Go-Routines
                  [org.clojure/test.check "0.5.9"] ; Generative Testing
                  [prismatic/schema "0.2.6"] ; Schema Verification


upgrading sidecar dependencies

upgrading sidecar dependencies

--- sidecar/project.clj
+++ sidecar/project.clj
@@ -13,9 +13,9 @@
    [org.clojure/core.async "0.1.346.0-17112a-alpha"]
    [com.cemerick/pomegranate "0.3.0"]
    [http-kit "2.1.16"]
-   [ring-cors "0.1.4"]
-   [compojure "1.1.7"]
-   [clj-stacktrace "0.2.7"]
+   [ring-cors "0.1.7"]
+   [compojure "1.3.3"]
+   [clj-stacktrace "0.2.8"]
    [cljsbuild "1.0.5"]

    [com.cemerick/piggieback "0.1.5"]
@@ -23,4 +23,4 @@

    [clojurescript-build "0.1.5"]
    [watchtower "0.1.1"]
-   [digest "1.4.3"]])
+   [digest "1.4.4"]])


Terminate stack traces at any "speclj" namespace

--- dev-resources/user.clj
+++ dev-resources/user.clj
@@ -1,17 +1,23 @@
 (ns user
-  (:use
-    speclj.config
-    io.aviso.tracker
-    io.aviso.repl
-    clojure.pprint
-    [io.aviso.twixt :only [get-asset-uris default-options]]
-    io.aviso.twixt.startup
-    ring.adapter.jetty)
-  (:require
-    ;; See https://github.com/slagyr/speclj/issues/79
-    speclj.run.standard))
+  (:use speclj.config
+        io.aviso.tracker
+        io.aviso.repl
+        clojure.pprint
+        [io.aviso.twixt :only [get-asset-uris default-options]]
+        io.aviso.exception
+        io.aviso.twixt.startup
+        ring.adapter.jetty)
+  ;; See https://github.com/slagyr/speclj/issues/79
+  (:require speclj.run.standard))

 (install-pretty-exceptions)
+
+(alter-var-root #'*default-frame-filter*
+                (fn [default-frame-filter]
+                  (fn [frame]
+                    (if (= (:package frame) "speclj")
+                      :terminate
+                      (default-frame-filter frame)))))

 (alter-var-root #'default-config assoc :color true :reporters ["documentation"])


Возврат к сортировке по id

Возврат к сортировке по id

--- src/ixinfestor/core_handler.clj
+++ src/ixinfestor/core_handler.clj
@@ -89,9 +89,10 @@
              (as-> query
                  (let [fts-query (clojure.string/trim fts-query)]
                    (if (empty? fts-query)
-                     (korma.core/order query :id :desc)
+                     query
                      (ix/files-pred-search* query fts-query))))

+             (korma.core/order :id :desc)
              ix/com-exec
              ring.util.response/response))

@@ -157,9 +158,10 @@
                         (as-> query
                             (let [fts-query (clojure.string/trim fts-query)]
                               (if (empty? fts-query)
-                                (korma.core/order query :id :desc)
+                                query
                                 (ix/webdoc-pred-search* query fts-query))))

+                        (korma.core/order :id :desc)
                         ix/com-exec
                         ((partial map #(dissoc % :password)))))))

@@ -249,9 +251,10 @@
                       (as-> query
                           (let [fts-query (clojure.string/trim fts-query)]
                             (if (empty? fts-query)
-                              (korma.core/order query :id :desc)
+                              query
                               (ix/webdoc-pred-search* query fts-query))))

+                      (korma.core/order :id :desc)
                       ix/com-exec
                       ((partial map #(dissoc % :password)))
                       ring.util.response/response))
@@ -347,14 +350,15 @@
                         (ix/webdoc-pred-search-for-the-child-tree-tags*
                          {:id (if (= tag-id "root") nil tag-id)})

+                        (ix/com-pred-page* (dec page) page-size)
+
                         (as-> query
                             (let [fts-query (clojure.string/trim fts-query)]
                               (if (empty? fts-query)
-                                (korma.core/order query :id :desc)
+                                query
                                 (ix/webdoc-pred-search* query fts-query))))

-
-                        (ix/com-pred-page* (dec page) page-size)
+                        (korma.core/order :id :desc)
                         ix/com-exec
                         korma.db/transaction
                         ring.util.response/response


fix broken editing

fix broken editing

--- cljs/src/main/plastic/cogs/editor/model.cljs
+++ cljs/src/main/plastic/cogs/editor/model.cljs
@@ -121,7 +121,8 @@
     (= (:tag item) :token)))                                ; we have also :tree node in selectables

 (defn can-edit-focused-selection? [editor]
-  (every? (partial can-edit-node? editor (get-focused-render-info editor)) (get-focused-selection editor)))
+  (if-let [render-info (get-focused-render-info editor)]
+    (every? (partial can-edit-node? editor render-info) (get-focused-selection editor))))

 (defn get-top-level-form-ids [editor]
   (let [render-infos (get-render-infos editor)]


Fixes to search-lines in clojure

Fixes to search-lines in clojure

--- clojure/cljsearch/src/cljsearch/searcher.clj
+++ clojure/cljsearch/src/cljsearch/searcher.clj
@@ -14,8 +14,7 @@
   (:use [cljsearch.common])
   (:use [cljsearch.filetypes])
   (:use [cljsearch.fileutil])
-  (:use [cljsearch.searchresult])
-)
+  (:use [cljsearch.searchresult]))

 ; ref to contain the seq of SearchResult records
 (def search-results (ref []))
@@ -239,18 +238,6 @@
                        line
                        linesbefore
                        linesafter)]
-          ;(log-msg (format "startmatchindex: %d" startmatchindex))
-          ;(log-msg (format "endmatchindex: %d" endmatchindex))
-          ;(log-msg (format "startlineindices (%d): (%s)" (count startlineindices) (str/join "," startlineindices)))
-          ;(log-msg (format "endlineindices (%d): (%s)" (count endlineindices) (str/join "," endlineindices)))
-          ;(log-msg (format "beforestartindices (%d): (%s)" (count beforestartindices) (str/join "," beforestartindices)))
-          ;(log-msg (format "beforeendindices (%d): (%s)" (count beforeendindices) (str/join "," beforeendindices)))
-          ;(log-msg (format "afterstartindices (%d): (%s)" (count afterstartindices) (str/join "," afterstartindices)))
-          ;(log-msg (format "afterendindices (%d): (%s)" (count afterendindices) (str/join "," afterendindices)))
-          ;(log-msg (format "startlineindex: %d" startlineindex))
-          ;(log-msg (format "endlineindex: %d" endlineindex))
-          ;(log-msg (format "line: \"%s\"" line))
-          ;(log-msg (format "linenum: %d" linenum))
           (if (:firstmatch settings)
             [result]
             (concat [result] (search-multiline-string-for-pattern s m
@@ -312,11 +299,8 @@
                        line
                        linesbefore
                        linesafter)]
-          ;(log-msg result)
-          (if (:firstmatch settings)
-            [result]
-            (search-line-for-pattern linenum line linesbefore linesafter m
-              endmatchindex (concat results [result]) settings))))
+          (search-line-for-pattern linenum line linesbefore linesafter m
+            endmatchindex (concat results [result]) settings)))
       results)))

 (defn search-line [linenum line linesbefore linesafter settings]
@@ -326,15 +310,11 @@

 (defn search-lines
   ([lines settings]
-    ; (if (:debug settings)
-    ;   (log-msg "Searching lines"))
     (let [line (first lines)
-          nextlines (drop (:linesafter settings) lines)
+          nextlines (drop (:linesafter settings) (rest lines))
           linesbefore []
-          linesafter (take (:linesafter settings) lines)]
-      (search-lines 1 line nextlines linesbefore linesafter [] settings)
-    )
-  )
+          linesafter (take (:linesafter settings) (rest lines))]
+      (search-lines 1 line nextlines linesbefore linesafter [] settings)))
   ([linenum line lines linesbefore linesafter results settings]
     (if line
       (let [nextresults (search-line linenum line linesbefore linesafter settings)
@@ -349,19 +329,15 @@
             nextlinesafter
               (if (> (:linesafter settings) 0)
                 (concat (rest linesafter) (take 1 lines))
-                [])
-            ]
-          ; (if (not (empty? nextresults))
-          ;   (do
-          ;     (log-msg "nextresults:")
-          ;     (log-msg nextresults)))
+                [])]
           (search-lines nextlinenum nextline (rest lines) nextlinesbefore
-            nextlinesafter (concat results nextresults) settings)
-      )
-      results
-    )
-  )
-)
+            nextlinesafter (concat results nextresults) settings))
+      (if
+        (and
+          (> (count results) 0)
+          (:firstmatch settings))
+        (take 1 results)
+        results))))

 (defn search-text-file-lines [f settings]
   (with-open [rdr (reader f)]
@@ -409,10 +385,5 @@
     (if (empty? errs)
       (do
         (search-dirs (get-search-dirs settings) settings)
-        []
-      )
-      errs
-    )
-  )
-)
-
+        [])
+      errs)))


combineTiles.clj: implemented function (glue-faces)

--- clojure/org/gavrog/clojure/combineTiles.clj
+++ clojure/org/gavrog/clojure/combineTiles.clj
@@ -2,6 +2,7 @@
   (:use (clojure
           [set :only [difference]])
         (org.gavrog.clojure
+          [util :only [empty-queue]]
           [generators :only [make-backtracker results]]
           delaney
           partition)))
@@ -26,15 +27,23 @@
                  E block]
              [E inv])))

-(defn- glue-faces [ds i D E] ;; TODO implement this
-  )
+(defn- glue-faces [ds i D E]
+  (loop [ds ds, q (conj empty-queue [D E])]
+    (if (empty? q)
+      ds
+      (let [[D E] (first q)]
+        (if (s ds i D)
+          (recur ds (rest q))
+          (recur (glue ds i D E)
+                 (into (rest q) (for [j (range (dec i))]
+                                  [(s ds j D) (s ds j E)]))))))))

 (defn- children [d forms [symbol sig free-elements free-components]]
   (when-let [D (first (free-elements))]
     (let [face-idcs (range (dec d))
           face (fn [D] (orbit-elements symbol face-idcs D))
           adding (for [E free-elements :when (= (sig D) (sig E))]
-                   [(glue-faces ds d D E)
+                   [(glue-faces symbol d D E)
                     signatures
                     (difference free-elements (face D) (face E))
                     free-components])


switch out placeholder images on homepage

--- src-cljs/frontend/components/landing.cljs
+++ src-cljs/frontend/components/landing.cljs
@@ -42,19 +42,19 @@
         [:div.art-heading "Today"]
         [:div.art-doc
          [:div.art-doc-frame
-          [:img.art-doc-img {:src "https://prcrsr.com/document/17592196129062.svg"}]]]
+          [:img.art-doc-img {:src "https://precursorapp.com/document/17592196582600.svg"}]]]
         [:div.art-doc.selected
          [:div.art-doc-frame
-          [:img.art-doc-img {:src "https://prcrsr.com/document/17592196129062.svg"}]]]
+          [:img.art-doc-img {:src "https://precursorapp.com/document/17592196582448.svg"}]]]
         [:div.art-doc
          [:div.art-doc-frame
-          [:img.art-doc-img {:src "https://prcrsr.com/document/17592196129062.svg"}]]]
+          [:img.art-doc-img {:src "https://precursorapp.com/document/17592196581236.svg"}]]]
         [:div.art-doc
          [:div.art-doc-frame
-          [:img.art-doc-img {:src "https://prcrsr.com/document/17592196129062.svg"}]]]]
+          [:img.art-doc-img {:src "https://precursorapp.com/document/17592196129062.svg"}]]]]
        [:div.art-canvas
         [:div.art-doc-frame
-         [:img.art-doc-img {:src "https://prcrsr.com/document/17592196129062.svg"}]]]
+         [:img.art-doc-img {:src "https://precursorapp.com/document/17592196582448.svg"}]]]
        [:div.art-screen-select]]]
      [:div.art-mobile-foot
       [:div.art-mobile-button]]]]))


oops, forgot make class on sign in button

--- src-cljs/frontend/components/overlay.cljs
+++ src-cljs/frontend/components/overlay.cljs
@@ -228,7 +228,8 @@
                [:p.make
                 "It's visible to anyone with the url.
                 Sign in with your Google account to send an invite or give someone your url."]
-               (om/build common/google-login {:source "Public Sharing Menu"}))
+               [:div.make
+                (om/build common/google-login {:source "Public Sharing Menu"})])

              (list
                [:p.make


delays in minutes

delays in minutes

--- src/clj/ceres_analytics/news_measures.clj
+++ src/clj/ceres_analytics/news_measures.clj
@@ -269,7 +269,7 @@
           (fn [[l ls]]
             (if (empty? ls)
               nil
-              (stats/mean (pmap #(/ (t/in-seconds (t/interval (:ts l) (:ts %))) 3600) ls)))))
+              (stats/mean (pmap #(/ (t/in-seconds (t/interval (:ts l) (:ts %))) 60) ls)))))
          (remove nil?)
          statistics)
     :distribution
@@ -279,7 +279,7 @@
           (fn [[l ls]]
             (if (empty? ls)
               nil
-              (statistics (pmap #(/ (t/in-seconds (t/interval (:ts l) (:ts %))) 3600) ls)))))
+              (statistics (pmap #(/ (t/in-seconds (t/interval (:ts l) (:ts %))) 60) ls)))))
          (remove nil?))
     :evolution
     (->> (t/interval t0 tmax)
@@ -293,7 +293,7 @@
                   (fn [[l ls]]
                     (if (empty? ls)
                       nil
-                      (stats/mean (pmap #(/ (t/in-seconds (t/interval (:ts l) (:ts %))) 3600) ls)))))
+                      (stats/mean (pmap #(/ (t/in-seconds (t/interval (:ts l) (:ts %))) 60) ls)))))
                  (remove nil?)
                  statistics))))
     :unrelated))


prog log level

prog log level

--- src/clojure/zensols/cisql/interactive.clj
+++ src/clojure/zensols/cisql/interactive.clj
@@ -44,7 +44,6 @@
     (repl/repl-port-set-option nil "--repl")]
    :app (fn [{:keys [repl config] :as opts} & args]
           (with-exception
-            (lu/change-log-level "info")
             (let [dbspec (create-db-spec opts)]
               (if repl
                 (future (repl/run-server {:port 12345})))


Fix job start.

Fix job start.

--- src/onyx/log/commands/submit_job.clj
+++ src/onyx/log/commands/submit_job.clj
@@ -56,7 +56,9 @@
   [{:keys [args] :as entry} old new diff state]
   (let [scheduler (get-in new [:task-schedulers (:job diff)])]
     (when (and (common/volunteer-via-new-job? old new diff state)
-               (common/reallocate-from-task? scheduler old new (:job diff) state))
+               (if (:job state)
+                 (common/reallocate-from-task? scheduler old new (:job diff) state)
+                 true))
       [{:fn :volunteer-for-task :args {:id (:id state)}}])))

 (defmethod extensions/fire-side-effects! :submit-job