AMPS, floats, strings.

AMPS, floats, strings.

--- src/clojush/problems/classification/penn.clj
+++ src/clojush/problems/classification/penn.clj
@@ -30,7 +30,7 @@
     (println "Total number of data lines:" (count lines))
     (mapv #(mapv read-string %) lines)))

-(def training-proportion 0.5) ;; proportion of training cases to use each generation
+(def training-proportion 0.1) ;; proportion of training cases to use each generation

 (defn define-fitness-cases
   "Returns a map with two keys: train and test. Train maps to a
@@ -109,12 +109,12 @@

 (def penn-atom-generators
   (vec (concat (distinct (mapv :target (:all-train @penn-fitness-cases))) ;; classes, for output
-               ;(list (tag-instruction-erc [:exec :integer :boolean :string] 1000)
-               ;      (tagged-instruction-erc 1000))
+               (list (tag-instruction-erc [:exec :integer :float :boolean :string] 1000)
+                     (tagged-instruction-erc 1000))
                (for [n (map inc
                             (range (count (:inputs (first (:train @penn-fitness-cases))))))]
                  (symbol (str "in" n)))
-               (registered-for-stacks [:exec :integer :boolean]))))
+               (registered-for-stacks [:exec :integer :float :boolean :string]))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Main call
@@ -128,10 +128,11 @@
    :population-size 1000
    :max-generations 300
    :parent-selection :lexicase
-   :genetic-operator-probabilities {:alternation 0.2
-                                    :uniform-mutation 0.2
+   :genetic-operator-probabilities {:alternation 0.4 ;*** 0.2
+                                    :uniform-mutation 0.4 ;*** 0.2
                                     :uniform-close-mutation 0.1
-                                    [:alternation :uniform-mutation] 0.5
+                                    ;*** [:alternation :uniform-mutation] 0.4
+                                    :genesis 0.1 ;***
                                     }
    :alternation-rate 0.01
    :alignment-deviation 10
@@ -141,6 +142,8 @@
    ;:print-behavioral-diversity true ;; requires maintaining @population-behaviors
    :report-simplifications 0
    :final-report-simplifications 5000
+   :age-mediated-parent-selection [0.05 0.5] ;***
+   :age-combining-function :proportionate ;***
    })


Uniform.

Uniform.

--- src/clojush/problems/classification/penn.clj
+++ src/clojush/problems/classification/penn.clj
@@ -130,12 +130,16 @@
    :population-size 1000
    :max-generations 300
    :parent-selection :lexicase
-   :genetic-operator-probabilities {:alternation 0.4 ;*** 0.2
-                                    :uniform-mutation 0.4 ;*** 0.2
-                                    :uniform-close-mutation 0.1
-                                    ;*** [:alternation :uniform-mutation] 0.4
-                                    :genesis 0.1 ;***
-                                    }
+   ;:genetic-operator-probabilities {:alternation 0.4 ;*** 0.2
+   ;                                 :uniform-mutation 0.4 ;*** 0.2
+   ;                                 :uniform-close-mutation 0.1
+   ;                                 ;*** [:alternation :uniform-mutation] 0.4
+   ;                                 :genesis 0.1 ;***
+   ;                                 }
+   :genetic-operator-probabilities {:uniform-addition-and-deletion 0.5
+                                    :uniform-combination-and-deletion 0.5}
+   :uniform-addition-and-deletion-rate [1 1/2 1/4 1/8 1/16 1/32 1/64 1/128]
+   :uniform-combination-and-deletion-rate [1 1/2 1/4 1/8 1/16 1/32 1/64 1/128]
    :alternation-rate 0.01
    :alignment-deviation 10
    :uniform-mutation-rate 0.01
@@ -144,12 +148,13 @@
    ;:print-behavioral-diversity true ;; requires maintaining @population-behaviors
    :report-simplifications 0
    :final-report-simplifications 5000
-   :age-mediated-parent-selection [0.05 0.5] ;***
-   :age-combining-function :first-reuse ;***
-   :autoconstructive true
-   :autoconstructive-genome-instructions :uniform
-   :autoconstructive-diversification-test :three-gens-size-and-instruction
-   :autoconstructive-si-children 2
-   :autoconstructive-entropy 0.1
+   :age-mediated-parent-selection [0.05 0.5]
+   :age-combining-function :proportionate
+   ;:age-combining-function :first-reuse
+   ;:autoconstructive true
+   ;:autoconstructive-genome-instructions :uniform
+   ;:autoconstructive-diversification-test :three-gens-size-and-instruction
+   ;:autoconstructive-si-children 2
+   ;:autoconstructive-entropy 0.1
    })


Use block-forever! from shared utils

Use block-forever! from shared utils

--- src/desdemona/launcher/launch_prod_peers.clj
+++ src/desdemona/launcher/launch_prod_peers.clj
@@ -1,5 +1,5 @@
 (ns desdemona.launcher.launch-prod-peers
-  (:require [clojure.core.async :refer [<!! chan]]
+  (:require [desdemona.launcher.utils :as utils]
             [aero.core :as aero]
             [taoensso.timbre :as t]
             [clojure.java.io :as io]
@@ -48,5 +48,4 @@
                           (onyx.api/shutdown-peer-group peer-group)
                           (shutdown-agents)))
     (println "Started peers. Blocking forever.")
-    ;; Block forever.
-    (<!! (chan))))
+    (utils/block-forever!)))


Update react-bootstrap

Update react-bootstrap

--- build.boot
+++ build.boot
@@ -10,7 +10,7 @@
    [boot-codox "0.10.1" :scope "test"]
    [cljsjs/clipboard "1.5.9-0"]
    [cljsjs/react "15.3.1-0"]
-   [cljsjs/react-bootstrap "0.29.2-0"]
+   [cljsjs/react-bootstrap "0.30.6-0"]
    [cljsjs/react-dom "15.3.1-0"]
    [cljsjs/react-dom-server "15.3.1-0"]
    [com.cemerick/piggieback "0.2.1" :scope "test"]


Update cheshire

Update cheshire

--- build.boot
+++ build.boot
@@ -6,7 +6,7 @@
  '[[org.clojure/clojure "1.8.0"]
    [clj-jgit "0.8.9"]
    [clj-http "3.0.0"]
-   [cheshire "5.5.0"]
+   [cheshire "5.6.1"]
    [throttler "1.0.0"]
    [org.slf4j/slf4j-nop "1.7.18"]
    [grimradical/clj-semver "0.3.0-20130920.191002-3" :exclusions [org.clojure/clojure]]


Bump play-cljs template again

Bump play-cljs template again

--- build.boot
+++ build.boot
@@ -7,7 +7,7 @@
                   [leiningen "2.7.0" :exclusions [leiningen.search]]
                   [ring "1.4.0"]
                   [clojail "1.0.6"]
-                  [play-cljs/lein-template "0.6.1"]])
+                  [play-cljs/lein-template "0.6.2"]])

 (task-options!
   sift {:include #{#"\.jar$"}}


Update boot-reload

Update boot-reload

--- build.boot
+++ build.boot
@@ -13,7 +13,7 @@
                   [com.cemerick/piggieback "0.2.1"     :scope "test"]
                   [weasel                 "0.7.0"      :scope "test"]
                   [org.clojure/tools.nrepl "0.2.12"    :scope "test"]
-                  [adzerk/boot-reload     "0.4.4"      :scope "test"]
+                  [adzerk/boot-reload     "0.4.5"      :scope "test"]
                   [adzerk/boot-test       "1.0.7"      :scope "test"]
                   [deraen/boot-less       "0.5.0"      :scope "test"]
                   ;; For boot-less


Dev helper task

Dev helper task

--- build.boot
+++ build.boot
@@ -35,6 +35,12 @@
    (jar)
    (install)))

+(deftask dev []
+  (comp
+    (watch)
+    (build)
+    (repl :server true)))
+
 (deftask deploy []
   (comp
    (build)


re-enable parallel build (#228)

re-enable parallel build (#228)

--- build.boot
+++ build.boot
@@ -20,7 +20,6 @@
 (require
   '[adzerk.boot-cljs      :refer [cljs]]
   '[crisptrutski.boot-cljs-test :refer [test-cljs]]
-  '[boot.pod              :as pod]
   '[boot.util             :as util]
   '[clojure.edn           :as edn]
   '[clojure.string        :as str]
@@ -156,9 +155,7 @@
                                              'lumo.core/*lumo-version* lumo-version}
                            :compiler-stats true
                            :fn-invoke-direct true
-                           ;; re-enable once https://dev.clojure.org/jira/browse/CLJS-2153
-                           ;; is fixed
-                           :parallel-build false}))
+                           :parallel-build true}))

 (deftask dev []
   (comp


Use newer repo-map target repo selection

--- build.boot
+++ build.boot
@@ -27,6 +27,7 @@
         :ensure-release true
         :ensure-clean   true
         :gpg-sign       true
+        :repo           "clojars"
         :repo-map [["clojars" {:url "https://clojars.org/repo/"}]]}
   target  {:dir #{"target"}})


Update lein

Update lein

--- build.boot
+++ build.boot
@@ -11,7 +11,7 @@
                   [cljsjs/codemirror "5.24.0-1" :scope "test"]
                   ; clj deps
                   [org.clojure/clojure "1.9.0-beta2"]
-                  [leiningen "2.7.1" :exclusions [leiningen.search]]
+                  [leiningen "2.8.0" :exclusions [leiningen.search]]
                   [ring "1.6.1"]
                   [play-cljs/lein-template "0.10.1-5"]
                   [eval-soup "1.2.3" :exclusions [org.clojure/core.async]]


Update play-cljs template

Update play-cljs template

--- build.boot
+++ build.boot
@@ -7,7 +7,7 @@
                   [leiningen "2.7.0" :exclusions [leiningen.search]]
                   [ring "1.4.0"]
                   [clojail "1.0.6"]
-                  [play-cljs/lein-template "0.6.3"]])
+                  [play-cljs/lein-template "0.6.4"]])

 (task-options!
   sift {:include #{#"\.jar$"}}


Increment version number

Increment version number

--- template/project.clj
+++ template/project.clj
@@ -1,4 +1,4 @@
-(defproject play-clj/lein-template "0.3.7.1"
+(defproject play-clj/lein-template "0.3.7.2"
   :description "A template for making play-clj projects"
   :url "https://github.com/oakes/play-clj"
   :license {:name "Public Domain"


make number of workers configurable in fsworker

use "num-workers" key from the ini file or 10 as default.

--- src/brainbot/nozzle/fsworker.clj
+++ src/brainbot/nozzle/fsworker.clj
@@ -98,29 +98,30 @@
       (mqhelper/initialize-rabbitmq-structures ch c rmq-prefix fs))))

 (defn build-handle-connection
-  [filesystems rmq-prefix]
+  [filesystems rmq-prefix num-workers]
   (fn [conn]
     (logging/info "initializing connection")
     (let [ch (lch/open conn)]
       (init-all-rmq-structures ch rmq-prefix (map :fsid filesystems))
       (lch/close ch))
     (doseq [{:keys [fsid] :as fs} filesystems
-            [command handle-msg] (seq command->msg-handler)]
+            [command handle-msg] (seq command->msg-handler)
+            _ (range num-workers)]
       (mqhelper/channel-loop
        conn
        (fn [ch]
          (let [qname (rk/routing-key-string rmq-prefix fsid command)]
-           (logging/info "starting consumer for" qname)
-           (lb/qos ch 1)
+           ;; (logging/info "starting consumer for" qname)
+           ;; (lb/qos ch 1)
            (lcons/subscribe ch qname (mqhelper/make-handler (partial handle-msg fs)))))))))

-(defrecord FSWorkerService [rmq-settings rmq-prefix filesystems thread-pool]
+(defrecord FSWorkerService [rmq-settings rmq-prefix filesystems num-workers thread-pool]
   worker/Service
   (start [this]
     (future (mqhelper/connect-loop-with-thread-pool
              rmq-settings
-             (build-handle-connection filesystems rmq-prefix)
+             (build-handle-connection filesystems rmq-prefix num-workers)
              thread-pool))))

 (def runner
@@ -130,6 +131,7 @@
     (make-object-from-section [this system section]
       (let [rmq-settings (-> system :config :rmq-settings)
             rmq-prefix (-> system :config :rmq-prefix)
+            num-workers (Integer. (get-in system [:iniconfig section "num-workers"] "10"))
             filesystems (map (fn [name] (vfs/make-filesystem system name))
                              (sys/get-filesystems-for-section system section))]
-        (->FSWorkerService rmq-settings rmq-prefix filesystems (:thread-pool system))))))
+        (->FSWorkerService rmq-settings rmq-prefix filesystems num-workers (:thread-pool system))))))


remove debug code

remove debug code

--- src/clj/dokkaa_builder/pages.clj
+++ src/clj/dokkaa_builder/pages.clj
@@ -1,5 +1,5 @@
 (ns dokkaa-builder.pages
-  (:require [cemerick.austin.repls :refer (browser-connected-repl-js)]
+  (:require [cemerick.austin.repls :refer [browser-connected-repl-js]]
             [hiccup.core :refer :all]
             [hiccup.page :as page]
             [hiccup.util :as util]))
@@ -16,5 +16,3 @@
 (defn index []
   (layout
    [:div {:id "my-app"}]))
-
-(index)


Drop the feedback component

Drop the feedback component

--- src/cljs/hyphen_keeper/core.cljs
+++ src/cljs/hyphen_keeper/core.cljs
@@ -12,14 +12,12 @@
     :spelling 1
     :word ""
     :hyphenation ""
-    :suggested-hyphenation ""
-    :feedback {:message "" :kind :none}}))
+    :suggested-hyphenation ""}))

 (def spelling (reagent/cursor app-state [:spelling]))
 (def word (reagent/cursor app-state [:word]))
 (def hyphenation (reagent/cursor app-state [:hyphenation]))
 (def suggested-hyphenation (reagent/cursor app-state [:suggested-hyphenation]))
-(def feedback (reagent/cursor app-state [:feedback]))

 (defn update-hyphenations! [f & args]
   (apply swap! app-state update-in [:hyphenations] f args))
@@ -41,23 +39,11 @@
             :response-format :json
             :keywords? true))

-(defn set-feedback! [message kind]
-  (reset! feedback {:message message :kind kind})
-  (.setTimeout js/window #(reset! feedback {:message "" :kind :none}) 2000)
-  )
-
-(defn reset-all! []
-  (set-feedback! "Word successfully added" :success)
-  (reset! word "")
-  (reset! hyphenation "")
-  (reset! suggested-hyphenation "")
-  (load-hyphenation-patterns! @spelling @word))
-
 (defn add-hyphenation-pattern!
   [pattern]
   (ajax/POST "/api/words"
              :params pattern
-             :handler (fn [] (reset-all!))
+             :handler (fn [] (load-hyphenation-patterns! @spelling @word))
              :error-handler (fn [details]
                               (.warn js/console
                                      (str "Failed to add hyphenation pattern: " details)))
@@ -205,23 +191,6 @@
        :placeholder label
        :disabled "disabled"
        :value @suggested-hyphenation}]]))
-
-(defn feedback-alert []
-  (let [msg (:message @feedback)
-        klass (if-let [kind (:kind @feedback)]
-                (str "alert alert-" (name kind))
-                "alert")]
-    [:div {:class klass :role "alert"} msg]))
-
-(defn new-hyphenation []
-  [:div.form
-   [spelling-filter]
-   [word-field]
-   [suggested-hyphenation-field]
-   [hyphenation-field]
-   [hyphenation-add-button]
-   (when (not= :none (:kind @feedback))
-     [feedback-alert])])

 (defn- button [label href disabled]
   [:a.btn.btn-default {:href href :target "_blank" :disabled disabled} label])


the lepton atom holds current topics

the lepton atom holds current topics

--- src/cljs/martenblog/buttock.cljs
+++ src/cljs/martenblog/buttock.cljs
@@ -9,7 +9,8 @@
 (def ^:private lepton (atom {:entry-count 40
                              :topic {:topics []
                                      :filter ""
-                                     :filtered-topics []}}))
+                                     :filtered-topics []
+                                     :current #{}}}))

 ;; ---------------------
 ;; logic
@@ -56,15 +57,32 @@
 ;; view
 ;; ---------------------

-(defn- page-links []
+(defn- show-page-links []
   (let [page-count (+ (quot (:entry-count @lepton) entries-per-page)
                       (if (zero? (rem (:entry-count @lepton) entries-per-page)) 0 1))
         the-links (for [p (range 1 (inc page-count))] [:a {:href (str "/entries/page/" p)
                                                            :key p} p])]
     [:div the-links]))

+(defn- show-current-topic [topic]
+  (letfn [(remove-current-topic! []
+            (let [current-topic-ids (:current (:topic @lepton))]
+              (js/console.log (str "current-topic-ids " current-topic-ids))
+              (swap! lepton assoc-in [:topic :current]
+                     (set (remove #(= (Math/floor (:id topic)) (Math/floor %))
+                                  current-topic-ids)))))]
+    [:a {:href "#" :key (:id topic)
+         :on-click remove-current-topic!} (:topic topic)]))
+
+(defn- show-current-topics []
+  (let [current-topic-ids (:current (:topic @lepton))
+        current-topics (filter #(get current-topic-ids (:id %)) (:topics (:topic @lepton)))]
+    [:div#current-topics
+     "Current:"
+     (for [t current-topics] (show-current-topic t))]))
+
 ;; take tf-change! out of this
-(defn- topic-filter []
+(defn- show-topic-filter []
   (letfn [(tf-change! [e]
             (swap! lepton assoc-in [:topic :filter] (-> e .-target .-value))
             (let [all-topics (:topics (:topic @lepton))
@@ -79,13 +97,19 @@
                :placeholder "Kill Christián"
                :value (:filter (:topic @lepton))}])))

-(defn- topic-links []
-  (let [the-links (for [t (:filtered-topics (:topic @lepton))]
-                    [:li {:key (:id t)}
-                     [:a {:href (str "/entries/topic-add/" (:id t))} (:topic t)]])]
+(defn- show-topic-link [topic]
+  (letfn [(add-current-topic! []
+            (let [current-topics (:current (:topic @lepton))]
+              (swap! lepton assoc-in [:topic :current] (conj current-topics (:id topic)))))]
+    [:li {:key (:id topic)}
+     [:a {:href "#"
+          :on-click add-current-topic!} (:topic topic)]]))
+
+(defn- show-topic-links []
+  (let [the-links (for [t (:filtered-topics (:topic @lepton))] (show-topic-link t))]
     [:div#sidebar-wrapper
      [:ul.sidebar-nav
-      [:li.sidebar-brand (topic-filter)]
+      [:li.sidebar-brand (show-topic-filter)]
       the-links]]))

 (defn buttock-page []
@@ -96,8 +120,9 @@
        [:div#header
         [:img {:src "img/gretel.jpg"}]]
        [:div.content
-        (page-links)
-        (topic-links)
+        (show-page-links)
+        (show-current-topics)
+        (show-topic-links)
         [:div#entries
          "entries!"
          [:div [:a {:href "/"} "go home"]]]]])))


thomsky: Change notes, add TODO

thomsky: Change notes, add TODO

This is the result of processing a new comment on Dave Dixon's
Reagent+DataScript Gist.

--- src/cljs/theatralia/thomsky.cljs
+++ src/cljs/theatralia/thomsky.cljs
@@ -17,8 +17,8 @@
      (reset-meta! app-db (meta conn)))))

 ;;; Credits:
-;;;  - https://gist.github.com/allgress/11348685, see here for a bit more
-;;;    discussion:
+;;;  - https://gist.github.com/allgress/11348685, though it isn't complete. See
+;;;    the comments. See here for a bit more discussion:
 ;;;    https://groups.google.com/d/topic/clojurescript/o0W57ptvPc8/discussion
 ;;;  - https://github.com/Day8/re-frame/blob/master/src/re_frame/middleware.cljs
 ;;;  - https://github.com/Day8/re-frame/blob/master/src/re_frame/core.cljs
@@ -41,6 +41,10 @@
 ;; If it wasn't repeated bind calls, you might want to exclude scratch changes
 ;; from being checked for novelties. At tag filter-scratch you can find a
 ;; commit that introduced that, but wasn't needed at the time.
+;;
+;; TODO: When all the querying gets too slow, we have to introduce some
+;;       cleverness. See the links in the credits above and
+;;       https://github.com/tonsky/datascript/pull/12. (RM 2015-09-17)
 (defn bind
   "Returns a ratom containing the result of query Q with the arguments Q-ARGS on
   the value of the database behind CONN."


Fix not calling 'build'

Fix not calling 'build'

--- src/clojure_fabric/grpc_core.clj
+++ src/clojure_fabric/grpc_core.clj
@@ -62,7 +62,8 @@
 (defn make-chaincode-invocation-spec
   ([^Chaincode$ChaincodeSpec chaincode-spec]
    (-> (Chaincode$ChaincodeInvocationSpec/newBuilder)
-       (.setChaincodeSpec chaincode-spec)))
+       (.setChaincodeSpec chaincode-spec)
+       (.build)))
   ;; FIXME: setIdGenerationAlg
   #_
   ([^Chaincode$ChaincodeSpec chaincode-spec id-generation-alg]
@@ -145,4 +146,15 @@
    (-> (ProposalPackage$Proposal/newBuilder)
        (.setHeader (.toByteString ^Common$Header header))
        (.setPayload (.toByteString ^ProposalPackage$ChaincodeProposalPayload payload))
-       (.setExtension extension))))
+       (.setExtension extension)
+       (.build))))
+
+;;;
+;;; User level functions
+;;;
+(defn make-proposal-payload [chaincode-id fcn args]
+  (assert (vector? args))
+  (->> (make-chaincode-input (mapv #(ByteString/copyFromUtf8 (str %)) `[~fcn ~@args]))
+       (make-chaincode-spec chaincode-id)
+       (make-chaincode-invocation-spec)
+       (make-chaincode-proposal-payload)))


Additional webhook code cleanup. Minor.

Additional webhook code cleanup. Minor.

--- src/coming_soon/lib/webhooks.clj
+++ src/coming_soon/lib/webhooks.clj
@@ -8,19 +8,17 @@
 (defn call
   "Send an async message for each configured webhook."
   [email referrer]
-  (let [webhooks config/webhooks]
-    (doseq [webhook (keys webhooks)]
-      (put! webhook-chan {:webhook webhook :email email :referrer referrer :config (webhooks webhook)}))))
+  (doseq [webhook (keys config/webhooks)]
+    (put! webhook-chan {:webhook webhook :email email :referrer referrer :config (get config/webhooks webhook)})))

-;; Dynamically require all configured webhook's namespaces
-(let [webhooks config/webhooks]
-  (doseq [webhook (keys webhooks)]
-    (if-let [handler (:handler (webhooks webhook))]
-      (try
-        (require (symbol handler))
-        (catch Exception e
-          (println "Warning: could not load handler for" handler)
-          (println e))))))
+;; Dynamically require each configured webhook's handler's namespace
+(doseq [webhook (keys config/webhooks)]
+  (if-let [handler (:handler (get config/webhooks webhook))]
+    (try
+      (require (symbol handler))
+      (catch Exception e
+        (println "Warning: could not load handler for" handler)
+        (println e)))))

 ;; Consume the webhook channel with 100 workers
 (doseq [n (range 100)]


Add combining view

Add combining view

--- src/discuss/components/find.cljs
+++ src/discuss/components/find.cljs
@@ -73,7 +73,9 @@
                               :value     (str (lib/prefix-name "issue-selector-") issue-id)}
                          (map #(issue-selector-view (lib/merge-react-key %) owner) (lib/get-issues))))))

-(defn form-view [_ owner]
+(defn form-view
+  "Create form to select issue and place the search."
+  [_ owner]
   (reify
     om/IInitState
     (init-state [_]
@@ -81,21 +83,34 @@
        :issue-id     (get-in @lib/app-state [:issues :uid])})
     om/IRenderState
     (render-state [_ {:keys [search-value issue-id]}]
-      (dom/div nil
-               (issue-component owner)
-               (dom/div #js {:className "input-group"}
-                        (dom/input #js {:className   "form-control"
-                                        :onChange    #(vlib/commit-component-state :search-value % owner)
-                                        :value       search-value
-                                        :placeholder "Find Statement"})
-                        (dom/span #js {:className "input-group-btn"}
-                                  (bs/button-primary #(find-statement search-value issue-id) (vlib/fa-icon "fa-search fa-fw"))))))))
+      (dom/div #js {:className "row"}
+               (dom/div #js {:className "col-md-offset-1 col-md-10"}
+                        (issue-component owner)
+                        (dom/div #js {:className "input-group"}
+                                 (dom/input #js {:className   "form-control"
+                                                 :onChange    #(vlib/commit-component-state :search-value % owner)
+                                                 :value       search-value
+                                                 :placeholder "Find Statement"})
+                                 (dom/span #js {:className "input-group-btn"}
+                                           (bs/button-primary #(find-statement search-value issue-id) (vlib/fa-icon "fa-search fa-fw")))))))))

-(defn results-view []
+(defn results-view
+  "Show results from the search."
+  []
   (reify om/IRender
     (render [_]
       (let [results (get-search-results)]
         (dom/div nil
                  (dom/h6 nil (str "Received " (count results) " " (lib/singular->plural (count results) "entry") "."))
                  (apply dom/div nil
-                        (map #(om/build item-view (lib/merge-react-key %)) results)))))))+                        (map #(om/build item-view (lib/merge-react-key %)) results)))))))
+
+(defn view
+  "Return combined view with form and results."
+  [data]
+  (reify om/IRender
+    (render [_]
+      (dom/div nil
+               (vlib/view-header "Find Statements")
+               (dom/div nil (om/build form-view data))
+               (dom/div nil (om/build results-view data))))))


Version 0.3.4-SNAPSHOT

Version 0.3.4-SNAPSHOT

--- metlog-vault/project.clj
+++ metlog-vault/project.clj
@@ -1,4 +1,4 @@
-(defproject metlog-vault "0.3.3"
+(defproject metlog-vault "0.3.4-SNAPSHOT"
   :description "Repository for long term storage of series data."

   :license {:name "Eclipse Public License"


more past-tense analysis rules

more past-tense analysis rules

--- src/babel/italiano/morphology/verbs.clj
+++ src/babel/italiano/morphology/verbs.clj
@@ -9,7 +9,14 @@
     :u {:synsem {:subcat {:1 {:agr {:number :sing
                                     :person :1st}}}
                  :infl :future}}}
-   {:p [#"^([^ ]+)erò" "$1ere"]
+
+   ;; optional second r: berro -> bere
+   {:p [#"^([^ ]+)er[r]?ò" "$1ere"]
+    :u {:synsem {:subcat {:1 {:agr {:number :sing
+                                    :person :1st}}}
+                 :infl :future}}}
+
+   {:p [#"^([^ ]+)erò" "$1iare"]
     :u {:synsem {:subcat {:1 {:agr {:number :sing
                                     :person :1st}}}
                  :infl :future}}}
@@ -18,7 +25,13 @@
     :u {:synsem {:subcat {:1 {:agr {:number :sing
                                     :person :2nd}}}
                  :infl :future}}}
-   {:p [#"^([^ ]+)erai" "$1ere"]
+
+   {:p [#"^([^ ]+)er[r]?ai" "$1ere"]
+    :u {:synsem {:subcat {:1 {:agr {:number :sing
+                                    :person :2nd}}}
+                 :infl :future}}}
+
+   {:p [#"^([^ ]+)erai" "$1iare"]
     :u {:synsem {:subcat {:1 {:agr {:number :sing
                                     :person :2nd}}}
                  :infl :future}}}
@@ -28,7 +41,12 @@
                                     :person :3rd}}}
                  :infl :future}}}

-   {:p [#"^([^ ]+)erà" "$1ere"]
+   {:p [#"^([^ ]+)er[r]?à" "$1ere"]
+    :u {:synsem {:subcat {:1 {:agr {:number :sing
+                                    :person :3rd}}}
+                 :infl :future}}}
+
+   {:p [#"^([^ ]+)erà" "$1iare"]
     :u {:synsem {:subcat {:1 {:agr {:number :sing
                                     :person :3rd}}}
                  :infl :future}}}
@@ -38,12 +56,27 @@
                                     :person :1st}}}
                  :infl :future}}}

-   {:p [#"^([^ ]+)eremo" "$1ere"]
+   {:p [#"^([^ ]+)er[r]?emo" "$1ere"]
+    :u {:synsem {:subcat {:1 {:agr {:number :plur
+                                    :person :1st}}}
+                 :infl :future}}}
+
+   {:p [#"^([^ ]+)eremo" "$1iare"]
     :u {:synsem {:subcat {:1 {:agr {:number :plur
                                     :person :1st}}}
                  :infl :future}}}

-   {:p [#"^([^ ]+)erete" "$1ere"]
+   {:p [#"^([^ ]+)erete" "$1are"]
+    :u {:synsem {:subcat {:1 {:agr {:number :plur
+                                    :person :2nd}}}
+                 :infl :future}}}
+
+   {:p [#"^([^ ]+)er[r]?ete" "$1ere"]
+    :u {:synsem {:subcat {:1 {:agr {:number :plur
+                                    :person :2nd}}}
+                 :infl :future}}}
+
+   {:p [#"^([^ ]+)erete" "$1iare"]
     :u {:synsem {:subcat {:1 {:agr {:number :plur
                                     :person :2nd}}}
                  :infl :future}}}
@@ -52,12 +85,17 @@
     :u {:synsem {:subcat {:1 {:agr {:number :plur
                                     :person :3rd}}}
                  :infl :future}}}
-   {:p [#"^([^ ]+)eranno" "$1ere"]
-    :u {:synsem {:subcat {:1 {:agr {:number :plur
-                                    :person :3rd}}}
-                 :infl :future}}}
-
-
+
+   {:p [#"^([^ ]+)er[r]?anno" "$1ere"]
+    :u {:synsem {:subcat {:1 {:agr {:number :plur
+                                    :person :3rd}}}
+                 :infl :future}}}
+
+   {:p [#"^([^ ]+)eranno" "$1iare"]
+    :u {:synsem {:subcat {:1 {:agr {:number :plur
+                                    :person :3rd}}}
+                 :infl :future}}}
+
    ])

 (def replace-patterns-past-tense
@@ -97,6 +135,18 @@

    {:p [#"^([^ ]+)ato" "$1arsi"]
     :u {:synsem {:infl :past}}}
+
+   ;; scese -> sceso -> scendere
+   {:p [#"^([^ ]+)ese" "$1eso"]
+    :u {:synsem {:subcat {:1 {:agr {:number :plur
+                                    :gender :fem}}}
+                 :infl :past}}}
+
+   ;; scesi -> sceso -> scendere
+   {:p [#"^([^ ]+)esi" "$1eso"]
+    :u {:synsem {:subcat {:1 {:agr {:number :plur
+                                    :gender :masc}}}
+                 :infl :past}}}

    {:p [#"^([^ ]+)ita" "$1ire"]
     :u {:synsem {:subcat {:1 {:agr {:number :sing
@@ -108,6 +158,16 @@
                                     :gender :fem}}}
                  :infl :past}}}

+   {:p [#"^([^ ]+)ite" "$1ire"]
+    :u {:synsem {:subcat {:1 {:agr {:number :plur
+                                    :gender :fem}}}
+                 :infl :past}}}
+
+   {:p [#"^([^ ]+)ite" "$1irsi"]
+    :u {:synsem {:subcat {:1 {:agr {:number :plur
+                                    :gender :fem}}}
+                 :infl :past}}}
+
    {:p [#"^([^ ]+)iti" "$1ire"]
     :u {:synsem {:subcat {:1 {:agr {:number :plur}}}
                  :infl :past}}}
@@ -126,25 +186,52 @@
     :u {:synsem {:subcat {:1 {:agr {:gender :fem
                                     :number :sing}}}
                  :infl :past}}}
+
    {:p [#"^([^ ]+)uta" "$1ersi"]
     :u {:synsem {:subcat {:1 {:agr {:gender :fem
                                     :number :sing}}}
                  :infl :past}}}

+   {:p [#"^([^ ]+)uta" "$1uto"]
+    :u {:synsem {:subcat {:1 {:agr {:gender :fem
+                                    :number :fem}}}
+                 :infl :past}}}
+
    {:p [#"^([^ ]+)ute" "$1ere"]
     :u {:synsem {:subcat {:1 {:agr {:gender :fem
                                     :number :sing}}}
                  :infl :past}}}
+
    {:p [#"^([^ ]+)ute" "$1ersi"]
     :u {:synsem {:subcat {:1 {:agr {:gender :fem
                                     :number :sing}}}
                  :infl :past}}}
+
+   {:p [#"^([^ ]+)ute" "$1irsi"]
+    :u {:synsem {:subcat {:1 {:agr {:gender :fem
+                                    :number :plur}}}
+                 :infl :past}}}
+
+   {:p [#"^([^ ]+)ute" "$1ire"]
+    :u {:synsem {:subcat {:1 {:agr {:number :plur
+                                    :gender :fem}}}
+                 :infl :past}}}
+
+   {:p [#"^([^ ]+)ute" "$1uto"]
+    :u {:synsem {:subcat {:1 {:agr {:gender :fem
+                                    :number :plur}}}
+                 :infl :past}}}
+

    {:p [#"^([^ ]+)uti" "$1ere"]
     :u {:synsem {:subcat {:1 {:agr {:number :plur}}}
                  :infl :past}}}

    {:p [#"^([^ ]+)uti" "$1ersi"]
+    :u {:synsem {:subcat {:1 {:agr {:number :plur}}}
+                 :infl :past}}}
+
+   {:p [#"^([^ ]+)uti" "$1ire"]
     :u {:synsem {:subcat {:1 {:agr {:number :plur}}}
                  :infl :past}}}


layout-title in title, fixes #3

layout-title in title, fixes #3

--- src/cljs/swarmpit/component/layout.cljs
+++ src/cljs/swarmpit/component/layout.cljs
@@ -59,6 +59,7 @@
                       "layout-opened"
                       "layout-closed")
         layout-title (page-title handler)]
+    (set! (. js/document -title) (str layout-title " :: swarmpit"))
     [:div {:class ["layout" layout-type]}
      [:header (header/appbar layout-title)]
      [:nav (menu/drawer layout-title)]


working on inner trace loop bindings

working on inner trace loop bindings

--- src/com/billpiel/sayid/inner_trace3.clj
+++ src/com/billpiel/sayid/inner_trace3.clj
@@ -160,7 +160,7 @@

 (defn record-trace-tree!
   [tree-atom root-path]
-  (let [children (some-> (@tree-atom root-path)
+  (let [children (some-> (@tree-atom [] #_root-path)
                          deref-children
                          :children
                          deref)]
@@ -210,13 +210,12 @@

 (defn mk-recent-tree-at-inner-path
   [path path-parents tree-atom]
-  (if (= (count path) 1) ;; TODO is this the right way to detect root?
+  (if (= (count path) 0) ;; TODO is this the right way to detect root?
     (let [new-tree (get-temp-root-tree path)]
       (push-to-tree-atom!  new-tree
                            tree-atom)
       new-tree)
-    (let [parent (produce-recent-tree-atom! (find-closest-parent path
-                                                                 path-parents)
+    (let [parent (produce-recent-tree-atom! (find-closest-parent path path-parents)
                                             path-parents
                                             tree-atom)
           new-tree (-> (trace/mk-tree :parent @parent)
@@ -337,7 +336,7 @@
                                                                      src-map
                                                                      fn-meta
                                                                      (conj path %)
-                                                                     path #_path-parent)
+                                                                     path-parent)
                                                         form)))]
       (update-in xmap
                  [:form]
@@ -396,7 +395,7 @@
                         src-map
                         fn-meta
                         path
-                        path-parent)]
+                        path)]
     (layer-xpansion-maps xmap
                          {:path-parents {path path-parent}
                           :templates {path (mk-tree-template src-map
@@ -433,7 +432,7 @@
                         src-map
                         fn-meta
                         path
-                        path-parent)]
+                        path)]
     (layer-xpansion-maps xmap
                          {:path-parents {path path-parent}
                           :templates {path (mk-tree-template src-map
@@ -499,7 +498,7 @@
                         src-map
                         fn-meta
                         path
-                        path-parent)]
+                        path)]
     (layer-xpansion-maps xmap
                          {:path-parents {path path-parent}
                           :templates {path (mk-tree-template src-map
@@ -522,7 +521,7 @@
                         src-map
                         fn-meta
                         path
-                        path-parent)]
+                        path)]
     (layer-xpansion-maps xmap
                          {:path-parents {path path-parent}
                           :templates {path (mk-tree-template src-map


Improve docstring

Improve docstring

--- src/io/aviso/rook/resources/swagger.clj
+++ src/io/aviso/rook/resources/swagger.clj
@@ -1,6 +1,7 @@
 (ns io.aviso.rook.resources.swagger
-  "Exposes a resource used to access the Swagger description for the mapped namespaces (excluding this one, and any other
-  endpoints with the :no-swagger metadata."
+  "Exposes a resource used to access the Swagger description for the mapped namespaces.
+
+  Namespaces with the :no-swagger metadata (including this one) are excluded from the generated documentation."
   {:no-swagger true
    :added      "0.1.27"}
   (:require [ring.util.response :as res]


Return random number seed on test failure

Fixes TCHECK-12

--- src/main/clojure/clojure/test/check.clj
+++ src/main/clojure/clojure/test/check.clj
@@ -48,11 +48,11 @@
           (cond
             (instance? Throwable result) (failure
                                            property result-map-rose
-                                           so-far size)
+                                           so-far size created-seed)
             result (do
                      (ct/report-trial property so-far num-tests)
                      (recur (inc so-far) rest-size-seq))
-            :default (failure property result-map-rose so-far size)))))))
+            :default (failure property result-map-rose so-far size created-seed)))))))

 (defn- smallest-shrink
   [total-nodes-visited depth smallest]
@@ -102,7 +102,7 @@
                   (recur children (gen/rose-root head) (inc total-nodes-visited) (inc depth)))))))))))

 (defn- failure
-  [property failing-rose-tree trial-number size]
+  [property failing-rose-tree trial-number size seed]
   (let [root (gen/rose-root failing-rose-tree)
         result (:result root)
         failing-args (:args root)]
@@ -110,6 +110,7 @@
     (ct/report-failure property result trial-number failing-args)

     {:result result
+     :seed seed
      :failing-size size
      :num-tests (inc trial-number)
      :fail (vec failing-args)


Remove deprecated ^

Remove deprecated ^

--- src/main/clojure/vimclojure/backend.clj
+++ src/main/clojure/vimclojure/backend.clj
@@ -168,7 +168,7 @@
                 (.getResourceAsStream (RT/baseLoader) fname))]
     (when strm
       (with-open [rdr (LineNumberReader. (InputStreamReader. strm))]
-        (dotimes [_ (dec (:line ^the-var))] (.readLine rdr))
+        (dotimes [_ (dec (:line (meta the-var)))] (.readLine rdr))
         (let [text (StringBuilder.)
               pbr (proxy [PushbackReader] [rdr]
                     (read [] (let [i (proxy-super read)]


clearing instance-id in delete for reload

--- src/aws/provider.clj
+++ src/aws/provider.clj
@@ -172,7 +172,11 @@
       (debug "deleting" instance-id)
       (delete-volumes endpoint instance-id)
       (with-ctx ec2/terminate-instances instance-id)
-      (wait-for-status this "terminated" [5 :minute])))
+      (wait-for-status this "terminated" [5 :minute])
+      ; for reload support
+      (s/update-system (spec :system-id)
+         (dissoc-in* (s/get-system (spec :system-id)) [:aws :instance-id]))
+      ))

   (stop [this]
     (with-instance-id


allow [:synsem :subcat] to be non-empty

allow [:synsem :subcat] to be non-empty

--- src/babel/engine.clj
+++ src/babel/engine.clj
@@ -28,7 +28,8 @@
 (defn generate [spec language-model & [{add-subcat :add-subcat
                                         do-enrich :do-enrich}]]
   (let [do-enrich (if do-enrich do-enrich true)
-        spec (if (= false add-subcat)
+        spec (if (or (= false add-subcat)
+                     (fail? (unify spec {:synsem {:subcat '()}})))
                spec
                (unify spec
                       {:synsem {:subcat '()}}))
@@ -49,11 +50,12 @@
                       spec))
                 (log/debug (str "post-enrich spec: " spec)))
         ]
-    (forest/generate spec
-                     (:grammar language-model)
-                     (:lexicon language-model)
-                     (:index language-model)
-                     (:morph language-model))))
+    (let [result (forest/generate spec
+                                  (:grammar language-model)
+                                  (:lexicon language-model)
+                                  (:index language-model)
+                                  (:morph language-model))]
+      result)))

 (defn generate-from-request [request]
   "respond to an HTTP client's request with a generated sentence, given the client's desired spec, language name, and language model name."


insert-value for 'serialized' column in 'lexeme' table should be wrapped in square brackets "[" .. "]"

--- src/babel/writer.clj
+++ src/babel/writer.clj
@@ -175,7 +175,8 @@
                           VALUES (?,"
                     "$$" (json/write-str (strip-refs lexeme)) "$$"
                     ",?,?)")
-               [canonical (str (serialize lexeme))
+               [canonical (str "[" (string/join " " (serialize lexeme))
+                               "]")
                 language]])))

 (defn populate-with-language [num model spec]


Fix typo

Fix typo

--- src/beicon/core.cljc
+++ src/beicon/core.cljc
@@ -112,7 +112,7 @@
   "Check if the provided object is disposable (jvm) or subscription (js)."
   [v]
   #?(:clj (instance? Disposable v)
-     :clj (instance? Subscription v)))
+     :cljs (instance? Subscription v)))

 #?(:clj
    (defn flowable?


made video-js-player responsive

made video-js-player responsive

--- src/prais2/components/video_player.cljc
+++ src/prais2/components/video_player.cljc
@@ -4,12 +4,11 @@
 ;(defn video-js-debug [s] (prn s))
 (defn video-js-debug [s] nil)

-(def init-video-js
+(def use-video-js
   {:did-mount      (fn [state]
                      #?(:cljs (assoc state
                                 ::player (.videojs js/window (:video-id (first (:rum/args state)))
-                                                   (clj->js {
-                                                             :aspect-ratio (/ 480 270) :fluid true})
+                                                   (clj->js {:aspect-ratio (/ 480 270) :fluid true})
                                                    #(video-js-debug (str (:video-id (first (:rum/args state)))
                                                                          " initialised"))))
                         :clj  state))
@@ -24,7 +23,7 @@
                      (dissoc state ::player))
    })

-(rum.core/defc video-js < init-video-js
+(rum.core/defc video-js < use-video-js
   [{:keys [video-id src controls preload poster track-src]
     :or   {controls true preload "auto" poster "" track-src nil}}]
   [:video.video-js.vjs-default-skin.vjs-big-play-centered


[Fix] using destructuring

[Fix] using destructuring

--- src/clj_elm/core.clj
+++ src/clj_elm/core.clj
@@ -204,17 +204,17 @@

 (defn -main [& args]
   (if (= (count args) 8)
-    (do
+    (let [[datap1 classidx1 header1 datap2 classidx2 header2 L n-of-cv] args]
       (printfl "Start exp\n")
-      (def dataset (atom (read-dataset (first args) (read-string (second args)) :header (read-string (nth args 2)))))
-      (printfl (str "Fin read-data " (first args) "\n"))
-      (def datasets (atom (read-dataset (nth args 3) (read-string (nth args 4)) :header (read-string (nth args 5)))))
-      (printfl (str "Fin read-data " (nth args 3) "\n"))
+      (def dataset (atom (read-dataset datap1 (read-string classidx1) :header (read-string header1))))
+      (printfl (str "Fin read-data " datap1 "\n"))
+      (def datasets (atom (read-dataset datap2 (read-string classidx2) :header (read-string header2))))
+      (printfl (str "Fin read-data " datap1 "\n"))
       (reset! dataset (data/concat-dataset @dataset @datasets))
       (printfl "Fin data concat\n")
       (reset! dataset (data/shuffle-dataset @dataset))
       (printfl "Fin data shuffle\n")
-      (let [result (cross-validate @dataset (read-string (nth args 6)) (read-string (nth args 7)))]
+      (let [result (cross-validate @dataset (read-string L) (read-string n-of-cv))]
         (printfl "Final result:\n")
         (print-exp-data result)
         (flush))


Fix compatibility with latest funcool/cuerdas version.

--- src/uxbox/main/ui/dashboard/images.cljs
+++ src/uxbox/main/ui/dashboard/images.cljs
@@ -42,7 +42,7 @@

 (defn- contains-term?
   [phrase term]
-  (str/contains? (str/lower phrase) (str/trim (str/lower term))))
+  (str/includes? (str/lower phrase) (str/trim (str/lower term))))

 (defn- filter-images-by
   [term projs]


validation bugfix

validation bugfix

--- src/dartbot/core.clj
+++ src/dartbot/core.clj
@@ -224,7 +224,6 @@

 (defn valid? [world {:keys [command bid gid payload]}]
   (case command
-    "next" (contains? world gid)
     "throw" (contains? world (find-game bid world))
     "start" true
     "delete" true


1.3-ifying examples.tg8

1.3-ifying examples.tg8

--- src/examples/tg8.clj
+++ src/examples/tg8.clj
@@ -3,8 +3,8 @@
 ;; Lee Spector, lspector@hampshire.edu, 2010

 (ns examples.tg8
-  (:require [clojush] [clojure.contrib.math])
-  (:use [clojush] [clojure.contrib.math]))
+  (:use [clojush]
+	[clojure.math.numeric-tower]))

 ;;;;;;;;;;;;
 ;; Integer symbolic regression of the y=5x^6-2x^5-5x^3+3x^2+5. This uses


pedantic renaming

pedantic renaming

--- src/fatlip/plot.cljs
+++ src/fatlip/plot.cljs
@@ -28,9 +28,9 @@
   "Calculates the relative y-positions of blocks within a class. If the class
   was compacted upward, we start at the top and walk down the class; for
   downward, at the bottom, walking up."
-  [class block-edges node-sep char-sep compacted]
+  [class block-edges node-sep char-sep compaction]
   (let [filter-set (set class)
-        rel-op ({:up + :down -} compacted)]
+        rel-op ({:up + :down -} compaction)]
     (reduce (fn [ys block]
               (let [in-class-edges (filter #(contains? filter-set (:dest %))
                                            (get block-edges block))
@@ -39,20 +39,19 @@
                                      in-class-edges)
                     block-y (if (empty? neighbor-ys)
                               0
-                              (if (= compacted :up)
+                              (if (= compaction :up)
                                 (+ (apply max neighbor-ys) node-sep)
                                 (- (apply min neighbor-ys) node-sep)))]
                 (assoc ys block block-y)))
             {}
             class)))

-
 (defn get-shift-ys
   "Calculates the relative y-positions of classes. If compacted upward, we walk
   the classes downward; for downward compaction, upward."
-  [classes block-classes class-edges node-sep char-sep rel-ys compacted]
+  [classes block-classes class-edges node-sep char-sep rel-ys compaction]
   (reduce (fn [ys class]
-            (let [rel-op ({:up + :down -} compacted)
+            (let [rel-op ({:up + :down -} compaction)
                   neighbor-ys (map #(rel-op (- (+ (get ys (get block-classes (:dest %)))
                                                   (get rel-ys (:dest %)))
                                                (get rel-ys (:src %)))
@@ -60,29 +59,28 @@
                                (get class-edges class))
                   class-y (if (empty? neighbor-ys)
                             0
-                            (if (= compacted :up)
+                            (if (= compaction :up)
                               (+ (apply max neighbor-ys) node-sep)
                               (- (apply min neighbor-ys) node-sep)))]
               (assoc ys class class-y)))
           {}
           classes))

-
 (defrecord ClassGraph [classes block-classes succs preds block-succs
-                       block-preds sources sinks aligned compacted]
+                       block-preds sources sinks alignment compaction]
   YPlottable
   (ys [this node-sep char-sep]
     (let [{:keys [classes block-classes preds succs
-                  block-preds block-succs compacted]} this
+                  block-preds block-succs compaction]} this
                   [block-edges class-edges] ({:up [block-preds preds]
-                                              :down [block-succs succs]} compacted)
+                                              :down [block-succs succs]} compaction)
                   rel-ys (reduce #(merge %1 (get-block-rel-ys %2 block-edges
                                                               node-sep char-sep
-                                                              compacted))
+                                                              compaction))
                                  {}
                                  classes)
                   shift-ys (get-shift-ys classes block-classes class-edges node-sep
-                                         char-sep rel-ys compacted)
+                                         char-sep rel-ys compaction)
                   block-shift-ys (into {} (mapcat (fn [[class shift]]
                                                     (map #(-> [% shift]) class))
                                                   shift-ys))]
@@ -305,12 +303,11 @@
                  [{} #{}]
                  start-blocks)))

-
 (defn block-info->ClassGraph
   "For a particular blockification, compacts these blocks in to a ClassGraph,
   in either an :up or :down direction"
-  [block-info compacted]
-  (let [block-keys (if (= compacted :up)
+  [block-info alignment compaction]
+  (let [block-keys (if (= compaction :up)
                      [:blocks-up :simple-succs :sources]
                      [:blocks-down :simple-preds :sinks])
         [blocks classify-edges start-blocks] (map block-info block-keys)
@@ -333,7 +330,7 @@
                 classes-set)
         sources (set/difference classes-set (set (keys preds)))
         sinks (set/difference classes-set (set (keys succs)))
-        classes (if (= compacted :up)
+        classes (if (= compaction :up)
                   (let [simple-succs (->> succs
                                           (map (fn [[src edges]]
                                                  [src (set (map #(get-in
@@ -356,31 +353,26 @@
                       :sources sources :sinks sinks
                       :block-succs block-succs
                       :block-preds (:preds block-info)
-                      :compacted compacted})))
-
+                      :alignment alignment
+                      :compaction compaction})))

 (defn FlatGraph->UpDownClassGraphs
   "Organizes nodes and edges into blocks into classes and then constructs a
   ClassGraph, where the nodes are classes and the edges are BlockEdges that
   span classes. This means there can be multiple edges per class pair."
-  [flat-graph]
-  (let [block-info (FlatGraph->block-info flat-graph)]
-    [(block-info->ClassGraph block-info :up)
-     (block-info->ClassGraph block-info :down)]))
-
+  [flat-graph reversed]
+  (let [block-info (FlatGraph->block-info flat-graph)
+        alignment (if reversed :right :left)]
+    [(block-info->ClassGraph block-info alignment :up)
+     (block-info->ClassGraph block-info alignment :down)]))

 (defn FlatGraph->ClassGraphs
   "Takes a FlatGraph and creates four variations of it by aggregating nodes and
   segments into blocks in forward and reverse directions, and then organizes
   these blocks both upward and downward"
   [flat-graph]
-  (mapcat (fn [fg]
-            (let [class-graphs (FlatGraph->UpDownClassGraphs fg)]
-              (if (:reversed (meta fg))
-                (map #(vary-meta % {:aligned-right true}) class-graphs)
-                (map #(vary-meta % {:aligned-left true}) class-graphs))))
-          [flat-graph ^:reversed (rev flat-graph)]))
-
+  (mapcat #(FlatGraph->UpDownClassGraphs % (:reversed (meta %)))
+          [flat-graph (with-meta (rev flat-graph) {:reversed true})]))

 (defn plot-ys
   "Given a FlatGraph, generate four ClassGraphs, which are used to assign
@@ -413,7 +405,7 @@
         narrow-min-y (min-y narrowest node-sep char-sep)
         narrow-max-y (max-y narrowest node-sep char-sep)
         y-map (->> class-graphs
-                   (map #(let [delta (if (:aligned-down (meta %))
+                   (map #(let [delta (if (= (:alignment (meta %)) :right)
                                        (- narrow-max-y (max-y % node-sep
                                                               char-sep))
                                        (- narrow-min-y (min-y % node-sep


try to debug env issue

try to debug env issue

--- src/holston/core.clj
+++ src/holston/core.clj
@@ -23,6 +23,7 @@
 (defn get-mandatory-env-var [name]
   (println (str "env var" name))
   (println (System/getenv name))
+  (println (str "and now a var which we kinda know works" (System/getenv "DATABASE_URL")))
   (println "Now the or..")
   (or (System/getenv name)
       (throw (Exception. (str "Mandatory environment variable missing: " name)))))


see does this var come through

see does this var come through

--- src/holston/core.clj
+++ src/holston/core.clj
@@ -31,6 +31,8 @@
     "http://localhost:8080"))

 (defn create-client-config []
+  (println "callback domain")
+  (println (get-oauth-callback-domain))
   {:client-id (get-mandatory-env-var "HOLSTON_GOOGLE_CLIENT_ID")
    :client-secret (get-mandatory-env-var "HOLSTON_GOOGLE_CLIENT_SECRET")
    :callback {:domain (get-oauth-callback-domain) :path "/oauth2callback"}})


add permission check for new coll api handler

--- src/imago/config.clj
+++ src/imago/config.clj
@@ -99,7 +99,7 @@
            :get-collection
            {:coll-id [(v/required) (v/uuid4)]}
            :new-collection
-           {:user [(v/required "must be authenticated")]
+           {:user {:perms [(v/required-keys ["create-coll"] "insufficient permission")]}
             :title [(v/optional (v/max-length 64))]}}}

    :queries


fddggdgd

fddggdgd

--- src/lobos/config.clj
+++ src/lobos/config.clj
@@ -21,6 +21,7 @@
 (def db
   {:classname "org.postgresql.Driver"
    :subprotocol "postgresql"
+   :user "nqboeyfbipdulq"
    :password "79gw1OolTi2gb8LxCFz4N1A06i"
    :subname "//ec2-107-20-222-114.compute-1.amazonaws.com:5432/dbsa7cb9rv7jtk"})


Encode JDBC URL properly

Encode JDBC URL properly

--- src/pepa/db.clj
+++ src/pepa/db.clj
@@ -14,8 +14,7 @@
     (let [spec (:db config)
           cpds (doto (ComboPooledDataSource.)
                  (.setDriverClass "org.postgresql.Driver")
-                 ;; TOOD: Proper URL encoding of host and dbname
-                 (.setJdbcUrl (str "jdbc:postgresql://" (:host spec) "/" (:dbname spec)))
+                 (.setJdbcUrl (.toASCIIString (java.net.URI. "jdbc:postgresql" (:host spec) (str "/" (:dbname spec)) nil)))
                  (.setUser (:user spec))
                  (.setPassword (:password spec))
                  ;; TODO: Make configurable


Use clojure.data.xml for parsing GET bodies

--- src/myshelf/core.clj
+++ src/myshelf/core.clj
@@ -1,7 +1,7 @@
 (ns myshelf.core
   (:require [clj-http.client :as http]
+            [clojure.data.xml :as xml]
             [clojure.java.io :refer [input-stream]]
-            [clojure.xml :as xml]
             [oauth.client :as oauth]))

 (def goodreads-request-token-url
@@ -49,10 +49,11 @@
                                        :GET
                                        url
                                        params)]
-    (xml/parse (input-stream
-                (.getBytes
-                 (:body (http/get url
-                                  {:query-params credentials})))))))
+      (xml/parse-str
+       (:body
+        (http/get url
+                  {:query-params (merge credentials
+                                        params)})))))

 (defn get-user-id
   "Fetch the Goodreads user id for the user that has granted access"


pointer cursor

pointer cursor

--- src/nonaga/draw.cljs
+++ src/nonaga/draw.cljs
@@ -31,6 +31,7 @@
             "r"       8
             "fill"    color
             "onClick" click
+            "style"   {"cursor" (if click "pointer")}
             "key"     (str "marble" x "," y)})))

 (defn draw [shape coords]
@@ -52,8 +53,9 @@

 (defn start-marble-move [component color coord]
   (fn []
-    (let [state (assoc (.-wrapper (.-state component)) :event [:marble-move color coord])]
-      (.setState component #js {:wrapper state}))))
+    (let [old-state (.-wrapper (.-state component))
+          new-state (assoc old-state :event [:marble-move color coord])]
+      (.setState component #js {:wrapper new-state}))))

 (def board
   (create-class


Reduce macro complexity for alternate scrolling implementation.

--- src/cli4clj/cli.clj
+++ src/cli4clj/cli.clj
@@ -372,44 +372,51 @@
   [opts]
   (add-args-info opts))

+(defn alt-scroll-writer
+  [options]
+  (let [alternate-height (options :alternate-height)
+        stdout *out*
+        new-line (atom true)
+        term (TerminalFactory/create)
+        x (atom 1)
+        y (atom 1)
+        wrtr (proxy [java.io.StringWriter] []
+                (flush []
+                  (reset! new-line true))
+                (write
+                  ([obj]
+                    (let [s (condp instance? obj
+                             java.lang.String obj
+                             java.lang.Integer (str (char obj))
+                             (str obj))
+                          term-height (.getHeight term)]
+                      (binding [*out* stdout]
+                        (when @new-line
+                          (reset! x 1)
+                          (reset! y (- term-height alternate-height 3)))
+                        (print "\u001B[s")
+                        (print (str "\u001B[" @y ";" @x "H"))
+                        (when @new-line
+                          (print "\n"))
+                        (print s)
+                        (swap! x #(+ % (count s)))
+                        (when @new-line
+                          (print "\n"))
+                        (reset! new-line (.endsWith s "\n"))
+                        (print "\u001B[u")
+                        (flush))))))]
+    wrtr))
+
+(defn get-writer-to-wrap
+  [wrtr options]
+  (if (options :alternate-scrolling)
+    @wrtr
+    *out*))
+
 (defmacro wrap-alt-scroll-writer
-  [options & body]
-  `(let [stdout# *out*
-         new-line# (atom true)
-         term# (TerminalFactory/create)
-         x# (atom 1)
-         y# (atom 1)
-         wrtr# (proxy [java.io.StringWriter] []
-                 (flush []
-                   (reset! new-line# true))
-                 (write
-                   ([obj#]
-                     (let [s# (condp instance? obj#
-                               java.lang.String obj#
-                               java.lang.Integer (str (char obj#))
-                               (str obj#))
-                           term-height# (.getHeight term#)
-                           alternate-height# (~options :alternate-height)]
-                       (binding [*out* stdout#]
-                         (when @new-line#
-                           (reset! x# 1)
-                           (reset! y# (- term-height# alternate-height# 3)))
-                         (print "\u001B[s")
-                         (print (str "\u001B[" @y# ";" @x# "H"))
-                         (when @new-line#
-                           (print "\n"))
-                         (print s#)
-                         (swap! x# #(+ % (count s#)))
-                         (when @new-line#
-                           (print "\n"))
-                         (reset! new-line# (.endsWith s# "\n"))
-                         (print "\u001B[u")
-                         (flush))))))]
-     (fn []
-       (binding [*out* (if (~options :alternate-scrolling)
-                         wrtr#
-                         stdout#)]
-         ~@body))))
+  [wrtr options & body]
+  `(binding [*out* (get-writer-to-wrap ~wrtr ~options)]
+     ~@body))

 (defmacro start-cli
   "This is the primary entry point for starting and configuring cli4clj.
@@ -418,20 +425,23 @@
   [user-options]
   (let []
     `(let [_tmp_options# (atom {})
-           ~'with-alt-scroll-out (fn [& body#] (wrap-alt-scroll-writer @_tmp_options# body#))
+           alt-scroll-wrtr# (atom nil)
+           ~'with-alt-scroll-out (fn [& body#] (wrap-alt-scroll-writer alt-scroll-wrtr# @_tmp_options# body#))
            user-options# ~user-options
            options-with-args-info# (add-args-info user-options#)
            options# (assoc
                       (get-cli-opts options-with-args-info#)
                       :calling-ns ~*ns*)]
        (swap! _tmp_options# into options#)
-       ((wrap-alt-scroll-writer
-          options#
-          (main/repl
-            :eval ((options# :eval-factory) options#)
-            :print (options# :print)
-            :prompt (options# :prompt-fn)
-            :read (*read-factory* options#)))))))
+       (reset! alt-scroll-wrtr# (alt-scroll-writer options#))
+       (wrap-alt-scroll-writer
+         alt-scroll-wrtr#
+         options#
+         (main/repl
+           :eval ((options# :eval-factory) options#)
+           :print (options# :print)
+           :prompt (options# :prompt-fn)
+           :read (*read-factory* options#))))))

 (defn create-embedded-read-fn
   "This creates a read fn intended for use in the embedded CLI."


bugfix: nest parentheses correctly

bugfix: nest parentheses correctly

--- src/goodbot/bot.clj
+++ src/goodbot/bot.clj
@@ -5,7 +5,7 @@
    [goodbot.parse :refer [extract-command extract-word]]])

 (defn select-plugin [plugins name]
-  (->> plugins (filter #(= name (:command %)) first)))
+  (->> plugins (filter #(= name (:command %))) first))

 (defn add-help [plugins]
   (declare plugins-with-help)


Better doc string describing the behaviour of statements with quad stores.

--- src/grafter/rdf.clj
+++ src/grafter/rdf.clj
@@ -211,6 +211,9 @@
   "Attempts to coerce an arbitrary source of RDF statements into a
   sequence of grafter Statements.

+  If the source is a quad store quads from all the named graphs will
+  be returned.  Any triples in an unnamed graph will be ignored.
+
   Takes optional parameters which may be used depending on the
   context e.g. specifiying the format of the source triples.


Unnecessary to set nature ids, as they come with the imported project. Create folders that are not recreated by unpacking the ZIP file.

--- ccw.support.examples/src/ccw/support/labrepl/wizards/LabreplCreationOperation.clj
+++ ccw.support.examples/src/ccw/support/labrepl/wizards/LabreplCreationOperation.clj
@@ -37,7 +37,7 @@
   [[] (ref {:pages pages :overwrite-query overwrite-query})])

 (defn config-new-project
-  [root name nature-ids monitor]
+  [root name monitor]
   (try
     (let
       [project (.getProject root name)]
@@ -45,9 +45,7 @@
       (if (not (.isOpen project)) (.open project nil))
       (let
         [desc (.getDescription project)]
-        (doto desc
-          (.setLocation nil)
-          (.setNatureIds (into-array String nature-ids)))
+        (.setLocation desc nil)
         (.setDescription project desc (SubProgressMonitor. monitor 1))
         project))
     (catch CoreException exception (throw (InvocationTargetException. exception)))))
@@ -72,23 +70,27 @@
       op (ImportOperation. dest-path (.getRoot structure-provider) structure-provider overwrite-query)]
     (.run op monitor)))

+(defn make-project-folder
+  [project folder monitor]
+  (let [project-folder (.getFolder project folder)]
+    (.create project-folder true true monitor)))
+
 (defn do-imports
   [project monitor overwrite-query]
   (try
     (let
       [dest-path (.getFullPath project)
+        additional-folders ["lib" "classes"]
         zip-file (get-zipfile-from-plugin-dir "examples/labrepl.zip")]
+      (doall (map #(make-project-folder project % monitor) additional-folders))
       (import-files-from-zip zip-file dest-path (SubProgressMonitor. monitor 1) overwrite-query))
     (catch CoreException exception (throw (InvocationTargetException. exception)))))

 (defn create-project
   [root page monitor overwrite-query]
   (.beginTask monitor "Configuring project..." 1)
-  (let [nature-ids ["org.eclipse.pde.PluginNature"
-                    "org.eclipse.jdt.core.javanature"
-                    "ccw.nature"]
-        project-name (.getProjectName page)
-        project (config-new-project root project-name nature-ids monitor)]
+  (let [project-name (.getProjectName page)
+        project (config-new-project root project-name monitor)]
      (do-imports project (SubProgressMonitor. monitor 1) overwrite-query)))

 (defn -run


Remove comment - not so bad.

Remove comment - not so bad.

--- src/isla/parser.clj
+++ src/isla/parser.clj
@@ -79,7 +79,7 @@
       true
       false)))

-(defn alternatives [input types] ;; bit round the houses
+(defn alternatives [input types]
   (vec (map (fn [t] (t input)) ;; get nodes for each matching type
             (filter (fn [t] (not= nil (t input))) ;; get matching types
                     types))))


bucket brigade version of saving.clj

bucket brigade version of saving.clj

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

--- acqEngine/src/org/micromanager/test/saving.clj
+++ acqEngine/src/org/micromanager/test/saving.clj
@@ -7,20 +7,43 @@
   (:require [org.micromanager.mm :as mm])
   (:use [org.micromanager.mm :only (core)]))

-(def native-order (ByteOrder/nativeOrder))
+;; bucket brigade

-(defn byte-buffer
-  "Create a direct byte-buffer with native order."
-  [size-bytes]
-  (.. ByteBuffer (allocateDirect size-bytes)
-      (order native-order)))
+(defn bucket-node [input-queue function output-queue]
+  (future
+    (loop []
+      (let [item (.take input-queue)]
+        (if (= item input-queue)
+          (.put output-queue output-queue)
+          (do (.put output-queue (function item))
+              (recur)))))))

-(defn image-to-byte-buffer
-  "Store 16-bit image pixel array data in a
-   pre-existing byte buffer instance."
-  [pix buffer]
-  (.. buffer asShortBuffer (put pix))
-  buffer)
+(defn first-node [n function output-queue]
+  (future
+    (dotimes [i n]
+      (.put output-queue (function)))
+    (.put output-queue output-queue)))
+
+(defn last-node [input-queue function]
+  (loop []
+    (let [item (.take input-queue)]
+      (when (not= item input-queue)
+        (function item)
+        (recur)))))
+
+
+(defn bucket-brigade [n & functions]
+  (let [first-queue (LinkedBlockingQueue.)
+        first-node (first-node n (first functions) first-queue)]
+    (loop [remaining-functions (rest functions) input-queue first-queue]
+      (let [f (first remaining-functions)]
+        (if-let [n (next remaining-functions)]
+          (let [output-queue (LinkedBlockingQueue.)]
+            (bucket-node input-queue f output-queue)
+            (recur n output-queue))
+          (last-node input-queue f))))))
+
+;; acquiring and popping images

 (defn run-sequence-acquisition
   "Start a sequence acquisition and, optionally, wait for it."
@@ -46,91 +69,52 @@
              (when (core isBufferOverflowed)
                (throw (Exception. "Circular buffer overflowed."))))))

-(defn single-thread-pop-test
-  "Run a sequence acquisition and pop the images,
-   inserting them into image-queue as they arrive."
-  [num-images image-queue]
-  (run-sequence-acquisition num-images false)
-  (dotimes [i num-images]
-    (when-let [image (pop-next-image)]
-      (when image-queue
-        (.put image-queue image)))))
+(def pop-next-image-memo (memoize pop-next-image))

-(defn byte-buffer-queue
-  "Run a sequence acquisition, convert the incoming
-   images to direct byte buffers, and return references
-   to the buffers in a queue."
-  [num-images]
-  (let [image-queue (LinkedBlockingQueue. 1)]
-    (future (single-thread-pop-test num-images image-queue))
-    (let [queue (LinkedBlockingQueue. 1)]
-      (future (dotimes [i num-images]
-                (let [img (.take image-queue)
-                      n (count img)]
-                  (.put queue
-                        (image-to-byte-buffer
-                          img
-                          (byte-buffer (* n 2))))
-                  )))
-      queue)))
+;; converting to byte buffer

-(defmacro dotimes-timed [bindings interval & body]
-  `(let [t0# (System/currentTimeMillis)]
-     (println '~(first bindings) "time (ms)")
-     (dotimes ~bindings
-       (when (zero? (mod ~(first bindings) ~interval))
-         (println ~(first bindings) (- (System/currentTimeMillis) t0#)
-                  (core getRemainingImageCount)))
-       ~@body)))
+(def native-order (ByteOrder/nativeOrder))
+
+(defn byte-buffer
+  "Create a direct byte-buffer with native order."
+  [size-bytes]
+  (.. ByteBuffer (allocateDirect size-bytes)
+      (order native-order)))
+
+(defn image-to-byte-buffer
+  "Store 16-bit image pixel array data in a
+   pre-existing byte buffer instance."
+  ([pix buffer]
+  (doto buffer
+    .rewind
+    (.. asShortBuffer (put pix))))
+  ([pix]
+    (image-to-byte-buffer pix (byte-buffer (* 2 (count pix))))))
+
+
+;; writing to disk

 (defn write-buf [channel buffer]
-  (.write channel buffer)
-  )
+  (.write channel buffer))

-(defn acquire-and-save
-  "Simulate running a sequence acquisition, and save the
-   images to a file using the direct byte buffer method."
-  [num-images]
-    (let [filename (str "D:/AcquisitionData/test" (rand-int 100000) ".dat")
-          file (RandomAccessFile. filename "rw")
-          channel (.getChannel file)]
-      (try
-        (let [buffer-queue (time (byte-buffer-queue num-images))]
-          (println filename)
-          (dotimes-timed [i num-images] 100
-            (let [buffer (.take buffer-queue)]
-              (write-buf channel buffer)
-              )))
-        (catch Exception e (println e))
-        (finally (.close file)))
-      filename))
+(defn acquire-and-write-to-disk [num-images]
+  (let [filename (str "D:/AcquisitionData/deleteMe" (rand-int 100000) ".dat")
+        file (RandomAccessFile. filename "rw")
+        channel (.getChannel file)
+        fake-buf (image-to-byte-buffer (core getImage))]
+    (println filename)
+    (run-sequence-acquisition num-images false)
+    (time (bucket-brigade num-images
+            pop-next-image
+            ;pop-next-image-memo
+            image-to-byte-buffer
+            ;(constantly fake-buf)
+            #(write-buf channel %)
+            ;(constantly nil)
+            ))
+    (.close file)))

-(defn acquire-and-map
-  [num-images]
-  (let [buffer-queue (time (byte-buffer-queue num-images))]
-    (let [filename (str "D:/AcquisitionData/test" (rand-int 100000) ".dat")
-          file (RandomAccessFile. filename "rw")
-          channel (.getChannel file)]
-      (try
-        (dotimes-timed [i num-images] 100
-                       (let [pixels (.take buffer-queue)
-                             out (.. file getChannel (map FileChannel$MapMode/READ_WRITE 0 (.limit pixels)))]
-                         (.put out pixels)))
-        (catch Exception e (println e))
-        (finally (.close file))))))
-
-
-(defn acquire-and-store-in-ram
-  "Simulate running a sequence acquisition, and store
-   the images in RAM using the direct byte buffer method."
-  [num-images]
-  (let [buffer-queue (time (byte-buffer-queue num-images))
-        storage-queue (proxy [LinkedBlockingQueue] []
-                        (toString [] (str "(" (count this) " items)")))]
-      (dotimes-timed [i num-images] 100
-        (let [buffer (.take buffer-queue)]
-          (.put storage-queue buffer)))
-    storage-queue))
+;; other tests

 (defn test-write [num-images]
   (let [buffer (byte-buffer (* 2560 2160 2))
@@ -144,9 +128,7 @@
         (.write channel buffer))
       (catch Exception e (println e))
       (finally
-        (.close file)))))
-
-
+        (.close file)))))

 (defn monitor-circular-buffer []
   (while (not (core isSequenceRunning))
@@ -155,3 +137,33 @@
     (println (core getRemainingImageCount))
     (Thread/sleep 250)))

+(defn drain-queue [blocking-queue]
+  (future (loop [i 0]
+            (let [obj (.take blocking-queue)]
+              (when (zero? (mod i 100))
+                (println i (core getRemainingImageCount)))
+              (when (not= obj blocking-queue)
+                (recur (inc i)))))))
+
+(defn profile [repetitions f]
+  (time (dorun (repeatedly repetitions f))))
+
+(defn test-popping-speed [n]
+  ;(future (monitor-circular-buffer))
+  (core startSequenceAcquisition n 0 false)
+ ; (time (while (core isSequenceRunning)
+ ;         (Thread/sleep 1)))
+  (profile n #(pop-next-image)))
+
+(defn extract-array [short-buf]
+  (.rewind short-buf)
+  (let [n (.limit short-buf)
+        a (short-array n)]
+    (.get short-buf a 0 n)
+    a))
+
+(defn extract-array-test [n]
+  (let [short-buf (.asShortBuffer (byte-buffer (* 2 2560 2160)))]
+    (profile n #(extract-array short-buf))))
+
+


fix typo in usage

fix typo in usage

--- src/revdiff/core.clj
+++ src/revdiff/core.clj
@@ -33,7 +33,7 @@
    ["-i" "--case-insensitive" "Treat regexp as case-insensitive"]
    ["-d" "--diff-opts options" "Quoted list of options to pass to svn diff"]
    ["-l" "--log-opts options" "Quoted list of options to pass to svn log"]
-   ["-s" "--show-cmds" "Show the svn commands taht are issued"]])
+   ["-s" "--show-cmds" "Show svn commands as they are issued"]])

 ;; A string containing the output of "diff" on the two svn revision of object.


output system now flushes automatically

output system now flushes automatically

--- src/setbang/core.clj
+++ src/setbang/core.clj
@@ -252,6 +252,7 @@

 (defn write-1 [ch]
   (.write *out* (card ch))
+  (flush)
   [])

 (declare run-code)


[l.d.manifest] Specify array type in merge-manifests

--- src/leiningen/droid/manifest.clj
+++ src/leiningen/droid/manifest.clj
@@ -11,7 +11,8 @@
             [leiningen.release :refer [parse-semantic-version]])
   (:import com.android.manifmerger.ManifestMerger
            com.android.manifmerger.MergerLog
-           [com.android.utils StdLogger StdLogger$Level]))
+           [com.android.utils StdLogger StdLogger$Level]
+           java.io.File))

 ;; ### Constants

@@ -125,7 +126,7 @@
         lib-manifests (get-aar-files project "AndroidManifest.xml")]
     (debug "Merging secondary manifests:" lib-manifests)
     (.process merger (jio/file manifest-path) (jio/file manifest-main-app-path)
-              (into-array lib-manifests) nil nil)))
+              (into-array File lib-manifests) nil nil)))

 (defn generate-manifest
   "If a :manifest-template-path is specified, perform template substitution with


(SERVER-1107) Update versioned-code-core tests for changes to execute-code-id-script

--- test/unit/puppetlabs/services/versioned_code_service/versioned_code_core_test.clj
+++ test/unit/puppetlabs/services/versioned_code_service/versioned_code_core_test.clj
@@ -23,16 +23,15 @@
      (is (= "" (vc-core/execute-code-id-script! (script-path "warn") "foo")))
      (is (logged? (format "Error output generated while running '%s'. stderr: '%s'" (script-path "warn") "foo\n")))))

-  (testing "exit-code, stdout and stderr are all logged for non-zero exit"
+  (testing "an exception is thrown for non-zero exit of the code-id-script"
     (logging/with-test-logging
      (is (thrown? IllegalStateException
                   (vc-core/execute-code-id-script! (script-path "warn_echo_and_error") "foo")))
-     (is (logged? (format "Non-zero exit code returned while running '%s'. exit-code: '%d', stdout: '%s', stderr: '%s'" (script-path "warn_echo_and_error") 1 "foo\n" "foo\n")))))
+     (is (logged? "Executed an external process which logged to STDERR: foo\n"))))

   (testing "exception thrown and error logged for exception during execute-command"
     (logging/with-test-logging
-     (is (thrown? IllegalStateException (vc-core/execute-code-id-script! "false" "foo")))
-     (is (logged? "Running script generated an error. Command executed: 'false', error generated: 'An absolute path is required, but 'false' is not an absolute path'")))))
+     (is (thrown? IllegalArgumentException (vc-core/execute-code-id-script! "false" "foo"))))))

 (deftest test-code-content-execution
   (testing "when executing external code content command"


Fix function call params.

Fix function call params.

--- src/onyx/peer/task_lifecycle.clj
+++ src/onyx/peer/task_lifecycle.clj
@@ -406,7 +406,7 @@
       (while (first (alts!! [seal-ch kill-ch] :default true))
         (->> init-event
              (gen-lifecycle-id)
-             (lc/invoke-before-batch compiled-before-batch-fn pipeline)
+             (lc/invoke-before-batch compiled-before-batch-fn)
              (read-batch task-type replica peer-replica-view job-id pipeline)
              (tag-messages task-type replica peer-replica-view id)
              (add-messages-to-timeout-pool task-type state)


Bad merge call, event map was already merged as part of compiled call

--- src/onyx/peer/task_lifecycle.clj
+++ src/onyx/peer/task_lifecycle.clj
@@ -428,11 +428,11 @@
     rets))

 (defn close-batch-resources [event]
-  (let [rets ((:onyx.core/compiled-after-batch-fn event) event)]
+  (let [rets ((:onyx.core/compiled-after-batch-fn event) event)]
     (taoensso.timbre/trace (format "[%s / %s] Closed batch plugin resources"
                                    (:onyx.core/id rets)
                                    (:onyx.core/lifecycle-id rets)))
-    (merge event rets)))
+    rets))

 (defn launch-aux-threads!
   [messenger {:keys [onyx.core/pipeline


added default for the reports bucket name

--- cimi-resources/src/com/sixsq/slipstream/ssclj/resources/external_object_report.clj
+++ cimi-resources/src/com/sixsq/slipstream/ssclj/resources/external_object_report.clj
@@ -26,8 +26,10 @@
 ;;
 (def ^:const desc ExternalObjectReportDescription)

+(def ^:const reports-bucket-default "slipstream-reports")
+
 ;; single bucket containing reports, must exist
-(def reports-bucket (delay (:reportsBucketName (s3/object-store-config))))
+(def reports-bucket (delay (get (s3/object-store-config) :reportsBucketName reports-bucket-default)))

 ;;
 ;; multimethods for validation


Fix the test after merging

Fix the test after merging

--- test/circle/backend/build/test_run_build.clj
+++ test/circle/backend/build/test_run_build.clj
@@ -8,6 +8,7 @@
   (:use [circle.backend.build.run :only (run-build)])
   (:require [circle.model.project :as project])
   (:use [circle.backend.build.config :only (build-from-url)])
+  (:require [circle.backend.nodes.rails :as rails])
   (:require circle.system)
   (:require [somnium.congomongo :as mongo])
   (:use [arohner.utils :only (inspect)])
@@ -90,7 +91,7 @@
 ;; This is the only test that should start an instnace
 (fact "the customer AMI starts up"
   (let [build (run-build (minimal-build :actions [(nodes/start-nodes)]
-                                        :node config/default-node))]
+                                        :node rails/rails-node))]
     (-> @build :instance-id (ec2/instance) :state :name) => "running"
     (-> @build :instance-ids (first)) => string?
     (nodes/cleanup-nodes build) => anything


(PE-14580) Pass in timeout argument to replication-status test

--- test/puppetlabs/jdbc_util/pglogical_test.clj
+++ test/puppetlabs/jdbc_util/pglogical_test.clj
@@ -32,4 +32,6 @@
                                                        :subprotocol "postgresql"
                                                        :subname "fakedb"
                                                        :user "fakedb"
-                                                       :password "fakedb"} :source))))))
+                                                       :password "fakedb"}
+                                                      :source
+                                                      4))))))


(PDB-5484) nodes-test/paging-results: test timestamp fields as intended

--- test/puppetlabs/puppetdb/http/nodes_test.clj
+++ test/puppetlabs/puppetdb/http/nodes_test.clj
@@ -528,17 +528,19 @@
               (is (= (mapv :certname result) expected))))))

       (testing "multiple fields"
-        (let [ordered-names  ["db.example.com" "puppet.example.com"
-                              "web1.example.com" "web2.example.com"]]
+        ;; ordered-names is in increasing timestamp order
+        (let [ordered-names ["web1.example.com" "web2.example.com"
+                             "puppet.example.com" "db.example.com"]]
           (doseq [[[timestamp-order name-order] expected]
                   [[["asc" "desc"] ordered-names]
-                   [["asc" "asc"] ordered-names]]]
-            (ordered-query-result method endpoint nil
-                                  {:order_by (vector-param method
-                                                           [{"field" "facts_timestamp"
-                                                             "order" timestamp-order}
-                                                            {"field" "certname"
-                                                             "order" name-order}])}))))
+                   [["asc" "asc"] ordered-names]]
+                  :let [order {:order_by (vector-param method
+                                                       [{"field" "facts_timestamp"
+                                                         "order" timestamp-order}
+                                                        {"field" "certname"
+                                                         "order" name-order}])}
+                        res (ordered-query-result method endpoint nil order)]]
+            (is (= expected (map :certname res))))))

       (testing "offset"
         (let [ordered-names ["db.example.com" "puppet.example.com" "web1.example.com" "web2.example.com"]


(PDB-2905) Replace rm-r with fs/delete-dir

--- test/puppetlabs/puppetdb/testutils/queue.clj
+++ test/puppetlabs/puppetdb/testutils/queue.clj
@@ -1,18 +1,12 @@
 (ns puppetlabs.puppetdb.testutils.queue
   (:require [clojure.string :as str]
             [clojure.java.shell :as shell]
+            [me.raynes.fs :refer [delete-dir]]
             [stockpile :as stock]
             [puppetlabs.puppetdb.nio :refer [get-path]]
             [puppetlabs.puppetdb.testutils.nio :refer [create-temp-dir]]
             [puppetlabs.puppetdb.queue :as q]
             [puppetlabs.puppetdb.cheshire :as json]))
-
-(defn rm-r [pathstr]
-  (let [rm (shell/sh "rm" "-r" pathstr)]
-    (when-not (zero? (:exit rm))
-      (throw (-> "'rm -r %s' failed: %s"
-                 (format (pr-str pathstr) (pr-str rm))
-                 Exception.)))))

 (defmacro with-stockpile [queue-sym & body]
   `(let [ns-str#  (str (ns-name ~*ns*))
@@ -23,7 +17,8 @@
          ~queue-sym (stock/create queue-dir#)]
      (try
        ~@body
-       (finally (rm-r queue-dir#)))))
+       (finally
+         (delete-dir queue-dir#)))))

 (defprotocol CoerceToStream
   (coerce-to-stream [x]


cleaned up leftover fixtures and notes in tests

--- test/push/instructions/base/integer_test.clj
+++ test/push/instructions/base/integer_test.clj
@@ -3,18 +3,6 @@
   (:use [push.instructions.base.integer])
   (:use midje.sweet)
   (:use [push.util.test-helpers]))
-
-
-;; fixtures
-
-
-(def knows-some-integers
-    (i/make-interpreter
-      :stacks {:integer '(11 -5 3333333333333333333 7777777777777777777)}))
-      ;; the last two, when added, push us over the interger overflow limit
-
-
-; setup-stack items instruction read-stack

 (tabular


Switched back to using :localname to reify the property id in the ontology_id_denotes_object_property rule

--- resources/rules/pre_identifier_merge/step_a_ontology_to_ice/step_b/ontology_id_denotes_object_property.clj
+++ resources/rules/pre_identifier_merge/step_a_ontology_to_ice/step_b/ontology_id_denotes_object_property.clj
@@ -5,8 +5,8 @@
   :description "This rule generates an object property identifier for every non-top-level object property."
   :head ((?/id obo/IAO_0000219 ?/object_property) ;; obo:denotes
          (?/id rdf/type ccp/IAO_EXT_0000306)) ;; ccp:object property identifier
-  :reify ([?/id {:ln (:sha-1 ?/object_property)
-                 :ns "ccp" :prefix "O_" :suffix ""}])
+  :reify ([?/id {:ln (:localname ?/object_property)
+                 :ns "ccp" :prefix "" :suffix ""}])
   :sparql-string "prefix ccp: <http://ccp.ucdenver.edu/obo/ext/>
                   prefix obo: <http://purl.obolibrary.org/obo/>
                   select ?object_property {


Come to think of it, it'll work even better unquoted.

--- lib/shin/cljs/cljs/core.clj
+++ lib/shin/cljs/cljs/core.clj
@@ -39,7 +39,7 @@
   ([cond]
    (assert cond "Assert failed"))
   ([cond message]
-   `(when-not ~cond (throw (js/Error. message)))))
+   `(when-not ~cond (throw (js/Error. ~message)))))

 (defmacro exists? [something]
   `(*js-bop != "undefined" (*js-uop typeof ~something)))


Day 12 - issue with solution located

Day 12 - issue with solution located

--- src/adventofcode/solutions.clj
+++ src/adventofcode/solutions.clj
@@ -5,7 +5,7 @@
   (:import (java.security MessageDigest)))

-(defn day-x-input [x] (str "adventofcode/day" x "-input"))
+(defn- day-x-input [x] (str "adventofcode/day" x "-input"))
 ;(defn day-x-input [x] (str "adventofcode/day" x "-input-test"))
 ;(defn day-x-input [x] (str "adventofcode/temp.txt"))
 (defn slurp-day-input [x] (slurp (io/file (io/resource (day-x-input x)))))
@@ -371,4 +371,30 @@
                                            x)))
                        (assoc x 7 (inc (last x))))) (s->ch-seq input))))

-
+;day 12
+;part 1
+;simply:
+(reduce + (map #(s->int %) (re-seq #"\-?\d+" (slurp-day-input 12))))
+
+
+(defn- rm-red-jsobj
+  "Removes single JS object containing property with value 'red'"
+  [input]
+  (let [lr (.lastIndexOf input ":\"red\"")]
+    (when (>= lr 0)
+      (let [llrs (subs input 0 lr)
+            rlrs (subs input lr)
+            ob (.lastIndexOf llrs "{")
+            cb (.indexOf rlrs "}")]
+        (str (subs input 0 ob) (subs rlrs (inc cb)))))))
+
+;TODO: fix this, this is wrong, it is not taking into account that there can be objects
+;prior to "red" valued property which breaks my conception
+(defn day12 [input]
+  (reduce #(if %2
+            %2
+            (reduced (reduce
+                       +
+                       (map
+                         (fn [n] (s->int n)) (re-seq #"\-?\d+" %))))) (iterate rm-red-jsobj input)))
+


Safe bounding for solved summaries

Safe bounding for solved summaries

--- src/angelic/search/summary.clj
+++ src/angelic/search/summary.clj
@@ -70,7 +70,7 @@

 (defn or-combine-b [summaries new-src bound]
   (let [best (apply-max-b summaries bound)]
-    (when (solved? best) (assert (>= bound (max-reward best))))
+    (when (solved? best) (assert (clojure.core/>= bound (max-reward best))))
     (re-source best new-src bound :solved)))

@@ -131,7 +131,7 @@
   (+                [s other new-src bound]
     (let [new-stat (min-key status-val stat (status other))
 	  r        (clojure.core/+ max-rew (max-reward other))]
-      (when (= new-stat :solved) (assert (>= bound r)))
+      (when (= new-stat :solved) (assert (clojure.core/>= bound r)))
       (SimpleSummary. (clojure.core/min r bound) new-stat new-src [s other]))))

 (defn make-live-simple-summary [max-reward source] (SimpleSummary. max-reward :live source nil))


added get married

added get married

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -733,7 +733,22 @@
       :english {:participle "getting dressed"
                 :present {:3sing "gets dressed"}
                 :past "got dressed"}})
-   "get off"
+
+
+    "get married"
+   (let [subject-semantics (atom :top)]
+     {:synsem {:cat :verb
+               :sem {:pred :get-married
+                     :reflexive true
+                     :subj subject-semantics
+                     :obj subject-semantics}
+               :subcat {:1 {:sem subject-semantics}
+                        :2 '()}}
+      :english {:participle "getting married"
+                :present {:3sing "gets married"}
+                :past "got married"}})
+
+    "get off"
    (let [subject-semantics (atom :top)]
      {:synsem {:cat :verb
                :sem {:pred :get-off


add TODO: about generalizing about reflexive verbs

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -1336,6 +1336,7 @@
                            :obj {:human false
                                  :music true}}}}]

+   ;; TODO: all reflexive verbs should have this subject-object agreement like this one does:
    "prepare" (let [subject-semantics (atom {:human true})
                    subject-agreement (atom :top)]
                {:synsem {:cat :verb


Updated wording of messages

Updated wording of messages

--- scrape-n-mail/src/scrape_n_mail/core.cljs
+++ scrape-n-mail/src/scrape_n_mail/core.cljs
@@ -147,12 +147,27 @@
                [:br]
                [:p "Dear " (::submitter-name (first name-records)) ","]

-               [:p "We are holding:"
+               [:p "Currently, the community is holding the following names on the altar "
+                   "in support of their wellbeing at your request:"
                 (into [:ul {:id "content"}]
                   ; We currently assume all visible data is "current"
                   ; (filter #(s/includes? (aget % 0) "2017"))
                   ; Each line is a list, this joins them in to one string
-                  (map #(vector :li (::held-name-altar %)) name-records)) ]]))
+                  (map #(vector :li (::held-name-altar %)) name-records))
+
+                "Please let us know if these names should remain, along with any other names "
+                "you'd like added by (re-)submitting names at "
+                [:a {:href "https://docs.google.com/forms/d/e/1FAIpQLSc_FFrH7a_ClDmpAq36vA7gdUd1njmoEK0wfhRNaYcjfLox0w/viewform"}
+                "this link"] ". If that link doesn't work, you can copy-paste it into your browser:"]
+
+               [:p "https://docs.google.com/forms/d/e/1FAIpQLSc_FFrH7a_ClDmpAq36vA7gdUd1njmoEK0wfhRNaYcjfLox0w/viewform"]
+
+               [:p "If we do not hear from you, we will assume they are doing better and "
+                "remove them from the altar."]
+
+               ; Note that the \ is an escape character!
+               [:p "/|\\"]
+                ]))
      ]))

 (rum/mount (hello-world)


defcomponent now allows multiple methods. defentity works with any number of components/methods

--- src/clj/chocolatier/macros.clj
+++ src/clj/chocolatier/macros.clj
@@ -17,33 +17,46 @@
 ;; state is a list of keywords
 (defmacro defcomponent
   "Creates a component with name state and methods"
-  [vname state methods]
+  [vname state & methods]
   `(do
      ;; Create the protocol with methods
-     (defprotocol ~vname ~methods)
+     (defprotocol ~vname ~@methods)
      ;; Metadata can't be attached to a protocol so rebind the newly
      ;; created protocol to a var with metadata describing it's state
      (def ~vname
        (with-meta ~vname {:fields ~state}))))

+(defn is-protocol? [sym]
+  (boolean (:method-map sym)))
+
 (defmacro defentity
   "A collection of components that represent all aspects of what
-   the entity can do"
+   the entity can do
+
+   Example:
+   (defentitiy Player
+     Moveable
+     (move [this] nil)
+     (stop [this] nil)
+
+     Renderable
+     (render [this] nil))
+  "
   [vname & body]
-  (let [;; Every odd form in body is a Protocol
-        ;; TODO what if there is more than one method on a protocol?
-        components (map #(-> % first eval) (partition-all 2 body))
-        _ (println "Components:" components)
+  (let [;; Protocols are not seqs so we can filter by that
+        components (filter #(not (seq? %)) body)
         symbolize #(map symbol %)
         namify #(map name %)
         extract #(-> % meta :fields)
-        parse-fn #(-> % extract namify symbolize)
-        fields (vec (reduce #(concat %1 (parse-fn %2)) [] components))
-        _ (println "Fields:" fields)
-        ]
-    ;; Create the defrecord with component protocols
-    `(defrecord ~vname [~@fields]
-       ~@body)))
+        parse-fn #(-> % eval extract namify symbolize)
+        fields (vec (reduce #(concat %1 (parse-fn %2)) [] components))]
+    ;; Validate that all fields are unique or throw an error
+    (if (= (count fields)  (count (set fields)))
+      ;; Create the defrecord with component protocols
+      `(defrecord ~vname [~@fields]
+         ~@body)
+      (throw (Exception. (str "Duplicate fields found across components. "
+                              "Fields must all be unique."))))))

 ;; Creates a defrecord with a list of methods and adds all the


updated indentation.

updated indentation.

--- src/clj/forma/matrix/utils.clj
+++ src/clj/forma/matrix/utils.clj
@@ -64,10 +64,10 @@
               tup-seq tuples
               v (transient [])]
          (let [[pos val] (first tup-seq)]
-           (cond (halt? idx tup-seq)    (persistent! v)
+           (cond (halt? idx tup-seq) (persistent! v)
                  (when pos (= idx pos)) (recur (inc idx) (rest tup-seq) (conj! v val))
                  (when pos (> idx pos)) (recur (inc idx) (rest tup-seq) (conj! v placeholder))
-                 :else                  (recur (inc idx) tup-seq (conj! v placeholder))))))))
+                 :else (recur (inc idx) tup-seq (conj! v placeholder))))))))

 (defn idx->colrow
   "Takes an index within a row vector, and returns the appropriate
@@ -95,9 +95,10 @@
 ;; ## Multi-dimensional matrix operations

 (defn variance-matrix
-  "construct a variance-covariance matrix from a given matrix `X`. If the
-  value of the matrix multiplication yields an integer value, then we
-  vectorize.  This would be equivalent to the var function in incanter.stats."
+  "construct a variance-covariance matrix from a given matrix `X`. If
+  the value of the matrix multiplication yields an integer value, then
+  we vectorize.  This would be equivalent to the var function in
+  incanter.stats."
   [X]
   (let [product (i/mmult (i/trans X) X)]
     (i/solve (if (seq? product)


Updates ABT to put all cards in play-zone, also adds activation message.

--- src/clj/game/cards-agendas.clj
+++ src/clj/game/cards-agendas.clj
@@ -17,22 +17,25 @@
    "Accelerated Beta Test"
    (letfn [(abt [n i]
              {:req (req (> i 0))
-              :prompt "Select a piece of ICE from the top of the play area to install"
-              :choices {:req #(and (:side % "Corp") (= (:type %) "ICE") (= (:zone %) [:play-area]))}
-              :effect (req (corp-install state side target nil {:no-install-cost true :install-state :rezzed-no-cost})
+              :prompt "Select a piece of ICE from the Temporary Zone to install"
+              :choices {:req #(and (:side % "Corp")
+                                   (= (:type %) "ICE")
+                                   (= (:zone %) [:play-area]))}
+              :effect (req (corp-install state side target nil
+                                         {:no-install-cost true :install-state :rezzed-no-cost})
                            (trigger-event state side :rez target)
                            (when (< n i)
                              (resolve-ability state side (abt (inc n) i) card nil)))})]
      {:optional {:prompt "Look at the top 3 cards of R&D?"
-                 :yes-ability {:effect (req (let [n (count (filter #(= (:type %) "ICE") (take 3 (:deck corp))))]
-                                              (resolve-ability state side
-                                                               {:msg (msg "install " n " ICE and trash " (- 3 n) " card" (when (< n 2) "s"))
-                                                                :effect (req (doseq [c (take 3 (:deck corp))]
-                                                                               (if (= (:type c) "ICE")
-                                                                                (move state side c :play-area)
-                                                                                (trash state side c)))
-                                                                             (resolve-ability state side (abt 1 n) card nil))}
-                                                               card nil)))}}})
+                 :yes-ability {:effect (req (let [n (count (filter #(= (:type %) "ICE")
+                                                                   (take 3 (:deck corp))))]
+                                              (resolve-ability
+                                               state side
+                                               {:msg "look at the top 3 cards of R&D"
+                                                :effect (req (doseq [c (take 3 (:deck corp))]
+                                                               (move state side c :play-area))
+                                                             (resolve-ability state side (abt 1 n) card nil))}
+                                               card nil)))}}})

    "Ancestral Imager"
    {:events {:jack-out {:msg "do 1 net damage" :effect (effect (damage :net 1))}}}


Extract jline *in*-binding from the read itself

--- src/clj/reply/reader/jline.clj
+++ src/clj/reply/reader/jline.clj
@@ -55,26 +55,23 @@
 (defn shutdown-reader []
   (.restore (.getTerminal @jline-reader)))

-(defn actual-read [input-reader request-prompt request-exit]
-  (binding [*in* input-reader]
-    (clojure.main/repl-read request-prompt request-exit)))
+(defmacro with-jline-in [& body]
+  `(do
+    (when-not @jline-reader (setup-reader!))
+    (try
+      (.flush (.getHistory @jline-reader))
+      (.setPrompt @jline-reader (get-prompt (eval-state/get-ns)))
+      (.removeCompleter @jline-reader (first (.getCompleters @jline-reader)))
+      (.addCompleter @jline-reader (jline.completion/make-completer (eval-state/get-ns)))
+      (binding [*in* @jline-pushback-reader]
+        (Thread/interrupted) ; just to clear the status
+        ~@body)
+      ; NOTE: this indirection is for wrapped exceptions in 1.3
+      (catch Throwable e#
+        (if (#{IOException InterruptedException} (type (clojure.main/repl-exception e#)))
+          (do (reset-reader) nil)
+          (throw e#))))))

 (defn read [request-prompt request-exit]
-  (when-not @jline-reader (setup-reader!))
-  (try
-    (.flush (.getHistory @jline-reader))
-    (.setPrompt @jline-reader (get-prompt (eval-state/get-ns)))
-    (let [completer (first (.getCompleters @jline-reader))]
-      (.removeCompleter @jline-reader completer)
-      (.addCompleter @jline-reader (jline.completion/make-completer (eval-state/get-ns))))
-    (let [input-stream @jline-pushback-reader]
-      (do
-        (Thread/interrupted) ; just to clear the status
-        (actual-read input-stream request-prompt request-exit)))
-    ; NOTE: this indirection is for wrapped exceptions in 1.3
-    (catch Throwable e
-      (if (#{IOException InterruptedException} (type (clojure.main/repl-exception e)))
-        (do
-          (reset-reader)
-          request-prompt)
-        (throw e)))))
+  (with-jline-in
+    (clojure.main/repl-read request-prompt request-exit)))