forgot to map operation/prepared over all rules

Signed-off-by: Chris Granger <5654cde260ae99bc4d30054171b8bcd902efd19a@gmail.com>

--- src/aurora/editor/fake.cljs
+++ src/aurora/editor/fake.cljs
@@ -337,7 +337,7 @@

 (defn inject-compiled []
   (let [comped (compile-state)
-        rules (operation/prepared (:rules comped))
+        rules (map operation/prepared (:rules comped))
         tick-rules (stratifier/strata->ruleset (identity rules))
         paused? (:pause @cur-env)]
     (pause cur-env)


lein: add eastwood

lein: add eastwood

--- lein_profiles.clj
+++ lein_profiles.clj
@@ -1,6 +1,7 @@
 {:user {:plugins [
                   [lein-ring "0.8.10"]
                   [lein-ancient "0.5.4"]
+                  [jonase/eastwood "0.1.2"]
                   ]}}
 {:dev {:dependencies
        [[com.cemerick/pomegranate "0.2.0"]]


Fix for clojure 1.7-beta1 object printing

--- src/midje/emission/plugins/util.clj
+++ src/midje/emission/plugins/util.clj
@@ -98,9 +98,11 @@
 (defn function-name
   "Convert a function into a readable name, if possible."
   [function]
-  (let [printed (pr-str function)
-        [_ match] (re-matches #"#<([^/]+/[^ ]+).*" (demunge printed))]
-  match))
+  (->> (.. function getClass getName)
+       demunge
+       ( #(str/split % #"\.|/"))
+       (take-last 2)
+       (str/join "/")))

 (defn record-name [value]
   (.getName (class value)))


store: wrap common operations

store: wrap common operations

--- src/io/cyanite/store.clj
+++ src/io/cyanite/store.clj
@@ -69,3 +69,8 @@
 (defmethod build-store :cassandra-v2
   [options]
   (map->CassandraV2Store {:options (dissoc options :type)}))
+
+(defn query! [store from to paths]
+  (let [raw-series         (fetch! store from to paths)
+        [precision series] (p/normalize raw-series)]
+    (p/data->series series to precision)))


Re-add restart-pred-fn

Re-add restart-pred-fn

--- src/onyx_peers/tasks/bookkeeper.clj
+++ src/onyx_peers/tasks/bookkeeper.clj
@@ -17,6 +17,7 @@
                          :onyx/plugin :onyx.plugin.bookkeeper/read-ledgers
                          :onyx/type :input
                          :onyx/medium :bookkeeper
+                         :onyx/restart-pred-fn :onyx-peers.lifecycles.restart-lifecycle/restart?
                          ;; TODO: Vary pending timeout in different Jepsen tests
                          :onyx/pending-timeout 10000
                          ;; TODO: Vary read max chunk in different tests


wip: introspection test case

wip: introspection test case

--- test/graphql_clj/introspection_test.clj
+++ test/graphql_clj/introspection_test.clj
@@ -87,5 +87,42 @@
 (deftest-valid-introspection query-type-fields
   "# QueryRoot sample description
 type QueryRoot { name: String }"
-  "query {__type(name: \"QueryRoot\") {name fields}}"
-  {:data {"__type" {"name" "QueryRoot", "fields" '({} {} {} {})}}})
+  "query {__type(name: \"QueryRoot\") { name fields{name} }}"
+  {:data
+   {"__type"
+    {"name" "QueryRoot",
+     "fields"
+     [{"name" '__typename}
+      {"name" 'name}
+      {"name" '__schema}
+      {"name" '__type}]}}})
+
+;; ;; FIXME: name has no field of args, should return error
+;; (deftest-valid-introspection query-type-fields-args-invalid
+;;   "# QueryRoot sample description
+;; type QueryRoot { name(id: String): String }"
+;;   "query {__type(name: \"QueryRoot\") { name fields{name {args} } }}"
+;;   {:data
+;;    {"__type"
+;;     {"name" "QueryRoot",
+;;      "fields"
+;;      [{"name" '__typename}
+;;       {"name" 'name}
+;;       {"name" '__schema}
+;;       {"name" '__type}]}}})
+
+(deftest-valid-introspection query-type-fields-args
+  "# QueryRoot sample description
+type QueryRoot {
+  # description for name field
+  name(id: String): String
+}"
+  "query {__type(name: \"QueryRoot\") { name fields{name args{name} type{name}} }}"
+  {:data
+   {"__type"
+    {"name" "QueryRoot",
+     "fields"
+     [{"name" '__typename, "args" nil, "type" {"name" 'String}}
+      {"name" 'name, "args" [{"name" 'id}], "type" {"name" 'String}}
+      {"name" '__schema, "args" nil, "type" {"name" '__Schema}}
+      {"name" '__type, "args" [{"name" 'name}], "type" {"name" '__Type}}]}}})


Pulled in missing date-time function from postprocess branch

--- src/clj/forma/date_time.clj
+++ src/clj/forma/date_time.clj
@@ -267,3 +267,11 @@
            "16" [ordinal 16]
            "8" [ordinal 8]
            "1" [ordinal 1])))
+
+(defn convert-period-res
+  "Convert a period from in-res to corresponding period at out-res.
+
+   By converting a period to a date, we get the first date within a period. Converting date to period, we get the period in which that first date falls, at the new resolution."
+  [res-in res-out period]
+  (->> (period->datetime res-in period)
+       (datetime->period res-out)))


remove :cannot-draw and :drawn-this-turn at end turn

--- src/clj/game/core-turns.clj
+++ src/clj/game/core-turns.clj
@@ -160,5 +160,7 @@
           (when (has-subtype? card "Virus")
             (set-prop state :runner card :added-virus-counter false))))
       (swap! state assoc :end-turn true)
+      (swap! state update-in [side :register] dissoc :cannot-draw)
+      (swap! state update-in [side :register] dissoc :drawn-this-turn)
       (clear-turn-register! state)
       (swap! state dissoc :turn-events))))


cleanup -> authentication + authorization in separate ns

--- src/clj/swarmpit/server.clj
+++ src/clj/swarmpit/server.clj
@@ -5,60 +5,17 @@
             [ring.middleware.defaults :refer [wrap-defaults site-defaults]]
             [ring.middleware.resource :refer [wrap-resource]]
             [ring.middleware.gzip :refer [wrap-gzip]]
-            [buddy.auth.backends.token :refer [jws-backend]]
-            [buddy.auth :refer [authenticated?]]
-            [buddy.auth.accessrules :refer [success error wrap-access-rules]]
-            [buddy.auth.middleware :refer [authentication-request]]
+            [swarmpit.authentication :refer [wrap-authentication]]
+            [swarmpit.authorization :refer [wrap-authorization]]
+            [swarmpit.handler :as handler :refer :all]
             [org.httpkit.server :refer [run-server]]
             [cheshire.core :refer [parse-string]]
             [bidi.ring :refer [make-handler]]
+            [bidi.bidi :refer [match-pair match-route*]]
             [clojure.tools.logging :as log]
-            [clojure.string :refer [starts-with?]]
-            [swarmpit.handler :as handler :refer :all]
             [swarmpit.routes :as routes]
             [swarmpit.install :as install]
-            [swarmpit.agent :as agent]
-            [swarmpit.couchdb.client :as cc]))
-
-(defn authentication-backend
-  [secret]
-  (jws-backend
-    {:secret     secret
-     :token-name "Bearer"
-     :on-error   (fn [_ ex] (throw ex))}))
-
-(defn authenticated-access
-  [request]
-  (if (authenticated? request)
-    true
-    (error {:code    401
-            :message "Authentication failed"})))
-
-(defn any-access
-  [_]
-  true)
-
-(defn admin-access
-  [request]
-  (let [role (get-in (:identity request) [:usr :role])]
-    (if (= "admin" role)
-      true
-      (error {:code    403
-              :message "Unauthorized access"}))))
-
-(def rules [{:pattern #"^/admin/.*"
-             :handler {:and [authenticated-access admin-access]}}
-            {:pattern #"^/login$"
-             :handler any-access}
-            {:pattern #"^/$"
-             :handler any-access}
-            {:pattern #"^/.*"
-             :handler authenticated-access}])
-
-(defn rules-error
-  [_ val]
-  (resp-error (:code val)
-              (:message val)))
+            [swarmpit.agent :as agent]))

 (defn wrap-client-exception
   [handler]
@@ -77,31 +34,24 @@
         {:status 500
          :body   (Throwable->map e)}))))

-(defn wrap-authentication
+(defn wrap-path-params
   [handler]
-  (fn [request]
-    (let [secret (:secret (cc/get-secret))
-          auth-backend (authentication-backend secret)]
-      (try
-        (handler (authentication-request request auth-backend))
-        (catch ExceptionInfo ex
-          (let [error (case (:cause (ex-data ex))
-                        :exp "Token expired"
-                        :signature "Token corrupted"
-                        "Token invalid")]
-            (resp-unauthorized error)))))))
+  (fn [{:keys [uri] :as request}]
+    (let [{:keys [route-params]} (match-route* routes/backend uri request)]
+      (handler
+        (assoc request :path-params route-params)))))

 (def app
   (-> (make-handler routes/backend handler/dispatch)
       (wrap-resource "public")
       (wrap-resource "react")
-      (wrap-access-rules {:rules    rules
-                          :on-error rules-error})
+      wrap-authorization
+      wrap-client-exception
+      wrap-fallback-exception
       wrap-authentication
-      wrap-client-exception
+      wrap-path-params
+      wrap-json-params
       wrap-json-response
-      wrap-json-params
-      wrap-fallback-exception
       (wrap-defaults (assoc-in site-defaults [:security :anti-forgery] false))
       wrap-gzip))


add (if (not (null? ...)) ...) optimization too

--- src/clj/wombat/compiler.clj
+++ src/clj/wombat/compiler.clj
@@ -683,16 +683,27 @@
   (let [false-label (. gen newLabel)
         end-label (. gen newLabel)]
     (cond
-                                        ; optmize common case (if (null? ...) ...)
-     (and (seqable? condition) (= (first condition) 'null?))
+                                        ; optimize common case (if (null? ...) ...)
+     (and (list-like? condition) (= (first condition) 'null?))
      (do
        (when (not= (count condition) 2)
          (throw (IllegalArgumentException. "`null?' takes exactly one argument")))
        (emit env :context/expression gen (second condition))
        (. gen ifNonNull false-label))

+                                        ; optimize common case (if (not (null? ...)) ...)
+     (and (list-like? condition) (= (first condition) 'not)
+          (list-like? (second condition)) (= (first (second condition)) 'null?))
+     (do
+       (when (not= (count condition) 2)
+         (throw (IllegalArgumentException. "`not' takes exactly one argument")))
+       (when (not= (count (second condition)) 2)
+         (throw (IllegalArgumentException. "`null?' takes exactly one argument")))
+       (emit env :context/expression gen (second (second condition)))
+       (. gen ifNull false-label))
+
                                         ; optimize common case (if (not ...) ...)
-     (and (seqable? condition) (= (first condition) 'not))
+     (and (list-like? condition) (= (first condition) 'not))
      (do
        (when (not= (count condition) 2)
          (throw (IllegalArgumentException. "`not' takes exactly one argument")))


add extend type

add extend type

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

--- src/cljs/chip8/ui/core.cljs
+++ src/cljs/chip8/ui/core.cljs
@@ -31,6 +31,12 @@

 ;;(:memory @app-state)

+;; make native arrays sequable
+;; ref: https://groups.google.com/forum/#!topic/clojurescript/bMoFWh7VYGg
+(extend-protocol ISeqable
+  js/Uint8Array
+  (-seq [array] (array-seq array 0)))
+
 ;; # Load rom event
 ;;
 ;; This function define the chip8 cpu action when user
@@ -45,7 +51,7 @@

                      (reset! app-state
                              (cpu/load-rom @app-state
-                                           (array-seq (js/Uint8Array. (.getResponse req)))))
+                                           (js/Uint8Array. (.getResponse req))))

                      ;; log data
                      ;; (.log js/console  ">>>> "  (js/Uint8Array. (.getResponse req)))


extracted two more functions from repo routes

--- src/clojars/routes/repo.clj
+++ src/clojars/routes/repo.clj
@@ -50,6 +50,15 @@
       (.delete sent-file)
       (throw e))))

+(defn pom? [filename]
+  (.endsWith filename ".pom"))
+
+(defn get-pom-info [contents info]
+  (-> contents
+      StringReader.
+      maven/pom-to-map
+      (merge info)))
+
 (defroutes routes
   (PUT ["/:group/:artifact/:file"
         :group #".+" :artifact #"[^/]+" :file #"maven-metadata\.xml[^/]*"]
@@ -77,15 +86,13 @@
                                   artifact version filename)]
                 (ev/validate-deploy groupname artifact version filename)
                 (db/check-and-add-group account groupname)
-                (if (.endsWith filename ".pom")
-                  (let [contents (slurp body)
-                        pom-info (-> contents
-                                     StringReader.
-                                     maven/pom-to-map
-                                     (merge info))]
-                    (db/add-jar account pom-info)
-                    (try-save-to-file file contents))
-                  (try-save-to-file file body))
+                (let [contents (if (pom? filename)
+                                 (let [contents (slurp body)]
+                                   (db/add-jar account (get-pom-info contents info))
+                                   contents)
+                                 body
+                                 )]
+                  (try-save-to-file file contents))
                 ;; Be consistent with scp only recording pom or jar
                 (when (some #(.endsWith filename %) [".pom" ".jar"])
                   (ev/record-deploy {:group-id groupname


Reformatting in context-for-clop

Reformatting in context-for-clop

since I know now it is not easy...

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

--- src/conexp/fca/contexts.clj
+++ src/conexp/fca/contexts.clj
@@ -645,13 +645,12 @@
 ;;;

 (defn context-for-clop
-  "Returns a minimal context describing the closure operator clop on base-set.
-
-  BAD IMPLEMENTATION."
+  "Returns a minimal context describing the closure operator clop on
+  base-set."
   [base-set clop]
-  (let [objects (all-closed-sets base-set clop), ; we actually only need the inf-irr closures
-	attributes base-set
-	incidence contains?]
+  (let [objects    (all-closed-sets base-set clop),
+	attributes base-set,
+	incidence  contains?]
     (reduce-context-objects (make-context objects attributes incidence))))

 ;;;


Attempted to build in support for auto-rated cgens but figured out that it is crazy hard with the current cgen infrastructure. However, these changes might be useful.

--- src/overtone/sc/machinery/defcgen.clj
+++ src/overtone/sc/machinery/defcgen.clj
@@ -106,7 +106,7 @@
        (:full-doc (with-full-doc spec)))))

 (defn mk-cgen
-  "Generate the form represign a cgen - a callable map of associated information
+  "Generate the form representing a cgen - a callable map of associated information
   and the function that evaluates the body within the binding context of the
   params."
   ([c-name summary doc params body categories rate] (mk-cgen c-name summary doc params body categories rate #{rate}))
@@ -139,6 +139,12 @@
   (let [c-name (symbol (name c-name))]
     (mk-cgen c-name summary doc params body categories rate)))

+(defn- mk-default-cgen
+  [rated-defs rate]
+  (if (= :auto rate)
+    (throw (Exception. "Auto-rated cgens not supported (yet)"))
+    (get rated-defs rate)))
+
 (defmacro defcgen
   "Define one or more related cgens (composite generators) with different rates.

@@ -161,30 +167,36 @@
     (:kr (sin-osc:kr car-freq (* pm-index (sin-osc:kr mod-freq mod-phase))))
     (:default :ar))"
   [c-name & c-form]
-  (let [[summary doc params bodies default-rate] (cgen-form c-form)
-        arglists                                 (list (vec (map #(symbol (name (:name %))) params)))
-        arglists                                 (list 'quote arglists)
-        rates                                    (into #{} (keys bodies))
-        categories                               [["Composite Ugen"]]
-        full-doc                                 (generate-full-cgen-doc c-name summary doc categories default-rate params rates)
-        metadata                                 {:doc full-doc
-                                                  :arglists arglists
-                                                  :type ::cgen}
-
-        default-body                             (get bodies default-rate)
-        default-cgen                             (mk-cgen c-name summary doc params default-body categories default-rate)
-        default-c-name                           (with-meta c-name metadata)
-        default-def                              `(def ~default-c-name ~default-cgen)
-        cgen-defs (list* default-def
-                         (for [rate rates]
-                           (let [body   (get bodies rate)
-                                 cgen   (mk-cgen c-name summary doc params body categories rate)
-                                 c-name (symbol (str (name c-name) rate))
-                                 c-name (with-meta c-name metadata)
-                                 ]
-                             `(def ~c-name ~cgen))))]
+  (let [[summary doc params bodies default-rate] (cgen-form c-form)]
+    (let [arglists       (list (vec (map #(symbol (name (:name %))) params)))
+          arglists       (list 'quote arglists)
+          rates          (into #{} (keys bodies))
+          categories     [["Composite Ugen"]]
+          full-doc       (generate-full-cgen-doc c-name summary doc categories default-rate params rates)
+          metadata       {:doc full-doc
+                          :arglists arglists
+                          :type ::cgen}
+
+          default-c-name (with-meta c-name metadata)
+          rated-defs     (reduce (fn [defs rate]
+                                   (let [body (get bodies rate)
+                                         cgen (mk-cgen c-name summary doc params body categories rate)]
+                                     (assoc defs rate cgen)))
+                                 {}
+                                 rates)
+
+          default-cgen   (mk-default-cgen rated-defs default-rate)
+
+          default-def    `(def ~default-c-name ~default-cgen)
+          cgen-defs      (list* default-def
+                                (for [rate rates]
+                                  (let [cgen   (get rated-defs rate)
+                                        c-name (symbol (str (name c-name) rate))
+                                        c-name (with-meta c-name metadata)]
+                                    `(def ~c-name ~cgen))))]

     `(do ~@cgen-defs)))
+  )

 (defmethod print-method ::cgen [cgen w]
   (let [info (meta cgen)]


(PDB-4636) core: remove slingshot

(PDB-4636) core: remove slingshot

While we're reworking this code, remove slingshot.  It's easy to
handle the ex-data directly, and then we don't have to keep
slingshot's potentially surprising behaviors in mind, e.g.

  (try+
    ...
    (catch Exception ex
      ...))

may not actually catch ex.  cf.

  https://github.com/scgilardi/slingshot/issues/24
  https://github.com/scgilardi/slingshot/issues/52

--- src/puppetlabs/trapperkeeper/core.clj
+++ src/puppetlabs/trapperkeeper/core.clj
@@ -1,6 +1,5 @@
 (ns puppetlabs.trapperkeeper.core
   (:require [clojure.tools.logging :as log]
-            [slingshot.slingshot :refer [try+ throw+]]
             [puppetlabs.kitchensink.core :refer [without-ns]]
             [puppetlabs.trapperkeeper.services :as services]
             [puppetlabs.trapperkeeper.app :as app]
@@ -10,7 +9,9 @@
             [puppetlabs.trapperkeeper.plugins :as plugins]
             [schema.core :as schema]
             [puppetlabs.trapperkeeper.common :as common]
-            [puppetlabs.i18n.core :as i18n]))
+            [puppetlabs.i18n.core :as i18n])
+  (:import
+   (clojure.lang ExceptionInfo)))

 (def #^{:macro true
         :doc "An alias for the `puppetlabs.trapperkeeper.services/service` macro
@@ -168,19 +169,14 @@
   (let [quit (fn [status msg stream]
                (binding [*out* stream] (println msg) (flush))
                (System/exit status))]
-    (try+
-      (-> (or args '())
-          (internal/parse-cli-args!)
-          (run))
-      (catch map? m
-        (let [type (:kind m)]
-          (if (keyword? type)
-            (case (without-ns (:kind m))
-              :cli-error (quit 1 (:msg m) *err*)
-              :cli-help (quit 0 (:msg m) *out*)
-              ;; By default let the throw below reraise the error
-              nil)))
-        (throw+))
+    (try
+      (run (internal/parse-cli-args! (or args '())))
+      (catch ExceptionInfo ex
+        (let [{:keys [kind msg] :as data} (ex-data ex)]
+          (case (some-> kind without-ns)
+            :cli-error (quit 1 msg *err*)
+            :cli-help (quit 0 msg *out*)
+            (throw ex))))
       (finally
         (log/debug (i18n/trs "Finished TK main lifecycle, shutting down Clojure agent threads."))
         (shutdown-agents)))))


Update plugin task's use of write-components to use new arity.

--- src/leiningen/plugin.clj
+++ src/leiningen/plugin.clj
@@ -46,7 +46,7 @@
       (let [deps (->> (.listFiles (file (:library-path project)))
                       (filter #(.endsWith (.getName %) ".jar"))
                       (cons (file jarfile)))]
-        (write-components deps out)))
+        (write-components project deps out)))
     (delete-file-recursively temp-project)
     (println "Created" standalone-filename)))


CMR-6295 removing unnecessary step in fixture setup

--- system-int-test/test/cmr/system_int_test/search/autocomplete/suggestion_reindex_test.clj
+++ system-int-test/test/cmr/system_int_test/search/autocomplete/suggestion_reindex_test.clj
@@ -95,7 +95,6 @@
         _ (index/wait-until-indexed)
         _ (index/reindex-suggestions)
         _ (index/wait-until-indexed)]
-    (search/get-autocomplete-json "q=boo")
     (f)))

 (use-fixtures :each (join-fixtures


missing ws object

missing ws object

--- cljs-src/index.cljs
+++ cljs-src/index.cljs
@@ -53,11 +53,11 @@
       (.listen ws (.. WebSocket -Event -MESSAGE #()))))

   (render [this]
-    (let [ws])
-    (dom/div nil
-      (repolist-factory)
-      (dom/input #js {:id "url-input" :type "text"})
-      (dom/button #js {:onClick add-repo} "submit"))))
+    (let [{:keys [ws] (om/get-state this)}]
+      (dom/div nil
+        (repolist-factory)
+        (dom/input #js {:id "url-input" :type "text"})
+        (dom/button #js {:onClick #(add-repo % ws) "submit"})))))

 (def widget-factory (om/factory Widget))


css cleaned up

css cleaned up

--- src/NoteHub/views/css.clj
+++ src/NoteHub/views/css.clj
@@ -126,16 +126,6 @@
             (rule "tr"
                   (rule "& > td:first-child"
                         :text-align :right)))
-      (rule "table,tr,td"
-            :margin 0)
-      (rule "td"
-            :padding :0.5em)
-      (rule ".one-third-column"
-            :line-height (% 120)
-            :text-align :justify
-            :vertical-align :top
-            ; Replace this by arithmetic with css-lengths as soon as they fix the bug
-            :width (px (quot page-width 3)))
       (rule ".helvetica-neue"
             helvetica-neue)
       (rule "#hero"


clarify first caption to mention 'languages' on JS platform

--- src/solar_system_of_js/actions.cljs
+++ src/solar_system_of_js/actions.cljs
@@ -163,7 +163,7 @@
    {:caption
     (str "Hello, I'm [@shaunlebron](http://twitter.com/shaunlebron)"
          " and I made this for [#spacecityjs](http://spacecityjs.com/)"
-         " to help us visualize the current state of the JS platform.")}
+         " to visualize the current state of languages on the JS platform.")}

    ;; slide in the JS logo
    {:caption


Showing users a spinner while they wait for the build timings chart.

--- src-cljs/frontend/components/build_timings.cljs
+++ src-cljs/frontend/components/build_timings.cljs
@@ -5,7 +5,8 @@
             [frontend.datetime :as datetime]
             [frontend.models.build :as build]
             [frontend.models.project :as project-model]
-            [frontend.routes :as routes])
+            [frontend.routes :as routes]
+            [frontend.components.common :as common])
   (:require-macros [frontend.utils :refer [html]]))

 (def padding-right 20)
@@ -40,8 +41,7 @@
         (.range  #js [0 (timings-width)]))))

 (defn create-root-svg [number-of-containers]
-  (-> (.select js/d3 ".build-timings")
-      (.select "svg")
+  (-> (.select js/d3 "#build-timings")
         (.attr "width"  (+ (timings-width)
                            left-axis-width
                            padding-right))
@@ -198,18 +198,28 @@
 ;;;; Main component
 (defn build-timings [{:keys [build project plan]} owner]
   (reify
+
+    om/IInitState
+    (init-state [_]
+      {:loading? true})
+
     om/IDidUpdate
     (did-update [_ _ _]
       (if (project-model/show-build-timing? project plan)
-        (draw-chart! build)
+        (do
+          (draw-chart! build)
+          (om/set-state! owner [:loading?] false))
         (analytics/track-build-timing-upsell-impression {:org-name (:org_name plan)
                                                          :reponame (:reponame project)})))
     om/IRenderState
-    (render-state [_ _]
+    (render-state [_ {:keys [loading?]}]
       (html
        [:div.build-timings
         (if (project-model/show-build-timing? project plan)
-          [:svg]
+          [:div
+           (when loading?
+             [:div.loading-spinner common/spinner])
+           [:svg#build-timings]]
           [:span.message "This release of Build Timing is only available for repos belonging to paid plans "
            [:a.upgrade-link {:href (routes/v1-org-settings {:org (:org_name plan)})
                              :on-click #(analytics/track-build-timing-upsell-click {:org-name (:org_name plan)


Clever mappings from keys to React methods

--- re_view/src/re_view/core.cljs
+++ re_view/src/re_view/core.cljs
@@ -54,21 +54,24 @@
           (set! (.-re$dbPatterns this) patterns))
         value))))

-(def ^:private kmap
+(defn- class-key
   "Mapping of methods-map keys to React lifecycle keys."
-  {:constructor "constructor"
-   :view/initial-state "$initialState"
-   :view/state "$state"
-   :view/did-catch "componentDidCatch"
-   :view/will-mount "componentWillMount"
-   :view/did-mount "componentDidMount"
-   :view/will-receive-props "componentWillReceiveProps"
-   :view/will-receive-state "componentWillReceiveState"
-   :view/should-update "shouldComponentUpdate"
-   :view/will-update "componentWillUpdate"
-   :view/did-update "componentDidUpdate"
-   :view/will-unmount "componentWillUnmount"
-   :view/render "render"})
+  [k]
+  (case k
+    :constructor "constructor"
+    :view/initial-state "$initialState"
+    :view/state "$state"
+    :view/did-catch "componentDidCatch"
+    :view/will-mount "componentWillMount"
+    :view/did-mount "componentDidMount"
+    :view/will-receive-props "componentWillReceiveProps"
+    :view/will-receive-state "componentWillReceiveState"
+    :view/should-update "shouldComponentUpdate"
+    :view/will-update "componentWillUpdate"
+    :view/did-update "componentDidUpdate"
+    :view/will-unmount "componentWillUnmount"
+    :view/render "render"
+    (str "re$" (v-util/camelCase (name k)))))

 (defn compseq
   "Compose fns to execute sequentially over the same arguments"
@@ -165,7 +168,7 @@
              (if (keyword-identical? k :view/state)
                (do (ensure-state! this)
                    (.-re$state this))
-               (gobj/get this (str "re$" (v-util/camelCase (name k)))))
+               (gobj/get this (class-key k)))

              (identical? ns "spec")
              (get (.-re$spec this) k)
@@ -178,7 +181,7 @@
              (if (keyword-identical? k :view/state)
                (do (ensure-state! this)
                    (.-re$state this))
-               (gobj/get this (str "re$" (v-util/camelCase (name k)))))
+               (gobj/get this (class-key k)))

              (identical? ns "spec")
              (get (.-re$spec this) k)
@@ -213,7 +216,7 @@
                   :view/did-update finish-lifecycle}])
        (reduce-kv (fn [obj method-k method]
                     (doto obj
-                      (gobj/set (get kmap method-k) (wrap-methods method-k method)))) #js {})))
+                      (gobj/set (class-key method-k) (wrap-methods method-k method)))) #js {})))

 (defn swap-silently!
   "Swap a component's state atom without forcing an update (render)"


make job scheduling and processing independent

--- src/wb_es/bulk/core.clj
+++ src/wb_es/bulk/core.clj
@@ -114,7 +114,7 @@
 (defn- scheduler-stats [] (dq/stats q))

-(defn run-index-sample [db]
+(defn schedule-jobs-sample [db]
   ;; schedule something for testing
   (let [eids (get-eids-by-type db :analysis/id)
         jobs (make-batches 1000 :analysis eids)]
@@ -122,7 +122,7 @@
       (scheduler-put! job)))
   )

-(defn run-index-all [db]
+(defn schedule-jobs-all [db]
   (do
     ;; add jobs to scheduler in sequence

@@ -302,15 +302,9 @@
     ))

-(defn run [& {:keys [db index-revision-number index-id skip-create-snapshot]
-              :or {db (d/db datomic-conn)
-                   index-revision-number 0
-                   index-id (format "%s_v%s" release-id index-revision-number)}}]
+(defn run [db]
   (let []
     (do
-      (create-index index-id
-                    :default-index (= index-revision-number 0)
-                    :delete-existing true)
       (let [n-threads 4
             logger (chan n-threads)]

@@ -347,30 +341,30 @@
                     (recur)))
                 (close! logger)))))

-        (run-index-all db)
-        ;;(run-index-sample db)
-        (prn (scheduler-stats))
-
         )

-      (if-not skip-create-snapshot
-        (let [repository-name "s3_repository"]
-          (do
-            (connect-snapshot-repository repository-name)
-            (let [snapshot-id (get-next-snapshot-id repository-name release-id)]
-              (save-snapshot index-id repository-name snapshot-id)))))
       )))

 (defn -main
   "I don't do a whole lot ... yet."
   [& args]
-  (do
-    (es-connect)
-    (println "Indexer starting!")
-    (mount/start)
-    (if-let [index-revision-number (first args)]
-      (run :index-revision-number index-revision-number)
-      (run))
-    (mount/stop))
+  (let [index-revision-number (or (first args) 0)
+        index-id (format "%s_v%s" release-id index-revision-number)
+        repository-name "s3_repository"]
+    (do
+      (println "Indexer starting!")
+      (mount/start)
+      (es-connect)
+      (create-index index-id
+                    :default-index (= index-revision-number 0)
+                    :delete-existing true)
+      (let [db (d/db datomic-conn)]
+        (do
+          (run db)
+          (schedule-jobs-all db)))
+      (connect-snapshot-repository repository-name)
+      (let [snapshot-id (get-next-snapshot-id repository-name release-id)]
+        (save-snapshot index-id repository-name snapshot-id))
+      (mount/stop)))
   )


modify parameters to utilize the availabe cpu

--- src/wb_es/bulk/core.clj
+++ src/wb_es/bulk/core.clj
@@ -316,7 +316,7 @@
       (doseq [job jobs]
         (scheduler-put! job)))
     (let [eids (get-eids-by-type db :variation/id)
-          jobs (make-batches 100 :variation eids)] ; smaller batch for slower ones
+          jobs (make-batches 1000 :variation eids)]
       (doseq [job jobs]
         (scheduler-put! job)))

@@ -390,7 +390,7 @@
                                          :index index-id
                                          :repository repository-name}))
           (->> (partial worker db)
-               (repeatedly 4)
+               (repeatedly 5)
                (pmap deref) ; wait for the futures to return
                (doall) ; force the side effects
                )


Calculate timestamp for all samples

Calculate timestamp for all samples

Avoids a possible situation in which the day changes while different
samples are being calculated, resulting in mismatched data.

--- src/whitman/crawler.clj
+++ src/whitman/crawler.clj
@@ -44,23 +44,24 @@
 (defn reduce-data [data path]
   (reduce get-value data (path-components path)))

-(defn ^{:private true} sample-query [user]
-  {:user user, :timestamp (utils/midnight (utils/utcnow))})
+(defn ^{:private true} sample-query [now user]
+  {:user user, :timestamp (utils/midnight now)})

-(defn ^{:private true} sample-insert [user key sample]
-  (let [hours (utils/hours-since-midnight (utils/utcnow))]
+(defn ^{:private true} sample-insert [now user key sample]
+  (let [hours (utils/hours-since-midnight now)]
     {(str key "." hours) sample}))

 (defn sample-datapoint [cfg point user]
   (let [data (client/request cfg user)]
     (reduce-data data (get point "path"))))

-(defn ^{:private true} sample-and-insert [cfg user datum]
-  (sample-insert user (get datum "key") (sample-datapoint cfg datum user)))
+(defn ^{:private true} sample-and-insert [now cfg user datum]
+  (sample-insert now user (get datum "key") (sample-datapoint cfg datum user)))

 (defn sample-docs [cfg user]
-  (let [datapoints (get cfg "data")
-        q (sample-query user)
-        data (map #(sample-and-insert cfg user %) datapoints)
+  (let [now (utils/utcnow)
+        datapoints (get cfg "data")
+        q (sample-query now user)
+        data (map #(sample-and-insert now cfg user %) datapoints)
         ins (utils/merge-map-list data)]
     {:query q, :insert {"$set" ins}}))


typo in arglists test

typo in arglists test

--- test/cljs/cljs/core_test.cljs
+++ test/cljs/cljs/core_test.cljs
@@ -2783,7 +2783,7 @@
   (is (= (set {:a 0 :b 0 :c 0 :d 0 :e 0 :f 0 :g 0 :h 0 :i 0})
          #{[:a 0] [:b 0] [:c 0] [:d 0] [:e 0] [:f 0] [:g 0] [:h 0] [:i 0]})))

-(deftest test-var-aarglists
+(deftest test-var-arglists
   (is (= (-> #'first meta :arglists) '([coll])))
   (is (= (-> #'hash-map meta :arglists) '([& keyvals])))
   (is (= (-> #'map meta :arglists)


Make split-by-blocksize as public function.

--- src/buddy/core/crypto.clj
+++ src/buddy/core/crypto.clj
@@ -237,8 +237,9 @@
   [engine output offset]
   (calculate-authtag engine output offset))

-(defn- split-by-blocksize
+(defn split-by-blocksize
   "Split a byte array in blocksize blocks.
+
   Given a arbitrary size bytearray and block size in bytes,
   returns a lazy sequence of bytearray blocks of blocksize
   size. If last block does not have enought data for fill


Add a test for logical disjunction

Add a test for logical disjunction

--- test/desdemona/query_test.clj
+++ test/desdemona/query_test.clj
@@ -16,7 +16,13 @@
              [(clojure.core.logic/featurec x {:ip "10.0.0.1"})
               (clojure.core.logic/featurec x {:type "egress"})])
            (dsl->logic '(and (= (:ip x) "10.0.0.1")
-                             (= (:type x) "egress")))))))
+                             (= (:type x) "egress"))))))
+  (testing "logical disjunction"
+    (is (= '(clojure.core.logic/conde
+             [(clojure.core.logic/featurec x {:ip "10.0.0.1"})]
+             [(clojure.core.logic/featurec x {:type "egress"})])
+           (dsl->logic '(or (= (:ip x) "10.0.0.1")
+                            (= (:type x) "egress")))))))

 (def events
   [{:ip "10.0.0.1"}


Solve a simpler problem first

Solve a simpler problem first

--- test/desdemona/query_test.clj
+++ test/desdemona/query_test.clj
@@ -53,6 +53,16 @@
                    (fn-call "ip" "x")
                    (fn-call "ip" "y")]]
            (#'q/infix-parser "10.0.0.1 = ip(x) = ip(y)")))))
+
+(deftest infix-term->dsl-tests
+  (are [term dsl] (= dsl (q/infix->dsl term))
+    [:fn-call
+     [:identifier "ip"]
+     [:identifier "xyzzy"]]
+    '(:ip "xyzzy")
+
+    [:ipv4-addr "10" "0" "0" "1"]
+    "10.0.0.1"))

 (deftest infix->dsl-tests
   (is (= '(= (:ip x) "10.0.0.1")


Need inline world-vis-init-cb for future replayability.

--- src/cbfg/world-store.cljs
+++ src/cbfg/world-store.cljs
@@ -52,40 +52,39 @@

 (def store-max-inflight (atom 10))

-(defn world-vis-init-cb [world]
-  (let [store (store/make-store world)
-        store-cmd-handlers (make-store-cmd-handlers store)
-        cmd-ch (map< (fn [ev] {:op (.-id (.-target ev))})
-                     (cljs.core.async/merge (map #(listen-el (gdom/getElement %) "click")
-                                                 (keys store-cmd-handlers))))
-        client-hist (atom {}) ; Keyed by opaque -> [request, replies]
-        in-ch (achan-buf world 100)
-        out-ch (achan-buf world 0)]
-    (ago-loop client world [num-ins 0 num-outs 0]
-              (let [[v ch] (aalts client [cmd-ch out-ch])
-                    ts (+ num-ins num-outs)]
-                (cond
-                 (= ch cmd-ch) (let [op (:op v)
-                                     op-fence (= (get-el-value (str op "-fence")) "1")
-                                     [params handler] (get store-cmd-handlers op)
-                                     cmd2 (-> v
-                                              (assoc :opaque ts)
-                                              (assoc :fence op-fence))
-                                     cmd3 (reduce #(assoc %1 (keyword %2)
-                                                          (get-el-value (str op "-" %2)))
-                                                  cmd2 params)]
-                                 (render-client-hist (swap! client-hist
-                                                            #(assoc % ts [cmd3 nil])))
-                                 (aput client in-ch (merge cmd3 (handler cmd3)))
-                                 (recur (inc num-ins) num-outs))
-                 (= ch out-ch) (do (render-client-hist (swap! client-hist
-                                                              #(update-in % [(:opaque v) 1]
-                                                                          conj [ts v])))
-                                   (recur num-ins (inc num-outs))))))
-    (make-fenced-pump world in-ch out-ch @store-max-inflight)))
-
 (defn world-vis-init [el-prefix]
-  (vis-init world-vis-init-cb el-prefix nil))
+  (vis-init (fn [world]
+              (let [store (store/make-store world)
+                    store-cmd-handlers (make-store-cmd-handlers store)
+                    cmd-ch (map< (fn [ev] {:op (.-id (.-target ev))})
+                                 (cljs.core.async/merge (map #(listen-el (gdom/getElement %) "click")
+                                                             (keys store-cmd-handlers))))
+                    client-hist (atom {}) ; Keyed by opaque -> [request, replies]
+                    in-ch (achan-buf world 100)
+                    out-ch (achan-buf world 0)]
+                (ago-loop client world [num-ins 0 num-outs 0]
+                          (let [[v ch] (aalts client [cmd-ch out-ch])
+                                ts (+ num-ins num-outs)]
+                            (cond
+                             (= ch cmd-ch) (let [op (:op v)
+                                                 op-fence (= (get-el-value (str op "-fence")) "1")
+                                                 [params handler] (get store-cmd-handlers op)
+                                                 cmd2 (-> v
+                                                          (assoc :opaque ts)
+                                                          (assoc :fence op-fence))
+                                                 cmd3 (reduce #(assoc %1 (keyword %2)
+                                                                      (get-el-value (str op "-" %2)))
+                                                              cmd2 params)]
+                                             (render-client-hist (swap! client-hist
+                                                                        #(assoc % ts [cmd3 nil])))
+                                             (aput client in-ch (merge cmd3 (handler cmd3)))
+                                             (recur (inc num-ins) num-outs))
+                             (= ch out-ch) (do (render-client-hist (swap! client-hist
+                                                                          #(update-in % [(:opaque v) 1]
+                                                                                conj [ts v])))
+                                               (recur num-ins (inc num-outs))))))
+                (make-fenced-pump world in-ch out-ch @store-max-inflight)))
+            el-prefix nil))

 (let [last-id (atom 0)
       gen-id #(swap! last-id inc)]


added skip-* parameter to core-test job configuration

--- test/distillery/core_test.clj
+++ test/distillery/core_test.clj
@@ -47,9 +47,11 @@
   {:job-name "Testlauf"
    :job-description "Ein Testprojekt für Testzwecke mit Testvideos und Testkategorien. Wird zum Testen verwendet."
    :output-dir (str root "Output")
-   :configuration {:main-cloud {:precision :low}
-                   :video-cloud {:precision :low}
-                   :category-cloud {:precision :low}}
+   :configuration {:skip-wordclouds false
+                   :skip-word-includes false
+                   :main-cloud {:precision :medium}
+                   :video-cloud {:precision :medium}
+                   :category-cloud {:precision :medium}}
    :videos (->> videos
                 (map (fn
                        [[id name]]


Fixed out -> in for gpio pin in play

Fixed out -> in for gpio pin in play

--- src/chicken_coop/core.clj
+++ src/chicken_coop/core.clj
@@ -93,7 +93,7 @@

 (defn play []
   (println "ready to initialize")
-  (let [g  (gpio :P8 11 :out)
+  (let [g  (gpio :P8 12 :in)
         a1 (ain 33)
         a2 (ain 35)]
     (setup-shutdown-hook!


Post react observer reactions on the thread of the message reacted to

--- src/yetibot/core/adapters/slack.clj
+++ src/yetibot/core/adapters/slack.clj
@@ -249,15 +249,38 @@
                           :yetibot? yetibot?)
         reaction-message-user (assoc (users/get-user cs item_user)
                                      :yetibot? (= yetibot-uid item_user))
-        {[message] :messages} (conversations/history
-                                sc (:channel item)
-                                {:latest (:ts item)
-                                 :inclusive "true"
-                                 :count "1"})]
-    (info "reaction_added" (pr-str event) (pr-str message))
+
+        {[parent-message] :messages} (conversations/history
+                                       sc (:channel item)
+                                       {:latest (:ts item)
+                                        :inclusive "true"
+                                        :count "1"})
+
+        parent-ts (:ts parent-message)
+
+        ;; figure out if the user reacted to the top level parent of the thread
+        ;; or a child
+        is-parent? (= (:ts parent-message) (:ts item))
+
+        child-ts (:ts item)
+
+        child-message (when-not is-parent?
+                        (->> (conversations/replies
+                               sc (:channel item)
+                               parent-ts
+                               {:latest child-ts
+                                :inclusive "true"
+                                :limit "1"})
+                             :messages
+                             (filter (fn [{:keys [ts]}] (= ts child-ts)))
+                             first
+                             ))
+
+        message (if is-parent? parent-message child-message)]
     ;; only support reactions on message types
     (when (= "message" (:type item))
-      (binding [*target* (:channel item)]
+      (binding [*target* (:channel item)
+                *thread-ts* parent-ts]
         (handle-raw cs user-model :react yetibot-user
                     {:reaction reaction
                      ;; body of the message reacted to


study-1

--- src/clj_opengrok/core.clj
+++ src/clj_opengrok/core.clj
@@ -1,6 +1,8 @@
 (ns clj-opengrok.core
-  (:import (java.io StringReader File ByteArrayInputStream ObjectInputStream)
+  (:import (java.io StringReader File ByteArrayInputStream ObjectInputStream
+                    InputStreamReader FileInputStream)
            (org.opensolaris.opengrok.analysis Definitions Definitions$Tag)
+           (org.opensolaris.opengrok.search QueryBuilder Hit)
            (org.opensolaris.opengrok.search.context Context)
            (org.apache.lucene.analysis Analyzer TokenStream)
            (org.apache.lucene.analysis.standard StandardAnalyzer)
@@ -17,32 +19,78 @@
            (org.apache.lucene.util Version AttributeSource BytesRef)
            (org.apache.lucene.store FSDirectory NIOFSDirectory RAMDirectory Directory)))

-(def ^{:dynamic true} *version* Version/LUCENE_CURRENT)
-(def ^{:dynamic true} *analyzer* (StandardAnalyzer. *version*))
+(defn get-query-builder []
+  (QueryBuilder.))
+
+(defn get-query [query-builder query]
+  (.build (.setDefs query-builder query)))
+
+(defn get-context [query query-builder]
+  (Context. query (.getQueries query-builder)))

 (defn get-searcher [dir]
-  (IndexSearcher. (DirectoryReader/open (FSDirectory/open (File. dir)))))
+  (IndexSearcher.
+   (DirectoryReader/open
+    (FSDirectory/open (File. dir)))))

 (defn get-sort []
   (Sort. (SortField. "date" SortField$Type/STRING true)))

-(defn get-docs []
-  (let [parser (QueryParser. *version* "full" *analyzer*)
-        query (.parse parser "google")
-        searcher (get-searcher
-                  "/Users/youngker/Projects/lp/.opengrok/index/frameworks")
-        fdocs (.search searcher query 25 (get-sort))
-        totalhits (.totalHits fdocs)
-        hits (.scoreDocs fdocs)]
-    (map #(.doc searcher (.doc %)) hits)))
+(defn get-fdocs [searcher query]
+  (.search searcher query 5 (get-sort)))
+
+(defn get-total-hits [fdocs]
+  (.totalHits fdocs))
+
+(defn get-hits [fdocs]
+  (.scoreDocs fdocs))
+
+(defn get-docs [searcher hits]
+  (map #(.doc searcher (.doc %)) hits))
+
+(defn get-tags-field [doc]
+  (.getField doc "tags"))
+
+(defn get-taglist [tag]
+  (map #(list (.line %) "///" (.text %) "///" (.symbol %) "///" (.type %)) tag))

 (defn get-data [^Definitions definition]
   (let [^Definitions$Tag tag (.getTags definition)]
-    (.type (first tag))))
+    (get-taglist tag)))

-(defn get-tags [doc]
-  (when-let [tags-field (.getField doc "tags")]
-    (get-data (Definitions/deserialize (.bytes (.binaryValue tags-field))))))
+(defn get-tag [context doc]
+  (println "get-tag")
+  (println (.get doc "t"))
+  (let [filename (.get doc "path")
+        tag-field (get-tags-field doc)
+        tag (if tag-field
+              (Definitions/deserialize (.bytes (.binaryValue
+                                                tag-field)))
+              nil)
+        hit (list (Hit.))]
+    (.getContext context
+                 (InputStreamReader. (FileInputStream. (str
+                                                        "/path/to"
+                                                        filename))) nil nil nil
+                 filename tag false false hit)
+    (println "line num"(.getLineno (first hit)))
+    ))

-(defn get-xxx []
-  (map #(get-tags %) (get-docs)))
+(defn get-tags [context docs]
+  (println "get-tags")
+  (map #(get-tag context %) docs))
+
+(defn search []
+  (let [query-builder (get-query-builder)
+        query (get-query query-builder "test")
+        context (get-context query query-builder)
+        searcher (get-searcher
+                  "/path/to")
+        fdocs (get-fdocs searcher query)
+        totalhits (get-total-hits fdocs)
+        hits (get-hits fdocs)
+        docs (get-docs searcher hits)
+        tags (get-tags context docs)]
+    (println "total hits: " totalhits)
+    ;;    (println tags)
+    ))


Add transposition of top-idxs and bot-idxs to flip-graph

--- src/cljs/fatlip/core.cljs
+++ src/cljs/fatlip/core.cljs
@@ -545,7 +545,9 @@
   [graph]
   (assoc graph
     :aboves (:belows graph)
-    :belows (:aboves graph)))
+    :belows (:aboves graph)
+    :top-idxs (:bot-idxs graph)
+    :bot-idxs (:top-idxs graph)))

 (defn neighborify


massage single arity Clojure functions in Java 8 Function

--- src/cognitect/transit.clj
+++ src/cognitect/transit.clj
@@ -151,7 +151,10 @@
        (let [handler-map (if (instance? HandlerMapContainer handlers)
                            (handler-map handlers)
                            (merge default-write-handlers handlers))]
-         (Writer. (TransitFactory/writer (transit-format type) out handler-map nil transform)))
+         (Writer. (TransitFactory/writer (transit-format type) out handler-map nil
+                    (reify Function
+                      (apply [_ x]
+                        (transform x))))))
        (throw (ex-info "Type must be :json, :json-verbose or :msgpack" {:type type})))))

 (defn write
@@ -366,15 +369,14 @@
   (HandlerMapContainer.
    (TransitFactory/writeHandlerMap (merge default-write-handlers custom-handlers))))

-(def ^{:doc "For :transform. Will write any metadata present on the value."}
-  write-meta
-  (reify Function
-    (apply [_ x]
-      (if (instance? clojure.lang.IObj x)
-        (if-let [m (meta x)]
-          (WithMeta. (with-meta x nil) m)
-          x)
-        x))))
+(defn write-meta
+  "For :transform. Will write any metadata present on the value."
+  [x]
+  (if (instance? clojure.lang.IObj x)
+    (if-let [m (meta x)]
+      (WithMeta. (with-meta x nil) m)
+      x)
+    x))

 (comment
   (require 'cognitect.transit)


Fixed imf tests to reflect that header field names are lowercased when parsed.

--- test/neveragain/imf_tests.clj
+++ test/neveragain/imf_tests.clj
@@ -58,5 +58,5 @@

     (is (:headers result-one))
     (is (:body result-one))
-    (is (= (:To (:headers result-one)) "lanny@neveraga.in"))
-    (is (= (:From (:headers result-one)) "lan.rogers.book@gmail.com"))))
+    (is (= (:to (:headers result-one)) "lanny@neveraga.in"))
+    (is (= (:from (:headers result-one)) "lan.rogers.book@gmail.com"))))


fixing recipe puppy integration

fixing recipe puppy integration

--- src/eatme/recipe_book.clj
+++ src/eatme/recipe_book.clj
@@ -2,9 +2,12 @@
   (:require [clj-http.client :as client]
             [clojure.string :as string]))

-(def recipe-puppy "http://www.recipepuppy.com/api/?q=omelet&p=1")
+(def recipe-puppy "http://www.recipepuppy.com/api/")
+(def ingred "http://ingred.oliy.co.uk")
+(def ^:dynamic *provider* :recipe-puppy)

 (defn call-api [q p]
+  (println q p)
   (:body (client/get recipe-puppy {:query-params {"q" q "p" p} :as :json})))

 (defn upper-first [s]
@@ -15,5 +18,7 @@
       (select-keys [:title :href])
       (assoc :ingredients (map #(-> % string/trim upper-first) (string/split ingredients #",")))))

-(defn suggest-recipe [q p]
+(defmulti suggest-recipe (fn [q p] *provider*))
+
+(defmethod suggest-recipe :recipe-puppy [q p]
   (map clean-recipe (:results (call-api q p))))


Read redis from env

Read redis from env

--- src/harland/messaging.clj
+++ src/harland/messaging.clj
@@ -5,7 +5,7 @@
             [taoensso.carmine :as car :refer (wcar)]))

 ; TODO move this to conf file or something
-(def master-redis "redis://localhost:6379")
+(def master-redis (System/getenv "REDIS_URI"))
 (def server-conn {:pool {} :spec {:uri master-redis}})
 (defmacro wcar* [& body] `(car/wcar server-conn ~@body))


refactor-nrepl 2.2.0 (no snapshot!)

refactor-nrepl 2.2.0 (no snapshot!)

--- dot/lein/profiles.clj
+++ dot/lein/profiles.clj
@@ -2,7 +2,7 @@
  {:plugins [[lein-vanity "0.2.0" :exclusions [org.clojure/clojure]]
             [lein-ancient "0.6.5"]
             [jonase/eastwood "0.2.0"]
-            [refactor-nrepl "2.2.0-SNAPSHOT"]]
+            [refactor-nrepl "2.2.0"]]
   :dependencies [[slamhound "1.5.5"]
                  [org.clojure/tools.nrepl "0.2.12"]]
   :aliases {"slamhound" ["run" "-m" "slam.hound"]}}}


Add lein kibit for code suggestion/linter

--- dot/lein/profiles.clj
+++ dot/lein/profiles.clj
@@ -1,6 +1,7 @@
 {:user
  {:plugins [[lein-vanity "0.2.0" :exclusions [org.clojure/clojure]]
             [lein-ancient "0.6.5"]
+            [lein-kibit "0.1.3"]
             [jonase/eastwood "0.2.0"]
             ;;[com.billpiel/sayid "0.0.10"]
             ]


add new test: parse-reflexive-past

add new test: parse-reflexive-past

--- test/babel/test/fr.cljc
+++ test/babel/test/fr.cljc
@@ -4,7 +4,7 @@
   (:require [babel.engine :as engine]
             [babel.forest :as forest]
             [babel.francais.grammar :refer [small medium]]
-            [babel.francais.morphology :refer [fo]]
+            [babel.francais.morphology :refer [fo analyze]]
             [babel.francais.workbook :refer [generate parse]]
             [babel.over :as over]
             [clojure.string :as string]
@@ -240,3 +240,8 @@
            :have-fun))
     (is (= (get-in result [:synsem :sem :subj :pred])
            :tu))))
+
+(deftest parse-reflexive-past
+  (let [result (first (parse "tu t'es amusé"))]
+    (is (not (nil? result)))))
+


Updated test for dictionary-type->char

Updated test for dictionary-type->char

--- test/zg/db_interface_test.clj
+++ test/zg/db_interface_test.clj
@@ -135,6 +135,7 @@
         (are [x y] (= x (dictionary-type->char y))
             "w" :whitelist
             "b" :blacklist
+            "a" :atomic-typos
             "o" :other)))

 (deftest test-insert-word-into-dictionary


Test test-read-description-negative

Test test-read-description-negative

--- test/clouseau/test_db_interface.clj
+++ test/clouseau/test_db_interface.clj
@@ -143,3 +143,15 @@
                 (is (= "select description from packages where lower(name)='';"
                     (read-description product "")))))))

+(deftest test-read-description-negative
+    (testing "clouseau.db-interface/read-description"
+        ; use mock instead of jdbc/query
+        (with-redefs [jdbc/query (fn [product package] package)]
+            (let [product ["RHEL 6"                                   ; first
+                              {:classname   "org.sqlite.JDBC"         ; second
+                               :subprotocol "sqlite"
+                               :subname     "packages/rhel6/primary.sqlite"
+                           }]]
+                (is (thrown? NullPointerException (read-description product nil)))
+                (is (thrown? NullPointerException (read-description nil nil)))))))
+


Oh dear

Oh dear

--- src/exploud/deployments.clj
+++ src/exploud/deployments.clj
@@ -3,6 +3,7 @@
             [exploud
              [actions :as actions]
              [elasticsearch :as es]
+             [log :as log]
              [redis :as redis]
              [tasks :as tasks]]))


couple more fixes for unit tests.

couple more fixes for unit tests.

--- test/metabase/models/pulse_test.clj
+++ test/metabase/models/pulse_test.clj
@@ -52,6 +52,7 @@
                    :display "table"}]
    :channels     [{:schedule_type :daily,
                    :schedule_hour 15,
+                   :schedule_frame nil,
                    :channel_type  :email,
                    :details       {:other "stuff"},
                    :schedule_day  nil,
@@ -177,6 +178,7 @@
    :schedule_type schedule-type-daily
    :schedule_hour 4
    :schedule_day  nil
+   :schedule_frame nil
    :recipients    [{:email "foo@bar.com"}
                    (dissoc (user-details :rasta) :is_superuser :is_qbnewb)]}
   (tu/with-temp Pulse [{:keys [id]} {:creator_id (user->id :rasta)
@@ -198,6 +200,7 @@
    :name       "Booyah!"
    :channels   [{:schedule_type :daily
                  :schedule_hour 18
+                 :schedule_frame nil
                  :channel_type  :email
                  :recipients    [{:email "foo@bar.com"}]
                  :schedule_day  nil}]
@@ -235,6 +238,7 @@
                    :display "table"}]
    :channels     [{:schedule_type :daily,
                    :schedule_hour 18,
+                   :schedule_frame nil,
                    :channel_type  :email,
                    :schedule_day  nil,
                    :recipients    [{:email "foo@bar.com"}


Also make ordered and unordered lists defelems.

--- src/hiccup/page_helpers.clj
+++ src/hiccup/page_helpers.clj
@@ -49,12 +49,12 @@
   [url & content]
   [:a {:href url} content])

-(defn unordered-list
+(defelem unordered-list
   "Wrap a collection in an unordered list"
   [coll]
   [:ul (for [x coll] [:li x])])

-(defn ordered-list
+(defelem ordered-list
   "Wrap a collection in an unordered list"
   [coll]
   [:ol (for [x coll] [:li x])])


Now fuzzifies minion costs on scenario creation, up to 2 access either way, to a minimum of 1

--- src/hphelper/shared/sql.clj
+++ src/hphelper/shared/sql.clj
@@ -20,7 +20,7 @@
   (if (integer? i)
     i
     (try (Integer/parseInt i)
-         (catch Exception e
+         (catch Exception e
            (do
              (log/debug "Could not parse:" i)
              nil)))))
@@ -332,7 +332,8 @@
          (repeatedly numb (partial get-cbay-random-single zone)))))))

 (defn get-single-minion-from-sg
-  "Given a service group, returns a single minion from that group. Returns nil if invalid sg_id or no minions in that service group"
+  "Given a service group, returns a single minion from that group. Returns nil if invalid sg_id or no minions in that service group.
+  Modifies minion cost up or down 2, to a minimum of 1"
   [^Integer sg_id]
   (log/trace "create-single-minion-from-sg. sg_id:" sg_id)
   (-> (query "SELECT minion_id FROM minion
@@ -342,7 +343,9 @@
       (get :minion_id)
       (#(query "SELECT * FROM minion_skills WHERE minion_id = ?;" %))
       ; The above returns a collection, with one item
-      first)
+      first
+      (update-in [:minion_cost] (fn [^Integer cost] (max 1 (+ (rand-int 5) -2 cost))))
+      )
   )

 (defn get-single-minion-from-sg-and-skill
@@ -357,6 +360,9 @@
                                                    WHERE skills_id = ?);"
                                                    sg_id
                                                    skill_id)))]
-    (first (query "SELECT * FROM minion_skills WHERE minion_id = ?;"
-                  mId))
+    (-> (query "SELECT * FROM minion_skills WHERE minion_id = ?;"
+                  mId)
+        first
+        (update-in [:minion_cost] (fn [^Integer cost] (max 1 (+ (rand-int 5) -2 cost))))
+        )
     nil))


Sketch of testing ContentSource options [WIP]

--- test/uruk/core_test.clj
+++ test/uruk/core_test.clj
@@ -458,3 +458,33 @@
 ;;                                    (managed-content-source connection-provider ;; TODO implement https://docs.marklogic.com/javadoc/xcc/com/marklogic/xcc/spi/ConnectionProvider.html interface
 ;;                                                            "rest-admin" "x" "TutorialDB")
 ;;                                    {})))
+
+
+
+(deftest content-src-options
+  (testing "Content Source preemptive-authentication settings"
+    (is (true? (.isAuthenticationPreemptive (make-uri-content-source "xdbc://localhost:8383/"
+                                                                     {:preemptive-auth true}))))
+    (is (false? (.isAuthenticationPreemptive (make-uri-content-source "xdbc://localhost:8383/"
+                                                                      {:preemptive-auth false}))))
+    (is (true? (.isAuthenticationPreemptive (make-hosted-content-source "localhost" 8383
+                                                                        {:preemptive-auth true}))))
+    (is (false? (.isAuthenticationPreemptive (make-hosted-content-source "localhost" 8383
+                                                                         {:preemptive-auth false}))))
+    ;; TODO with make-cp-content-source, once we want to delve into
+    ;; the extreme complexity of ConnectionProvider
+    )
+  ;; (testing "Content Source default Logger settings"
+  ;;   (is (= "foo" (.getName (.getDefaultLogger (make-uri-content-source
+  ;;                                              "xdbc://localhost:8383/"
+  ;;                                              {:default-logger (Logger. )})))))
+  ;;   (is (false? (.isAuthenticationPreemptive (make-uri-content-source "xdbc://localhost:8383/"
+  ;;                                                                     {:preemptive-auth false}))))
+  ;;   (is (true? (.isAuthenticationPreemptive (make-hosted-content-source "localhost" 8383
+  ;;                                                                       {:preemptive-auth true}))))
+  ;;   (is (false? (.isAuthenticationPreemptive (make-hosted-content-source "localhost" 8383
+  ;;                                                                        {:preemptive-auth false}))))
+  ;;   ;; TODO with make-cp-content-source, once we want to delve into
+  ;;   ;; the extreme complexity of ConnectionProvider
+  ;;   )
+  )


Don't both checking whether files exist - that was in the tools.namespace code, but I think it's because files might get deleted during dev and that doesn't matter here.

--- src/klangmeister/macros.clj
+++ src/klangmeister/macros.clj
@@ -11,7 +11,6 @@
 (defn files []
   (->> (classpath/classpath-directories)
        (map io/file)
-       (filter #(.exists ^File %))
        (mapcat #(find/find-sources-in-dir % find/cljs))))

 (defn collate [entries]


WIP: watch working

WIP: watch working

--- src/leiningen/cljs_test.clj
+++ src/leiningen/cljs_test.clj
@@ -52,8 +52,7 @@
   {:pre [(contains? js-envs (keyword js-env))]}
   (let [{:keys [source-paths compiler]}
         (first (:builds (config/extract-options project)))]
-    (pprint source-paths)
-    (pprint compiler)
+    (pprint (assoc compiler :watch-fn #(println "!!!")))
     (run-local-project project [build-id]
       '(require 'cljs.build.api 'cljs.closure)
       `(cljs.build.api/watch


Don't write empty relation sets

Don't write empty relation sets

--- src/leiningen/voom/pldb.clj
+++ src/leiningen/voom/pldb.clj
@@ -25,7 +25,8 @@
   pairs that can be passed to from-reldata to reconstruct a database.
   The reldata is smaller than the database because it has no indexes."
   [db]
-  (for [[rel-name indexes] db]
+  (for [[rel-name indexes] db
+        :when (seq (::pldb/unindexed indexes))]
     (if-let [min-index (and (< 1 (count indexes))
                             (apply min (filter number? (keys indexes))))]
       [rel-name (mapcat seq (vals (get indexes min-index)))]


added logging

added logging

--- src/dda/pallet/crate/managed_vm.clj
+++ src/dda/pallet/crate/managed_vm.clj
@@ -62,20 +62,36 @@
       {:sudo-user "root"
        :script-dir "/root/"
        :script-env {:HOME (str "/root")}}
+      (actions/as-action
+          (logging/info (str facility "-install system: create user " user-key)))
       (user/create-sudo-user (os-user/new-os-user-from-config user-key global-config))
       (when (contains? settings :install-git)
+        (actions/as-action
+          (logging/info (str facility "-install system: git")))
         (basics/install-git))
       (when (contains? settings :install-linus-basics)
+        (actions/as-action
+          (logging/info (str facility "-install system: linus tools")))
         (basics/install-linus-basics))
       (when (contains? settings :install-xfce-desktop)
+        (actions/as-action
+          (logging/info (str facility "-install system: xfce")))
         (basics/install-xfce-desktop))
       (when (contains? settings :install-virtualbox-guest)
+        (actions/as-action
+          (logging/info (str facility "-install system: virtualbox-guest")))
         (basics/install-virtualbox-guest-additions))
       (when (contains? config :tightvnc-server)
+        (actions/as-action
+          (logging/info (str facility "-install system: tightvnc")))
         (tightvnc/install-system-tightvnc-server config))
       (when (contains? settings :install-libreoffice)
+        (actions/as-action
+          (logging/info (str facility "-install system: libreoffice")))
         (office/install-libreoffice))
       (when (contains? settings :install-open-jdk-8)
+        (actions/as-action
+          (logging/info (str facility "-install system: openjdk")))
         (java/install-open-jdk-8))
       )))

@@ -89,8 +105,12 @@
        :script-dir (str "/home/" os-user-name "/")
        :script-env {:HOME (str "/home/" os-user-name "/")}}
       (when (contains? config :bookmarks-download-url)
+        (actions/as-action
+          (logging/info (str facility "-install user: bookmarks")))
         (convenience/install-user-bookmarks os-user-name (-> config :bookmarks-download-url)))
       (when (contains? config :tightvnc-server)
+        (actions/as-action
+          (logging/info (str facility "-install user: tightvnc")))
         (tightvnc/install-user-tightvnc-server config)
         (tightvnc/install-user-vnc-tab-workaround config))
       ))
@@ -106,8 +126,12 @@
        :script-dir "/root/"
        :script-env {:HOME (str "/root")}}
       (when (contains? config :tightvnc-server)
-              (tightvnc/configure-system-tightvnc-server config))
+        (actions/as-action
+          (logging/info (str facility "-configure system: tightvnc")))
+        (tightvnc/configure-system-tightvnc-server config))
       (when (contains? settings :install-virtualbox-guest)
+        (actions/as-action
+          (logging/info (str facility "-configure system: tightvnc")))
         (basics/configure-virtualbox-guest-additions config))
       )))

@@ -121,7 +145,9 @@
        :script-dir (str "/home/" os-user-name "/")
        :script-env {:HOME (str "/home/" os-user-name "/")}}
       (when (contains? config :tightvnc-server)
-              (tightvnc/configure-user-tightvnc-server config))
+        (actions/as-action
+          (logging/info (str facility "-configure user: tightvnc")))
+        (tightvnc/configure-user-tightvnc-server config))
       )))

 (s/defn vm-test


Adds equals

Adds equals

--- src/the_little_clojurian/chapter4.clj
+++ src/the_little_clojurian/chapter4.clj
@@ -123,4 +123,17 @@
             :else (smaller-than (sub1 n) (sub1 m)))))

   (is (= (smaller-than 0 0) false))
-  (is (= (smaller-than 0 1) true)))
+  (is (= (smaller-than 0 1) true))
+  (is (= (smaller-than 4 6))))
+
+(with-test
+  (def equal
+    (fn [n m]
+      (cond (smaller-than n m) false
+            (greater-than n m) false
+            :else true)))
+
+  (is (= (equal 0 0) true))
+  (is (= (equal 0 1) false))
+  (is (= (equal 1 1) true))
+  (is (= (equal 44 44) true)))


Fix tons of unneeded DB calls

Fix tons of unneeded DB calls

--- src/metabase/api/common.clj
+++ src/metabase/api/common.clj
@@ -434,7 +434,8 @@
    {:pre [(models/metabase-entity? entity)
           (integer? id)]}
    (if (satisfies? models/ICanReadWrite entity)
-       (read-check (entity id)))))
+     (models/can-read? entity id)
+     (read-check (entity id)))))

 (defn write-check
   "Check whether we can write an existing OBJ, or ENTITY with ID."
@@ -445,5 +446,6 @@
   ([entity id]
    {:pre [(models/metabase-entity? entity)
           (integer? id)]}
-   (if (satisfies? models/ICanReadWrite entity) (models/can-write? entity id)
-       (write-check (entity id)))))
+   (if (satisfies? models/ICanReadWrite entity)
+     (models/can-write? entity id)
+     (write-check (entity id)))))


Added test for validation criteria PERF02.

--- src/alfresco_technical_validation/source_validation.clj
+++ src/alfresco_technical_validation/source_validation.clj
@@ -25,6 +25,7 @@
     :xml                    #".*\.xml"
     :web-script-descriptors #".*\.desc\.xml"
     :spring-app-context     #".*-context\.xml"
+    :content-model          #".*model.*\.xml"
     :ant                    #"build\.xml"
     :maven                  #"pom\.xml"
     :gradle                 #"build\.gradle"
@@ -54,10 +55,13 @@
                         }
     :ant                { :ivy            #"antlib:org\.apache\.ivy\.ant" }
     :java               {
-                          :stb08-stb09    #"(^|\s)synchronized(\s|$)"
+                          :stb08-stb09    #"(?:^|\s)synchronized(?:\s|$)"
                         }
     :spring-app-context {
-                          :api05          #"(^|\s)ref="
+                          :api05          #"(?:^|\s)ref="
+                        }
+    :content-model      {
+                          :perf02         #"(?:^|\s)<index enabled\s*=\s*\"true"
                         }
   })

@@ -135,6 +139,18 @@
                           (str message "\n#### Manual followup required. ####")
                           "The technology does not synchronize."))))

+(defn- perf02-judicious-use-of-indexed-properties
+  [source content-index]
+  (let [matches (filter #(= :perf02 (:regex-id %)) content-index)
+        message (str "Indexed content model properties:\n"
+                     (s/join "\n"
+                             (map #(str (subs (str (:file %)) (.length ^String source)) " line " (:line-number %) ": " (:line %))
+                                  matches)))]
+      (build-bookmark-map "PERF02"
+                          (empty? matches)
+                          (str message "\n#### Manual followup required. ####")
+                          "The technology does not index any content model properties.")))
+
 (defn validate
   "Runs all source-based validations."
   [source]
@@ -142,11 +158,12 @@
         file-index    (build-file-types-index files)
         content-index (build-content-index file-index)]
     (merge
-      (detect-build-tools                        file-index)
-      (module-versions                           content-index)
-      (alfresco-min-versions                     content-index)
-      (alfresco-max-versions                     content-index)
-      (stb08-stb09-use-of-synchronized           source content-index)
-      (api05-inject-serviceregistry-not-services source content-index)
+      (detect-build-tools                         file-index)
+      (module-versions                            content-index)
+      (alfresco-min-versions                      content-index)
+      (alfresco-max-versions                      content-index)
+      (stb08-stb09-use-of-synchronized            source content-index)
+      (api05-inject-serviceregistry-not-services  source content-index)
+      (perf02-judicious-use-of-indexed-properties source content-index)
     )))


Add bi-weekly to footer for other week frequency.

--- src/oc/email/content.clj
+++ src/oc/email/content.clj
@@ -447,6 +447,7 @@
               (case (s/lower-case frequency)
                 "quarter" "quarterly"
                 "month" "monthly"
+                "other week" "bi-weekly"
                 ;:else
                 "weekly")
               " reminder. You can adjust or turn off reminders in ")


z-test

z-test

--- statspop/src/statspop/math/stats.cljs
+++ statspop/src/statspop/math/stats.cljs
@@ -15,6 +15,13 @@
         sqn (.sqrt js/Math (count observations))]
     (/ (m - hypothesis) (/ sd sqn))))

+(defn z-statistic
+  "hypothesis = ostensible population mean
+  observations = vector"
+  [observations hypothesis]
+  (let [m (mean observations)
+        sd (stdev observations)]
+    (/ (m - hypothesis) sd)))

 ;; generate p-values from standard distributions.  UNTESTED beyond api test on front page (which may be fine)

@@ -30,15 +37,17 @@
   ([test-stat tail]
   (let [one-tailed (js/jStat.normal.cdf test-stat 0 1)]
     (if (= 1 tail) one-tailed (* 2 one-tailed))))
-  ([test-stat mean sd tails]
-   (let [one-tailed (js/jStat.normal.cdf test-stat mean sd)]
+  ([test-stat distro-mean distro-sd tails]
+   (let [one-tailed (js/jStat.normal.cdf test-stat distro-mean distro-sd)]
      (if (= 1 tail) one-tailed (* 2 one-tailed)))))

 ;; actual hypothesis tests.  These are probably the only ones that should be treated as "public" and ever make it to other namespaces.

 (defn t-test
-  "conduct one-sample t-test. defaults to hypothesized mean = zero and two-tailed test; takes map of opts including :tail (1 or 2) and :hypothesis. default are double-tail and hypothesis = 0"
+  "conduct one-sample t-test. defaults to hypothesized mean = zero and two-tailed test
+
+  takes map of opts including :tail (1 or 2) and :hypothesis."
   ([observations]
    (let [t-stat (t-statistic observations 0)
          df (- (count observations) 1)]
@@ -48,3 +57,16 @@
          df (- (count observations) 1)
          tail (:tail opts 2)]
      (t->p t-stat df tail))))
+
+(defn z-test
+  "conduct one-sample z-test. defaults to hypothesized mean = zero, two-tailed test, normal distribution with mean 0 and sd 1
+  takes map of opts including :tail (1 or 2), :hypothesis, :mean (of distro), :sd (ditto)."
+  ([observations]
+   (let [z-stat (z-statistic observations 0)]
+     (z->p z-stat 2)))
+  ([observations opts]
+   (let [z-stat (z-statistic observations (:hypothesis opts 0))
+         tail (:tail opts 2)
+         distro-mean (:mean opts 0)
+         distro-sd (:sd opts 1)]
+     (z->p z-stat distro-mean distro-sd tail))))


run connect fn in sync with booting

run connect fn in sync with booting

--- src/overtone/sc/core.clj
+++ src/overtone/sc/core.clj
@@ -292,7 +292,7 @@
        (log/debug "Booting SuperCollider internal server (scsynth)...")
        (.start sc-thread)
        (dosync (ref-set server-thread* sc-thread))
-       (on-event :booted ::internal-boot-connector #(connect))
+       (on-sync-event :booted ::internal-boot-connector #(connect))
        :booting))))

 (defn- sc-log


tidy whitespace

tidy whitespace

--- src/overtone/sc/node.clj
+++ src/overtone/sc/node.clj
@@ -102,9 +102,9 @@
 (defn node
   "Instantiate a synth node on the audio server.  Takes the synth name
   and a map of argument name/value pairs.  Optionally use target
-  <node/group-id> and position <pos> to specify where the node should
-  be located.  The position can be one
-  of :head, :tail :before, :after, or :replace.
+  <node/group-id> and position <pos> to specify where the node should be
+  located.  The position can be one of :head, :tail :before, :after,
+  or :replace.

   (node \"foo\")
   (node \"foo\" {:pitch 60})
@@ -253,7 +253,7 @@
   "Place a node :before or :after another node."
   [node position target]
   (ensure-connected!)
-  (let [node-id (to-synth-id node)
+  (let [node-id   (to-synth-id node)
         target-id (to-synth-id target)]
     (cond
       (= :before position) (snd "/n_before" node-id target-id)
@@ -274,7 +274,7 @@
   {:freq 440.0 :attack 0.2}"
   [node names]
   (ensure-connected!)
-  (let [res (recv "/n_set")
+  (let [res   (recv "/n_set")
         cvals (do (apply snd "/s_get" (to-synth-id node) (stringify names))
                   (:args (deref! res)))]
     (apply hash-map (keywordify (drop 1 cvals)))))
@@ -293,7 +293,7 @@
   Returns a vector of values."
   [node name-index n]
   (ensure-connected!)
-  (let [res (recv "/n_setn")
+  (let [res   (recv "/n_setn")
         cvals (do (snd "/s_getn" (to-synth-id node) (to-str name-index) n)
                   (:args (deref! res)))]
     (vec (drop 3 cvals))))
@@ -310,7 +310,7 @@
   "Connect a node's controls to a control bus."
   [node names-busses]
   (ensure-connected!)
-  (let [node-id (to-synth-id node)
+  (let [node-id      (to-synth-id node)
         names-busses (bussify (stringify names-busses))]
     (apply snd "/n_map" node-id names-busses)))

@@ -336,7 +336,7 @@
   [group node]
   (ensure-connected!)
   (let [group-id (to-synth-id group)
-        node-id (to-synth-id node)]
+        node-id  (to-synth-id node)]
     (snd "/g_head" group-id node-id)))

 (defn- group-append-node*
@@ -344,7 +344,7 @@
   [group node]
   (ensure-connected!)
   (let [group-id (to-synth-id group)
-        node-id (to-synth-id node)]
+        node-id  (to-synth-id node)]
     (snd "/g_tail" group-id node-id)))

 (defn- group-clear*
@@ -486,9 +486,9 @@
   [id ctls?]
   (let [sname (first *node-tree-data*)]
     (if ctls?
-      (let [n-ctls (second *node-tree-data*)
+      (let [n-ctls              (second *node-tree-data*)
             [ctl-data new-data] (split-at (* 2 n-ctls) (nnext *node-tree-data*))
-            ctls (apply hash-map ctl-data)]
+            ctls                (apply hash-map ctl-data)]
         (set! *node-tree-data* new-data)
         {:type :synth
          :name sname
@@ -504,21 +504,21 @@
   (let [[id n-children & new-data] *node-tree-data*]
     (set! *node-tree-data* new-data)
     (cond
-      (neg? n-children)
-      (parse-synth-tree id ctls?) ; synth
-
-      (= 0 n-children)
-      {:type :group
-       :id id
-       :name (get-in @active-synth-nodes* [id :group] "Unknown Group")
-       :children nil}
-
-      (pos? n-children)
-      {:type     :group
-       :id       id
-       :name     (get-in @active-synth-nodes* [id :group] "Unknown Group")
-       :children (doall (map (fn [i] (parse-node-tree-helper ctls?))
-                             (range n-children)))})))
+     (neg? n-children)
+     (parse-synth-tree id ctls?)        ; synth
+
+     (= 0 n-children)
+     {:type :group
+      :id id
+      :name (get-in @active-synth-nodes* [id :group] "Unknown Group")
+      :children nil}
+
+     (pos? n-children)
+     {:type     :group
+      :id       id
+      :name     (get-in @active-synth-nodes* [id :group] "Unknown Group")
+      :children (doall (map (fn [i] (parse-node-tree-helper ctls?))
+                            (range n-children)))})))

 (defn- parse-node-tree
   [data]
@@ -533,10 +533,10 @@
   ([id & [ctls?]]
      (ensure-connected!)
      (let [ctls? (if (or (= 1 ctls?) (= true ctls?)) 1 0)
-           id (to-synth-id id)]
+           id    (to-synth-id id)]
        (let [reply-p (recv "/g_queryTree.reply")
-             _ (snd "/g_queryTree" id ctls?)
-             tree (:args (deref! reply-p))]
+             _       (snd "/g_queryTree" id ctls?)
+             tree    (:args (deref! reply-p))]
          (with-meta (parse-node-tree tree)
            {:type ::node-tree})))))


Display group names in #'node-tree

Display group names in #'node-tree

--- src/overtone/sc/node.clj
+++ src/overtone/sc/node.clj
@@ -473,10 +473,19 @@
   (let [[id n-children & new-data] *node-tree-data*]
     (set! *node-tree-data* new-data)
     (cond
-      (neg? n-children) (parse-synth-tree id ctls?) ; synth
-      (= 0 n-children) {:type :group :id id :children nil}
+      (neg? n-children)
+      (parse-synth-tree id ctls?) ; synth
+
+      (= 0 n-children)
+      {:type :group
+       :id id
+       :name (get-in @active-synth-nodes* [id :group] "Unknown Group")
+       :children nil}
+
       (pos? n-children)
-      {:type :group :id id
+      {:type     :group
+       :id       id
+       :name     (get-in @active-synth-nodes* [id :group] "Unknown Group")
        :children (doall (map (fn [i] (parse-node-tree-helper ctls?)) (range n-children)))})))

 (defn- parse-node-tree


correct outdated docstring

correct outdated docstring

--- src/overtone/sc/synth.clj
+++ src/overtone/sc/synth.clj
@@ -250,13 +250,7 @@
 (defmacro synth
   "Define a SuperCollider synthesizer using the library of ugen functions
   provided by overtone.sc.ugen.  This will return an anonymous function which
-  can be used to trigger the synthesizer.  If the synth has an audio rate ugen
-  that is not an 'Out' ugen, then a prefix will be appended.  By default: (out
-  (pan2 synth)).  You can change it by passing a function to
-  (set-synth-prefix my-prefix-fn), which will then be called with a synth ugen
-  tree as it's single argument.
-
-  (synth (sin-osc (+ 300 (* 10 (sin-osc:kr 10)))))
+  can be used to trigger the synthesizer.
   "
   [& args]
   `(let [[sname# params# ugens# constants#] (pre-synth ~@args)


clean up docstrings

clean up docstrings

--- src/overtone/sc/ugens.clj
+++ src/overtone/sc/ugens.clj
@@ -1,25 +1,78 @@
-(ns
-    ^{:doc "Namespace containing fns to generate UGens, or Unit Generators. These are the functions that act as DSP nodes in the synthesizer definitions used by SuperCollider.  We generate the UGen functions based on hand written metadata about each ugen (ugen directory). (Eventually we hope to get this information dynamically from the server.)"
+(ns ^{:doc "Namespace containing fns to generate UGens, or Unit
+    Generators. These are the functions that act as DSP nodes in the
+    synthesizer definitions used by SuperCollider.  We generate the UGen
+    functions based on hand written metadata about each ugen (ugen
+    directory). (Eventually we hope to get this information dynamically
+    from the server.)"
       :author "Jeff Rose & Christophe McKeon"}
   overtone.sc.ugens
   (:use [overtone.sc.machinery.ugen fn-gen]))

 ;; Done actions are typically executed when an envelope ends, or a sample ends
-(def NO-ACTION              "Do nothing when the ugen is finished" 0)
-(def PAUSE                  "Pause the enclosing synth, but do not free it" 1)
-(def FREE                   "Free the enclosing synth" 2)
-(def FREE-AND-BEFORE        "Free both this synth and the preceding node" 3)
-(def FREE-AND-AFTER         "Free both this synth and the following node" 4)
-(def FREE-AND-GROUP-BEFORE  "Free this synth; if the preceding node is a group then do g_freeAll on it, else free it" 5)
-(def FREE-AND-GROUP-AFTER   "Free this synth; if the following node is a group then do g_freeAll on it, else free it" 6)
-(def FREE-UPTO-THIS         "Free this synth and all preceding nodes in this group" 7)
-(def FREE-FROM-THIS-ON      "Free this synth and all following nodes in this group" 8)
-(def FREE-PAUSE-BEFORE      "Free this synth and pause the preceding node" 9)
-(def FREE-PAUSE-AFTER       "Free this synth and pause the following node" 10)
-(def FREE-AND-GROUP-BEFORE-DEEP "Free this synth and if the preceding node is a group then do g_deepFree on it, else free it" 11)
-(def FREE-AND-GROUP-AFTER-DEEP "Free this synth and if the following node is a group then do g_deepFree on it, else free it" 12)
-(def FREE-CHILDREN          "Free this synth and all other nodes in this group (before and after)" 13)
-(def FREE-GROUP             "Free the enclosing group and all nodes within it (including this synth)" 14)
+(def NO-ACTION
+  "Do nothing when the ugen is finished"
+  0)
+
+(def PAUSE
+  "Pause the enclosing synth, but do not free it"
+  1)
+
+(def FREE
+  "Free the enclosing synth"
+  2)
+
+(def FREE-AND-BEFORE
+  "Free both this synth and the preceding node"
+  3)
+
+(def FREE-AND-AFTER
+  "Free both this synth and the following node"
+  4)
+
+(def FREE-AND-GROUP-BEFORE
+  "Free this synth; if the preceding node is a group then do g_freeAll
+   on it, else free it"
+  5)
+
+(def FREE-AND-GROUP-AFTER
+  "Free this synth; if the following node is a group then do g_freeAll
+   on it, else free it"
+  6)
+
+(def FREE-UPTO-THIS
+  "Free this synth and all preceding nodes in this group"
+  7)
+
+(def FREE-FROM-THIS-ON
+  "Free this synth and all following nodes in this group"
+  8)
+
+(def FREE-PAUSE-BEFORE
+  "Free this synth and pause the preceding node"
+  9)
+
+(def FREE-PAUSE-AFTER
+  "Free this synth and pause the following node"
+  10)
+
+(def FREE-AND-GROUP-BEFORE-DEEP
+  "Free this synth and if the preceding node is a group then do
+  g_deepFree on it, else free it"
+  11)
+
+(def FREE-AND-GROUP-AFTER-DEEP
+  "Free this synth and if the following node is a group then do
+ g_deepFree on it, else free it"
+  12)
+
+(def FREE-CHILDREN
+  "Free this synth and all other nodes in this group (before and after)"
+  13)
+
+(def FREE-GROUP
+  "Free the enclosing group and all nodes within it (including this
+   synth)"
+  14)

 ;;FFT Windows
 (def SINE        0)
@@ -46,8 +99,9 @@

 (defmacro with-overloaded-ugens
-  "Bind symbols for all overloaded ugens (i.e. + - / etc.) to the overloaded fn
-  in the ns overtone.sc.ugen-colliders. These fns will revert back to original
+  "Bind symbols for all overloaded ugens (i.e. + - / etc.) to the
+  overloaded fn in the ns overtone.sc.ugen-colliders. These fns will
+  revert back to original
   (Clojure) semantics if not passed with ugen args. "
   [& body]
   (let [bindings (flatten (map (fn [[orig overload]]
@@ -56,7 +110,8 @@
     `(let [~@bindings]
        ~@body)))

-;; We refer all the ugen functions here so they can be access by other parts
-;; of the Overtone system using a fixed namespace.  For example, to automatically
-;; stick an Out ugen on synths that don't explicitly use one.
+;; We refer all the ugen functions here so they can be access by other
+;; parts of the Overtone system using a fixed namespace.  For example,
+;; to automatically stick an Out ugen on synths that don't explicitly
+;; use one.
 (defonce _ugens (intern-ugens))


Skip :done segment.

Skip :done segment.

--- src/onyx/peer/transform.clj
+++ src/onyx/peer/transform.clj
@@ -19,9 +19,11 @@
     (read-string segment)))

 (defn apply-fn [task segment]
-  (let [user-ns (symbol (name (namespace (:onyx/fn task))))
-        user-fn (symbol (name (:onyx/fn task)))]
-    ((ns-resolve user-ns user-fn) segment)))
+  (if (= segment :done)
+    :done
+    (let [user-ns (symbol (name (namespace (:onyx/fn task))))
+          user-fn (symbol (name (:onyx/fn task)))]
+      ((ns-resolve user-ns user-fn) segment))))

 (defn compress-segment [segment]
   (pr-str segment))


load_all.clj: added internal.application

--- src/org/altlaw/load_all.clj
+++ src/org/altlaw/load_all.clj
@@ -1,5 +1,7 @@
 (ns org.altlaw.load-all
   (:require
+   org.altlaw.internal.application
+
    org.altlaw.test.run

    org.altlaw.util.context


adding network cfg

adding network cfg

--- src/proxmox/provider.clj
+++ src/proxmox/provider.clj
@@ -96,7 +96,9 @@
   [node ip_address {:keys [gateway] :as network} vmid]
   (let [temp (temp-dir "update-interfaces") ifcfg (<< "~(.getPath temp)/ifcfg-eth0") net (<< "~(.getPath temp)/network")]
     (spit ifcfg (redhat-ifcfg-eth0 (merge {:ip ip_address} network)))
-    (copy ifcfg (<< "/var/lib/vz/private/~{vmid}/etc/sysconfig/network-scripts/") (get-node node))))
+    (spit net (redhat-network-cfg (merge {:ip ip_address} network)))
+    (copy ifcfg (<< "/var/lib/vz/private/~{vmid}/etc/sysconfig/network-scripts/") (get-node node))
+    (copy net (<< "/var/lib/vz/private/~{vmid}/etc/sysconfig/") (get-node node))))

 (defn- debian-network
   "debian bridged networking update"


Now sending moderation through stormspec

--- src/polismath/stormspec.clj
+++ src/polismath/stormspec.clj
@@ -78,12 +78,7 @@
               ; First construct a new conversation builder. Then either find a conversation, or call that
               ; builder in conv-agency
               conv-actor (cm/get-or-set! conv-agency zid #(cm/new-conv-actor (partial cm/load-or-init zid :recompute recompute)))]
-          (case type
-            :votes
-              (cm/snd conv-actor [type batch])
-            :moderation
-              ;(cm/send-mods conv-actor {:last-mod-timestamp last-timestamp :moderations})))
-              nil)) ;do nothing for now
+          (cm/snd conv-actor [type batch]))
         (ack! collector tuple)))))


Fix starting viewport pos

Fix starting viewport pos

--- src/robinson/worldgen.clj
+++ src/robinson/worldgen.clj
@@ -223,12 +223,12 @@
         inventory-with-hotkeys (vec (map #(assoc %1 :hotkey %2) inventory (first hotkey-groups)))
         remaining-hotkeys      (set (clojure.string/join (second hotkey-groups)))
         ;; calculate place-id and viewport position using minimal state information
-        place-id               (xy->place-id {:world {:viewport {:width width :height height}}} x y)

         starting-pos           (find-starting-pos seed max-x max-y)
         viewport-state         {:world {:viewport {:width width :height height}}}
-        [vx vy]                (place-id->anchor-xy viewport-state
-                                                    (apply xy->place-id viewport-state (pos->xy starting-pos)))
+        place-id               (apply xy->place-id viewport-state (pos->xy starting-pos))
+        [sx sy]                (pos->xy starting-pos)
+        [vx vy]                [(int (- sx (/ width 2))) (int (- sy (/ height 2)))]
         _ (debug "starting-pos" starting-pos)
         place-0                (init-island seed vx vy width height max-x max-y)
         fruit-ids              [:red-fruit :orange-fruit :yellow-fruit :green-fruit :blue-fruit :purple-fruit :white-fruit :black-fruit]


Added remove-comments

Added remove-comments

--- src/semantic_csv/core.clj
+++ src/semantic_csv/core.clj
@@ -41,9 +41,16 @@
 ;;              '[clojure-csv :as csv]
 ;;              '[clojure.java.io :as io])
 ;;
-;; Now let's take a tour through some of the processing functions we have available.
+;; Now let's take a tour through some of the processing functions we have available, starting with the reader
+;; functions.
+
+;; <br/>

+
+;; # Reader functions
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
 ;; ## mappify-row

 (defn mappify-row
@@ -76,6 +83,45 @@
 ;;     ({:this "# some comment lines..."}
 ;;      {:this "1", :that "2", :more "stuff"}
 ;;      {:this "2", :that "3", :more "other yeah"})
+;;
+;; Note that "# some comment lines..." was really intended to be left out of the _data_ as a comment.
+;; We can solve this with the following function:
+
+;; ## remove-comments
+
+(defn remove-comments
+  "Removes rows which start with a comment character (by default, `#`). Operates by checking the regular
+  expression against the first argument of every row in the collection."
+  ([rows]
+   (remove-comments #"^\#" rows))
+  ([comment-re rows]
+   (remove
+     (fn [row]
+       (let [x (first row)]
+         (when x
+           (re-find comment-re x)))))))
+
+;; Let's see this in action with the above code:
+;;
+;;     => (with-open [in-file (io/reader "test/test.csv")]
+;;          (doall
+;;            (->>
+;;              (csv/parse-csv in-file)
+;;              remove-comments
+;;              mappify)))
+;;
+;;     ({:this "1", :that "2", :more "stuff"}
+;;      {:this "2", :that "3", :more "other yeah"})
+;;
+;; Much better :-)
+;;
+;; [**Sidenote**: it feels awkward to me that this operates _after_ the initial parsing step has already taken
+;; place.
+;; However, it's not clear how you would do this safely;
+;; It seems you have to make assumptions about how  things are going into the parsing function, which I'd
+;; rather avoid.]
+
+

 (defn read-csv-rows
   "Given a `lines` collection, produces a seq of maps (`colname -> val`) where the column names are
@@ -129,7 +175,7 @@

-;; ## Some parsing functions for your convenience
+;; # Some parsing functions for your convenience
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
 ;; These functions can be imported and used in your `:cast-fns` specification
@@ -145,3 +191,8 @@
   (Float/parseFloat string))

+;; # Writer functions
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+
+


remove old twitter file

remove old twitter file

--- markov-clj/src/twitter/twitter.clj
+++ markov-clj/src/twitter/twitter.clj
@@ -1,31 +0,0 @@
-(ns markov-clj.twitter
-  (:use
-   [twitter.oauth]
-   [twitter.callbacks]
-   [twitter.callbacks.handlers]
-   [twitter.api.restful]
-   [twitter.request])
-  (:import
-   (twitter.callbacks.protocols SyncSingleCallback)))
-
-
-(def my-creds (apply make-oauth-creds
-                     (clojure.string/split-lines
-                      (slurp "twitter_auth.txt"))))
-
-; simply retrieves the user, authenticating with the above credentials
-; note that anything in the :params map gets the -'s converted to _'s
-(defn- get-tweets [user-id] (->>
-                               (get-page user-id)
-                               (map :text)))
-
-(defn- get-page [user-id & since-id]
-  (:body (statuses-user-timeline :oauth-creds my-creds
-                                 :params {:screen-name user-id
-                                          :count 200
-                                          :include-rts "false"})))
-
-(get-tweets "bbombgardener")
-
-(statuses-update :oauth-creds my-creds
-                 :params {:status "Hello, world!"})


Fix fetching of JWT in Resource.

Fix fetching of JWT in Resource.

--- src/event_data_event_bus/server.clj
+++ src/event_data_event_bus/server.clj
@@ -40,7 +40,7 @@
   :allowed-methods [:get]
   :available-media-types ["application/json"]
   :authorized? (fn [ctx]
-                (:jwt-claims ctx))
+                (-> ctx :request :jwt-claims))
   :handle-ok {"status" "ok"})

 (defroutes app-routes


Don't overwrite meta of job-fn.

Don't overwrite meta of job-fn.

--- src/fhofherr/simple/core/job_fn.clj
+++ src/fhofherr/simple/core/job_fn.clj
@@ -97,4 +97,4 @@
                   (apply-step before false)
                   (apply-step test false)
                   (apply-step after true))))]
-    (with-meta job {::job-fn? true})))
+    (vary-meta job assoc ::job-fn? true)))


trying to fix some issues

trying to fix some issues

--- src/kushana/examples/tictactoe.cljs
+++ src/kushana/examples/tictactoe.cljs
@@ -7,7 +7,7 @@

 (defn line [points]
   {:scene/component :mesh/lines
-   :name "l1"
+   :name "line"
    :points points
    :color (c3 0 0 0)})

@@ -54,9 +54,8 @@
 (defn color-board [scene winner]
   (let [new-color   (cond (= :x winner) (c3 1 0 0)
                           (= :o winner) (c3 0 0 1))
-        [lid light] (->name scene "light")
-        new-light   (assoc light :groundColor new-color)]
-    (assoc-in scene [:scene-graph lid] new-light)))
+        [lid light] (->name scene "light")]
+    (assoc-in scene [:scene-graph lid :groundColor] new-color)))

 (defn three-in-row [key
                {tl [0 0] t  [1 0] tr [2 0]
@@ -73,16 +72,17 @@
 (defn decide-winner [board]
   (cond (three-in-row :x board) (assoc board :winner :x)
         (three-in-row :o board) (assoc board :winner :o)
-        :else (assoc board :winner :none)))
+        :else (assoc board :winner nil)))

 (defn handle-win [scene]
   (let [[id board] (->name scene "state")
-        board (decide-winner board)
-        winner (:winner board)]
+        board     (decide-winner board)
+        winner     (:winner board)]
     (if (or (= :x winner) (= :o winner))
       (-> scene
+          (assoc-in [:scene-graph id] board)
           (color-board winner)
-          (assoc-in [:scene-graph id] (assoc board :winner :done)))
+          (assoc-in [:scene-graph id :winner] :done))
       scene)))

 (defmiddleware game-logic [scene inputs]
@@ -94,6 +94,7 @@
                    (>= x 0) (>= z 0) (< x 3) (< z 3))
                 (take-turn id scene pos)
                 scene)]
+    (println "hi")
     (handle-win scene)))

 (def update-fn (lay debug reload game-logic))


Windows 10 fixes

Windows 10 fixes

The IP address needs to come from the local host address, just like on
Mac OS X.  Path names need to be specified using forward slashes (like
on UNIX), so that we do not mix forward and backward slashes in the same
path name.

--- resources/leiningen/new/exponent/env/dev/user.clj
+++ resources/leiningen/new/exponent/env/dev/user.clj
@@ -32,7 +32,7 @@
 (defn get-lan-ip
   []
   (cond
-    (= "Mac OS X" (System/getProperty "os.name"))
+    (some #{(System/getProperty "os.name")} ["Mac OS X" "Windows 10"])
     (.getHostAddress (java.net.InetAddress/getLocalHost))

     :else
@@ -71,8 +71,8 @@
   (let [modules (->> (file-seq (io/file "assets"))
                      (filter #(and (not (re-find #"DS_Store" (str %)))
                                    (.isFile %)))
-                     (map (fn [file] (when-let [path (str file)]
-                                      (str "../../" path))))
+                     (map (fn [file] (when-let [unix-path (->> file .toPath .iterator iterator-seq (str/join "/"))]
+                                      (str "../../" unix-path))))
                      (concat js-modules ["react" "react-native" "expo"])
                      (distinct))
         modules-map (zipmap


Fix most test cases.

Fix most test cases.

--- test/boefie_invest/db/schema_test.clj
+++ test/boefie_invest/db/schema_test.clj
@@ -20,7 +20,7 @@
                       (re-find #"UNIQUE constraint" (.getMessage e))))
            (throw e)))))

-(defn add-security [sec]
+(defn add-security [db-spec sec]
   (do (try-insert! db-spec :isins {:isin (sec :isin)})
       (try-insert! db-spec :securities (assoc sec :date_added (to-sql-time (:date_added sec))))))