Refactor

Refactor

--- src/cljs/load_test_om/load_test.cljs
+++ src/cljs/load_test_om/load_test.cljs
@@ -1,8 +1,8 @@
 (ns load-test-om.load-test
   (:require [om.core :as om :include-macros true]
             [om.dom :as dom :include-macros true]
-            [load-test-om.summary :as summary]
-            [load-test-om.hit-table :as hit-table]
+            [load-test-om.summary :refer [summary]]
+            [load-test-om.hit-table :refer [hit-table]]
             [load-test-om.statistics-table :refer [statistics-table]]))

 (defn start-date [data-points]
@@ -12,18 +12,6 @@
   (let [times (map :time data-points)]
     (Math/round (- (apply max times)
                    (apply min times)))))
-
-(defn hit-table [data-points]
-  (let [rows (->> (group-by :status data-points)
-                  (map (fn [[status values]]
-                         (dom/tr #js {:key status}
-                                 (dom/td nil status)
-                                 (dom/td nil (count values))))))]
-    (apply dom/table nil
-               (dom/tr nil
-                       (dom/th nil "Status Code")
-                       (dom/th nil "Hits"))
-               rows)))

 (defn minimized-view [{:keys [resource action id data-points] :as load-test} owner]
   (dom/div #js {:className "minimised-view"}
@@ -36,7 +24,7 @@
                    (dom/small #js {:className "capitalize"} id)
                    (dom/div #js {:className "size-toggle-btn u-pull-end"
                                  :onClick #(om/set-state! owner :minimised? false)} "+")
-                   (dom/div #js {:className "u-pull-end"} (summary/summary load-test)))))
+                   (dom/div #js {:className "u-pull-end"} (summary load-test)))))

 (defn load-test-detailed [{:keys [resource action id data-points] :as load-test} owner]
   (dom/div #js {:className "detail-view"}
@@ -62,7 +50,7 @@
            (dom/hr nil)

            (dom/div #js {:className "third"} (statistics-table load-test))
-           (dom/div #js {:className "third"} (hit-table/hit-table data-points))
+           (dom/div #js {:className "third"} (hit-table data-points))
            (dom/div #js {:className "third"}
                     (dom/table #js {:className "extra-details"}
                                (dom/tr nil


clean up

clean up

--- src/cljs/phonecat_re_frame/core.cljs
+++ src/cljs/phonecat_re_frame/core.cljs
@@ -19,7 +19,6 @@
    (reaction (:search-input @db))))

 (re-frame/register-sub        ;; a new subscription handler
-<<<<<<< HEAD
  :phones             ;; usage (subscribe [:phones])
  (fn [db]
    (reaction (:phones @db))))  ;; pulls out :phones


fix matches query in step-4

fix matches query in step-4

--- src/cljs/phonecat_re_frame/core.cljs
+++ src/cljs/phonecat_re_frame/core.cljs
@@ -71,10 +71,12 @@
    [:p (:snippet phone)]])

 (defn matches-query?
-  [search-input phone]
-  (if (= "" search-input)
-    true
-    (= (:name phone) search-input)))
+ [search-input phone]
+ (if (= "" search-input)
+   true
+   (boolean (or
+             (re-find (re-pattern search-input) (:name phone))
+             (re-find (re-pattern search-input) (:snippet phone))))))

 (defn phones-component
   []


revert to previous badge navi

revert to previous badge navi

--- src/cljs/salava/badge/ui/routes.cljs
+++ src/cljs/salava/badge/ui/routes.cljs
@@ -13,8 +13,7 @@
             [salava.badge.ui.stats :as stats]
             [reagent.session :as session]
             [salava.badge.ui.modal :as badgemodal]
-            [salava.core.i18n :as i18n :refer [t]]
-            #_[salava.extra.application.ui.application :as app]))
+            [salava.core.i18n :as i18n :refer [t]]))

 (defn placeholder [content]
   (fn [site-navi params]
@@ -22,23 +21,17 @@

 (defn ^:export routes [context]
-  (let [app-handler (first (plugin-fun (session/get :plugins) "application" "handler"))]
-    {(str (base-path context) "/badge") [["" my/handler]
-                                         ["/mybadges" my/handler]
-                                         [["/info/" :badge-id] info/handler]
-                                         [["/info/" :badge-id "/embed"] embed/handler]
-                                         [["/info/" :badge-id "/pic/embed"] embed-pic/handler]
-                                         ["/import" imp/handler]
-                                         [["/receive/" :badge-id] rec/handler]
-                                         ["/application" #_app/handler app-handler]]}))
+  {(str (base-path context) "/badge") [["" my/handler]
+                                       ["/mybadges" my/handler]
+                                       [["/info/" :badge-id] info/handler]
+                                       [["/info/" :badge-id "/embed"] embed/handler]
+                                       [["/info/" :badge-id "/pic/embed"] embed-pic/handler]
+                                       ["/import" imp/handler]
+                                       [["/receive/" :badge-id] rec/handler]]})

 (defn ^:export navi [context]
-  (let [app-handler (first (plugin-fun (session/get :plugins) "application" "handler"))
-        navi {(str (base-path context) "/badge") {:weight 20 :title (t :badge/Badges)   :top-navi true  :breadcrumb (t :badge/Badges " / " :badge/Mybadges)}
-              (str (base-path context) "/badge/mybadges") {:weight 20 :title (t :badge/Mybadges) :site-navi true :breadcrumb (t :badge/Badges " / "  :badge/Mybadges)}
-              (str (base-path context) "/badge/import") {:weight 22 :title (t :badge/Import) :site-navi false :breadcrumb (t :badge/Badges " / " :badge/Import)}
-              (str (base-path context) "/badge/info/\\d+") {:breadcrumb   (t :badge/Badges " / " :badge/Badgeinfo)}}]
-    (if app-handler
-      (merge navi {(str (base-path context) "/badge/application") {:weight 45 :title (t :extra-application/Application)  :site-navi true :breadcrumb (t :badge/Badges  " / " :extra-application/Application)}})
-      navi)))
+  {(str (base-path context) "/badge") {:weight 20 :title (t :badge/Badges)   :top-navi true  :breadcrumb (t :badge/Badges " / " :badge/Mybadges)}
+   (str (base-path context) "/badge/mybadges") {:weight 20 :title (t :badge/Mybadges) :site-navi true :breadcrumb (t :badge/Badges " / "  :badge/Mybadges)}
+   (str (base-path context) "/badge/import") {:weight 22 :title (t :badge/Import) :site-navi false :breadcrumb (t :badge/Badges " / " :badge/Import)}
+   (str (base-path context) "/badge/info/\\d+") {:breadcrumb   (t :badge/Badges " / " :badge/Badgeinfo)}})


don't return huge values from some ws funcs

--- src/com/billpiel/mem_tracer/core.clj
+++ src/com/billpiel/mem_tracer/core.clj
@@ -25,10 +25,18 @@
   @(ws-init! :quiet))
 (util/defalias w-gc! ws-get-current!)

+(defn ws-show-traced
+  [& [ws]]
+  (:traced (or ws
+               (ws-get-current!))))
+(util/defalias w-st ws-show-traced)
+
 (defn ws-remove-all-traces!
   "Disables and removes all traces in the active workspace."
-  [] (#'ws/remove-all-traces! workspace))
-(util/defalias w-rat! ws-remove-trace-ns!)
+  []
+  (#'ws/remove-all-traces! workspace)
+  (ws-show-traced))
+(util/defalias w-rat! ws-remove-all-traces!)

 (defn ws-reset!
   "Removes all traces set by active workspace. Resets the active workspace to nil."
@@ -102,7 +110,8 @@
   [slot]
   (#'ws/save-as! workspace
                  (:ws-ns @config)
-                 slot))
+                 slot)
+  true)
 (util/defalias w-sa! ws-save-as!)

 (defn ws-load!
@@ -113,14 +122,9 @@
   (#'ws/load! workspace
               (:ws-ns @config)
               slot
-              force))
+              force)
+  true)
 (util/defalias w-l! ws-load!)
-
-(defn ws-show-traced
-  [& [ws]]
-  (:traced (or ws
-               (ws-get-current!))))
-(util/defalias w-st ws-show-traced)

 ;; === END Workspace functions

@@ -135,7 +139,8 @@
 (defn rec-save!
   "Saves active recording to the recording shelf namespace in the pre-specified slot."
   []
-  (#'rec/save! recording (:rec-ns @config)))
+  (#'rec/save! recording (:rec-ns @config))
+  true)
 (util/defalias r-s! rec-save!)

 (defn rec-save-as!
@@ -172,7 +177,8 @@

 (defn rec-load-from-ws!
   [& [force]]
-  (rec-load-from! (ws-get-current!) force))
+  (rec-load-from! (ws-get-current!) force)
+  true)
 (util/defalias r-lfw! rec-load-from-ws!)

 ;; === END Recording functions
@@ -227,7 +233,8 @@
   [coll]
   (-> coll
       get-trees
-      so/print-trees))
+      (#'so/print-trees)))
+(util/defalias p-t print-trees)

 (defn ws-print
   [& [ws]]


Немного укоротил вывод даты до минут

Немного укоротил вывод даты до минут

--- radiolamp-6P3S/src/ixinfestor/omut.cljs
+++ radiolamp-6P3S/src/ixinfestor/omut.cljs
@@ -1100,7 +1100,7 @@
                (dom/label #js {:className (str "control-label " label-class+) } label)
                (dom/div #js {:className input-class+ :style #js {}}
                         (dom/b nil "введено: "
-                               (date-com-format-datetime (input-datetime--parse-str-to-date (@app :value))))
+                               (date-com-format-datetime-to-min (input-datetime--parse-str-to-date (@app :value))))
                         (om/build
                          input app
                          {:opts (assoc spec-input


Рудимент

Рудимент

--- radiolamp-6P3S/src/ixinfestor/omut.cljs
+++ radiolamp-6P3S/src/ixinfestor/omut.cljs
@@ -1343,7 +1343,6 @@
                   :active? (@app :value)
                   :disabled? disabled?
                   :on-click (fn [_]
-                              (when before-onClick-fn (before-onClick-fn))
                               (om/transact! app :value not)
                               (when onClick-fn (onClick-fn)))
                   :text (if (@app :value) text-on text-off)}))))


code cleanup

code cleanup

--- src/metabase/api/session.clj
+++ src/metabase/api/session.clj
@@ -87,7 +87,7 @@
   [:as {{:keys [token password] :as body} :body}]
   {token    Required
    password [Required ComplexPassword]}
-  (api-let [400 "Invalid reset token"] [[_ user-id] (re-matches #"(^\d+)_.+$" token)
+  (api-let [400 "Invalid reset token"] [[_ user-id]                           (re-matches #"(^\d+)_.+$" token)
                                         user-id                               (Integer/parseInt user-id)
                                         {:keys [reset_token reset_triggered]} (sel :one :fields [User :reset_triggered :reset_token] :id user-id)]
     ;; Make sure the plaintext token matches up with the hashed one for this user


Use user-mentions instead of pill in uploads view

--- src/braid/core/client/uploads/views/uploads_page.cljs
+++ src/braid/core/client/uploads/views/uploads_page.cljs
@@ -2,7 +2,7 @@
   (:require
    [braid.core.client.helpers :as helpers]
    [braid.core.client.routes :as routes]
-   [braid.core.client.ui.views.pills :as pills]
+   [braid.core.client.ui.views.mentions :as mentions]
    [braid.core.client.ui.views.thread :as thread]
    [clojure.string :as string]
    [re-frame.core :refer [dispatch subscribe]]
@@ -52,7 +52,8 @@
                    (dispatch [:core.uploads/delete-upload (:id upload)])))}
               \uf1f8])]
           [:td.uploader
-           "Uploaded by " [pills/user-pill-view (upload :uploader-id)]]
+           "Uploaded by "
+           [mentions/user-mention-view (upload :uploader-id)]]
           [:td.uploaded-thread
            [:a {:href (routes/page-path {:group-id @group-id
                                          :page-id "thread"


Fix docstring

Fix docstring

--- src/matchmaker_sparql/core.clj
+++ src/matchmaker_sparql/core.clj
@@ -13,7 +13,7 @@
   (str "templates/matchmaker/contract/bidder/" (string/replace (name kind) #"-" "_")))

 (defn- match-contract'
-  "Match `contract` to bidders using a `template` rendered with `data`."
+  "Match `contract` to bidders using the `query`."
   [query]
   (map :match (sparql/select-query endpoint query)))


adding appropriate validation failure error messages

--- src/midje/ideas/background.clj
+++ src/midje/ideas/background.clj
@@ -147,7 +147,8 @@
   (cond
       (and (#{"after" "around"} (name state-description)) (not= 3 (count form)))
       (user-error-report-form form
-        (cl-format nil "    ~A form should look like: (~A :contents/:facts/:checks (your-code))" form (name state-description)))
+        (cl-format nil "    In this form: ~A" form)
+        (cl-format nil "~A forms should look like: (~A :contents/:facts/:checks (your-code))" (name state-description) (name state-description)))

       (and (= "before" (name state-description))
            (not= 3 (count form))
@@ -155,8 +156,9 @@
                (and (= 5 (count form))
                     (not= :after (nth form 3)))))
       (user-error-report-form form
-        (cl-format nil "    ~A form should look like: (before :contents/:facts/:checks (your-code)) or" form (name state-description))
-        (cl-format nil "    (before :contents/:facts/:checks (your-code) :after (final-code))"))
+        (cl-format nil "    In this form: ~A" form)
+        "before forms should look like: (before :contents/:facts/:checks (your-code)) or "
+        "(before :contents/:facts/:checks (your-code) :after (final-code))")

       ((complement valid-wrapping-targets) wrapping-target)
       (user-error-report-form form
@@ -198,19 +200,19 @@
 (defmethod validate "against-background" [[_against-background_ state-descriptions+fakes & _body_ :as form]]
   (cond (< (count form) 3)
         (user-error-report-form form
-          "    against-background form looks like it is missing background fakes or state descriptions:"
+          "against-background form has no background fakes or state descriptions:"
           (str form))

         (vector? state-descriptions+fakes)
         (when-valid (filter state-description? state-descriptions+fakes)
           (cond (not (valid-state-descriptions+fakes? state-descriptions+fakes))
                 (user-error-report-form form
-                  "    something doesn't look like a state-desccription or a background fake:"
+                  "Badly formatted against-background fakes:"
                   (str form))

                 (empty? state-descriptions+fakes)
                 (user-error-report-form form
-                  "    can't be empty:"
+                  "You didn't enter any background fakes or wrappers:"
                   (str form))

                 :else
@@ -230,4 +232,6 @@
   (when-valid (filter state-description? state-descriptions+fakes)
     (if (valid-state-descriptions+fakes? state-descriptions+fakes)
       state-descriptions+fakes
-      (user-error-report-form form "boom"))))+      (user-error-report-form form
+        (cl-format nil "Badly formatted background fakes:")
+        (str form)))))


examples: fix errors, print start/stop messages

--- dev/examples.clj
+++ dev/examples.clj
@@ -4,19 +4,24 @@
 ;;; Dummy functions to use in the examples

 (defn connect-to-database [host port]
-  (prn "Opening database connection")
+  (println ";; Opening database connection")
   (reify java.io.Closeable
-    (close [_] (prn "Closing database connection"))))
+    (close [_] (println ";; Closing database connection"))))

 (defn execute-query [& _]
-  (prn 'execute-query))
+  (println ";; execute-query"))

 (defn execute-insert [& _]
-  (prn 'execute-insert))
+  (println ";; execute-insert"))

 (defn new-scheduler []
-  (prn 'new-scheduler)
-  {})
+  (reify component/Lifecycle
+    (start [this]
+      (println ";; Starting scheduler")
+      this)
+    (stop [this]
+      (println ";; Stopping scheduler")
+      this)))

 ;;; Example database component
@@ -29,6 +34,7 @@
   component/Lifecycle

   (start [component]
+    (println ";; Starting database")
     ;; In the 'start' method, initialize this component
     ;; and start it running. For example, connect to a
     ;; database, create thread pools, or initialize shared
@@ -39,6 +45,7 @@
       (assoc component :connection conn)))

   (stop [component]
+    (println ";; Stopping database")
     ;; In the 'stop' method, shut down the running
     ;; component and release any external resources it has
     ;; acquired.
@@ -76,11 +83,13 @@
   component/Lifecycle

   (start [this]
+    (println ";; Starting ExampleComponent")
     ;; In the 'start' method, a component may assume that its
     ;; dependencies are available and have already been started.
     (assoc this :admin (get-user database "admin")))

   (stop [this]
+    (println ";; Stopping ExampleComponent")
     ;; Likewise, in the 'stop' method, a component may assume that its
     ;; dependencies will not be stopped until AFTER it is stopped.
     this))
@@ -103,15 +112,17 @@
 ;; which take a set of keys naming components in the system to be
 ;; started/stopped. Order of the keys doesn't matter here.

+(def example-system-components [:scheduler :app :db])
+
 (defrecord ExampleSystem [config-options db scheduler app]
   component/Lifecycle
   (start [this]
-    (component/start-system this [:scheduler :app :db]))
+    (component/start-system this example-system-components))
   (stop [this]
-    (component/stop-system this [:scheduler :app :db])))
+    (component/stop-system this example-system-components)))

 ;; When constructing the system, specify the dependency relationships
-;; among components using the `using` function.
+;; among components with the `using` function.

 (defn example-system [config-options]
   (let [{:keys [host port]} config-options]
@@ -146,15 +157,38 @@

 (defrecord AnotherComponent [component-a component-b])

+(defrecord AnotherSystem [component-a component-b component-c])
+
 (defn another-component []
   (component/using
-    (->AnotherComponent nil nil)
+    (map->AnotherComponent {})
     [:component-a :component-b]))
-
-(defrecord AnotherSystem [component-a component-b component-c])

+;; Sample usage:
+(comment
+
+(def system (example-system {:host "dbhost.com" :port 123}))
+;;=> #'examples/system
+
+(alter-var-root #'system component/start)
+;; Starting database
+;; Opening database connection
+;; Starting scheduler
+;; Starting ExampleComponent
+;; execute-query
+;;=> #examples.ExampleSystem{ ... }
+
+(alter-var-root #'system component/stop)
+;; Stopping ExampleComponent
+;; Stopping scheduler
+;; Stopping database
+;; Closing database connection
+;;=> #examples.ExampleSystem{ ... }
+
+
+)

 ;; Local Variables:
 ;; clojure-defun-style-default-indent: t


[scamp] always reset random state in 'scamp-test wrapper

--- modules/scamp/test/scamp/core_test.clj
+++ modules/scamp/test/scamp/core_test.clj
@@ -21,6 +21,7 @@

 (defn scamp-test [f]
   (core/reset-envelope-ids!)
+  (reset-rand-state!)
   (f))

 (deftest subscribe-new-node-test


Whitespace

Whitespace

--- src/oxcart.clj
+++ src/oxcart.clj
@@ -30,6 +30,7 @@

 (def root-directory
   @#'clojure.core/root-directory)
+

 (def ^:dynamic *load-configuration*
   "Dynamic var that oxcart/load uses to stash its configuration.


Add basic-quorum

Add basic-quorum

--- src/icecap/store/riak.clj
+++ src/icecap/store/riak.clj
@@ -34,6 +34,7 @@
      :dw w

      :notfound-ok false
+     :basic-quorum true

      :allow-mult false
      :last-write-wins true}))


minor clean up of midi-note string fns in pitch.clj

--- src/overtone/music/pitch.clj
+++ src/overtone/music/pitch.clj
@@ -109,10 +109,33 @@
 (def MIDI-NOTE-RE (re-pattern MIDI-NOTE-RE-STR))
 (def ONLY-MIDI-NOTE-RE (re-pattern (str "\\A" MIDI-NOTE-RE-STR "\\Z")))

-(defn- parse-note-match
+(defn midi-string-matcher
+  "Determines whether a midi keyword is valid or not. If valid,
+  returns a regexp match object"
+  [mk]
+  (re-find ONLY-MIDI-NOTE-RE (name mk)))
+
+(defn validate-midi-string!
+  "Throws a friendly exception if midi-keyword mk is not
+  valid. Returns regexp match object if valid."
+  [mk]
+  (let [matcher (midi-string-matcher mk)]
+    (when-not matcher
+      (throw (IllegalArgumentException.
+              (str "Invalid midi-string. " mk
+                   " does not appear to be in MIDI format i.e. C#4"))))
+
+    (let [[match pictch-class octave] matcher]
+      (when (< (Integer. octave) -1)
+        (throw (IllegalArgumentException.
+                (str "Invalid midi-string: " mk
+                     ". Octave is out of range. Lowest octave value is -1")))))
+    matcher))
+
+(defn note-map
   "Takes a match array returned by a regexp match and returns a map of note info"
-  [match]
-  (let [[match pitch-class octave] match
+  [midi-string]
+  (let [[match pitch-class octave] (validate-midi-string! midi-string)
         pitch-class                (canonical-pitch-class-name pitch-class)
         octave                     (Integer. octave)
         interval                   (NOTES (keyword pitch-class))]
@@ -122,6 +145,20 @@
      :interval    interval
      :midi-note   (octave-note octave interval)}))

+
+(defn mk-midi-string
+  "Takes a string or keyword representing a pitch and a number
+  representing an integer and returns a new keyword which is a
+  concatanation of the two. Throws an error if the resulting midi
+  string is invalid.
+
+  (midi-string :F 7)  ;=> :F7
+  (midi-string :Eb 3) ;=> :Eb3"
+  [pitch-key octave]
+  (let [res (str (name pitch-key) octave)]
+    (validate-midi-string! res)
+    res))
+
 (defn note
   "Resolves note to MIDI number format. Resolves upper and lower-case keywords
   and strings in MIDI note format. If given an integer or nil, returns them
@@ -136,31 +173,18 @@
   (note :db5)    ;=> 73
   (note 60)      ;=> 60
   (note nil)     ;=> nil"
-
   [n]
   (cond
-   (nil? n) nil
-   (integer? n) (if (>= n 0)
-                    n
-                    (throw (IllegalArgumentException.
-                            (str "Unable to resolve note: "
-                                 n
-                                 ". Value is out of range. Lowest value is 0"))))
-   (keyword? n) (note (name n))
-   (string? n) (let [match (re-find ONLY-MIDI-NOTE-RE n)
-                     _ (when (nil? match)
-                         (throw (IllegalArgumentException.
-                                 (str "Unable to resolve note: "
-                                      n
-                                      ". Does not appear to be in MIDI format i.e. C#4"))))
-                     note-match (parse-note-match match)
-                     _ (when (< (:octave note-match) -1)
-                         (throw (IllegalArgumentException.
-                                 (str "Unable to resolve note: "
-                                      n
-                                      ". Octave is out of range. Lowest octave value is -1"))))]
-                 (:midi-note note-match))
-   :else (throw (IllegalArgumentException. (str "Unable to resolve note: " n ". Wasn't a recognised format (either an integer, keyword, string or nil)")))))
+    (nil? n) nil
+    (integer? n) (if (>= n 0)
+                   n
+                   (throw (IllegalArgumentException.
+                           (str "Unable to resolve note: "
+                                n
+                                ". Value is out of range. Lowest value is 0"))))
+    (keyword? n) (note (name n))
+    (string? n) (:midi-note (note-map n))
+    :else (throw (IllegalArgumentException. (str "Unable to resolve note: " n ". Wasn't a recognised format (either an integer, keyword, string or nil)")))))

 (defn match-note
   "Returns the first midi-note formatted substring in s. If passed optional prev
@@ -172,7 +196,7 @@
            look-ahead (if post-str (str "(?=" post-str ")") "")
            match (re-find (re-pattern (str look-behind MIDI-NOTE-RE-STR look-ahead)) s)]
        (when match
-         (parse-note-match match)))))
+         (note-map match)))))


Em & en dashes now converted

Em & en dashes now converted

--- src/omhome/transformations.clj
+++ src/omhome/transformations.clj
@@ -34,6 +34,8 @@
 (def ellipsis "...")
 (def triple-prime "'''")
 (def double-prime "''")
+(def em-dash "---")
+(def en-dash "--")
 (def opening-double-quote #"(\W|^)\"(\S)")
 (def closing-double-quote #"(\u201c[^\"]*)\"([^\"]*$|[^\u201c\"]*\u201c)")
 (def closing-double-quote-supp #"([^0-9])\"")
@@ -50,6 +52,8 @@
                    [(includes? ellipsis)] #(s/replace % ellipsis "\u2026")
                    [(includes? triple-prime)] #(s/replace % triple-prime "\u2034")
                    [(includes? double-prime)] #(s/replace % double-prime "\u2033")
+                   [(includes? em-dash)] #(s/replace % em-dash "\u2014")
+                   [(includes? en-dash)] #(s/replace % en-dash "\u2013")
                    [(re= opening-double-quote)] #(s/replace % opening-double-quote "$1\u201c$2")
                    [(re= closing-double-quote)] #(s/replace % closing-double-quote "$1\u201d$2")
                    [(re= closing-double-quote-supp)] #(s/replace % closing-double-quote-supp "$1\u201d")


Reset iterator on recover to avoid stale reads.

--- src/onyx/plugin/bookkeeper.clj
+++ src/onyx/plugin/bookkeeper.clj
@@ -124,8 +124,9 @@
     offset)

   (recover! [this replica-version checkpoint]
-    (println "RECOVER FROM CHECKPOINT" checkpoint)
+    (info "RECOVER FROM CHECKPOINT" checkpoint)
     (set! drained false)
+    (set! entries nil)
     (set! offset (or checkpoint (:bookkeeper/ledger-start-id task-map)))
     this)


play with tests in clojure -- still not hooked up or actual tests

--- src/test/clojure/rx/lang/clojure/observable_tests.clj
+++ src/test/clojure/rx/lang/clojure/observable_tests.clj
@@ -2,4 +2,6 @@
   (import rx.Observable))

 ;; still need to get this wired up in build.gradle to run as tests
-; (-> (rx.Observable/toObservable [\"one\" \"two\" \"three\"]) (.take 2) (.subscribe (fn [arg] (println arg))))+; (-> (rx.Observable/toObservable ["one" "two" "three"]) (.take 2) (.subscribe (fn [arg] (println arg))))
+
+; (-> (rx.Observable/toObservable [1 2 3]) (.takeWhile (fn [x i] (< x 2))) (.subscribe (fn [arg] (println arg))))


Don't need to test date rendering anymore.

--- test-cljs/frontend/components/test_documentation.cljs
+++ test-cljs/frontend/components/test_documentation.cljs
@@ -48,11 +48,6 @@
   (let [test-doc (:continuous-deployment-with-heroku test-docs)
         test-node (goog.dom/htmlToDocumentFragment "

")]
     (om/root documentation/docs-subpage test-doc {:target test-node})
-    (is (re-find #"Last Updated"
-                 (-> test-node
-                     (sel1 "p")
-                     utils/text))
-        "Updated date renders")
     (is (= "Quick start videos"
            (-> test-node
                (sel1 "h2")


A couple of simple optimizations

A couple of simple optimizations

--- src/reagent/impl/template.cljs
+++ src/reagent/impl/template.cljs
@@ -57,13 +57,14 @@
         :else (to-js-val x)))

 (defn set-id-class [props [id class]]
-  (let [pid (.' props :id)]
-    (.! props :id (if (some? pid) pid id))
-    (when (some? class)
-      (let [old (.' props :className)]
-        (.! props :className (if (some? old)
-                               (str class " " old)
-                               class))))))
+  (when (some? id)
+    (let [pid (.' props :id)]
+      (.! props :id (if (some? pid) pid id))))
+  (when (some? class)
+    (let [old (.' props :className)]
+      (.! props :className (if (some? old)
+                             (str class " " old)
+                             class)))))

 (defn convert-props [props id-class]
   (if (and (empty? props) (nil? id-class))
@@ -238,10 +239,13 @@
     a))

 (defn make-element [argv comp jsprops first-child]
-  (if (== (count argv) (inc first-child))
-    ;; Optimize common case of one child
-    (.' js/React createElement comp jsprops
-        (as-element (nth argv first-child)))
+  (case (- (count argv) first-child)
+    ;; Optimize cases of zero or one child
+    0 (.' js/React createElement comp jsprops)
+
+    1 (.' js/React createElement comp jsprops
+          (as-element (nth argv first-child)))
+
     (.apply (.' js/React :createElement) nil
             (reduce-kv (fn [a k v]
                          (when (>= k first-child)


RS | #129 Log missing config variables as info if a default is provided or an error if no default is provided

--- src/objective8/config.clj
+++ src/objective8/config.clj
@@ -16,5 +16,8 @@
   ([var-name default]
   (if-let [variable (get (System/getenv) var-name)]
     variable
-    (do (log/error (str "Failed to look up environment variable \"" var-name "\""))
-        default))))
+    (do
+      (if default
+          (log/info (str "Failed to look up environment variable \"" var-name "\" - using provided default"))
+          (log/error (str "Failed to look up environment variable \"" var-name "\" - no default provided")))
+      default))))


Commit messages only after acking periodically.

[ci skip]

--- src/onyx/plugin/kafka.clj
+++ src/onyx/plugin/kafka.clj
@@ -1,5 +1,5 @@
 (ns onyx.plugin.kafka
-  (:require [clojure.core.async :refer [chan >!! <!! close! timeout alts!!]]
+  (:require [clojure.core.async :refer [chan >!! <!! close! timeout alts!! sliding-buffer]]
             [clj-kafka.producer :as kp]
             [clj-kafka.zk :as kzk]
             [clj-kafka.consumer.simple :as kc]
@@ -7,7 +7,8 @@
             [cheshire.core :refer [parse-string]]
             [zookeeper :as zk]
             [onyx.peer.pipeline-extensions :as p-ext]
-            [taoensso.timbre :as log :refer [fatal]]))
+            [taoensso.timbre :as log :refer [fatal]])
+  (:import [kafka.message Message]))

 (defn id->broker [m]
   (k/with-resource [z (zk/connect (get m "zookeeper.connect"))]
@@ -30,9 +31,17 @@
         (kc/topic-offset consumer topic partition :latest)
         :else (kzk/committed-offset m group-id topic (str partition))))

+
+(defn highest-offset-to-commit [offsets]
+  (->> (partition-all 2 1 offsets)
+       (partition-by #(- (or (second %) (first %)) (first %)))
+       (first)
+       (last)
+       (last)))
+
 (defn start-kafka-consumer
   [{:keys [onyx.core/task-map] :as event} lifecycle]
-  (let [{:keys [kafka/topic kafka/partition kafka/group-id fetch-size]} task-map
+  (let [{:keys [kafka/topic kafka/partition kafka/group-id fetch-size chan-capacity]} task-map
         partition (str partition)
         client-id "onyx"
         m {"zookeeper.connect" (:kafka/zookeeper task-map)}
@@ -41,33 +50,40 @@
         broker (get (id->broker m) (first brokers))
         consumer (kc/consumer (:host broker) (:port broker) client-id)
         offset (starting-offset consumer topic partition group-id task-map)
-        messages (kc/messages consumer "onyx" topic partition offset fetch-size)]
+        messages (kc/messages consumer "onyx" topic partition offset fetch-size)
+        ch (chan (sliding-buffer chan-capacity))
+        pending-messages (atom {})
+        pending-commits (atom (sorted-set))
+        reader-fut (future
+                     (try
+                       (log/debug "Opening Kafka resource " task-map)
+                       (loop [ms messages]
+                         (if (first ms)
+                           (>!! ch {:message (.payload ^Message (first ms))
+                                    :offset (.offset ^int (first ms))})
+                           (Thread/sleep (:kafka/empty-read-back-off task-map)))
+                         (recur (rest ms)))
+                       (catch InterruptedException e)
+                       (catch Throwable e
+                         (fatal e))))
+        commit-fut (future
+                     (try
+                       (loop []
+                         (Thread/sleep (:kafka/commit-interval task-map))
+                         (let [offset (highest-offset-to-commit @(pending-commits))]
+                           (kzk/set-offset! m consumer topic partition offset)
+                           (swap! pending-commits (fn [coll] (remove (fn [k] (<= k offset)) coll)))
+                           (recur)))
+                       (catch InterruptedException e)
+                       (catch Throwable e
+                         (fatal e))))]
     {:kafka/consumer consumer
-     :kafka/messages messages}))
-
-(defn inject-read-messages
-  [{:keys [onyx.core/task-map] :as pipeline} lifecycle]
-  (let [config {"zookeeper.connect" (:kafka/zookeeper task-map)
-                "group.id" (:kafka/group-id task-map)
-                "auto.offset.reset" (:kafka/offset-reset task-map)
-                "auto.commit.enable" "true"}
-        ch (chan (:kafka/chan-capacity task-map))]
-    {:kafka/future (future
-                     (try
-                       (log/debug "Opening Kafka resource " config)
-                       (k/with-resource [c (zk/consumer config)]
-                         zk/shutdown
-                         (loop [ms (zk/messages c (:kafka/topic task-map))]
-                           (if (= (:value (first ms)) :done)
-                             (>!! ch :done)
-                             (>!! ch {:content (:value (first ms))}))
-                           (recur (rest ms))))
-                       (catch InterruptedException e)
-                       (catch Exception e
-                         (fatal e)))
-                     (log/debug "Stopping Kafka consumer and cleaning up"))
+     :kafka/messages messages
      :kafka/read-ch ch
-     :kafka/pending-messages (atom {})}))
+     :kafka/reader-future reader-fut
+     :kafka/commit-future commit-fut
+     :kafka/pending-messages pending-messages
+     :kafka/pending-commits pending-commits}))

 (defmethod p-ext/read-batch :kafka/read-messages
   [{:keys [kafka/read-ch kafka/pending-messages onyx.core/task-map] :as event}]
@@ -79,21 +95,20 @@
         timeout-ch (timeout ms)
         batch (->> (range max-segments)
                    (map (fn [_]
-                          (let [result (first (alts!! [read-ch timeout-ch] :priority true))]
-                            (if (= :done result)
-                              {:id (java.util.UUID/randomUUID)
-                               :input :kafka
-                               :message :done}
-                              {:id (java.util.UUID/randomUUID)
-                               :input :kafka
-                               :message (:content result)}))))
+                          (let [result (first (alts!! [read-ch timeout-ch] :priority true))
+                                ]
+                            {:id (java.util.UUID/randomUUID)
+                             :input :kafka
+                             :message (read-string (String. (:message result) "UTF-8"))
+                             :offset (:offset result)})))
                    (remove (comp nil? :message)))]
     (doseq [m batch]
-      (swap! pending-messages assoc (:id m) (select-keys m [:message])))
+      (swap! pending-messages assoc (:id m) (select-keys m [:message :offset])))
     {:onyx.core/batch batch}))

 (defmethod p-ext/ack-message :kafka/read-messages
-  [{:keys [kafka/pending-messages onyx.core/log onyx.core/task-id]} message-id]
+  [{:keys [kafka/pending-messages kafka/pending-commits onyx.core/log onyx.core/task-id]} message-id]
+  (swap! pending-commits conj (:offset (get pending-messages message-id)))
   (swap! pending-messages dissoc message-id))

 (defmethod p-ext/retry-message :kafka/read-messages
@@ -116,7 +131,8 @@

 (defn close-read-messages
   [{:keys [kafka/read-ch] :as pipeline} lifecycle]
-  (future-cancel (:kafka/future pipeline))
+  (future-cancel (:kafka/reader-future pipeline))
+  (future-cancel (:kafka/commit-future pipeline))
   (close! read-ch)
   {})

@@ -142,7 +158,7 @@
   {})

 (def read-messages-calls
-  {:lifecycle/before-task inject-read-messages
+  {:lifecycle/before-task start-kafka-consumer
    :lifecycle/after-task close-read-messages})

 (def write-messages-calls


[onyx-kafka#28] Do not handle-exception :restart on unrecoverable exceptions

--- src/onyx/plugin/kafka.clj
+++ src/onyx/plugin/kafka.clj
@@ -56,6 +56,7 @@
             (when-not offset
               (throw (ex-info "Offset missing for existing partition when using :kafka/start-offsets"
                               {:missing-partition kpartition
+                               :recoverable? false
                                :kafka/start-offsets start-offsets})))
             (seek-to-offset! consumer {:topic topic :partition kpartition} offset))
           (cp/seek-to-beginning-offset! consumer [{:topic topic :partition kpartition}]))))))
@@ -71,7 +72,8 @@
             (cp/seek-to-end-offset! consumer [{:topic topic :partition kpartition}])

             :else
-            (throw (ex-info "Tried to seek to unknown policy" {:policy policy}))))
+            (throw (ex-info "Tried to seek to unknown policy" {:recoverable? false
+                                                               :policy policy}))))
     (checkpoint-or-beginning log consumer topic kpartition group-id task-map)))

 (defn log-id [replica-val job-id peer-id task-id]
@@ -97,7 +99,8 @@
     (if (seq results)
       results
       (throw (ex-info "Could not locate any Kafka brokers to connect to."
-                      {:zk-addr zk-addr})))))
+                      {:recoverable? true
+                       :zk-addr zk-addr})))))

 (defn highest-offset-to-commit [offsets]
   (->> (sort offsets)
@@ -136,6 +139,7 @@
                         :n-peers n-peers
                         :min-peers min-peers
                         :max-peers max-peers
+                        :recoverable? false
                         :task-map task-map})]
         (log/error e)
         (throw e)))))
@@ -212,7 +216,7 @@
        (recur (dec n))))))

 (defrecord KafkaReadMessages
-  [max-pending batch-size batch-timeout pending-messages pending-commits drained? iter retry-ch segment-fn]
+  [task-map max-pending batch-size batch-timeout pending-messages pending-commits drained? iter retry-ch segment-fn]
   p-ext/Pipeline
   (write-batch
     [this event]
@@ -236,8 +240,9 @@
                  (or (not (empty? @pending-messages))
                      (not (empty? batch))))
         (if (:kafka/done-unsupported? event)
-          (throw (UnsupportedOperationException. ":done is not supported for auto assigned kafka partitions.
-                                                  (:kafka/partition must be supplied)"))
+          (throw (ex-info ":done is not supported for auto assigned kafka partitions. (:kafka/partition must be supplied)"
+                          {:recoverable? false
+                           :task-map task-map}))
           (reset! drained? true)))
       {:onyx.core/batch batch}))

@@ -287,7 +292,7 @@
                                        (deserializer-fn (.value cr)))
                               :offset (.offset cr))))
         buffered-segments (atom nil)]
-    (->KafkaReadMessages max-pending batch-size batch-timeout
+    (->KafkaReadMessages task-map max-pending batch-size batch-timeout
                          pending-messages pending-commits drained? buffered-segments retry-ch segment-fn)))

 (defn close-read-messages
@@ -315,18 +320,18 @@
         k (some-> m :key serializer-fn)
         p (some-> m :partition int)
         message-topic (get m :topic topic)]
-    (cond
-      (nil? message)
-      (throw (ex-info "Payload is missing required :message!"
-                      {:payload m}))
-      (nil? message-topic)
-      (throw (ex-info
-              (str "Unable to write message payload to Kafka! "
-                   "Both :kafka/topic, and :topic in message payload "
-                   "are missing!")
-              {:payload m}))
-      :else
-      (ProducerRecord. message-topic p k (serializer-fn message)))))
+    (cond (nil? message)
+          (throw (ex-info "Payload is missing required. Need message key :message"
+                          {:payload m}))
+
+          (nil? message-topic)
+          (throw (ex-info
+                  (str "Unable to write message payload to Kafka! "
+                       "Both :kafka/topic, and :topic in message payload "
+                       "are missing!")
+                  {:payload m}))
+          :else
+          (ProducerRecord. message-topic p k (serializer-fn message)))))

 (defrecord KafkaWriteMessages [task-map config topic producer serializer-fn]
   p-ext/Pipeline
@@ -366,7 +371,9 @@
     (->KafkaWriteMessages task-map config topic producer serializer-fn)))

 (defn read-handle-exception [event lifecycle lf-kw exception]
-  :restart)
+  (if (false? (:recoverable? (ex-data exception)))
+    :kill
+    :restart))

 (def read-messages-calls
   {:lifecycle/before-task-start start-kafka-consumer
@@ -374,7 +381,9 @@
    :lifecycle/after-task-stop close-read-messages})

 (defn write-handle-exception [event lifecycle lf-kw exception]
-  :restart)
+  (if (false? (:recoverable? (ex-data exception)))
+    :kill
+    :restart))

 (def write-messages-calls
   {:lifecycle/before-task-start inject-write-messages


cleaning out jons synth stuff until it works

--- src/overtone/app/main.clj
+++ src/overtone/app/main.clj
@@ -8,8 +8,7 @@
     (com.sun.scenario.scenegraph JSGPanel SGText SGShape SGGroup SGAbstractShape$Mode SGComponent
                                  SGTransform)
     (com.sun.scenario.scenegraph.event SGMouseAdapter)
-    (com.sun.scenario.scenegraph.fx FXShape)
-    (scenariogui.synth ISynth ISynthParam SynthControl))
+    (com.sun.scenario.scenegraph.fx FXShape))
   (:use (overtone.app editor)
         (overtone.core sc ugen synth envelope event)
         (overtone.gui scope)
@@ -82,26 +81,7 @@
       (.add (booter))
       (.add (header-status)))))

-(defn make-synth-param [[name start end step]]
-  (proxy [ISynthParam] []
-    (getName [] name)
-    (getStart [] start)
-    (getEnd [] end)
-    (getStep [] step)))
-
-(defn make-synth []
-  (let [s-fn (synth [freq 400 dur 0.2] (ug/* (ug/env-gen (perc 0.1 dur)) (ug/sin-osc freq)))]
-    (proxy [ISynth] []
-      (getParams [] (into-array (map make-synth-param [["freq" 0.0 1200.0 1.0] ["dur" 0.01 10.0 0.1]])))
-      (getName [] (:name (meta s-fn)))
-      (play [vals] (do (println "playing vals: " vals) (apply s-fn vals)))
-      (kill [] ())
-      (control [param value] (s-fn :ctl param value)))))
-
 (def scene-root* (ref nil))
-
-(defn synth-control []
-  (.add @scene-root* (SynthControl. (make-synth))))

 (defn overtone-scene [args]
   (let [root (SGGroup.)]


taking out browser for now

taking out browser for now

--- src/overtone/app/main.clj
+++ src/overtone/app/main.clj
@@ -10,7 +10,7 @@
                                  SGAbstractShape$Mode SGComponent SGTransform)
     (com.sun.scenario.scenegraph.event SGMouseAdapter)
     (com.sun.scenario.scenegraph.fx FXShape))
-  (:use (overtone.app editor browser)
+  (:use (overtone.app editor)
         (overtone.core sc ugen synth envelope event time-utils)
         (overtone.gui scope curve)
         clojure.stacktrace)
@@ -113,11 +113,11 @@
 (defn -main [& args]
   (let [app-frame (JFrame.  "Project Overtone")
         app-pane (.getContentPane app-frame)
-        browse-panel (browser)
+        ;browse-panel (browser)
         header-panel (header)
         scene-panel (JSGPanel.)
-        edit-panel (editor-panel)
-        left-split (JSplitPane. JSplitPane/HORIZONTAL_SPLIT browse-panel edit-panel)]
+        edit-panel (editor-panel)]
+        ;left-split (JSplitPane. JSplitPane/HORIZONTAL_SPLIT browse-panel edit-panel)]

     (when (not (connected?))
       (boot)
@@ -128,13 +128,16 @@
       (.setScene (overtone-scene args))
       (.setPreferredSize (Dimension. 600 900)))

+    (doto edit-panel
+      (.setPreferredSize (Dimension. 600 900)))
+
     (doto app-pane
       (.setLayout (BorderLayout.))
       (.add header-panel BorderLayout/NORTH)
-      (.add left-split BorderLayout/CENTER)
+      (.add edit-panel BorderLayout/WEST)
       (.add scene-panel BorderLayout/EAST))

-    (.setDividerLocation left-split 0.4)
+    ;(.setDividerLocation left-split 0.4)

     (doto app-frame
       (.pack)


Improvement to tag docstrings

Improvement to tag docstrings

--- src/shared/hyjinks/macros.cljc
+++ src/shared/hyjinks/macros.cljc
@@ -1,15 +1,17 @@
 (ns hyjinks.macros)
+
+(defn- docs [tag-name stuff]
+  (if (some #{'void-element} stuff)
+    (str "The <" tag-name "/> tag.")
+    (str "The <" tag-name "></" tag-name "> tag.")))

 (defmacro deftag [sym & stuff]
   `(def ~sym
-    ~(str "The <" (name sym) "> tag.")
+    ~(docs (name sym) stuff)
     (~'tag ~(name sym) ~@stuff)))

 (defmacro deftags [& syms]
-  `(do
-    ~@(map
-      (fn [sym] `(~'deftag ~sym))
-      syms)))
+  (cons 'do (map #(list 'deftag %) syms)))

 (defn- invoke-params [n]
   (map #(symbol (str "x" %)) (range n)))


CLJS: don't refer to non-existent utils/munge

--- src/main/cljs/cljs/tools/reader.cljs
+++ src/main/cljs/cljs/tools/reader.cljs
@@ -18,7 +18,7 @@
               get-line-number get-column-number get-file-name
               string-push-back-reader]]
             [cljs.tools.reader.impl.utils :refer
-             [char ex-info? whitespace? numeric? desugar-meta next-id munge
+             [char ex-info? whitespace? numeric? desugar-meta next-id
               ReaderConditional reader-conditional reader-conditional?]]
             [cljs.tools.reader.impl.commons :refer
              [number-literal? read-past match-number parse-symbol read-comment throwing-reader]]


목록에 여러줄 이어붙이기

목록에 여러줄 이어붙이기


improve code style

improve code style

--- src/clj/lambdacd/presentation/pipeline_structure.clj
+++ src/clj/lambdacd/presentation/pipeline_structure.clj
@@ -90,7 +90,7 @@
 (declare step-display-representation) ; mutual recursion

 (defn- seq-to-display-representations [parent-step-id part]
-  (map-indexed #(step-display-representation %2 (conj parent-step-id (inc %1))) (filter (complement nil?) part)))
+  (map-indexed #(step-display-representation %2 (conj parent-step-id (inc %1))) (remove nil? part)))

 (defn- is-container-step? [x]
   (let [dt (display-type x)]


bugfix: zmq sends chunks as bytes

bugfix: zmq sends chunks as bytes

--- src/clojure/src/leela/blackbox/network/zmqserver.clj
+++ src/clojure/src/leela/blackbox/network/zmqserver.clj
@@ -143,7 +143,7 @@
       (fn [[k n v o]] [{:key (f/bytes-to-uuid k)
                         :name (f/bytes-to-str n)
                         :value (f/str-to-bytes v)}
-                       (parse-opts o)])
+                       (parse-opts (f/bytes-to-str o))])
         (partition 4 attrs))))
   (msg-done))


added multi-transform tests

added multi-transform tests

--- test/com/rpl/specter/core_test.cljx
+++ test/com/rpl/specter/core_test.cljx
@@ -8,7 +8,8 @@
              :refer [paramsfn defprotocolpath defnav extend-protocolpath
                      nav declarepath providepath select select-one select-one!
                      select-first transform setval replace-in defnavconstructor
-                     select-any selected-any? collected? traverse]])
+                     select-any selected-any? collected? traverse
+                     multi-transform]])
   (:use
     #+clj [clojure.test :only [deftest is]]
     #+clj [clojure.test.check.clojure-test :only [defspec]]
@@ -17,7 +18,8 @@
            :only [paramsfn defprotocolpath defnav extend-protocolpath
                   nav declarepath providepath select select-one select-one!
                   select-first transform setval replace-in defnavconstructor
-                  select-any selected-any? collected? traverse]]
+                  select-any selected-any? collected? traverse
+                  multi-transform]]

     )

@@ -1304,3 +1306,24 @@

 (deftest setval-vals-collection-test
   (is (= 2 (setval s/VAL 2 :a))))
+
+(defspec multi-transform-test
+  (for-all+
+    [kw1 gen/keyword
+     kw2 gen/keyword
+     m (limit-size 5 (gen-map-with-keys gen/keyword gen/int kw1 kw2))]
+    (= (->> m (transform [(s/keypath kw1) s/VAL] +) (transform (s/keypath kw2) dec))
+       (multi-transform
+         (s/multi-path [(s/keypath kw1) s/VAL (s/terminal +)]
+                       [(s/keypath kw2) (s/terminal dec)])
+         m
+         ))))
+
+(deftest multi-transform-overrun-error
+  (is (thrown? Exception (multi-transform s/STAY 3)))
+  )
+
+(deftest terminal-val-test
+  (is (= 3 (multi-transform (s/terminal-val 3) 2)))
+  (is (= 3 (multi-transform [s/VAL (s/terminal-val 3)] 2)))
+  )


debugger: fix shortcut unlistening

debugger: fix shortcut unlistening

--- examples/_common/middleware/devtools.cljs
+++ examples/_common/middleware/devtools.cljs
@@ -112,7 +112,6 @@
   Non-existent parent ids are ignored."
   [id->parent-id id]
   {:pre [(map? id->parent-id)]}
-  (println "id->parent-id =" id->parent-id)
   (let [existing-ids (keys id->parent-id)
         result (atom #{})]
     (loop [child-id id]
@@ -198,7 +197,7 @@

                :on-stop
                (do
-                 #(@unlisten-shortcuts)
+                 (@unlisten-shortcuts )

                  (record-and-dispatch-to-app :on-stop nil))


Add tests for `fetch-entries` event

Add tests for `fetch-entries` event

--- test/elfeed_cljsrn/events_test.cljs
+++ test/elfeed_cljsrn/events_test.cljs
@@ -27,3 +27,25 @@
       (is (= (events/search-execute-handler {:db db} [:search/execute {:term term}])
              {:dispatch [:fetch-entries expected-search-params]
               :db expected-db})))))
+
+(deftest fetch-entries-handler-test
+  (testing
+    "when term in search-params is empty"
+    (let [term ""
+          expected-default-term "@15-days-old +unread"
+          db {}
+          search-params {:term term :default-term expected-default-term :feed-title nil}
+          subject (events/fetch-entries {:db db} [:fetch/entries search-params])]
+      (is (= (:params (:http-xhrio subject))
+             {:q (js/encodeURIComponent expected-default-term)}))
+      (is (= (:on-success (:http-xhrio subject)) [:success-fetch-entries search-params]))
+      (is (= (:db subject) {:fetching-feeds? true :fetching-entries? true}))))
+  (testing
+    "when there is feed-title in search-params"
+    (let [search-params {:term "@15-days-old +unread" :feed-title "Foo"}
+          term-without-feed-title (:term search-params)
+          subject (events/fetch-entries {:db db} [:fetch/entries search-params])]
+      (is (= (:params (:http-xhrio subject))
+             {:q (js/encodeURIComponent term-without-feed-title)}))
+      (is (= (:on-success (:http-xhrio subject)) [:success-fetch-entries search-params]))
+      (is (= (:db subject) {:fetching-feeds? true :fetching-entries? true})))))


Robustify test

Robustify test

--- test/exploud/messages/data_test.clj
+++ test/exploud/messages/data_test.clj
@@ -369,14 +369,14 @@
    :user "user"})

 (fact "that creating auto scaling group tags creates the right data"
-      (:auto-scaling-group-tags (:new-state (:parameters (create-auto-scaling-group-tags {:parameters create-auto-scaling-group-tags-params}))))
-      => [..application-tag.. ..contact-tag.. ..deployed-by-tag.. ..deployed-on-tag.. ..environment-tag.. ..name-tag.. ..version-tag..]
+      (sort (:auto-scaling-group-tags (:new-state (:parameters (create-auto-scaling-group-tags {:parameters create-auto-scaling-group-tags-params})))))
+      => ["application-tag" "contact-tag" "deployed-by-tag" "deployed-on-tag" "environment-tag" "name-tag" "version-tag"]
       (provided
        (time/now) => "time"
-       (to-auto-scaling-group-tag "new-asg" [:Application "application"]) => ..application-tag..
-       (to-auto-scaling-group-tag "new-asg" [:Contact "new-contact"]) => ..contact-tag..
-       (to-auto-scaling-group-tag "new-asg" [:DeployedBy "user"]) => ..deployed-by-tag..
-       (to-auto-scaling-group-tag "new-asg" [:DeployedOn "time"]) => ..deployed-on-tag..
-       (to-auto-scaling-group-tag "new-asg" [:Environment "environment"]) => ..environment-tag..
-       (to-auto-scaling-group-tag "new-asg" [:Name "application-environment-new-version"]) => ..name-tag..
-       (to-auto-scaling-group-tag "new-asg" [:Version "new-version"]) => ..version-tag..))
+       (to-auto-scaling-group-tag "new-asg" [:Application "application"]) => "application-tag"
+       (to-auto-scaling-group-tag "new-asg" [:Contact "new-contact"]) => "contact-tag"
+       (to-auto-scaling-group-tag "new-asg" [:DeployedBy "user"]) => "deployed-by-tag"
+       (to-auto-scaling-group-tag "new-asg" [:DeployedOn "time"]) => "deployed-on-tag"
+       (to-auto-scaling-group-tag "new-asg" [:Environment "environment"]) => "environment-tag"
+       (to-auto-scaling-group-tag "new-asg" [:Name "application-environment-new-version"]) => "name-tag"
+       (to-auto-scaling-group-tag "new-asg" [:Version "new-version"]) => "version-tag"))


Version 0.1.1-SNAPSHOT

Version 0.1.1-SNAPSHOT

--- metlog-common/project.clj
+++ metlog-common/project.clj
@@ -1,4 +1,4 @@
-(defproject metlog-common "0.1.0"
+(defproject metlog-common "0.1.1-SNAPSHOT"
   :description "Code common between the metlog agent and vault."

   :license {:name "Eclipse Public License"


GM: Fix failing tabbed-dataview-tests

GM: Fix failing tabbed-dataview-tests

--- test/hatti/views/dataview_test.cljs
+++ test/hatti/views/dataview_test.cljs
@@ -49,4 +49,4 @@
 (deftest tabbed-dataview-tests
   (let [tabbed-view (tabbed-dataview-container shared/app-state)]
     (testing "All tabs are rendered when none is disabled"
-      (is (re-find #"inactive" (dommy/html (sel1 tabbed-view)))))))
+      (is (re-find #"inactive" (dommy/html tabbed-view))))))


Style fix

Style fix

--- test/icecap/handlers/delay_test.clj
+++ test/icecap/handlers/delay_test.clj
@@ -36,8 +36,7 @@
   (let [{:keys [advance add-waiter]} (fake-clock)
         timeout (fn [^long ms]
                   (let [c (chan)]
-                    (add-waiter ms false (fn []
-                                           (close! c)))
+                    (add-waiter ms false (fn [] (close! c)))
                     c))]
     [advance {#'clojure.core.async/timeout timeout}]))


fixed timeline ticks

fixed timeline ticks

--- test/smooth_test/timeline_spec.cljc
+++ test/smooth_test/timeline_spec.cljc
@@ -39,7 +39,7 @@
                )

              (behavior "after all time is passed all callback timers are fired"
-               (tick 401)
+               (tick 301)
                (is (= 3 (count @detector)))
                (is (= "FIRST" (first @detector)))
                (is (= "SECOND" (second @detector)))


Use the dropping code.

Use the dropping code.

--- src/onyx/log/commands/submit_job.clj
+++ src/onyx/log/commands/submit_job.clj
@@ -34,7 +34,7 @@
   (throw (ex-info (format "Job scheduler %s not recognized" (:job-scheduler replica))
                   {:replica replica})))

-(defn job->n-peers [replica]
+(defn balance-jobs [replica]
   (let [j (count (:jobs replica))
         p (count (:peers replica))
         min-peers (int (/ p j))
@@ -46,6 +46,12 @@
            (fn [i [job-id tasks]]
              {job-id (if (<= i n) max-peers min-peers)})
            (:allocations replica)))))
+
+(defn job->peers [replica]
+  (reduce-kv
+   (fn [all job tasks]
+     (assoc all job (apply concat (vals tasks))))
+   {} (:allocations replica)))

 (defn peer->allocated-job [allocations id]
   (get
@@ -65,8 +71,11 @@
         [{:fn :volunteer-for-task :args {:id (:id peer-args)}}]
         (= (:job-scheduler old) :onyx.job-scheduler/round-robin)
         (if-let [allocation (peer->allocated-job (:allocations new) (:id peer-args))]
-          (let [peer-counts (job->n-peers new)]
-            (prn (get peer-counts (:job allocation)))
+          (let [peer-counts (balance-jobs new)
+                peers (get (job->peers new) (:job allocation))]
+            (when (> (count peers) (get peer-counts (:job allocation)))
+              (let [peers-to-drop (drop-peers new (:job allocation) (- (count peers) (get peer-counts (:job allocation))))]
+                (when (some #{(:id peer-args)} (into #{} peers-to-drop)))))
             [{:fn :volunteer-for-task :args {:id (:id peer-args)}}])
           [{:fn :volunteer-for-task :args {:id (:id peer-args)}}])))


Swap one at a time.

Swap one at a time.

--- src/onyx/messaging/acking_daemon.clj
+++ src/onyx/messaging/acking_daemon.clj
@@ -14,10 +14,11 @@
     (loop []
       (try
         (Thread/sleep interval)
-        (let [t (now)]
-          (swap! state
-                 (fn [x]
-                   (into {} (remove (fn [[k v]] (>= (- t (:timestamp v)) timeout)) x)))))
+        (let [t (now)
+              snapshot @state
+              dead (map first (remove (fn [[k v]] (>= (- t (:timestamp v)) timeout)) snapshot))]
+          (doseq [k dead]
+            (swap! state dissoc k)))
         (catch InterruptedException e
           (throw e))
         (catch Throwable e


list convertion

list convertion

--- src/shuppet/loadbalancer.clj
+++ src/shuppet/loadbalancer.clj
@@ -9,6 +9,12 @@

 (def subnet1 "subnet-24df904c")
 (def subnet2 "subnet-bdc08fd5")
+
+(defn map-to-dot [prefix map]
+  )
+
+(defn list-to-member [prefix list]
+  (apply hash-map (flatten (map #(do [(str prefix ".member." %1) %2]) (iterate inc 1) list))))

 (def elb-config-modified
   { "LoadBalancerName" "nico-test-elb"


put libs and build tasks in lib; add target task to build

--- tasklib/src/migae/boot_gae.clj
+++ tasklib/src/migae/boot_gae.clj
@@ -382,7 +382,7 @@
   "Unpack and install the SDK zipfile"
   [v verbose bool "Print trace messages"]
   ;;NB: java property expected by kickstart is "appengine.sdk.root"
-  (print-task "install-sdk" *opts*)
+  ;; (print-task "install-sdk" *opts*)
   (let [jar-path (pod/resolve-dependency-jar (boot/get-env)
                                              '[com.google.appengine/appengine-java-sdk "1.9.32"
                                                :extension "zip"])
@@ -551,3 +551,14 @@
   "watch for gae project"
   []
   (comp (builtin/watch) (clj-cp) (builtin/target :no-clean)))
+
+(boot/deftask build
+  "run all the boot-gae prep tasks"
+  []
+  (comp (install-sdk)
+        (libs)
+        (logging)
+        (config)
+        (builtin/sift :move {#"(.*\.clj$)" "WEB-INF/classes/$1"})
+        (servlets)
+        (builtin/target)))


Logging response status.

Logging response status.

--- src/ahnentafel/middleware/logging.clj
+++ src/ahnentafel/middleware/logging.clj
@@ -11,5 +11,7 @@
             resp   (handler req)
             finish (System/currentTimeMillis)
             total  (- finish start)]
-        (log "request %s %s (%dms)" request-method uri total)
+        (log "request %s %s (%dms) response: %d"
+             request-method uri total
+             (:status resp))
         resp))))


Improve error handlign on password change event.

--- src/uxbox/data/users.cljs
+++ src/uxbox/data/users.cljs
@@ -63,6 +63,10 @@
   (-apply-effect [_ state]
     (udm/info! (tr "profile.password-saved"))))

+(defn password-updated
+  []
+  (PasswordUpdated.))
+
 ;; --- Update Password

 (defrecord UpdatePassword [data]
@@ -75,8 +79,9 @@
       (let [params {:old-password (:old-password data)
                     :password (:password-1 data)}]
         (->> (rp/req :update/password params)
-             (rx/catch rp/client-error? on-error)
-             (rx/map #(->PasswordUpdated)))))))
+             (rx/map password-updated)
+             (rx/catch rp/client-error? on-error))))))
+

 (def ^:private update-password-schema
   [[:password-1 sc/required sc/string [sc/min-len 6]]


fixing validation

fixing validation

--- src/celestial/persistency/systems.clj
+++ src/celestial/persistency/systems.clj
@@ -180,7 +180,7 @@

 (def template-base {
   :type #{:required :type-exists} :defaults #{:required :Map}
-  :name #{:require :String}
+  :name #{:required :String}
 })

 (defn validate-template


Use format when logging

Use format when logging

--- src/clj/learndatalogtoday/handler.clj
+++ src/clj/learndatalogtoday/handler.clj
@@ -85,7 +85,7 @@
                              :value (with-out-str
                                       (fipp/pprint (value input)))))
                          ans-input)]
-         (do (log/info "Answer request [%s,%s]: %s" chapter exercise answer)
+         (do (log/info (format "Answer request [%s,%s]: %s" chapter exercise answer))
              (edn-response answer)))))

    (route/resources "/")


Fix auth type

Fix auth type

--- src/clj/org/openforis/ceo/routing.clj
+++ src/clj/org/openforis/ceo/routing.clj
@@ -96,7 +96,7 @@
    [:post "/close-project"]                  {:auth-type   :proj-admin
                                               :auth-action :block
                                               :handler     (api-handler projects/close-project)}
-   [:post "/create-project"]                 {:auth-type   :proj-admin
+   [:post "/create-project"]                 {:auth-type   :inst-admin
                                               :auth-action :block
                                               :handler     (api-handler projects/create-project)}
    [:post "/publish-project"]                {:auth-type   :proj-admin


refactor pending badges

refactor pending badges

--- src/cljs/salava/badge/ui/pending.cljs
+++ src/cljs/salava/badge/ui/pending.cljs
@@ -11,6 +11,12 @@
             [salava.core.ui.popover :refer [info]]
             #_[salava.metabadge.ui.metabadge :as mb]))

+(defn init-data [state]
+  (ajax/GET
+    (path-for "/obpv1/social/pending_badges" true)
+    {:handler (fn [data]
+                (swap! state assoc :spinner false :pending-badges (:pending-badges data)))}))
+

 (defn- init-badge-preview [state]
   (ajax/GET
@@ -36,7 +42,7 @@
       :keywords? true
       :params {:status new-status}
       :handler (fn []
-                 (init-data state) )
+                 (init-data state))
       :error-handler (fn [{:keys [status status-text]}])}))


CI needs more sleep, apparently

CI needs more sleep, apparently

--- modules/daemons/src/test/clojure/org/immutant/daemons/test/Daemon.clj
+++ modules/daemons/src/test/clojure/org/immutant/daemons/test/Daemon.clj
@@ -40,7 +40,7 @@

 (defn start-daemon []
   (.start *daemon*)
-  (Thread/sleep 10))
+  (Thread/sleep 100))

 (deftest start-should-call-the-start-function
   (start-daemon)


fixed missing parameter in panel method call

--- src/cljs/conference_rating/conference/conference_list_entry.cljs
+++ src/cljs/conference_rating/conference/conference_list_entry.cljs
@@ -88,8 +88,8 @@
          (title (:name conference))
          (conference-dates (:from conference) (:to conference))]]
        [:div {:class "col-lg-4 col-md-4 col-sm-6 recommendations-votes-panel"}
-        (panel/mini-panel-recommendations (get-in conference [:aggregated-ratings :recommendations]))
-        (panel/mini-panel-voices (get-in conference [:aggregated-ratings :number-of-ratings]))]]
+        (panel/mini-panel-recommendations (get-in conference [:aggregated-ratings :recommendations]) nil)
+        (panel/mini-panel-voices (get-in conference [:aggregated-ratings :number-of-ratings]) nil)]]
       [:div {:class "bottom-line"}]]
      [:div {:class "panel-body  bg-light"}
       [:div {:class "row"}


Don't make the toolbar scrollable

Don't make the toolbar scrollable

that looks awful

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

--- src/conexp/contrib/gui/editors/context_editor/context_editor.clj
+++ src/conexp/contrib/gui/editors/context_editor/context_editor.clj
@@ -241,9 +241,9 @@
           ectx           (ref (make-editable-context ctx)),
           bar            (toolbar :orientation :horizontal
                                   :floatable? false)
-          root           (top-bottom-split (scrollable bar)
+          root           (top-bottom-split bar
                                            (get-widget table)
-                                           :divider-location 70)
+                                           :divider-location 40)
           e-ctx          @ectx,
           widget         (context-editor-widget. root table ectx),
           keystroke-fill (KeyStroke/getKeyStroke KeyEvent/VK_SPACE


Fix unnecessarily strict test

Fix unnecessarily strict test

--- scheduler/test/cook/test/mesos/api.clj
+++ scheduler/test/cook/test/mesos/api.clj
@@ -34,7 +34,10 @@
    The first list is the correct list, which may be missing keys.
    The second list can be fully filled in by Cook with defaults."
   [gold-standard new-data]
-  (let [resp-uris (map (fn [gold copy]
+  ; URI is order independent
+  (let [gold-standard (sort-by #(or (get % :value) (get % "value")) gold-standard)
+        new-data (sort-by :value new-data)
+        resp-uris (map (fn [gold copy]
                          (select-keys copy (keys gold)))
                        gold-standard
                        new-data)]
@@ -64,7 +67,7 @@
              "labels" labels
              "cpus" 2.0
              "mem" 2048.0}
-        h (handler conn "my-framework-id" {:cpus 12 :memory-gb 100})]
+        h (handler conn "my-framework-id" {:cpus 12 :memory-gb 100} (fn [] []))]
     (is (<= 200
             (:status (h {:request-method :post
                          :scheme :http
@@ -120,7 +123,7 @@
                             "max_runtime" 1000000
                             "cpus" cpus
                             "mem" mem})
-        h (handler conn "my-framework-id" {:cpus 3.0 :memory-gb 2})]
+        h (handler conn "my-framework-id" {:cpus 3.0 :memory-gb 2} (fn [] []))]
     (testing "Within limits"
       (is (<= 200
               (:status (h {:request-method :post


added given

added given

--- src/babel/english/lexicon-verbcoach.clj
+++ src/babel/english/lexicon-verbcoach.clj
@@ -891,7 +891,8 @@
    ;; TODO: account for "give" being ditransitive.
    "give" {:synsem {:cat :verb
                     :sem {:pred :give}}
-           :english {:past "gave"}}
+           :english {:past "gave"
+                     :past-participle "given"}}
    "go"
    {:synsem {:cat :verb
               :sem {:activity true
@@ -928,6 +929,7 @@
                    :pred :go-out}
              :subcat {:2 '()}}
     :english {:past "went out"
+
               :participle "going out"
               :present {:3sing "goes out"}}}


Update regexes

Update regexes

--- src/braid/server/routes/api/private.clj
+++ src/braid/server/routes/api/private.clj
@@ -44,13 +44,13 @@
       (string/blank? slug)
       (error-response 400 "Must provide an Group URL")

-      (not (re-matches #"[a-z0-9-]*" slug))
+      (not (re-matches #"[a-z0-9-]+" slug))
       (error-response 400 "Group URL can only contain lowercase letters, numbers or dashes.")

-      (re-matches #"-.*" slug)
+      (string/starts-with? "-" slug)
       (error-response 400 "Group URL cannot start with a dash.")

-      (re-matches #".*-" slug)
+      (string/ends-with? "-" slug)
       (error-response 400 "Group URL cannot end with a dash.")

       (group/group-with-slug-exists? slug)


added normalize data function. Should it abs substract each row from mean vector? should this be in math.matrix?

--- src/brevis/math/logistic_regression.clj
+++ src/brevis/math/logistic_regression.clj
@@ -1,6 +1,6 @@
 (ns brevis.logistic-regression
-    (:use [brevis.math matrix]))
-
+    (:use [brevis.math matrix]
+          [brevis random]))

 (defn sigmoid
   "Hyperbolic-tangent function."
@@ -10,10 +10,22 @@
 (defn theta-rand
   "Returns number between -1 & 1."
   []
-  (let [switch (rand-int 2)]
+  (let [switch (lrand-int 2)]
     (if (= switch 0)
       (rand)
-      (unchecked-negate (rand)))))
+      (unchecked-negate (lrand)))))
+
+(defn normalize-data ;should this be abs?
+  "subtracts mean vector from all row vectors"
+  [mat]
+  (let [height (matrix-height mat)
+        width (matrix-width mat)
+        mean-vector (map #(/ % height) (matrix-to-seq (sum-rows mat)))
+        normalized-data (seq-to-matrix width height
+                                       (for [x1 (partition width (matrix-to-seq mat))]
+                                         (map #(- %1 %2) x1 mean-vector)))
+        ]
+    normalized-data))

 (defn theta-init
   "Random m x n matrix with all element values between -1 & 1."
@@ -22,16 +34,18 @@

 (defn logistic-regression
   "Logistic regression. x feature matrix, y label vector."
-  [x y]
-  (let [num-features (matrix-width x)]
-    (loop [stop 0
-           theta (theta-init num-features)
+  ([x y stop] (logistic-regression x y stop (theta-init (matrix-width x))))
+  ([x y stop theta-start]
+    (loop [start 0
+           theta theta-start
            ]
-      (if (= stop 500)
+      (if (= stop start)
         theta
-        (recur (inc stop)
+        (recur (inc start)
                (matrix-mult x
                             (transpose (sub y
-                                            (matrix-map sigmoid
+                                            (matrix-pmap sigmoid
                                                         (matrix-mult (transpose theta)
-                                                                     x))))))))))+                                                                     x))))))))))
+
+


CMR-277: Fixed merge conflict.

CMR-277: Fixed merge conflict.

--- src/cmr/metadata_db/data/provider.clj
+++ src/cmr/metadata_db/data/provider.clj
@@ -1,23 +1,38 @@
 (ns cmr.metadata-db.data.provider
   "Functions for saving, retrieving, deleting providers.")

-  ; (save-provider
-  ;   "Saves a provider and returns the provider id. If the provider already
-  ;   exists then an exception is thrown."
-  ;   [db provider-id]
-  ;   )
+(save-provider
+  "Saves a provider and returns the provider id. If the provider already
+  exists then an exception is thrown."
+  [db provider-id]
+  [this provider-id]
+  (try (j/insert! this
+                  "METADATA_DB.provider"
+                  ["provider_id"]
+                  [provider-id])
+    {:provider-id provider-id}
+    (catch Exception e
+      (error (.getMessage e))
+      (let [error-message (.getMessage e)
+            error-code (cond
+                         (re-find #"METADATA_DB.UNIQUE_PROVIDER_ID" error-message)
+                         :concept-id-concept-conflict
+
+                         :else
+                         :unknown-error)]
+        {:error error-code :error-message error-message}))))

-  ; (get-providers
-  ;    "Get a sequence of all the providers."
-  ;   [db]
-  ;  )
+(get-providers
+  "Get a sequence of all the providers."
+  [db]
+  )

-  ; (delete-provider
-  ;   "Remove a provider from the database completely, including all of its concepts."
-  ;   [db provider-id]
-  ;   )
+(delete-provider
+  "Remove a provider from the database completely, including all of its concepts."
+  [db provider-id]
+  )

-  ; (reset-providers
-  ;   "Delete all providers from the database.  USE WITH CAUTION."
-  ;   [db]
-  ;   ))+(reset-providers
+  "Delete all providers from the database.  USE WITH CAUTION."
+  [db]
+  )


wishes->wish

wishes->wish

--- src/wishlistd/cljs/main.cljs
+++ src/wishlistd/cljs/main.cljs
@@ -47,7 +47,7 @@
 (defn show-wishlist! [{:keys [wish title code] :as wishlist}]
   (empty $content)
   (empty $header)
-  (append $content (wish-ul wishes))
+  (append $content (wish-ul wish))
   (append $header  (wishlist-title title))
   (set-path! code))


Add test for safebase64 conversion functions.

--- test/buddy/test_buddy_core.clj
+++ test/buddy/test_buddy_core.clj
@@ -67,6 +67,13 @@
           valid-hash "7aa01e35e65701c9a9d8f71c4cbf056acddc9be17fdff06b4c7af1b0b34ddc29"]
       (is (= (bytes->hex (hash/sha256 (io/input-stream path))) valid-hash)))))

+(deftest buddy-core-codecs
+  (testing "Safe base64 encode/decode"
+    (let [output1 (str->safebase64 "foo")
+          output2 (safebase64->str output1)]
+      (is (= output1 "Zm9v"))
+      (is (= output2 "foo")))))
+
 (deftest buddy-core-mac-poly1305
   (let [iv        (byte-array 16) ;; 16 bytes array filled with 0
         plaintext "text"


a few log calls when adding layers

a few log calls when adding layers

--- src/cljs/infinitelives/pixi/canvas.cljs
+++ src/cljs/infinitelives/pixi/canvas.cljs
@@ -4,6 +4,7 @@
   (:require [cljs.core.async :refer [<!]]
             [infinitelives.utils.events :as events]
             [infinitelives.utils.dom :as dom]
+            [infinitelives.utils.console :refer [log]]
             [PIXI])

   (:require-macros [cljs.core.async.macros :refer [go]])


trailing newline bug

trailing newline bug

--- src/clojure/zensols/actioncli/parse.clj
+++ src/clojure/zensols/actioncli/parse.clj
@@ -214,7 +214,8 @@
         action-key (keyword (first arguments))
         action (get actions action-key)]
     (if (nil? action)
-      (println (help-msg action-context actions action-key))
+      (do (print (help-msg action-context actions action-key))
+          (flush))
       (parse-single action-context action (rest arguments) false))))

 (defn- parse-global [action-context actions arguments]


Doubled max points

Doubled max points

--- src/clojush/problems/boolean/mux_11.clj
+++ src/clojush/problems/boolean/mux_11.clj
@@ -79,7 +79,7 @@
                               ;boolean_dup boolean_swap boolean_pop boolean_rot
                               )
    :population-size 100
-   :max-points 200
+   :max-points 400
    :max-genome-size-in-initial-program 100
    :genetic-operator-probabilities {:uniform-close-mutation 0.1
                                     :alternation 0.45


Update dependencies.

Update dependencies.

--- frontend/project.clj
+++ frontend/project.clj
@@ -18,14 +18,14 @@
                  ;; runtime
                  [com.cognitect/transit-cljs "0.8.239"]
                  [rum "0.10.7"]
-                 [cljsjs/react "15.3.1-0"]
-                 [cljsjs/react-dom "15.3.1-0"]
-                 [cljsjs/react-dom-server "15.3.1-0"]
-                 [cljsjs/moment "2.15.2-2"]
+                 [cljsjs/react "15.4.0-0"]
+                 [cljsjs/react-dom "15.4.0-0"]
+                 [cljsjs/react-dom-server "15.4.0-0"]
+                 [cljsjs/moment "2.15.2-3"]
                  [funcool/struct "1.0.0"]
                  [funcool/lentes "1.2.0"]
-                 [funcool/beicon "2.3.0"]
-                 [funcool/cuerdas "2.0.0"]
+                 [funcool/beicon "2.5.0"]
+                 [funcool/cuerdas "2.0.1"]
                  [funcool/bide "1.0.5"]]
   :plugins [[lein-ancient "0.6.10"]]
   :clean-targets ^{:protect false} ["resources/public/js" "target"]


fix: use started UTC time to determine index name

--- systems/ring-analytics/src/containium/systems/ring_analytics.clj
+++ systems/ring-analytics/src/containium/systems/ring_analytics.clj
@@ -62,13 +62,13 @@
 ;;; ElasticSearch implementation.

 (defn- daily-index
-  [app]
-  (str "log-" (lower-case app) "-" (time/format (time/today) :basic-date)))
+  [app started-utc-ms]
+  (str "log-" (lower-case app) "-" (time/format (time/datetime started-utc-ms) :basic-date)))

 (defn- store-request
-  [client app-name request]
-  (es/index client (cnv/->index-request (daily-index app-name)
+  [client app-name started-utc-ms request]
+  (es/index client (cnv/->index-request (daily-index app-name started-utc-ms)
                                         "request" request
                                         {:op-type "create", :content-type :smile})))

@@ -97,7 +97,7 @@
                                                 (response-filter request)
                                                 (persistent!))))
                         (persistent!))]
-      (try (store-request client app-name processed)
+      (try (store-request client app-name started processed)
            (catch Throwable t
              (ex/exit-when-fatal t)
              (error logger "Failed to store request for ring-analytics:")


[#2253] Increase socket-timeout for script admin calls

--- backend/src/akvo/lumen/admin/util.clj
+++ backend/src/akvo/lumen/admin/util.clj
@@ -5,7 +5,7 @@
             [akvo.lumen.component.hikaricp :as hikaricp]
             [environ.core :refer [env]]))

-(def http-client-req-defaults (http.client/req-opts 5000))
+(def http-client-req-defaults (http.client/req-opts 200000))

 (defn exec!
   "Execute SQL expression"


def'd missed base addresses.

def'd missed base addresses.

--- test/kixi/hecuba/amon_test.clj
+++ test/kixi/hecuba/amon_test.clj
@@ -167,7 +167,7 @@
 ;;-----------------------------
 (defn- test-post-device [coll]
   (let [sample  (assoc-in coll [:entity_id]  (clojure.string/replace @entity-loc  #"/4/entities/(.*?)" "$1"))]
-    (client/post (apply str "http://127.0.0.1:8010" @entity-loc "/devices/") {:content-type :json :basic-auth ["support@mastodonc.com" "password"] :body (json/write-str sample)}))
+    (client/post (apply str base-addr @entity-loc "/devices/") {:content-type :json :basic-auth ["support@mastodonc.com" "password"] :body (json/write-str sample)}))
   )

 (def ^:private postable-device?
@@ -184,7 +184,7 @@
 (defn- test-post-entity [coll]
   (let [sample  (assoc-in coll [:project_id]  "ba776928f94b3aaa1e444569276ee5b66d6b21f7")]
     (log/info "\n-----------------STARTING EXAMPLE--------------\n" sample)
-    (client/post "http://127.0.0.1:8010/4/entities/" {:accept :json :content-type :json :basic-auth ["support@mastodonc.com" "password"] :body (json/write-str sample)}))
+    (client/post base-addr "/4/entities/" {:accept :json :content-type :json :basic-auth ["support@mastodonc.com" "password"] :body (json/write-str sample)}))
   )

 (def ^:private postable-entity?
@@ -199,19 +199,19 @@
 ;;-----------------------------
 (deftest ^:http-tests test-edn-json-programmes
   (is (=
-       (:body (client/get (apply str "http://127.0.0.1:8010/4" @programme-loc) {:accept :json :content-type :json :basic-auth ["support@mastodonc.com" "password"]}))
-       (:body (client/get (apply str "http://127.0.0.1:8010/4" @programme-loc) {:accept :edn :content-type :json :basic-auth ["support@mastodonc.com" "password"]}))))
+       (:body (client/get (apply str base-addr "/4" @programme-loc) {:accept :json :content-type :json :basic-auth ["support@mastodonc.com" "password"]}))
+       (:body (client/get (apply str base-addr "/4" @programme-loc) {:accept :edn :content-type :json :basic-auth ["support@mastodonc.com" "password"]}))))
   (log/info "Passed JSON EDN equality check for Programmes"))

 (deftest ^:http-tests test-edn-json-projects
   (is (=
-       (:body (client/get (apply str "http://127.0.0.1:8010/4" @programme-loc @project-loc) {:accept :json :content-type :json :basic-auth ["support@mastodonc.com" "password"]}))
-       (:body (client/get (apply str "http://127.0.0.1:8010/4" @programme-loc @project-loc) {:accept :edn :content-type :json :basic-auth ["support@mastodonc.com" "password"]}))))
+       (:body (client/get (apply str base-addr "/4" @programme-loc @project-loc) {:accept :json :content-type :json :basic-auth ["support@mastodonc.com" "password"]}))
+       (:body (client/get (apply str base-addr "/4" @programme-loc @project-loc) {:accept :edn :content-type :json :basic-auth ["support@mastodonc.com" "password"]}))))
   (log/info "Passed JSON EDN equality check for Projects"))
 ;;-----------------------------
 ;; test get device with edn (json not currently working):
 ;; "Don't know how to write JSON of class java.util.Date"
 ;;-----------------------------
 (deftest ^:http-tests test-edn-get-device
-  (is (:body (client/get (apply str "http://127.0.0.1:8010/4" @device-loc) {:accept :edn :content-type :json :basic-auth ["support@mastodonc.com" "password"]})))
+  (is (:body (client/get (apply str base-addr "/4" @device-loc) {:accept :edn :content-type :json :basic-auth ["support@mastodonc.com" "password"]})))
   (log/info "Passed EDN GET test for devices"))


Use extracted playback

Use extracted playback

--- test/onyx/log/one_job_test.clj
+++ test/onyx/log/one_job_test.clj
@@ -1,6 +1,7 @@
 (ns onyx.log.one-job-test
   (:require [clojure.core.async :refer [chan >!! <!! close! sliding-buffer]]
             [onyx.extensions :as extensions]
+            [onyx.log.helper :refer [playback-log]]
             [onyx.peer.task-lifecycle-extensions :as l-ext]
             [onyx.plugin.core-async :refer [take-segments!]]
             [onyx.api :as api]
@@ -70,17 +71,14 @@
 (def log (:log (:env subscription)))

 (def replica
-  (loop [replica (:replica subscription)]
-    (let [position (<!! ch)
-          entry (extensions/read-log-entry log position)
-          new-replica (extensions/apply-log-entry entry replica)
-          counts (map count (mapcat vals (vals (:allocations new-replica))))]
-      (when-not (= (into #{} counts) #{1 2})
-        (recur new-replica)))))
+  (playback-log (:log env) (extensions/subscribe-to-log (:log env) ch) ch 2000))

 (onyx.api/shutdown-env (:env subscription))

-(fact "peers balanced on 1 jobs" true => true)
+(fact "peers balanced on 1 jobs"
+      (into #{} (map count (mapcat vals (vals (:allocations replica)))))
+      =>
+      #{1 2})

 (doseq [v-peer v-peers]
   (onyx.api/shutdown-peer v-peer))


More tests

More tests

--- test/spec_tools/core_test.cljc
+++ test/spec_tools/core_test.cljc
@@ -165,17 +165,29 @@
           (s/valid?
             (st/coll-spec ::vector [{:olipa {:kerran string?}}])
             [{:olipa {:kerran "avaruus"}}
-             {:olipa {:kerran "elämä"}}]))))
+             {:olipa {:kerran "elämä"}}])))
+    (is (false?
+          (s/valid?
+            (st/coll-spec ::vector [{:olipa {:kerran string?}}])
+            [{:olipa {:kerran :muumuu}}]))))

   (testing "top-level set"
     (is (true?
           (s/valid?
             (st/coll-spec ::vector #{{:olipa {:kerran string?}}})
             #{{:olipa {:kerran "avaruus"}}
-              {:olipa {:kerran "elämä"}}}))))
+              {:olipa {:kerran "elämä"}}})))
+    (is (false?
+          (s/valid?
+            (st/coll-spec ::vector #{{:olipa {:kerran string?}}})
+            #{{:olipa {:kerran :muumuu}}}))))

   (testing "mega-nested"
     (is (true?
           (s/valid?
             (st/coll-spec ::vector [[[[[[[[[[string?]]]]]]]]]])
-            [[[[[[[[[["kikka" "kakka" "kukka"]]]]]]]]]])))))
+            [[[[[[[[[["kikka" "kakka" "kukka"]]]]]]]]]])))
+    (is (false?
+          (s/valid?
+            (st/coll-spec ::vector [[[[[[[[[[string?]]]]]]]]]])
+            [[[[[[[[[123]]]]]]]]]))))


defmacro in files using backquote macro expansion

--- test/files/defn.cljs
+++ test/files/defn.cljs
@@ -1,7 +1,7 @@
 (def defmacro (fn [name & fdecl]
-	(list 'do
-        (list 'def name (cons 'fn fdecl))
-        (list 'set! (list '. name 'macro) true))))
+	`(do
+        (def ~name (fn ~@fdecl))
+        (set! (. ~name macro) true))))

 (set! (. defmacro macro) true)


AOC day 11 - part 1

AOC day 11 - part 1

--- clj/advent-of-code-2016/src/advent_of_code_2016/day11.clj
+++ clj/advent-of-code-2016/src/advent_of_code_2016/day11.clj
@@ -4,10 +4,10 @@
   [floor]
   (case
     floor
-    "first" :1
-    "second" :2
-    "third" :3
-    "fourth" :4))
+    "first" 1
+    "second" 2
+    "third" 3
+    "fourth" 4))

 (defn parse-item
   [item]
@@ -17,9 +17,9 @@
 (defn parse-content
   [content]
   (if (= content "nothing relevant")
-    []
+    #{}
     (let [items (clojure.string/split content #", (and )?| and ")]
-      (map parse-item items))))
+      (set (map parse-item items)))))

 (defn parse-line
   [line]
@@ -30,4 +30,91 @@

 (defn parse-input
   [raw-input]
-  (apply merge (map parse-line (clojure.string/split-lines raw-input))))+  (apply merge (map parse-line (clojure.string/split-lines raw-input))))
+
+(defn initial-state
+  [parsed-input]
+  (merge {:elevator 1} parsed-input))
+
+(defn floor-reachable-from
+  [floor]
+  (->> [(inc floor) (dec floor)]
+       (filter (fn [fl] (and (> fl 0) (< fl 5))))))
+
+(defn objects-to-move
+  [all-objects]
+  (loop [acc [] [current & rest] all-objects]
+    (if (nil? current)
+      acc
+      (let [movements-incl-current (cons [current] (map (fn [x] [current x]) rest))
+            updated-acc (concat acc movements-incl-current)]
+        (recur updated-acc rest)))))
+
+(defn next-state
+  [initial-state to-move move-floor]
+  (let [curr-floor (:elevator initial-state)]
+    (-> initial-state
+        (assoc :elevator move-floor)
+        (update curr-floor (fn [curr] (apply disj curr to-move)))
+        (update move-floor (fn [next] (apply conj next to-move))))))
+
+(defn cartesian
+  [xs ys]
+  (mapcat (fn [x] (map (fn [y] [x y]) ys)) xs))
+
+(defn is-valid-floor?
+  [floor-objects]
+  (let [{microchips "microchip" generators "generator"} (group-by :type floor-objects)
+        is-valid-microchip? (fn [{material :material}] (some (fn [gen] (= (:material gen) material)) generators))]
+    (or (empty? generators)
+        (every? is-valid-microchip? microchips))))
+
+(defn is-valid-state?
+  [state source-floor]
+  (and (is-valid-floor? (get state source-floor)) (is-valid-floor? (get state (:elevator state)))))
+
+(defn next-states
+  [state]
+  (let [current-floor (:elevator state)
+        reachable-floors (floor-reachable-from current-floor)
+        potential-moves (objects-to-move (get state current-floor))
+        moves-and-floors (cartesian reachable-floors potential-moves)
+        new-states (map (fn [[floor moves]] (next-state state moves floor)) moves-and-floors)]
+    (filter (fn [new-state] (is-valid-state? new-state current-floor)) new-states)))
+
+(defn final-state
+  [initial-state]
+  (let [floors (filter number? (keys initial-state))
+        max-floor (apply max floors)
+        all-objects (reduce (fn [acc [k v]] (if (number? k) (apply conj acc v) acc)) #{} initial-state)]
+    (reduce (fn [acc fl] (assoc acc fl (if (= fl max-floor) all-objects #{}))) {:elevator max-floor} floors)))
+
+(defn solve
+  [initial-state]
+  (let [final-st (final-state initial-state)]
+    (loop [current-states [initial-state] known-states #{} steps 1]
+      (let [next-st (set (mapcat next-states current-states))
+            new-next-st (clojure.set/difference next-st known-states)]
+        (if (contains? new-next-st final-st)
+          steps
+          (recur new-next-st (apply conj known-states new-next-st) (inc steps)))))))
+
+
+(defn solve-part1
+  [input]
+  (-> input
+      (parse-input)
+      (initial-state)
+      (solve)))
+
+(defn solve-part2
+  [input]
+  (let [adjustment [{:material "elerium" :type "generator"}
+                    {:material "elerium" :type "microchip"}
+                    {:material "dilithium" :type "generator"}
+                    {:material "dilithium" :type "microchip"}]]
+    (-> input
+        (parse-input)
+        (initial-state)
+        (update 1 (fn [objects] (apply conj objects adjustment)))
+        (solve))))


changes to SequenceSettings/ChannelSpec variable names - clojure

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

--- acqEngine/src/org/micromanager/mm.clj
+++ acqEngine/src/org/micromanager/mm.clj
@@ -357,15 +357,15 @@
         (-> chan
             (data-object-to-map)
             (select-and-rekey
-              :config_                 :name
-              :exposure_               :exposure
-              :zOffset_                :z-offset
-              :doZStack_               :use-z-stack
-              :skipFactorFrame_        :skip-frames
-              :useChannel_             :use-channel
-              :color_                  :color
+              :config                 :name
+              :exposure               :exposure
+              :zOffset                :z-offset
+              :doZStack               :use-z-stack
+              :skipFactorFrame        :skip-frames
+              :useChannel             :use-channel
+              :color                  :color
               )
-            (assoc :properties (get-config channel-group (.config_ chan))))))
+            (assoc :properties (get-config channel-group (.config chan))))))

 (defn MultiStagePosition-to-map
   "Convert a Micro-Manager MultiStagePosition object to a clojure data map."


fix both weird cases

fix both weird cases

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

--- acqEngine/src/org/micromanager/mm.clj
+++ acqEngine/src/org/micromanager/mm.clj
@@ -62,8 +62,9 @@
           :when (zero? (bit-and
                          (.getModifiers f) java.lang.reflect.Modifier/STATIC))]
       [(keyword (.getName f))
-       (if (= Boolean (.getType f))
-         (.getBoolean f obj)
+       (condp = (.getType f)
+         Boolean (.booleanValue (.get f obj))
+         Boolean/TYPE (.getBoolean f obj)
          (.get f obj))])))

 (defn log


Connected thumb (mostly)

Connected thumb (mostly)

--- src/dactyl_keyboard/dactyl-manuform.clj
+++ src/dactyl_keyboard/dactyl-manuform.clj
@@ -3,6 +3,11 @@
   (:require [scad-clj.scad :refer :all]
             [scad-clj.model :refer :all]
             [unicode-math.core :refer :all]))
+
+
+(def nrows 4)
+(def lastrow (dec nrows))
+(def cornerrow (dec lastrow))

 ;;;;;;;;;;;;;;;;;
 ;; Switch Hole ;;
@@ -87,7 +92,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;

 (def columns (range 0 6))
-(def rows (range 0 4))
+(def rows (range 0 nrows))

 (def α (/ π 12))
 (def β (/ π 26))
@@ -139,7 +144,7 @@
          (for [column columns
                row rows
                :when (or (.contains [2 3] column)
-                         (not= row (last rows)))]
+                         (not= row lastrow))]
            (->> single-plate
                 (key-place column row)))))

@@ -148,7 +153,7 @@
          (for [column columns
                row rows
                :when (or (.contains [2 3] column)
-                         (not= row (last rows)))]
+                         (not= row lastrow))]
            (->> (sa-cap (if (= column 5) 1 1))
                 (key-place column row)))))

@@ -180,7 +185,7 @@
           (for [column (drop-last columns)
                 row rows
                 :when (or (.contains [2] column)
-                          (not= row (last rows)))]
+                          (not= row lastrow))]
             (triangle-hulls
              (key-place (inc column) row web-post-tl)
              (key-place column row web-post-tr)
@@ -294,18 +299,73 @@

 (def thumb
   (union
-;    thumb-connectors
    (thumb-1x-layout single-plate)
    (thumb-15x-layout single-plate)
    (thumb-15x-layout larger-plate)
    ))
+
+(def thumb-post-tr (translate [(- (/ mount-width 2) post-adj)  (- (/ mount-height  1.15) post-adj) 0] web-post))
+(def thumb-post-tl (translate [(+ (/ mount-width -2) post-adj) (- (/ mount-height  1.15) post-adj) 0] web-post))
+(def thumb-post-bl (translate [(+ (/ mount-width -2) post-adj) (+ (/ mount-height -1.15) post-adj) 0] web-post))
+(def thumb-post-br (translate [(- (/ mount-width 2) post-adj)  (+ (/ mount-height -1.15) post-adj) 0] web-post))
+
+(def thumb-connectors
+  (union
+      (triangle-hulls    ; top two
+             (thumb-tl-place thumb-post-tr)
+             (thumb-tl-place thumb-post-br)
+             (thumb-tr-place thumb-post-tl)
+             (thumb-tr-place thumb-post-bl))
+      (triangle-hulls    ; bottom two on the right
+             (thumb-br-place web-post-tr)
+             (thumb-br-place web-post-br)
+             (thumb-mr-place web-post-tl)
+             (thumb-mr-place web-post-bl))
+      (triangle-hulls    ; bottom two on the left
+             (thumb-bl-place web-post-tr)
+             (thumb-bl-place web-post-br)
+             (thumb-ml-place web-post-tl)
+             (thumb-ml-place web-post-bl))
+      (triangle-hulls    ; centers of the bottom four
+             (thumb-br-place web-post-tl)
+             (thumb-bl-place web-post-bl)
+             (thumb-br-place web-post-tr)
+             (thumb-bl-place web-post-br)
+             (thumb-mr-place web-post-tl)
+             (thumb-ml-place web-post-bl)
+             (thumb-mr-place web-post-tr)
+             (thumb-ml-place web-post-br))
+      (triangle-hulls    ; top two to the middle two, starting on the left
+             (thumb-tl-place thumb-post-tl)
+             (thumb-ml-place web-post-tr)
+             (thumb-tl-place thumb-post-bl)
+             (thumb-ml-place web-post-br)
+             (thumb-tl-place thumb-post-br)
+             (thumb-mr-place web-post-tr)
+             (thumb-tr-place thumb-post-bl)
+             (thumb-mr-place web-post-br)
+             (thumb-tr-place thumb-post-br))
+      (triangle-hulls    ; top two to the main keyboard, starting on the left
+             (thumb-tl-place thumb-post-tl)
+             (key-place 0 cornerrow web-post-bl)
+             (thumb-tl-place thumb-post-tr)
+             (key-place 0 cornerrow web-post-br)
+             (thumb-tr-place thumb-post-tl)
+             (key-place 1 cornerrow web-post-bl)
+             (key-place 1 cornerrow web-post-br)
+             (thumb-tr-place thumb-post-tr)
+             (key-place 2 cornerrow web-post-tl)
+             (key-place 2 cornerrow web-post-bl)
+      )
+  ))

 (spit "repl.scad"
       (write-scad (union
                    key-holes
                    connectors
                    thumb
-                   thumbcaps
+                   thumb-connectors
+                  ;  thumbcaps
                    caps
                   ;  front-wall
                   ;  right-wall


Fixed issue #182 - Ratios break structured editing (in fact, now exception in structured editing results in just going back to default editing)

--- ccw.core/src/ccw/editors/antlrbased/EditorSupport.clj
+++ ccw.core/src/ccw/editors/antlrbased/EditorSupport.clj
@@ -33,7 +33,7 @@
   (let [r (if (nil? r) (ref nil) r)]
     (dosync
       (if-let [rv @r] (cancel (:parser rv)))
-      (ref-set r {:text text :parser (timed-delay 800 #(p/parse text))}))
+      (ref-set r {:text text :parser (timed-delay 800 #(try (p/parse text) (catch Exception _ nil)))}))
     r))

 (defn -getParser [text r]


add two sentence adjunct rules and one PP adjunct rule

--- src/babel/english/grammar.cljc
+++ src/babel/english/grammar.cljc
@@ -86,6 +86,24 @@
     :first :comp
     :comp {:synsem {:subcat '()}}}))

+(def c00
+  (unify-check
+   head-last
+   {:comment "c00"
+    :schema-symbol 'c00 ;; used by over-each-parent to know where to put children.
+    :first :comp
+    :comp {:synsem {:subcat '()}}
+    :head {:synsem {:subcat '()}}}))
+
+(def h00
+  (unify-check
+   head-first
+   {:comment "h00"
+    :schema-symbol 'h00 ;; used by over-each-parent to know where to put children.
+    :first :head
+    :comp {:synsem {:subcat '()}}
+    :head {:synsem {:subcat '()}}}))
+
 (def c11
   (unify-check
    subcat-1-1-principle
@@ -204,10 +222,56 @@
                                        :sem {:number number-agreement}}
                               :head {:phrasal true
                                      :synsem {:propernoun propernoun}}}))
-                   (unify-check h10
-                           {:rule "prepositional-phrase"
-                            :synsem {:cat :prep}})
-
+;                   (unify-check h10
+;                                {:rule "prepositional-phrase-argument"
+;                                 :synsem {:cat :prep}})
+
+                   (unify-check
+                    subcat-1-principle
+                    head-first
+                    {:comment "h10"
+                     :schema-symbol 'h10
+                     :first :head}
+                    (let [obj-sem (atom :top)
+                          mod (atom {:obj obj-sem})]
+                      {:rule "prepositional-phrase-adjunct"
+                       :synsem {:cat :prep
+                                :sem {:mod mod}}
+                       :head {:synsem {:sem mod
+                                       :cat :prep
+                                       :subcat {:1 {:sem obj-sem}}}}
+                       :comp {:synsem {:sem obj-sem}}}))
+
+                   (unify-check c00
+                                (let [head-sem (atom :top)]
+                                  {:synsem {:subcat '()
+                                            :modified true
+                                            :sem head-sem
+                                            :cat :verb}
+                                   :comp {:synsem {:cat :prep
+                                                   :subcat '()
+                                                   :sem head-sem}}
+                                   :head {:synsem {:cat :verb
+                                                   :modified false
+                                                   :subcat '()
+                                                   :sem head-sem}}
+                                   :rule "s-modified-with-adjunct-adjunct-first"}))
+
+                   (unify-check h00
+                                (let [head-sem (atom :top)]
+                                  {:synsem {:subcat '()
+                                            :modified true
+                                            :sem head-sem
+                                            :cat :verb}
+                                   :comp {:synsem {:cat :prep
+                                                   :subcat '()
+                                                   :sem head-sem}}
+                                   :head {:synsem {:cat :verb
+                                                   :modified false
+                                                   :subcat '()
+                                                   :sem head-sem}}
+                                   :rule "s-modified-with-adjunct-head-first"}))
+
                    (unify-check c10
                            root-is-head-root
                            {:head {:phrasal true ;; only a vp-aux may be the head child, not simply a lexical auxiliary verb.


add subcategorization for "looks for"

add subcategorization for "looks for"

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -1131,7 +1131,10 @@
                     :sem {:pred :look}}}

    "look for" {:synsem {:cat :verb
-                        :sem {:pred :cercare}}
+                        :sem {:pred :cercare}
+                        :subcat {:1 {:cat :noun
+                                     :sem {:animate true}}
+                                 :2 {:cat :noun}}}
                :english {:participle "looking for"
                          :past "looked for"
                          :present {:3sing "looks for"}}}


comb-oneself is reflexive=true

comb-oneself is reflexive=true

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -487,6 +487,7 @@
                    subject-agr (atom :top)]
                {:unify [common]
                 :synsem {:sem {:pred :comb-oneself
+                               :reflexive true
                                :subj subject-semantics
                                :obj subject-semantics}
                          :subcat {:1 {:agr subject-agr
@@ -2769,6 +2770,11 @@

       (verb-pred-defaults encyc/verb-pred-defaults)

+      ;; if a verb has a subject,
+      (default {:synsem {:cat :verb
+                         :subcat {:1 {:cat :noun
+                                      :case :nom}}}})
+
       ;; if a verb has an object,
       ;; and the object is {:cat :noun},
       ;; then the object is {:synsem {:case :acc}}.