Nullcheck

Nullcheck

--- src/irobot/io.clj
+++ src/irobot/io.clj
@@ -13,5 +13,5 @@
   "Return a lowercased version of a string (calls toString on anything that isn't already a String)"
   [s]
   (let [s (if s s "")
-        ^String s (.toString s)]
-    (.toLowerCase s)))
+        ts (.toString s)]
+    (.toLowerCase ts)))


work on add support

work on add support

--- src/nml/core.clj
+++ src/nml/core.clj
@@ -34,20 +34,14 @@
   (nml-str (second x)))

 (defn nml-add [tree parent child match proxy]
-;; (println (str "--- nml-add tree: " tree))
-;; (println (str "--- nml-add parent=" parent " child=" child " match=" match " proxy=" proxy))
   (let [missing? (fn [children] (not-any? #(= (nml-name %) match) children))
         f (fn [& children]
-;;           (println (str "--- nml-add " match " missing? " (missing? children)))
             (if (missing? children)
               (into [parent (parse proxy :start child)] children)
               (into [parent] children)))]
-    (let [t2 (if (nil? tree) [parent (parse proxy :start child)] (insta/transform {parent f} tree))]
-;;     (println (str "--- nml-add returning " t2))
-      t2)))
+    (if (nil? tree) [parent (parse proxy :start child)] (insta/transform {parent f} tree))))

 (defn nml-set [tree nml key val & sub]
-;; (println (str "### nml-set nml=" nml " key=" key " val=" val))
   (let [child  (if sub :nvsubseq :stmt)
         match  (if sub key nml)
         parent (if sub :nvseq :s)
@@ -56,7 +50,6 @@
         f      (fn
                  ([k v] (if (= (nml-str k) match) [child k (vnew v  )] [child k v]))
                  ([k  ] (if (= (nml-str k) match) [child k (vnew nil)] [child k  ])))]
-;;   (println (str "### tree " tree))
     (insta/transform {child f} (nml-add tree parent child match proxy))))

 (defn nml-sets [tree sets]


Add check to catch error described in #65

--- src/main/clojure/clara/rules/dsl.clj
+++ src/main/clojure/clara/rules/dsl.clj
@@ -43,6 +43,12 @@
         args (if (vector? (second condition)) (second condition) nil)
         constraints (vec (if args (drop 2 condition) (rest condition)))]

+    (when (and (vector? type)
+               (some list? type))
+
+      (throw (IllegalArgumentException. (str "Type " type " is a vector and appears to contain expressions. "
+                                             "Is there an extraneous set of brackets in the condition?"))))
+
     (when (> (count args) 1)
       (throw (IllegalArgumentException. "Only one argument can be passed to a condition.")))


Remove fake-monads namespace

Remove fake-monads namespace

--- src/main/clojure/lazytest/monads.clj
+++ src/main/clojure/lazytest/monads.clj
@@ -1,17 +0,0 @@
-(ns lazytest.monads
-  (:import lazytest.ExpectationFailed))
-
-(defn store-result [world source result]
-  (assoc-in world [:results source] result))
-
-(assert (= {:results {= ::the-result}} (store-result {} = ::the-result)))
-
-(defn try-expectation [f]
-  (fn [] (try (f) true (catch ExpectationFailed e e))))
-
-(defn store-assertion [assertion]
-  (fn [world]
-    (store-result world assertion (try-expectation assertion))))
-
-(defn assertion-with-arguments [f arguments]
-  (fn [] (apply f arguments)))


Rebind clojure.test/*test-out* in the repl

Fixes #55

--- src/main/clojure/vimclojure/repl.clj
+++ src/main/clojure/vimclojure/repl.clj
@@ -21,6 +21,8 @@
 ; THE SOFTWARE.

 (ns vimclojure.repl
+  (:require
+    clojure.test)
   (:use
      [vimclojure.util :only (stream->seq pretty-print pretty-print-causetrace)])
   (:import
@@ -51,7 +53,8 @@
   invokations. The members correspond to the Vars as bound be with-binding."}
   repl
   :id :ns :warn-on-reflection :print-meta :print-length :print-level
-  :compile-path :command-line-args :expr1 :expr2 :expr3 :exception :line)
+  :compile-path :command-line-args :expr1 :expr2 :expr3 :exception :test-out
+  :line)

 (defn make-repl
   "Create a new Repl."
@@ -73,6 +76,7 @@
                :expr3              nil
                :exception          nil
                :print-pretty       vimclojure.repl/*print-pretty*
+               :test-out           nil
                :line               0)))

 (defn start
@@ -137,7 +141,10 @@
        #'*2                   (the-repl :expr2)
        #'*3                   (the-repl :expr3)
        #'*e                   (the-repl :exception)
-       #'vimclojure.repl/*print-pretty* (the-repl :print-pretty)}
+       #'vimclojure.repl/*print-pretty* (the-repl :print-pretty)
+       #'clojure.test/*test-out* (if-let [test-out (the-repl :test-out)]
+                                   test-out
+                                   *out*)}
       (try
         (thunk)
         (finally
@@ -158,6 +165,9 @@
                      :expr3              *3
                      :exception          *e
                      :print-pretty       vimclojure.repl/*print-pretty*
+                     :test-out           (let [test-out clojure.test/*test-out*]
+                                           (when-not (identical? test-out *out*)
+                                             test-out))
                      :line               (dec (.getLineNumber *in*))))))))))

 (defmacro with-repl


Don't throw on schema validation failure.

--- src/onyx/api.clj
+++ src/onyx/api.clj
@@ -145,40 +145,47 @@
         args (add-percentages-to-log-entry config job args tasks (:catalog job) id)]
     (create-log-entry :submit-job args)))

+(defn validate-submission [job peer-client-config]
+  (try
+    (validator/validate-peer-client-config peer-client-config)
+    (validator/validate-job job)
+    (validator/validate-flow-conditions job)
+    (validator/validate-lifecycles job)
+    (validator/validate-windows job)
+    (validator/validate-triggers job)
+    {:success? true}
+    (catch Throwable t
+      {:success? false :exception t})))
+
 (defn ^{:added "0.6.0"} submit-job
   "Takes a peer configuration, job map, and optional monitoring config,
    sending the job to the cluster for eventual execution."
   ([peer-client-config job]
    (submit-job peer-client-config job {:monitoring :no-op}))
   ([peer-client-config job monitoring-config]
-   (try (validator/validate-peer-client-config peer-client-config)
-        (validator/validate-job job)
-        (validator/validate-flow-conditions job)
-        (validator/validate-lifecycles job)
-        (validator/validate-windows job)
-        (validator/validate-triggers job)
-        (catch Throwable t
-          (error t)
-          (throw t)))
-   (let [id (java.util.UUID/randomUUID)
-         tasks (planning/discover-tasks (:catalog job) (:workflow job))
-         entry (create-submit-job-entry id peer-client-config job tasks)
-         client (component/start (system/onyx-client peer-client-config monitoring-config))]
-     (extensions/write-chunk (:log client) :catalog (:catalog job) id)
-     (extensions/write-chunk (:log client) :workflow (:workflow job) id)
-     (extensions/write-chunk (:log client) :flow-conditions (:flow-conditions job) id)
-     (extensions/write-chunk (:log client) :lifecycles (:lifecycles job) id)
-     (extensions/write-chunk (:log client) :windows (:windows job) id)
-     (extensions/write-chunk (:log client) :triggers (:triggers job) id)
-     (extensions/write-chunk (:log client) :job-metadata (:metadata job) id)
-
-     (doseq [task tasks]
-       (extensions/write-chunk (:log client) :task task id))
-
-     (extensions/write-log-entry (:log client) entry)
-     (component/stop client)
-     {:job-id id
-      :task-ids (zipmap (map :name tasks) tasks)})))
+   (let [result (validate-submission job peer-client-config)]
+     (if (:success? result)
+       (let [id (java.util.UUID/randomUUID)
+             tasks (planning/discover-tasks (:catalog job) (:workflow job))
+             entry (create-submit-job-entry id peer-client-config job tasks)
+             client (component/start (system/onyx-client peer-client-config monitoring-config))]
+         (extensions/write-chunk (:log client) :catalog (:catalog job) id)
+         (extensions/write-chunk (:log client) :workflow (:workflow job) id)
+         (extensions/write-chunk (:log client) :flow-conditions (:flow-conditions job) id)
+         (extensions/write-chunk (:log client) :lifecycles (:lifecycles job) id)
+         (extensions/write-chunk (:log client) :windows (:windows job) id)
+         (extensions/write-chunk (:log client) :triggers (:triggers job) id)
+         (extensions/write-chunk (:log client) :job-metadata (:metadata job) id)
+
+         (doseq [task tasks]
+           (extensions/write-chunk (:log client) :task task id))
+
+         (extensions/write-log-entry (:log client) entry)
+         (component/stop client)
+         {:success? true
+          :job-id id
+          :task-ids (zipmap (map :name tasks) tasks)})
+       result))))

 (defn ^{:added "0.6.0"} kill-job
   "Kills a currently executing job, given it's job ID. All peers executing


fixed missing assoc in swap for register-selector

--- src/kioo/core.clj
+++ src/kioo/core.clj
@@ -74,7 +74,7 @@
                              'nth-match nth-match}))

 (defmacro register-selector! [lookup-sym fn-sym]
-  (swap! custom-selectors lookup-sym (resolve fn-sym))
+  (swap! custom-selectors assoc lookup-sym (resolve fn-sym))
   nil)

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


Layout can display header

Layout can display header

--- src/swanson/views/layout.clj
+++ src/swanson/views/layout.clj
@@ -3,6 +3,13 @@
             [hiccup.element :refer [link-to]]
             [hiccup.form :refer :all]
             [noir.session :as session]))
+
+(defn header []
+  [:header {:class "navbar navbar-default navbar-fixed-top"}
+   [:div {:class "container" }
+    [:div {:class "navbar-header" }
+     [:a {:href "/" :class "navbar-brand"} "Swanson" ]
+     [:a {:href "/chart" :class "navbar-brand"} "Chart" ] ]]])

 (defn base [& content]
   (html5
@@ -14,7 +21,9 @@
      (include-css "/css/screen.css")
      (include-css "/css/bootstrap.min.css")
      (include-css "/css/bootstrap-theme.min.css")]
-    [:body [:div {:class "container"} content ]]))
+    [:body
+     (header)
+     [:div {:class "container"} content ]]))

 (defn common [& content]
   (base


Maintain a boot.class.path system property with dynamic class path

- This will be useful as a replacement for the java.class.path property
  which does not reflect the class path as modified by boot after the
  JVM has started.

--- boot/core/src/boot/core.clj
+++ boot/core/src/boot/core.clj
@@ -105,19 +105,25 @@
   pod class path plus the :source-paths and :resource-paths. Note that these
   directories are not actually on the class path (this is why it's the fake
   class path). This property is a workaround for IDEs and tools that expect
-  the full class path to be determined by the java.class.path property."
+  the full class path to be determined by the java.class.path property.
+
+  Also sets the boot.class.path system property which is the same as above
+  except that the actual class path directories are used instead of the user's
+  project directories. This property can be used to configure Java tools that
+  would otherwise be looking at java.class.path expecting it to have the full
+  class path (the javac task uses it, for example, to configure the Java com-
+  piler class)."
   []
-  (let [dirs (->> (get-env)
-                  ((juxt :source-paths :resource-paths))
-                  (apply concat)
-                  (map #(.getAbsolutePath (io/file %))))]
-    (->> (pod/get-classpath)
-         (map #(.getPath (URL. %)))
-         (remove #(.isDirectory (io/file %)))
-         (concat dirs)
-         (interpose (System/getProperty "path.separator"))
-         (apply str)
-         (System/setProperty "fake.class.path"))))
+  (let [user-dirs  (->> (get-env)
+                        ((juxt :source-paths :resource-paths))
+                        (apply concat)
+                        (map #(.getAbsolutePath (io/file %))))
+        paths      (->> (pod/get-classpath) (map #(.getPath (URL. %))))
+        dir?       (comp (memfn isDirectory) io/file)
+        fake-paths (->> paths (remove dir?) (concat user-dirs))
+        separated  (partial string/join (System/getProperty "path.separator"))]
+    (System/setProperty "boot.class.path" (separated paths))
+    (System/setProperty "fake.class.path" (separated fake-paths))))

 (defn- set-user-dirs!
   "Resets the file watchers that sync the project directories to their
@@ -388,6 +394,7 @@
              :repositories   [["clojars"       "http://clojars.org/repo/"]
                               ["maven-central" "http://repo1.maven.org/maven2/"]]})
     (add-watch ::boot #(configure!* %3 %4)))
+  (set-fake-class-path!)
   (temp-dir** nil :asset)
   (temp-dir** nil :source)
   (temp-dir** nil :resource)


The by-re function should match on path, not name (fixes #66)

--- boot/core/src/boot/core.clj
+++ boot/core/src/boot/core.clj
@@ -775,7 +775,7 @@
   [mkpred]
   (fn [criteria files & [negate?]]
     (let [tmp?   (partial satisfies? tmpd/ITmpFile)
-          ->file #(if (tmp? %) (tmpd/file %) (io/file %))]
+          ->file #(if (tmp? %) (io/file (tmppath %)) (io/file %))]
       ((if negate? remove filter)
        #(some identity ((apply juxt (map mkpred criteria)) (->file %))) files))))

@@ -808,10 +808,10 @@
 (defn by-re
   "This function takes two arguments: `res` and `files`, where `res` is a seq
   of regex patterns like `[#\"clj$\" #\"cljs$\"]` and `files` is a seq of
-  file objects. Returns a seq of the files in `files` whose names match one of
+  file objects. Returns a seq of the files in `files` whose paths match one of
   the regex patterns in `res`."
   [res files & [negate?]]
-  ((file-filter #(fn [f] (re-find % (.getName f)))) res files negate?))
+  ((file-filter #(fn [f] (re-find % (.getPath f)))) res files negate?))

 (defn not-by-re
   "This function is the same as `by-re` but negated."


Remove spurious (cleanup#) call

Remove spurious (cleanup#) call

--- boot/core/src/boot/core.clj
+++ boot/core/src/boot/core.clj
@@ -331,7 +331,6 @@
   (let [->list #(cond (seq? %) % (vector? %) (seq %) :else (list %))
         ->app  (fn [xs] `(apply comp (filter fn? [~@xs])))]
     `(let [cleanup# (partial #'boot.core/cleanup! (repl/thread-stopper))]
-       (cleanup#)
        (let [stack# ~(if (every? string? argv)
                        `(apply construct-tasks [~@argv])
                        (->app (map ->list argv)))]


(SERVER-989) Improve test descriptions

(SERVER-989) Improve test descriptions

--- test/integration/puppetlabs/services/jruby/jruby_locking_test.clj
+++ test/integration/puppetlabs/services/jruby/jruby_locking_test.clj
@@ -70,20 +70,24 @@
         (jruby-service-test-config 1)
         (let [jruby-service (tk-app/get-service app :JRubyPuppetService)]

-          (testing "FOO"
+          (testing "locking events trigger event notifications"
             (jruby-service/with-jruby-puppet
               jruby-puppet
               jruby-service
               :with-lock-events-test
-              (is (= [:instance-requested :instance-borrowed] @events)))
-            (is (= [:instance-requested :instance-borrowed :instance-returned] @events))
+              (testing "borrowing a jruby triggers 'requested'/'borrow' events"
+                (is (= [:instance-requested :instance-borrowed] @events))))
+            (testing "returning a jruby triggers 'returned' event"
+              (is (= [:instance-requested :instance-borrowed :instance-returned] @events)))
             (jruby-service/with-lock
               jruby-service
               :with-lock-events-test
-              (is (= [:instance-requested :instance-borrowed :instance-returned
-                      :lock-requested :lock-acquired] @events))))
-          (is (= [:instance-requested :instance-borrowed :instance-returned
-                  :lock-requested :lock-acquired :lock-released] @events)))))))
+              (testing "acquiring a lock triggers 'lock-requested'/'lock-acquired' events"
+                (is (= [:instance-requested :instance-borrowed :instance-returned
+                        :lock-requested :lock-acquired] @events)))))
+          (testing "releasing the lock triggers 'lock-released' event"
+            (is (= [:instance-requested :instance-borrowed :instance-returned
+                    :lock-requested :lock-acquired :lock-released] @events))))))))

 (deftest ^:integration borrow-and-return-affect-read-lock-test
   (tk-bootstrap/with-app-with-config


updade

updade

--- src/s7p/core.clj
+++ src/s7p/core.clj
@@ -1,33 +1,38 @@
 (ns s7p.core
   (:require [clojure.data.json :as json]
             [org.httpkit.client :as http]
-            [clojure.core.async :refer [go go-loop chan close! <! <!! >!]]))
+            [clojure.core.async :refer [thread chan close!  <!! >!!]])
+  (:gen-class)
+  )

 (def options {:timeout 100
               :keepalive 3000})

+(def someurl "")
+
 (def dsps (atom
            [{:id "1"
-             :url "http://dsp-no-bid.compe"
-             :winnotice "http://dsp-no-bid.compe"}
+             :url someurl
+             :winnotice someurl}
             {:id "2"
-             :url "http://dsp-no-bid.compe"
-             :winnotice "http://dsp-no-bid.compe"}
+             :url someurl
+             :winnotice someurl}
             {:id "3"
-             :url "http://dsp-no-bid.compe"
-             :winnotice "http://dsp-no-bid.compe"}
+             :url someurl
+             :winnotice someurl}
             {:id "4"
-             :url "http://dsp-no-bid.compe"
-             :winnotice "http://dsp-no-bid.compe"}
+             :url someurl
+             :winnotice someurl}
             {:id "5"
-             :url "http://dsp-no-bid.compe"
-             :winnotice "http://dsp-no-bid.compe"}
+             :url someurl
+             :winnotice someurl}
             {:id "6"
-             :url "http://dsp-no-bid.compe"
-             :winnotice "http://dsp-no-bid.compe"}
+             :url someurl
+             :winnotice someurl}
             {:id "7"
-             :url "http://dsp-no-bid.compe"
-             :winnotice "http://dsp-no-bid.compe"}]))
+             :url someurl
+             :winnotice someurl}
+            ]))

 (def advertisers [{:id "1"} {:id "2"} {:id "3"} {:id "4"}])

@@ -41,8 +46,8 @@
    :result [true]})

 (defn validate [[dsp res]]
-  (let [{:keys [status body error]} @res
-        body (and body (json/read-str body :key-fn keyword))
+  (let [{:keys [status body]} @res
+        body (and body (json/read-str body :key-fn keyword :eof-error? false))
         {:keys [id bidPrice advertiserId]} body
         ret (cond
               (= status 204) {:nobid "no bid"}
@@ -86,39 +91,40 @@
   ;; TODO: log
   (println response)

-  (http/post (:winnotice dsp)
+  (http/post  (:winnotice dsp)
+             ;; FIXME: options
              {:id (:advertiserId response)
               :price (+ 1 second-price)
               :isClick (click? result response)}))

 (defn gen-request [n]
   (let [c (chan)]
-    (go-loop [i n]
-      (>! c request)
-      (if (< 0 i)
-        (recur (- i 1))
-        (close! c)))
+    (thread
+      (loop [i n]
+        (>!! c request)
+        (if (< 0 i)
+          (recur (- i 1))
+          (close! c))))
     c))

 (defn process [c]
-  (let [sig (chan)]
-   (go-loop []
-     (if-let [{:keys [req result]} (<! c)]
-       (let [xf (comp
-                 (map (fn [dsp] [dsp (http/post (:url dsp) (assoc options :body (json/write-str req)))]))
-                 (map validate)
-                 ;; TODO: log validated responses
-                 (filter succeed?)
-                 (map (fn [[_ res]] (:valid res))))]
-         (some->> (sequence xf @dsps)
-                  (pick-winner-and-second-price (:floorPrice req))
-                  (winnotice req result))
-         (recur))
-       (close! sig)))
-   sig))
+  (thread
+    (loop []
+      (when-let [{:keys [req result]} (<!! c)]
+        (let [xf (comp
+                  (map (fn [dsp] [dsp (http/post (:url dsp) (assoc options :body (json/write-str req)))]))
+                  (map validate)
+                  ;; TODO: log validated responses
+                  (filter succeed?)
+                  (map (fn [[_ res]] (:valid res))))]
+          (some->> (sequence xf @dsps)
+                   (pick-winner-and-second-price (:floorPrice req))
+                   (winnotice req result)
+                   )
+          (recur))))))

-(defn -main []
-  (time (let [c (gen-request 100)
-         sig (process c)]
-     (<!! sig))))
+(defn -main [& args]
+  (time (let [c (gen-request 1000)]
+          (doseq [sig (vec (map (fn [_] (process c)) (range 64)))]
+            (<!! sig)))))


Fix reflection warnings

Fix reflection warnings

--- src/str/core.clj
+++ src/str/core.clj
@@ -34,7 +34,7 @@
 (alias-ns clojure.string)

 (defn- ^String slice-relative-to-end
-  [s index length]
+  [^String s index length]
   (if (neg? (+ (.length s) index)) ; slice outside beg of s
     nil
     (slice s (+ (.length s) index) length)))
@@ -84,7 +84,7 @@

   If a third argument is provided the string comparison is insensitive to case."
   ([^CharSequence s ^CharSequence prefix]
-   (when (.startsWith s prefix)
+   (when (.startsWith (.toString s) prefix)
      s))
   ([^CharSequence s ^CharSequence prefix ignore-case]
    (if-not ignore-case
@@ -139,14 +139,14 @@
 (defn ^String swap-case
   "Change lower case characters to upper case and vice versa."
   [^CharSequence s]
-  (let [invert-case (fn [c]
+  (let [invert-case (fn [^Character c]
                       (cond
                         (Character/isLowerCase c) (Character/toUpperCase c)
                         (Character/isUpperCase c) (Character/toLowerCase c)
                         :else c))]
     (->> s .toString (map invert-case) (apply str))))

-(defn- gen-padding
+(defn- ^String gen-padding
   "Generate the necessary padding to fill s upto width."
   [^CharSequence s ^CharSequence padding ^long width]
   (let [missing (- width (.length s))
@@ -155,7 +155,7 @@
                       (rem missing (* full-lengths (.length padding))))
         s (.toString s)
         padding (.toString padding)]
-    (.concat (apply str (repeat full-lengths padding))
+    (.concat ^String (apply str (repeat full-lengths padding))
              (.substring padding 0 remaining))))

@@ -181,11 +181,11 @@
   ([^CharSequence s ^long width ^CharSequence padding]
    {:pre [(not-empty padding)
           (not (nil? s))]
-    :post [(= (.length %) width)]}
+    :post [(= (.length ^String %) width)]}
    (let [s (.toString s)]
      (if (<= width (.length s))
        s
-       (.concat (gen-padding s padding width) s)))))
+       (.concat ^String (gen-padding s padding width) ^String s)))))

 (defn ^String center
   "Pad both ends of s with padding, or spaces, until the length of s
@@ -202,7 +202,7 @@
        s
        (let [missing (- width (.length s))
              full-lengths (Math/ceil (/ missing (.length padding)))
-             p (gen-padding s padding width)
+             ^String p (gen-padding s padding width)
              lengths-before (Math/floor (/ full-lengths 2))]
          (str (.substring p 0 (* (.length padding) lengths-before))
               s
@@ -243,7 +243,7 @@
        s))))

 (defn- case-sensitive-contains
-  [s needle]
+  [^String s ^String needle]
   (if (= needle "")
     s
     (when (and (seq s) (seq needle) (.contains s needle))
@@ -280,12 +280,12 @@
   "Return s if s contains all needles."
   ([^CharSequence s needles]
    (let [s (.toString s)
-         needles (map #(.toString %) needles)]
+         needles (map #(.toString ^String %) needles)]
      (when (every? (partial case-sensitive-contains s) needles)
        s)))
   ([^CharSequence s needles ignore-case]
    (let [s (.toString s)
-         needles (map #(.toString %) needles)]
+         needles (map #(.toString ^String %) needles)]
      (if ignore-case
        (when (every? (partial case-insensitive-contains s) needles)
          s)
@@ -295,11 +295,11 @@
   "Return s if s contains any of the needles."
   ([^CharSequence s needles]
    (let [s (.toString s)
-         needles (map #(.toString %) needles)]
+         needles (map #(.toString ^String %) needles)]
      (some (partial case-sensitive-contains s) needles)))
   ([^CharSequence s needles ignore-case]
    (let [s (.toString s)
-         needles (map #(.toString %) needles)]
+         needles (map #(.toString ^String %) needles)]
      (if ignore-case
        (some (partial case-insensitive-contains s) needles)
        (contains-any? s needles)))))
@@ -312,6 +312,13 @@
     (if (> (.length s) (max 3 (- len 3)))
       (str (.substring s 0 (- len 3)) "...")
       s)))
+
+(defn- char-equal-ignore-case
+  [^Character c1 ^Character c2]
+  (when (or (= c1 c2)
+            (= (Character/toUpperCase c1) c2)
+            (= (Character/toLowerCase c1) c2))
+    c1))

 (defn ^String common-prefix
   "Return the longest common prefix of s1 and s2."
@@ -330,11 +337,7 @@
      (common-prefix s1 s2)
      (->> s1
           .toString
-          (map #(when (or (= %1 %2)
-                          (= (Character/toUpperCase %1) %2)
-                          (= (Character/toLowerCase %1) %2))
-                  %1)
-               (.toString s2))
+          (map char-equal-ignore-case (.toString s2))
           (take-while (complement nil?))
           (apply str)))))

@@ -356,11 +359,7 @@
      (common-suffix s1 s2)
      (->> s1
           reverse
-          (map #(when (or (= %1 %2)
-                          (= (Character/toUpperCase %1) %2)
-                          (= (Character/toLowerCase %1) %2))
-                  %1)
-               (reverse s2))
+          (map char-equal-ignore-case (reverse s2))
           (take-while (complement nil?))
           (apply str)
           reverse))))
@@ -389,7 +388,7 @@
   {:pre [(not (nil? s))]
    :post [(or (nil? %) (string? %))]}
   (when (reduce
-         (fn [acc c]
+         (fn [acc ^Character c]
            (and acc (or (Character/isUpperCase c) (= c (Character/toUpperCase c)))))
          true (.toString s))
     s))
@@ -403,7 +402,7 @@
   {:pre [(not (nil? s))]
    :post [(or (nil? %) (string? %))]}
   (when (reduce
-         (fn [acc c]
+         (fn [acc ^Character c]
            (and acc (or (Character/isLowerCase c) (= c (Character/toLowerCase c)))))
          true (.toString s))
     s))
@@ -425,7 +424,7 @@
   (->> (split s #"\n|\t|\n| ")
        (remove empty?)
        (reduce
-        (fn [{:keys [len res]} word]
+        (fn [{:keys [len res]} ^String word]
           (if (< (+ len (.length word)) width)
             {:len (+ len (.length word) 1) :res (conj res " " word)}
             {:len (.length word) :res (conj res "\n" word)}))
@@ -560,7 +559,7 @@
   (.replaceAll (.toString s) "[ \t\n\r]+" " "))

 (defn- levenshtein-distance
-  [s1 s2]
+  [^String s1 ^String s2]
   (let [subsolutions (atom {})
         subsolution (fn [i j]
                       (if (or (zero? i) (zero? j))
@@ -578,7 +577,7 @@
                          1))))))
     (subsolution (.length s1) (.length s2))))

-(defn- hamming-distance [s1 s2]
+(defn- hamming-distance [^String s1 ^String s2]
   (+
    (reduce + (map #(if (= %1 %2) 0 1) s1 s2))
    (- (max (.length s1) (.length s2))


Remove debug message on messages events ns.

--- src/uxbox/data/messages.cljs
+++ src/uxbox/data/messages.cljs
@@ -75,7 +75,6 @@

   rs/WatchEvent
   (-apply-watch [_ state s]
-    (println "HideMessage.-apply-watch" canceled?)
     (if canceled?
       (rx/empty)
       (->> (rx/of #(dissoc state :message))


More tests added into dictionary-tests module

--- test/clj_mrazik/dictionary_test.clj
+++ test/clj_mrazik/dictionary_test.clj
@@ -178,10 +178,18 @@
     (testing "the function yes-no-with-caution"
         (is (= (yes-no-with-caution {:no 0 :yes 1 :with-caution 2} :no)           (red "no")))
         (is (= (yes-no-with-caution {:no 0 :yes 1 :with-caution 2} :yes)          (green "yes")))
-        (is (= (yes-no-with-caution {:no 0 :yes 1 :with-caution 2} :with-caution) (yellow "with caution")))))
+        (is (= (yes-no-with-caution {:no 0 :yes 1 :with-caution 2} :with-caution) (yellow "with caution")))
+        (is (= (yes-no-with-caution {} :anything)                                 (red "error - word usage is not set!")))))

 (deftest test-print-field
     "Checks the function print-field"
     (testing "the function print-field"
         (is (= (str (bold "title: ") " test ")) (print-field "title" {:term "term"} :term))))

+(deftest test-use-it
+    "Checks the function use-it"
+    (testing "the function use-it"
+        (is (= java.lang.String (type (use-it {:term "term" :use 0}))))
+        (is (= java.lang.String (type (use-it {:term "term" :use 1}))))
+        (is (= java.lang.String (type (use-it {:term "term" :use 2}))))))
+


Tests for existence for all functions in utils module

--- test/emender_jenkins/utils_test.clj
+++ test/emender_jenkins/utils_test.clj
@@ -57,3 +57,18 @@
         (is (callable? 'clouseau.utils/contains))))

+(deftest test-replaceAll-existence
+    "Check that the clouseau.utils/replaceAll definition exists."
+    (testing "if the clouseau.utils/replaceAll definition exists."
+        (is (callable? 'clouseau.utils/replaceAll))))
+
+
+(deftest test-get-exception-message-existence
+    "Check that the clouseau.utils/get-exception-message definition exists."
+    (testing "if the clouseau.utils/get-exception-message definition exists."
+        (is (callable? 'clouseau.utils/get-exception-message))))
+
+;
+; Tests for behaviour of all functions
+;
+


fix for rectmath test

fix for rectmath test

--- test/flatgui/util/rectmath_test.clj
+++ test/flatgui/util/rectmath_test.clj
@@ -117,23 +117,23 @@
         rf {:x 0 :y 0 :w 4 :h 4}
         rg {:x 1 :y 1 :w 2 :h 2}
         rfg {:x 0 :y 0 :w 4 :h 4}]
-    (test/is (= r1 (rect+ r1 r1)))
-    (test/is (= r12 (rect+ r1 r2)))
-    (test/is (= r12 (rect+ r2 r1)))
-    (test/is (= r34 (rect+ r3 r4)))
-    (test/is (= r34 (rect+ r4 r3)))
-    (test/is (nil? (rect+ r5 r6)))
-    (test/is (nil? (rect+ r6 r5)))
-    (test/is (nil? (rect+ r7 r8)))
-    (test/is (nil? (rect+ r8 r7)))
-    (test/is (= r9a (rect+ r9 ra)))
-    (test/is (= r9a (rect+ ra r9)))
-    (test/is (= rbc (rect+ rb rc)))
-    (test/is (= rbc (rect+ rc rb)))
-    (test/is (= rde (rect+ rd re)))
-    (test/is (= rde (rect+ re rd)))
-    (test/is (= rfg (rect+ rf rg)))
-    (test/is (= rfg (rect+ rg rf)))))
+    (test/is (= r1 (r/rect+ r1 r1)))
+    (test/is (= r12 (r/rect+ r1 r2)))
+    (test/is (= r12 (r/rect+ r2 r1)))
+    (test/is (= r34 (r/rect+ r3 r4)))
+    (test/is (= r34 (r/rect+ r4 r3)))
+    (test/is (nil? (r/rect+ r5 r6)))
+    (test/is (nil? (r/rect+ r6 r5)))
+    (test/is (nil? (r/rect+ r7 r8)))
+    (test/is (nil? (r/rect+ r8 r7)))
+    (test/is (= r9a (r/rect+ r9 ra)))
+    (test/is (= r9a (r/rect+ ra r9)))
+    (test/is (= rbc (r/rect+ rb rc)))
+    (test/is (= rbc (r/rect+ rc rb)))
+    (test/is (= rde (r/rect+ rd re)))
+    (test/is (= rde (r/rect+ re rd)))
+    (test/is (= rfg (r/rect+ rf rg)))
+    (test/is (= rfg (r/rect+ rg rf)))))

 (test/deftest get-largest-adjacent-test
   (let [r1 {:x 2 :y 0 :w 5 :h 2}
@@ -142,6 +142,6 @@
         r4 {:x 2 :y 5 :w 1 :h 1}
         r5 {:x 4 :y 5 :w 3 :h 1}
         res {:x 2 :y 0 :w 5 :h 5}]
-    (test/is (= res (get-largest-adjacent [r1 r2 r3 r4 r5])))))
+    (test/is (= res (r/get-largest-adjacent [r1 r2 r3 r4 r5])))))


added midje.cascalog

added midje.cascalog

--- test/forma/trends/analysis_test.clj
+++ test/forma/trends/analysis_test.clj
@@ -6,6 +6,7 @@
         [forma.trends.data]
         [forma.utils]
         [cascalog.api]
+        [midje.cascalog]
         [clojure.math.numeric-tower :only (sqrt floor abs expt)])
   (:require [incanter.core :as i]
             [incanter.stats :as s]


{:added "0.0.1"} metadata

{:added "0.0.1"} metadata

--- src/main/clojure/psq/clj.clj
+++ src/main/clojure/psq/clj.clj
@@ -24,6 +24,7 @@
 (defn psq
   "Returns a new priority search queue containing the contents of coll, which
   must be a collection of map entries or doubleton vectors."
+  {:added "0.0.1"}
   [coll]
   (reduce conj PersistentPrioritySearchQueue/EMPTY coll))

@@ -34,6 +35,7 @@
   equal, they are handled as if by repeated uses of assoc. NB. this function
   takes a seqable of keys and priorities; see psqueue for a variant taking
   varargs."
+  {:added "0.0.1"}
   [keypriorities]
   (PersistentPrioritySearchQueue/create (seq keypriorities)))

@@ -42,6 +44,7 @@
   "keypriority => key priority
   Returns a new priority search queue with supplied mappings. If any keys are
   equal, they are handled as if by repeated uses of assoc."
+  {:added "0.0.1"}
   [& keypriorities]
   (psqueue* keypriorities))

@@ -80,6 +83,7 @@
   "Returns a seq of entries of the given PSQ in ascending order of
   priority. Entries with equal priorities may be returned in arbitrary
   order."
+  {:added "0.0.1"}
   [psq]
   (.prioritySeq ^PersistentPrioritySearchQueue psq))

@@ -87,6 +91,7 @@
 (defn rank
   "Returns the index of the given key in the given PSQ in key order, or -1 if
   not present."
+  {:added "0.0.1"}
   [psq key]
   (.rank ^PersistentPrioritySearchQueue psq key))

@@ -117,6 +122,7 @@

   entry is the entry at the split key if present in the given PSQ, otherwise
   nil."
+  {:added "0.0.1"}
   [psq key]
   (.split ^PersistentPrioritySearchQueue psq key))

@@ -135,6 +141,7 @@

   (subrange psq >= start <= end) is equivalent to, but more efficient
   than, (into (empty psq) (subseq coll >= start <= end))."
+  {:added "0.0.1"}
   ([psq test limit]
    (cond
      (zero? (count psq))
@@ -201,6 +208,7 @@
   "Like seq, but only returns entries with priorities <= than the given ubound
   in the ordering determined by psq's priority comparator. This is more
   efficient than using filter."
+  {:added "0.0.1"}
   [psq ubound]
   (at-most psq ubound))

@@ -219,6 +227,7 @@
   "Like subseq, but only returns entries with priorities <= than the given
   ubound in the ordering determined by psq's priority comparator. This is more
   efficient than using subseq and filter."
+  {:added "0.0.1"}
   ([psq ubound test limit]
    (seq<= (subrange psq test limit) ubound))
   ([psq ubound start-test start end-test end]
@@ -251,6 +260,7 @@
   "Like rseq, but only returns entries with priorities <= than the given
   ubound in the ordering determined by psq's priority comparator. This is more
   efficient than using rseq and filter."
+  {:added "0.0.1"}
   [psq ubound]
   (reverse-at-most psq ubound))

@@ -271,6 +281,7 @@
   "Like rsubseq, but only returns entries with priorities <= than the given
   ubound in the ordering determined by psq's priority comparator. This is more
   efficient than using rsubseq and filter."
+  {:added "0.0.1"}
   ([psq ubound test limit]
    (let [sub (subrange psq test limit)]
      (reverse-at-most sub ubound)))


Extracting movie name and time-schedule for single-table is complete.

--- src/cine/core.clj
+++ src/cine/core.clj
@@ -34,10 +34,18 @@
     (map #(:content %))
     (flatten)))

+(def schedules-root-divs (-> schedule-markup
+                             (enlive/select [:div#main_body :> [:div (enlive/nth-of-type 2)]])
+                             (enlive/select [enlive/root :>  [:div (enlive/nth-of-type 2)]])
+                             (enlive/select [enlive/root :> [:div (enlive/nth-of-type 1)]])
+                             (enlive/select [enlive/root :> [:div]])))
+
+
+
 (defn extract-date [schedule-markup-list]
   (let [date-in-string (apply enlive/text
                               (enlive/select
-                                (enlive/select one
+                                (enlive/select schedule-markup-list
                                                [enlive/root :> [:table (enlive/nth-of-type 1)]]) [:div]))
         date-fmt (str/split date-in-string #",")
         week-day (str/trim (first date-fmt))
@@ -46,31 +54,30 @@
         date (second monthly-date)
         year (str/trim (nth date-fmt 2))]
     {:week-day week-day
-     :month month
+     :month (str month)
      :date date
      :year year}))

+(defn extract-movielist-from-schedule
+  "Extracts movies from a schedule day"
+  [single-schedule-markup]
+  (flatten (map #(:content %) (->> (->  single-schedule-markup
+                                       (enlive/select [enlive/root :> [:table (enlive/nth-of-type 2)]])
+                                       (enlive/select [enlive/root :> [:tr]]))
+                                   (map #(enlive/select % [:a]))
+                                   (flatten)))))
+
 (def one (first schedules-root-divs))

-(extract-date one)
-(->> (-> schedule-markup
-         (enlive/select [:div#main_body :> [:div (enlive/nth-of-type 2)]])
-         (enlive/select [enlive/root :>  [:div (enlive/nth-of-type 2)]])
-         (enlive/select [enlive/root :> [:div (enlive/nth-of-type 1)]])
-         (first))
-     (map #(:content %)))
-(def schedules-root-divs (-> schedule-markup
-                             (enlive/select [:div#main_body :> [:div (enlive/nth-of-type 2)]])
-                             (enlive/select [enlive/root :>  [:div (enlive/nth-of-type 2)]])
-                             (enlive/select [enlive/root :> [:div (enlive/nth-of-type 1)]])
-                             (enlive/select [enlive/root :> [:div]])))
+(flatten (map #(:content %) (->> (->  one
+         (enlive/select [enlive/root :> [:table (enlive/nth-of-type 2)]])
+         (enlive/select [enlive/root :> [:tr]]))
+     (map #(enlive/select % [:td.time]))
+     (flatten))))

-(get-current-movies)
-(get-upcoming-movies)
-
-
+(extract-date one)
 (defn -main
   "I don't do a whole lot ... yet."
   [& args]


Organizing facts by year

Organizing facts by year

--- src/civs/core.clj
+++ src/civs/core.clj
@@ -42,13 +42,16 @@
   [initial-game n-turns & [verbosity]]
   (def current-game initial-game)
   (let [game-snapshots (atom {0 initial-game})
+        facts-by-turn  (atom {})
         verbosity (if (nil? verbosity) true verbosity)]
     (dotimes [t n-turns]
       (do
         (when verbosity
           (println "=== Turn" (inc t) "==="))
         (def current-game (turn current-game))
-        (swap! game-snapshots assoc (int t) current-game)
+        (swap! game-snapshots assoc (inc t) current-game)
+        (swap! facts-by-turn assoc (inc t) (deref facts))
+        (swap! facts (fn [_] []))
         (when verbosity
           (println "  population  " (game-total-pop current-game))
           (println "  bands       " (n-bands-alive current-game))
@@ -56,7 +59,7 @@
           (println "  chiefdoms   " (n-chiefdoms-alive current-game))
           (println "  settlements " (.size (settlements current-game)))
           (println ""))))
-      {:facts (deref facts), :game-snapshots (deref game-snapshots)}))
+      {:facts (deref facts-by-turn), :game-snapshots (deref game-snapshots)}))

 (defn run [world-filename n-bands n-turns history-filename use-fressian]
   (println "World            :" world-filename)


Added comments to spatial changes made when verifying DIF collections.

--- test/cmr/umm/test/dif/collection.clj
+++ test/cmr/umm/test/dif/collection.clj
@@ -40,7 +40,9 @@
     (let [{:keys [granule-spatial-representation
                   spatial-representation
                   geometries]} spatial-coverage
+          ;; DIF only support bounding rectangles
           geometries (seq (filter (comp (partial = Mbr) type) geometries))
+          ;; DIF only supports the cartesian coordinate system for the collection spatial representation
           spatial-representation (when geometries :cartesian)]
       (when (or granule-spatial-representation spatial-representation)
         (assoc spatial-coverage


indexes

indexes

--- src/ophion/db.clj
+++ src/ophion/db.clj
@@ -156,6 +156,7 @@
 (defn connect-graph
   [path]
   (let [config (config/read-config path)]
+    (log/info "connecting to" (:graph config))
     (connect (:graph config))))

 (def indexes
@@ -181,13 +182,15 @@
     {:chromosome String :start String :end String}
     {:referenceName String :start String :end String}]
    :edges
-   [{:variantInGene {:featureId String}}]})
+   [{:variantIn {:featureId String}}]})

 (defn -main
   [& args]
   (let [graph (connect-graph "config/ophion.clj")
         indexes indexes]
     (doseq [vertex (:vertexes indexes)]
+      (log/info "creating index" vertex)
       (janus-property-index graph vertex))
     (doseq [edge (:edges indexes)]
+      (log/info "creating edge index" edge)
       (janus-edge-index graph (first (keys edge)) (first (vals edge))))))


setting properties

setting properties

--- src/ophion/db.clj
+++ src/ophion/db.clj
@@ -45,6 +45,21 @@
    (.make
     (.dataType
      (.makePropertyKey manage (name key)) type))))
+
+(defn property-type
+  [value]
+  (if (coll? val)
+    Object
+    (cond
+      (string? val) String
+      (float? val) Double
+      (number? val) Long
+      :else Object)))
+
+;; (defn janus-set-property
+;;   [manage element key value]
+;;   (let [type (property-type value)
+;;         property (janus-get-property-key manage [key type])]))

 (defn janus-get-edge-label
   [manage edge-label]


don't reach out to globals in retrieve-config

--- src/cu/config.clj
+++ src/cu/config.clj
@@ -15,8 +15,8 @@
       yaml/parse-string
       (assoc :aws-credentials {:access-key (environment :aws-access-key)
                                :secret-key (environment :aws-secret-key)}
-             :cu-username (env :cu-username)
-             :cu-password (env :cu-password)
+             :cu-username (environment :cu-username)
+             :cu-password (environment :cu-password)
              :cu-max-wait (env-or-max environment :cu-max-wait)
              :cu-period (env-or-max environment :cu-period))))
 (def retrieve-config-memo (memoize retrieve-config))


Fix sort value for bookmarks.

Fix sort value for bookmarks.

--- src/oc/storage/db/common.clj
+++ src/oc/storage/db/common.clj
@@ -115,18 +115,21 @@
       (as-> (r/table table-name) query
         (r/get-all query index-value {:index index-name})
         (if-not count?
-          (r/order-by query (order-fn index-name))
-          query)
-        (if (or dir-filter
-                (not count?))
           (r/merge query (r/fn [row]
-            {:sort-value (r/get-field row [:bookmarks (keyword user-id) :bookmarked-at])}))
+            {:sort-value (-> row
+                             (r/get-field :bookmarks)
+                             (r/nth 0)
+                             (r/get-field :bookmarked-at))}))
           query)
         ;; Filter out:
         (if dir-filter
           (r/filter query (r/fn [row]
             ;; All records after/before the start
             (dir-filter row)))
+          query)
+        ;; Order by sort value
+        (if-not count?
+          (r/order-by query (order-fn :sort-value))
           query)
            ;; Apply count if needed
         (if count? (r/count query) query)


dont return keys on increment

dont return keys on increment

--- src/om_next_e2e/handlers.clj
+++ src/om_next_e2e/handlers.clj
@@ -39,7 +39,7 @@
   (swap! state
          #(update % :count (fn [old] (+ old value))))
   {:status 200
-   :body {:value {:keys [:count]}}})
+   :body {}})

 (defmethod mutatef :default [_ key params]
   {:status 404 :body {:error "Not Found" :key key :params params}})


Remove old send code

Remove old send code

--- src/onyx/messaging/aeron.clj
+++ src/onyx/messaging/aeron.clj
@@ -15,13 +15,6 @@
              [uk.co.real_logic.aeron.common BackoffIdleStrategy]
              [java.util.function Consumer]
              [java.util.concurrent TimeUnit]))
-
-(defn handle-sent-message-nippy-only [inbound-ch ^UnsafeBuffer buffer offset length header]
-  (let [dst (byte-array length)]
-    (.getBytes buffer offset dst)
-    (let [thawed (decompress dst)]
-      (doseq [message thawed]
-        (>!! inbound-ch message)))))

 (defn handle-sent-message [inbound-ch ^UnsafeBuffer buffer offset length header]
   (let [messages (protocol/read-messages-buf buffer offset length)]
@@ -148,15 +141,6 @@
           segments)
         segments))))

-; (defmethod extensions/send-messages AeronConnection
-;   [messenger event peer-link batch]
-;   (let [compressed ^bytes (compress batch)
-;         len (count compressed)
-;         unsafe-buffer (UnsafeBuffer. compressed)
-;         pub ^uk.co.real_logic.aeron.Publication (:pub peer-link)
-;         offer-f (fn [] (.offer pub unsafe-buffer 0 len))]
-;     (while (not (offer-f)))))
-
 (defmethod extensions/send-messages AeronConnection
   [messenger event peer-link batch]
   (let [[len unsafe-buffer] (protocol/build-messages-msg-buf batch)


lein: cider-nrepl 0.8.2

lein: cider-nrepl 0.8.2

--- lein_profiles.clj
+++ lein_profiles.clj
@@ -2,7 +2,7 @@
                   [lein-ring "0.8.13"]
                   [lein-ancient "0.5.5"]
                   [jonase/eastwood "0.2.0"]
-                  [cider/cider-nrepl "0.8.1"]
+                  [cider/cider-nrepl "0.8.2"]
                   ]}}
 {:dev {:dependencies
        [[com.cemerick/pomegranate "0.3.0"]]


Move Filename into Other Let

Move Filename into Other Let

--- src/lens/core.clj
+++ src/lens/core.clj
@@ -42,14 +42,14 @@
       (nil? (:warehouse-uri options))
       (exit 1 "Missing Lens Warehouse URI."))

-    (letk [[warehouse-uri] options
-           filename (first arguments)]
+    (letk [[warehouse-uri] options]
       (println "Version:" (System/getProperty "lens-import.version"))
       (println "Max Memory:" (quot (.maxMemory (Runtime/getRuntime))
                                    (* 1024 1024)) "MB")
       (println "Num CPUs:" (.availableProcessors (Runtime/getRuntime)))
       (println "Warehouse:" warehouse-uri)
-      (let [service-document (<?? (hap/fetch warehouse-uri))
+      (let [filename (first arguments)
+            service-document (<?? (hap/fetch warehouse-uri))
             ch (parse! (io/input-stream filename))
             res (<!! (import! service-document 100 ch))]
         (if (instance? Throwable res)


Permit leading whitespace

Permit leading whitespace

Former-commit-id: 46f85496b0b4b9bc23766d6ce50d9942c874ef4a

--- planck-cljs/src/planck/core.cljs
+++ planck-cljs/src/planck/core.cljs
@@ -86,7 +86,7 @@
 (defn ^:export get-completions [buffer]
   (let [namespace-candidates (map str
                                (keys (:cljs.analyzer/namespaces @planck.core/st)))
-        top-form? (re-find #"^\(\s*[^()]*$" buffer)
+        top-form? (re-find #"^\s*\(\s*[^()]*$" buffer)
         all-candidates (set (concat namespace-candidates
                                     (completion-candidates-for-ns 'cljs.core false)
                                     (completion-candidates-for-ns @current-ns true)


hid redundant tags

hid redundant tags

--- src/lex/gcide.clj
+++ src/lex/gcide.clj
@@ -13,22 +13,24 @@
 ;;; it to throw this away. I could dump it all in a miscellania.
 ;;; remember, regexes are greedy! risk using up more tokens than you want too
 ;;; add more marks to text and misc
+;;; I want it to throw out the actual tags and just give :definition []
 (def gcide-parser
   (parser
    "S = body | Epsilon
-   body = '
' content '
'
+   body = <'
'> content <'
'>
    content = Epsilon | (misc | entry | headword | pronunciation | pos | etymology | definition | source | field | collocation-section | collocation-def | collocation-entry) content | text
-   pos = '<pos>' content '</pos>'
-   entry = '<ent>' content '</ent>'
-   headword = '<hw>' content '</hw>'
-   pronunciation = '<pr>' content '</pr>'
-   etymology = '<ety>' content '</ety>'
-   definition = '<def>' content '</def>'
-   source = '<ets>' content '</ets>'
-   field = '<fld>' content '</fld>'
-   collocation-section = '<cs>' content '</cs>'
-   collocation-def = '<cd>' content '</cd>'
-   collocation-entry = '<col>' content '</col>'
-   misc = #'<[a-z]*>' content #'</[a-z]*>'
-   text = #'[a-zA-Z\\ ]*'"))
+   pos = <'<pos>'> content <'</pos>'>
+   entry = <'<ent>'> content <'</ent>'>
+   headword = <'<hw>'> content <'</hw>'>
+   pronunciation = <'<pr>'> content <'</pr>'>
+   etymology = <'<ety>'> content <'</ety>'>
+   definition = <'<def>'> content <'</def>'>
+   source = <'<ets>'> content <'</ets>'>
+   field = <'<fld>'> content <'</fld>'>
+   collocation-section = <'<cs>'> content <'</cs>'>
+   collocation-def = <'<cd>'> content <'</cd>'>
+   collocation-entry = <'<col>'> content <'</col>'>
+   misc = #'<[a-z]*>' content #'</[a-z]*>' (* i actually do want tags here *)
+   <text> = #'[a-zA-Z\\ ]*'"))

+


pull in algo.chance so choose-n is defined

--- src/overtone/music/pitch.clj
+++ src/overtone/music/pitch.clj
@@ -4,7 +4,8 @@
           intervals, etc."
      :author "Jeff Rose, Sam Aaron & Marius Kempe"}
   overtone.music.pitch
-  (:use [clojure.contrib.str-utils2 :only (chop)])
+  (:use [clojure.contrib.str-utils2 :only (chop)]
+        [overtone.algo chance])
   (:require [clojure.contrib.math :as math]))

 ;; Notes in a typical scale are related by small, prime number ratios. Of all


make pulse and impulse control rate by default

--- src/overtone/sc/ugen/osc.clj
+++ src/overtone/sc/ugen/osc.clj
@@ -107,6 +107,7 @@
               {:name "width", :default 0.5 :doc "Pulse width duty cycle from zero to one"}]
        :signal-range :unipolar
        :rates #{:ar :kr}
+       :default-rate :kr
        :doc "A non-band-limited pulse oscillator. Outputs a high value of one and a low value of zero.
 "}

@@ -123,6 +124,7 @@
               {:name "phase", :default 0.0 :doc "Phase offset in cycles ( 0..1 )"}]
        :signal-range :unipolar
        :rates #{:ar :kr}
+       :default-rate :kr
        :doc "non band limited impulse oscillator. Outputs a single 1 every freq cycles per second and 0 the rest of the time."}


Got some basic files to load, now to interpret them

--- caffe/src/cortex_caffe/core.clj
+++ caffe/src/cortex_caffe/core.clj
@@ -1,2 +1,27 @@
 (ns cortex-caffe.core
-  (:import ))
+  (:require [clojure.java.io :as io])
+  (:import [caffe Caffe Caffe$NetParameter]
+           [com.google.protobuf CodedInputStream TextFormat]))
+
+
+(defn create-coded-input-stream
+  ^CodedInputStream [path-or-whatever]
+  (let [input-stream (io/input-stream path-or-whatever)
+        coded-stream (CodedInputStream/newInstance input-stream)]
+    ;;We deal in big stuff here
+    (.setSizeLimit coded-stream Integer/MAX_VALUE)
+    coded-stream))
+
+
+(defn load-binary-caffe-file
+  "Load a caffe model from binary file (.caffemodel)"
+  ^Caffe$NetParameter [path-or-whatever]
+  (Caffe$NetParameter/parseFrom (create-coded-input-stream path-or-whatever)))
+
+(defn load-text-caffe-file
+  "Load a net parameter from a text file (.prototxt)"
+  ^Caffe$NetParameter [path-or-whatever]
+  (let [reader (io/reader path-or-whatever)
+        builder (Caffe$NetParameter/newBuilder)]
+    (TextFormat/merge reader builder)
+    (.build builder)))


No longer possible to extract the time from a date

This might have led to unfortunate surprises.

--- src/tick/core.clj
+++ src/tick/core.clj
@@ -185,7 +185,6 @@
   (year [n] (Year/of n))

   LocalDate
-  (time [d] (midnight d)) ; this helps iCalendar dates become intervals
   (date [d] d)
   (day [d] (.getDayOfWeek d))
   (day-of-month [d] (.getDayOfMonth d))


Prefer the use of keywords as functions for retrieving values from maps

--- src/tobias/cv.clj
+++ src/tobias/cv.clj
@@ -44,7 +44,7 @@
                       "&analyzesGender=true"
                       "&analyzesHeadPose=false")
                  {:headers {"Content-Type" "application/octet-stream"
-                            "Ocp-Apim-Subscription-Key" (microsoft-creds :key)}
+                            "Ocp-Apim-Subscription-Key" (:key microsoft-creds)}
                   :body image}))
     (normalize [_ result]
       (map (fn [r]
@@ -58,8 +58,8 @@
     (features [_ image]
       (http/post "http://api.sightcorp.com/api/detect/"
                  {:multipart [{:name "img" :content image}
-                              {:name "app_key" :content (sightcorp-creds :app_key)}
-                              {:name "client_id" :content (sightcorp-creds :client_id)}]}))
+                              {:name "app_key" :content (:app_key sightcorp-creds)}
+                              {:name "client_id" :content (:client_id sightcorp-creds)}]}))
     (normalize [_ result]
       (map (fn [r]
              {:age       (age->sym (get-in r [:age :value]))
@@ -74,8 +74,8 @@
     (features [_ image]
       (http/post "http://apius.faceplusplus.com/detection/detect"
                  {:multipart [{:name "img" :content image}
-                              {:name "api_key" :content (faceplus-creds :api_key)}
-                              {:name "api_secret" :content (faceplus-creds :api_secret)}]}))
+                              {:name "api_key" :content (:api_key faceplus-creds)}
+                              {:name "api_secret" :content (:api_secret faceplus-creds)}]}))
     (normalize [_ result]
       (map (fn [r]
              {:age    (age->sym (get-in r [:attribute :age :value]))


Added logic to bind field value definition with "no definition" when no definition present

--- kabob-build/src/main/resources/edu/ucdenver/ccp/kabob/build/rules/bio_to_ice/step_c/ontology_concept_record_gen.clj
+++ kabob-build/src/main/resources/edu/ucdenver/ccp/kabob/build/rules/bio_to_ice/step_c/ontology_concept_record_gen.clj
@@ -25,10 +25,11 @@
   :sparql-string "prefix ccp: <http://ccp.ucdenver.edu/obo/ext/>
                   prefix obo: <http://purl.obolibrary.org/obo/>
                   prefix oboInOwl: <http://www.geneontology.org/formats/oboInOwl#>
-                  select ?id ?class ?definition ?label ?id_string {
+                  select ?id ?class ?bound_definition ?label ?id_string {
                   ?id rdf:type ccp:IAO_EXT_0000088 .
                   ?id obo:IAO_0000219 ?class .
                   optional {?class obo:IAO_0000115 ?definition } .
                   optional {?class rdfs:label ?label } .
                   optional {?class oboInOwl:id ?id_string } .
+                  BIND(IF(bound(?definition), ?definition, 'no definition') as ?bound_definition) .
                   }" }


fix bug

fix bug

--- code/self-raise/clojure.clj
+++ code/self-raise/clojure.clj
@@ -1,4 +1,4 @@
 (defn self-raise [coll]
-  (map #(Math/pow % %) a))
+  (map #(Math/pow % %) coll))

 (println (self-raise [1 8 2 6 4 5]))


Take only what's accurate from sightcorp

--- src/tobias/cv.clj
+++ src/tobias/cv.clj
@@ -60,9 +60,7 @@
                               {:name "client_id" :content (:client_id sightcorp-creds)}]}))
     (normalize [_ result]
       (map (fn [r]
-             {:age       (age->sym (get-in r [:age :value]))
-              :gender    (str->kw  (get-in r [:gender :value]))
-              :ethnicity (str->kw  (get-in r [:ethnicity :value]))
+             {:ethnicity (str->kw  (get-in r [:ethnicity :value]))
               :clothing  (get r :clothingcolors [])})
            (:persons result)))))

@@ -83,9 +81,6 @@
                               (async/merge))
          one (first (async/<!! merged-channels))
          two (first (async/<!! merged-channels))
-         combined-results (apply merge
-                                 (if (contains? one :clothing) ; sightcorp less accurate
-                                   [one two]
-                                   [two one]))]
+         combined-results (merge one two)]
      (prn combined-results)
      (conj [] combined-results))))


Ignorable whitespace changes

Ignorable whitespace changes

--- src/uruk/core.clj
+++ src/uruk/core.clj
@@ -126,7 +126,7 @@

   `:xcc-type` maps to the corresponding
   com.marklogic.xcc.types.ValueType field"
-  {:attribute {;; FIXME Causes "Unhandled java.lang.InternalError | Unrecognized valueType: attribute()" if passed as variable :type
+  {:attribute {;; FIXME Causes "Unhandled java.lang.InternalError | Unrecognized valueType: attribute()" if passed as variable :type
                :ml->clj #(.asString %)
                :clj->xdm identity ;; doesn't seem to be implemented by ValueFactory: "java.lang.InternalError Unrecognized valueType: attribute()"
                :xml-name "attribute()"
@@ -403,9 +403,9 @@
   [result-sequence & [type-mapping]]
   ;; TODO throw informative exception if type not found in types
   (map (fn [item] (((merge xml-type-str->conv-fn
-                          (when (map? type-mapping)
-                            type-mapping))
-                   (.toString (.getValueType item))) item))
+                           (when (map? type-mapping)
+                             type-mapping))
+                    (.toString (.getValueType item))) item))
        (.toArray result-sequence)))

@@ -472,7 +472,7 @@
    :request-time-limit (.getRequestTimeLimit req-opts)
    :result-buffer-size (.getResultBufferSize req-opts)
    :timeout-millis (.getTimeoutMillis req-opts)
-   :timezone (.getTimeZone req-opts)})
+   :timezone (.getTimeZone req-opts)})

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -738,7 +738,7 @@
    :current-server-time (.getCurrentServerPointInTime session)
    :content-source (.getContentSource session)
    :xaresource (.getXAResource session)
-   :user-object (.getUserObject session)
+   :user-object (.getUserObject session)
    :user-credentials (user-credentials->map (.getUserCredentials session))
    :closed? (.isClosed session) ;; TODO maybe create (defn closed? [session] ...) ? Except it wouldn't be specific to Session in this ns, and ResultSequence also has isClosed, so it's ambiguous.
    :cached-transaction-timeout (.getCachedTxnTimeout session)
@@ -910,7 +910,7 @@
   Variables may be passed as a map of Strings or with String names
   corresponding to maps describing the variable using mandatory key
   `:value` and optional keys `:namespace` and `:type`.`
-
+
   See https://docs.marklogic.com/javadoc/xcc/com/marklogic/xcc/ModuleSpawn.html"
   ([session module]
    (spawn-module session module {}))


lein task: package do :release first then :pack

--- ext/chrome/project.clj
+++ ext/chrome/project.clj
@@ -59,6 +59,8 @@
                            ["cljsbuild" "once"]]
             "package"     ["with-profile" "pro"
                            "do"
+                           ["clean"]
+                           ["cljsbuild" "once"]
                            ["packer" "once"]]}
   )


Reindent

Reindent


Minor refactoring: aget can accept multiple keys

--- test/devtools/test/core.cljs
+++ test/devtools/test/core.cljs
@@ -38,7 +38,7 @@
       (devtools/uninstall!)
       (is (= (devtools/installed?) false))
       (is (= (.-length (aget js/window devtools/formatter-key)) 1))
-      (is (= existing-formatter (aget (aget js/window devtools/formatter-key) 0)))))
+      (is (= existing-formatter (aget js/window devtools/formatter-key 0)))))
   (testing "Testing install, install foreign custom formatter, uninstall scenario"
     (let [existing-formatter #js {"some" "value"}
           initial-formatters #js [existing-formatter]]
@@ -57,5 +57,5 @@
         (devtools/uninstall!)
         (is (= (devtools/installed?) false))
         (is (= (.-length (aget js/window devtools/formatter-key)) 2))
-        (is (= existing-formatter (aget (aget js/window devtools/formatter-key) 0)))
-        (is (= additional-formatter (aget (aget js/window devtools/formatter-key) 1)))))))+        (is (= existing-formatter (aget js/window devtools/formatter-key 0)))
+        (is (= additional-formatter (aget js/window devtools/formatter-key 1)))))))


De-dup.

De-dup.

--- test/postal/test/message.clj
+++ test/postal/test/message.clj
@@ -31,16 +31,17 @@
             AddressException]))

 (deftest test-simple
-  (let [m {:from "fee@bar.dom"
-           :to "Foo Bar <foo@bar.dom>"
-           :cc ["baz@bar.dom" "Quux <quux@bar.dom>"]
-           :date (java.util.Date.)
-           :subject "Test"
-           :body "Test!"
-           :charset "us-ascii"}]
-    (is (= "Subject: Test" (re-find #"Subject: Test" (message->str m))))
-    (is (re-find #"Cc: baz@bar.dom, Quux <quux@bar.dom>" (message->str m)))
-    (is (re-find #"(?i)content-type:.*us-ascii" (message->str m)))))
+  (let [m (message->str
+           {:from "fee@bar.dom"
+            :to "Foo Bar <foo@bar.dom>"
+            :cc ["baz@bar.dom" "Quux <quux@bar.dom>"]
+            :date (java.util.Date.)
+            :subject "Test"
+            :body "Test!"
+            :charset "us-ascii"})]
+    (is (= "Subject: Test" (re-find #"Subject: Test" m)))
+    (is (re-find #"Cc: baz@bar.dom, Quux <quux@bar.dom>" m))
+    (is (re-find #"(?i)content-type:.*us-ascii" m))))

 (deftest test-multipart
   (let [m (message->str
@@ -157,24 +158,25 @@
     (is (re-find #"Reply-To: yermom" (message->str m)))))

 (deftest test-charset-addrs
-  (let [m {:from "íč <p@p.com>"
-           :to "Böb <bob@bar.dom>"
-           :cc ["Plain Addr <plain@bar.dom>"]
-           :subject "Test"
-           :body "Charsets!"}]
-    (is (.contains (message->str m) "=?utf-8?B?w63EjQ==?="))
-    (is (.contains (message->str m) "=?utf-8?Q?B=C3=B6b?="))
-    (is (.contains (message->str m) "Plain Addr")))
-  (let [m {:from "íč <p@p.com>"
-           :to "Böb <bob@bar.dom>"
-           :cc ["Plain Addr <plain@bar.dom>"]
-           :subject "Test"
-           :charset "iso-8859-1"
-           :body "Charsets!"}]
-    (is (.contains (message->str m)
-                   "Content-Type: text/plain; charset=iso-8859-1"))
-    (is (.contains (message->str m) "=?iso-8859-1?B?7T8=?="))
-    (is (.contains (message->str m) "Plain Addr")))
+  (let [m (message->str
+           {:from "íč <p@p.com>"
+            :to "Böb <bob@bar.dom>"
+            :cc ["Plain Addr <plain@bar.dom>"]
+            :subject "Test"
+            :body "Charsets!"})]
+    (is (.contains m "=?utf-8?B?w63EjQ==?="))
+    (is (.contains m "=?utf-8?Q?B=C3=B6b?="))
+    (is (.contains m "Plain Addr")))
+  (let [m (message->str
+           {:from "íč <p@p.com>"
+            :to "Böb <bob@bar.dom>"
+            :cc ["Plain Addr <plain@bar.dom>"]
+            :subject "Test"
+            :charset "iso-8859-1"
+            :body "Charsets!"})]
+    (is (.contains m "Content-Type: text/plain; charset=iso-8859-1"))
+    (is (.contains m "=?iso-8859-1?B?7T8=?="))
+    (is (.contains m "Plain Addr")))
   (let [m (message->str
            {:from "foo@bar.dom"
             :to "baz@bar.dom"
@@ -222,4 +224,3 @@
             :body "Where is that message ID!"
             :user-agent "foo/1.0"})]
     (is (.contains m "User-Agent: foo"))))
-


Reformatted parser to fit a smaller screen.

--- parser/parser.clj
+++ parser/parser.clj
@@ -30,12 +30,14 @@

 (def sexp-to-function-type (name parameters range)
      (match parameters
-            (Cons (List arg-types _) (Cons return-type Empty))  (result-flatmap (fn (arg-types)
-                                                                (result-map     (fn (return-type)
-                                                                                (FunctionType arg-types return-type range))
-                                                                                (sexp-to-type return-type)))
-                                                                                (sexp-to-types arg-types))
-            _                                          (Error (MalformedTypeError range))))
+            (Cons (List arg-types _) (Cons return-type Empty))
+                (result-flatmap (fn (arg-types)
+                (result-map     (fn (return-type)
+                    (FunctionType arg-types return-type range))
+                (sexp-to-type return-type)))
+                (sexp-to-types arg-types))
+            _
+                (Error (MalformedTypeError range))))

 (def sexp-to-complex-or-function-type (name parameters range)
      (match (function-type? name)
@@ -44,9 +46,14 @@

 (def sexp-to-type (type)
      (match type
-            (List (Cons (Symbol name _) parameters) range)  (sexp-to-complex-or-function-type name parameters range)
-            (Symbol name range)                             (Result (SimpleType name range))
-            (List _ range)                                  (Error (MalformedTypeError range))))
+            (List (Cons (Symbol name _) parameters) range)
+                (sexp-to-complex-or-function-type name
+                                                  parameters
+                                                  range)
+            (Symbol name range)
+                (Result (SimpleType name range))
+            (List _ range)
+                (Error (MalformedTypeError range))))

 (def sexp-to-types (types)
      (result-of-list (list-map sexp-to-type types)))
@@ -58,9 +65,12 @@

 (def sexp-to-constructor (constructor)
      (match constructor
-            (Symbol name range)                        (Result (SimpleConstructor name range))
-            (List (Cons (Symbol name _) types) range)  (sexp-to-complex-constructor name types range)
-            (List _ range)                             (Error (MalformedConstructorError range))))
+            (Symbol name range)
+                (Result (SimpleConstructor name range))
+            (List (Cons (Symbol name _) types) range)
+                (sexp-to-complex-constructor name types range)
+            (List _ range)
+                (Error (MalformedConstructorError range))))

 (def sexp-to-constructors (constructors)
      (result-of-list (list-map sexp-to-constructor constructors)))
@@ -75,13 +85,17 @@
 (def sexp-to-definition' (kind name rest range)
      (match (type-definition? (symbol-name kind))
             True   (sexp-to-type-definition name rest range)
-            False  (Result (OptOut (list-concat (list kind name) rest) range))))
+            False  (Result (OptOut (list-concat (list kind name) rest)
+                                   range))))

 (def sexp-to-definition (expression)
      (match expression
-            (List (Cons kind (Cons name rest)) range)  (sexp-to-definition' kind name rest range)
-            (List _ range)                             (Error (MalformedDefinitionError range))
-            (Symbol _ range)                           (Error (MalformedDefinitionError range))))
+            (List (Cons kind (Cons name rest)) range)
+                (sexp-to-definition' kind name rest range)
+            (List _ range)
+                (Error (MalformedDefinitionError range))
+            (Symbol _ range)
+                (Error (MalformedDefinitionError range))))

 (def sexps-to-definitions (expressions)
      (list-map sexp-to-definition expressions))
@@ -96,31 +110,43 @@

 (def type-to-sexp (type)
      (match type
-            (SimpleType name range)                     (Symbol name range)
-            (FunctionType arg-types return-type range)  (List (Cons (fn-symbol range)
-                                                              (Cons (List (types-to-sexp arg-types) range)
-                                                              (Cons (type-to-sexp return-type) Empty))) range)
-            (ComplexType name types range)              (List (Cons (Symbol name range) (types-to-sexp types)) range)))
+            (SimpleType name range)
+                (Symbol name range)
+            (FunctionType arg-types return-type range)
+                (List (Cons (fn-symbol range)
+                      (Cons (List (types-to-sexp arg-types) range)
+                      (Cons (type-to-sexp return-type) Empty))) range)
+            (ComplexType name types range)
+                (List (Cons (Symbol name range) (types-to-sexp types))
+                      range)))

 (def types-to-sexp (types)
      (list-map type-to-sexp types))

 (def constructor-to-sexp (constructor)
      (match constructor
-            (SimpleConstructor name range)         (Symbol name range)
-            (ComplexConstructor name types range)  (List (Cons (Symbol name range) (types-to-sexp types)) range)))
+            (SimpleConstructor name range)
+                (Symbol name range)
+            (ComplexConstructor name types range)
+                (List (Cons (Symbol name range) (types-to-sexp types))
+                      range)))

 (def constructors-to-sexp (constructors)
      (list-map constructor-to-sexp constructors))

 (def type-definition-to-sexp (type constructors range)
-     (List (list-concat (list (typ-symbol range) (type-to-sexp type)) (constructors-to-sexp constructors)) range))
+     (List (list-concat (list (typ-symbol range) (type-to-sexp type))
+                        (constructors-to-sexp constructors))
+           range))

 (def definition-to-sexp (definition)
      (match definition
-            (Result (TypeDefinition type constructors range))  (type-definition-to-sexp type constructors range)
-            (Result (OptOut sexp range))                       (List sexp range)
-            (Error  _)                                         (Symbol (list 33 33 33) (Range 0 0))))
+            (Result (TypeDefinition type constructors range))
+                (type-definition-to-sexp type constructors range)
+            (Result (OptOut sexp range))
+                (List sexp range)
+            (Error  _)
+                (Symbol (list 33 33 33) (Range 0 0))))

 (def definitions-to-sexps (definitions)
      (list-map definition-to-sexp definitions))


fix clansi reference

fix clansi reference

--- test/strictly_specking/core_test.clj
+++ test/strictly_specking/core_test.clj
@@ -1,7 +1,6 @@
 (ns strictly-specking.core-test
   (:require [clojure.test :refer :all]
             [clojure.string :as string]
-            [clansi.core :refer [without-ansi]]
             [strictly-specking.path-matching :as path-match]
             [strictly-specking.core :as ss]
             [strictly-specking.error-printing :as ep]
@@ -81,7 +80,7 @@
     (is (= (ss/keys-to-document err)
            [::t/css-dirs]))
     (is
-     (.contains (with-out-str (without-ansi (ep/pprint-inline-message err)))
+     (.contains (with-out-str (ep/pprint-inline-message err))
                 ":css-dirs"))
     (is (= (ss/keys-to-document err)
            [::t/css-dirs]))


Fix for JOIN messages not always starting with the '#' channel prefix.

--- Turbot/src/turbot/core.clj
+++ Turbot/src/turbot/core.clj
@@ -17,6 +17,11 @@

 (def empty-state {})

+(defn fix-channel [c]
+    (if (and c (not (= \# (first c))))
+        (str \# c)
+        c))
+
 (defn on-any [allow-privmsg event state-ref]
     (let [{:keys [
         channel
@@ -33,27 +38,28 @@
             (doseq [[c {:keys [users]}] @state-ref]
                 (if (some #{nick} users)
                     (on-any allow-privmsg (assoc event :channel c) state-ref)))
-            (if (= (= doing "PRIVMSG") allow-privmsg)
-                (dosync
-                    (if-let [channel-obj ((@irc :channels) channel)] (ref-set state-ref
-                        (assoc @state-ref channel
-                            (assoc (@state-ref channel)
-                                :users (sort (map first (channel-obj :users)))
-                                :topic (channel-obj :topic)))))
-                    (if channel
-                        (ref-set state-ref (assoc-in @state-ref [channel :recentlines]
-                            (vec (take 1000
-                                (concat (:recentlines (@state-ref channel))
-                                    [(into {} (filter val {
-                                        :nick nick
-                                        :newnick new-nick
-                                        :doing doing
-                                        :message message
-                                        :target target
-                                        :reason reason
-                                        :isaction action?
-                                        :topic topic
-                                    }))])))))))))))
+                (if (= (= doing "PRIVMSG") allow-privmsg)
+                    (let [channel (fix-channel channel)]
+                        (dosync
+                            (if-let [channel-obj ((@irc :channels) channel)] (ref-set state-ref
+                                (assoc @state-ref channel
+                                    (assoc (@state-ref channel)
+                                        :users (sort (map first (channel-obj :users)))
+                                        :topic (channel-obj :topic)))))
+                            (if channel
+                                (ref-set state-ref (assoc-in @state-ref [channel :recentlines]
+                                    (vec (take 1000
+                                        (concat (:recentlines (@state-ref channel))
+                                            [(into {} (filter val {
+                                                :nick nick
+                                                :newnick new-nick
+                                                :doing doing
+                                                :message message
+                                                :target target
+                                                :reason reason
+                                                :isaction action?
+                                                :topic topic
+                                            }))]))))))))))))

 (defn web-handler [{uri :uri} state-ref]
     (condp = uri


don't deploy frontend assets until backend is deployed

--- src/pc/assets.clj
+++ src/pc/assets.clj
@@ -220,8 +220,9 @@
                      :metadata {:content-length (count manifest-bytes)
                                 :content-type "application/edn"})
       (validate-manifest! (fetch-specific-manifest cdn-bucket manifest-key))
-      (log/infof "moving manifest pointer to %s" manifest-key)
-      (move-manifest-pointer cdn-bucket manifest-key)
+      ;;(log/infof "moving manifest pointer to %s" manifest-key)
+      ;;(move-manifest-pointer cdn-bucket manifest-key)
+      (log/infof "skip moving manifest pointer to %s" manifest-key)
       (log/infof "uploading sourcemap to rollbar")
       (upload-sourcemap sha1 manifest))))


remove deprecated route

remove deprecated route

--- src/pc/server.clj
+++ src/pc/server.clj
@@ -52,11 +52,6 @@
   (routes
    (POST "/api/entity-ids" request
          (datomic/entity-id-request (-> request :body slurp edn/read-string :count)))
-   (GET "/api/document/:id" [id]
-        ;; TODO: should probably verify document exists
-        ;; TODO: take tx-date as a param
-        {:status 200
-         :body (pr-str {:layers (layer/find-by-document (pcd/default-db) {:db/id (Long/parseLong id)})})})
    (GET "/document/:document-id.svg" [document-id :as req]
         (let [layers (layer/find-by-document (pcd/default-db) {:db/id (Long/parseLong document-id)})]
           {:status 200


Logging for smtp.

Logging for smtp.

--- src/pepa/smtp.clj
+++ src/pepa/smtp.clj
@@ -21,26 +21,29 @@
             address (and host (InetAddress/getByName host))
             server (->
                     (proxy [SimpleMessageListener] []
-                      (accept [from to] true)
+                      (accept [from to]
+                        (log/info component "Accepting mail" (str "(from: " from ", to: " to ")"))
+                        true)
                       (deliver [from to data]
                         (db/with-transaction [db (:db component)]
                           ;; TODO: Use proper mail address parser
-                          (let [origin (if (.startsWith to "scanner@") "scanner" "email")
-                                files (m/store-files! db
-                                                      (m/mime-message->files data)
-                                                      {:origin origin})]
-                            (when (= origin "email")
-                              (doseq [file files]
-                                (let [id (m/create-document! db {:file (:id file)
-                                                                 :title (:name file)})
-                                      tagging (get-in component [:config :tagging])]
-                                  ;; NOTE: auto-tag*! so we don't
-                                  ;; trigger an update on the
-                                  ;; notification bus
-                                  (m/auto-tag*! db id tagging
-                                               {:origin origin
-                                                :mail/from from
-                                                :mail/to to}))))))))
+                          (if-let [files (seq (m/mime-message->files data))]
+                            (let [origin (if (.startsWith to "scanner@") "scanner" "email")
+                                  files (m/store-files! db files {:origin origin})]
+                              (when (= origin "email")
+                                (doseq [file files]
+                                  (let [id (m/create-document! db {:file (:id file)
+                                                                   :title (:name file)})
+                                        tagging (get-in component [:config :tagging])]
+                                    ;; NOTE: auto-tag*! so we don't
+                                    ;; trigger an update on the
+                                    ;; notification bus
+                                    (log/info component "adding tags to created document")
+                                    (m/auto-tag*! db id tagging
+                                                  {:origin origin
+                                                   :mail/from from
+                                                   :mail/to to})))))
+                            (log/warn component "Got mail from" from "without attachments")))))
                     (SimpleMessageListenerAdapter.)
                     (SMTPServer.))]
         (doto server


додано БД за замовчанням

додано БД за замовчанням

--- src/uawa/jdbc.clj
+++ src/uawa/jdbc.clj
@@ -1,9 +1,10 @@
 (ns uawa.jdbc)
 (use 'uawa.core)
 (потребуй '[clojure.java.jdbc :as j])
-(функція запитай [джерело sql-запит] (j/query джерело sql-запит))
-(функція виконай [джерело sql-запит] (j/execute! джерело sql-запит))
 (змінна БД)
+(функція запитай ([sql-запит] (запитай БД sql-запит)) ([джерело sql-запит] (j/query джерело sql-запит)))
+(функція виконай ([sql-запит] (виконай БД sql-запит)) ([джерело sql-запит] (j/execute! джерело sql-запит)))
+
 (defmacro збережи-запит "збережи результати запиту до БД" [назва запит] `(постійна ~назва (запитай БД ~запит)))

 ;; Приклад


CMR-6495 More test fixes.

CMR-6495 More test fixes.

--- system-int-test/test/cmr/system_int_test/ingest/variable_ingest_with_association_test.clj
+++ system-int-test/test/cmr/system_int_test/ingest/variable_ingest_with_association_test.clj
@@ -19,9 +19,9 @@
         coll1-PROV1-1 (data-core/ingest-umm-spec-collection "PROV1" (data-umm-c/collection {:EntryTitle "E1"
                                                                                :ShortName "S1"}))
         coll1-PROV1-2 (data-core/ingest-umm-spec-collection "PROV1" (data-umm-c/collection {:EntryTitle "E1"
-                                                                                :ShortName "S1"}))
+                                                                                :ShortName "S1"}))
         coll2-PROV1-1 (data-core/ingest-umm-spec-collection "PROV1" (data-umm-c/collection {:EntryTitle "E2"
-                                                                                :ShortName "S2"}))
+                                                                                :ShortName "S2"}))
         coll2-PROV1-2 (data-core/ingest-umm-spec-collection "PROV1" (data-umm-c/collection {:EntryTitle "E2"
                                                                                :ShortName "S2"}))
         coll1-PROV2-1 (data-core/ingest-umm-spec-collection "PROV2" (data-umm-c/collection {:EntryTitle "E1"
@@ -31,18 +31,17 @@
         coll2-PROV2-1 (data-core/ingest-umm-spec-collection "PROV2" (data-umm-c/collection {:EntryTitle "E2"
                                                                                :ShortName "S2"}))
         coll2-PROV2-2 (data-core/ingest-umm-spec-collection "PROV2" (data-umm-c/collection {:EntryTitle "E2"
-                                                                                :ShortName "S2"}))
+                                                                                :ShortName "S2"}))
         _ (index/wait-until-indexed)]

     (testing "ingest of a new variable concept with association on PROV1"
       (let [concept (variable-util/make-variable-concept
                      {:Dimensions [(umm-v/map->DimensionType {:Name "Solution_3_Land"
                                                               :Size 3
-                                                              :Type "OTHER"})]
-                      :AcquisitionSourceName "Instrument1"}
+                                                              :Type "OTHER"})]}
                      {:native-id "var1"
                       :coll-concept-id (:concept-id coll1-PROV1-1)})
-            {:keys [concept-id revision-id variable-association]}
+            {:keys [concept-id revision-id variable-association]}
               (variable-util/ingest-variable-with-association concept)
             var-concept-id concept-id
             va-concept-id (:concept-id variable-association)
@@ -56,8 +55,7 @@
           (let [concept (variable-util/make-variable-concept
                          {:Dimensions [(umm-v/map->DimensionType {:Name "Solution_3_Land"
                                                                   :Size 3
-                                                                 :Type "OTHER"})]
-                          :AcquisitionSourceName "Instrument1"}
+                                                                 :Type "OTHER"})]}
                          {:native-id "var1"
                           :coll-concept-id (:concept-id coll1-PROV2-1)
                           :coll-revision-id (:revision-id coll1-PROV2-1)})
@@ -74,8 +72,7 @@
           (let [concept (variable-util/make-variable-concept
                          {:Dimensions [(umm-v/map->DimensionType {:Name "Solution_3_Land"
                                                                   :Size 3
-                                                                 :Type "OTHER"})]
-                          :AcquisitionSourceName "Instrument1"}
+                                                                 :Type "OTHER"})]}
                          {:native-id "var1"
                           :coll-concept-id (:concept-id coll1-PROV2-1)
                           :coll-revision-id (:revision-id coll1-PROV2-2)})
@@ -93,8 +90,7 @@
           (let [concept (variable-util/make-variable-concept
                          {:Dimensions [(umm-v/map->DimensionType {:Name " Solution_3_Land "
                                                                   :Size 3
-                                                                  :Type "OTHER"})]
-                          :AcquisitionSourceName " Instrument1 "}
+                                                                  :Type "OTHER"})]}
                          {:native-id "var1"})
                 {:keys [concept-id revision-id]} (variable-util/ingest-variable
                                                   concept)]
@@ -105,8 +101,7 @@
           (let [concept (variable-util/make-variable-concept
                          {:Dimensions [(umm-v/map->DimensionType {:Name "Solution_3_Land"
                                                                   :Size 3
-                                                                  :Type "OTHER"})]
-                          :AcquisitionSourceName "Instrument1"}
+                                                                  :Type "OTHER"})]}
                          {:native-id "var2"
                           :coll-concept-id (:concept-id coll1-PROV1-1)})
                 ;; Two variables with the same name (var1, var2) can not be associated
@@ -122,8 +117,7 @@
       (let [concept (variable-util/make-variable-concept
                      {:Dimensions [(umm-v/map->DimensionType {:Name "Solution_3_Land_3"
                                                               :Size 3
-                                                              :Type "OTHER"})]
-                      :AcquisitionSourceName "Instrument1"}
+                                                              :Type "OTHER"})]}
                      {:native-id "var3"
                       :coll-concept-id (:concept-id coll2-PROV1-1)
                       :coll-revision-id 1})
@@ -140,8 +134,7 @@
       (let [concept (variable-util/make-variable-concept
                      {:Dimensions [(umm-v/map->DimensionType {:Name "Solution_3_Land_4"
                                                               :Size 3
-                                                              :Type "OTHER"})]
-                      :AcquisitionSourceName "Instrument1"}
+                                                              :Type "OTHER"})]}
                      {:native-id "var4"
                       :coll-concept-id (:concept-id coll2-PROV1-1)
                       :coll-revision-id 3})
@@ -156,16 +149,14 @@
       (let [concept1 (variable-util/make-variable-concept
                        {:Dimensions [(umm-v/map->DimensionType {:Name "Solution_3_Land_4"
                                                                 :Size 3
-                                                                :Type "OTHER"})]
-                        :AcquisitionSourceName "Instrument1"}
+                                                                :Type "OTHER"})]}
                        {:native-id "var4"
                         :coll-concept-id (:concept-id coll2-PROV1-1)
                         :coll-revision-id 3})
             concept2 (variable-util/make-variable-concept
                        {:Dimensions [(umm-v/map->DimensionType {:Name "Solution_3_Land_4"
                                                                 :Size 3
-                                                                :Type "OTHER"})]
-                        :AcquisitionSourceName "Instrument1"}
+                                                                :Type "OTHER"})]}
                        {:native-id "var4"
                         :coll-concept-id (:concept-id coll2-PROV1-1)})
             _ (ingest/delete-concept
@@ -187,8 +178,8 @@
          (is (= expected-errors2 errors2))))

     (testing "ingest of a variable concept with a revision id"
-      (let [concept (variable-util/make-variable-concept
-                      {}
+      (let [concept (variable-util/make-variable-concept
+                      {}
                       {:native-id "var1"
                        :revision-id 5
                        :coll-concept-id (:concept-id coll1-PROV1-1)})


add inline fragment

add inline fragment


lein-release plugin: bumped version from 0.3.4 to 0.3.5-SNAPSHOT for next development cycle

--- backend/project.clj
+++ backend/project.clj
@@ -1,4 +1,4 @@
-(defproject lambdaui "0.3.4"
+(defproject lambdaui "0.3.5-SNAPSHOT"
   :description "LambdaCD-Plugin that provides a modern UI for your pipeline."
   :url "https://github.com/sroidl/lambda-ui"
   :license {:name "Apache License 2.0"


Trying to get data to db

Trying to get data to db

--- src-cljs/tea_time/core.cljs
+++ src-cljs/tea_time/core.cljs
@@ -60,11 +60,23 @@
        [:div {:dangerouslySetInnerHTML
               {:__html (md->html docs)}}]]])])

+(defn post-to-teas-db
+  "Sends an Ajax Request to the API route to post the tea from the form to the database"
+  [tea-name & other-params]
+  (println "post-to-teas-db hit, param: " (:params tea-name))
+  POST "/api/v1/newTea" {:params {:new-tea tea-name}})
+
 (defn special-page []
+  (let [tea-value (atom "New Tea")]
   [:div.container
    [:div.row
     [:div.col-md-12
-     "Special page is special proof of concept"]]])
+     "Special page is special proof of concept"]]
+   [:div.row
+    [:div.col-md-12
+     [:input.form-control {:field :text :id :tea}
+     [:input {:type "button" :value "Add Tea" :on-click post-to-teas-db}]]]]]) )
+

 (def pages
   {:home #'home-page


Began boilerplate on using re-frame for deleting teas.

--- src-cljs/tea_time/core.cljs
+++ src-cljs/tea_time/core.cljs
@@ -94,6 +94,20 @@
     app-db))

 (re-frame/register-handler
+  :delete-tea
+  (fn [app-db [_ id]]
+    (ajax/GET (str "/api/teas/" id "/delete")
+              :error-handler (fn [response] (println "DELETE-TEA ERROR" response))
+              :handler (fn [response] (println name " deleted") (re-frame/dispatch [:load-teas])(reset! edit-tea-snap nil)))))
+
+
+(re-frame/register-handler
+  :process-delete
+  (fn [app-db [_ response]]
+    (re-frame/dispatch [:load-teas])
+    app-db))
+
+(re-frame/register-handler
   :initialize-db
   (fn [_ _]
     {:teas-list []


Some lines of code are refactored.

Some lines of code are refactored.


Fixed specification of dictionary for word blacklist

--- src/zg/server.clj
+++ src/zg/server.clj
@@ -191,7 +191,7 @@
     "Function that prepares data for the blacklist front page."
     [request title emender-page]
     ; perform the operation selected by user on the web UI (delete, undelete etc.)
-    (perform-operation request :whitelist)
+    (perform-operation request :blacklist)
     (let [params         (:params request)
           word           (get params "word")
           search-results (if (not (empty? word))


zinc.core: windows compatible path handling

--- src/zinc/core.clj
+++ src/zinc/core.clj
@@ -19,16 +19,14 @@
 (defn java-home
   "JVM java.home. Returns one level above if the path ends with 'jre'."
   []
-  (let [home (System/getProperty "java.home")]
-    (if (.endsWith home "/jre") (string/replace home "/jre" "") home)))
+  (let [home (System/getProperty "java.home")
+        path (io/file home)]
+    (if (= (.getName path) "jre") (.getParent path) home)))

 (defn to-file
-  "Converts path to java.io.File. Prepend 'user.dir' if the path is relative."
+  "Converts absolute or relative path to canonical java.io.File."
   [^String path]
-  (if path
-     (if (.startsWith path "/")
-      (io/file path)
-      (io/file (str (user-dir) "/" path)))))
+  (if path (.getCanonicalFile (io/file path))))

 (defn is-dir? "Checks if the given file is a directory or not." [^File file]
   (.isDirectory file))


remove @Valid

remove @Valid

--- dropwizard-clojure-example/src/main/clojure/com/example/helloworld/resources/todo.clj
+++ dropwizard-clojure-example/src/main/clojure/com/example/helloworld/resources/todo.clj
@@ -2,8 +2,7 @@
   (:require [clojure.tools.logging :as log])
   (:import [com.example.helloworld.representations Todo]
            [com.codahale.metrics.annotation Timed]
-           [javax.ws.rs GET POST DELETE Path Consumes Produces PathParam]
-           [javax.validation Valid]))
+           [javax.ws.rs GET POST DELETE Path Consumes Produces PathParam]))

 (definterface ITodo
   (get [])
@@ -25,7 +24,7 @@
      {})

     (^{Path "{id}" POST true Timed true}
-     add [this ^{PathParam "id"} id ^{Valid true} todo]
+     add [this ^{PathParam "id"} id todo]
      (swap! state assoc id todo))

     (^{Path "{id}" GET true Timed true}


Get rid of unused statements in tests

Get rid of unused statements in tests


bump specter and midje

bump specter and midje

--- cljx/plongeur-clj/project.clj
+++ cljx/plongeur-clj/project.clj
@@ -13,10 +13,10 @@
   :test-paths   ["test"]

   :dependencies [[org.clojure/clojure "1.9.0-alpha5"]
-                 [org.clojure/core.async "0.2.374"]
+                 [org.clojure/core.async "0.2.385"]
                  [org.clojure/core.match "0.3.0-alpha4"]
                  [com.netflix.rxjava/rxjava-clojure "0.20.7"]
-                 [com.rpl/specter "0.10.0"]
+                 [com.rpl/specter "0.11.2"]

                  [ring "1.4.0"]
                  [ring/ring-defaults "0.2.0" :exclusions [[javax.servlet/*]]]
@@ -47,7 +47,7 @@
                        :dependencies [[org.clojure/tools.namespace "0.2.11"]
                                       [org.clojure/java.classpath "0.2.3"]
                                       [org.clojure/tools.nrepl "0.2.11"]
-                                      [midje "1.8.3"]
+                                      [midje "1.9.0-alpha2"]
                                       [aprint "0.1.3"]
                                       [org.clojure/tools.trace "0.7.9"]]
                        :plugins [[lein-midje "3.2"]


Cleaned up trace log

Cleaned up trace log

--- src/video_server/watcher.clj
+++ src/video_server/watcher.clj
@@ -174,7 +174,7 @@
 (defn file-event
   "Processes the file system events related to files."
   [folder event file]
-  (log/trace "file event" event file)
+  (log/trace "file event" event (str file))
   (when ((some-fn video? subtitle? image? metadata?) file)
     (try (case event
            :create (if (stable? file)
@@ -188,7 +188,7 @@
 (defn dir-event
   "Processes the file system events related to directories."
   [folder event dir]
-  (log/trace "dir event" event dir)
+  (log/trace "dir event" event (str dir))
   (try
     (case event
       :create (scan-dir folder dir)


Small tweak to slugify unit tests.

Small tweak to slugify unit tests.

--- test/fcms/unit/resources/slugify.clj
+++ test/fcms/unit/resources/slugify.clj
@@ -75,10 +75,10 @@
   ; accented latin
   ; unicode
   ; truncate for length
-  (let [all-in-one " -tHiS #$is%?-----ελληνικήalso-მივჰხვდემასჩემსაãالزجاجوهذالايؤلمني-slüg♜-♛-☃-✄-✈  - "
-        long-slug (apply str (range 0 200))]
+  (let [all-in-one " -tHiS #$is%?-----ελληνικήalso-მივჰხვდ-ემასჩემსაãالزجاجوه---ذالايؤلمني-slüg♜-♛--☃-✄-✈  - "
+        long-string (apply str (range 0 200))]
     (slugify all-in-one) => "this-is-also-a-slug"
-    (slugify (str all-in-one long-slug)) => (str "this-is-also-a-slug-" (apply str (take 236 long-slug)))))
+    (slugify (str all-in-one long-string)) => (str "this-is-also-a-slug-" (apply str (take 236 long-string)))))

 (fact "perfectly good slugs are unaffected"
   (slugify "slug") => "slug"


reads routed to API

reads routed to API

--- src/NoteHub/views/pages.clj
+++ src/NoteHub/views/pages.clj
@@ -1,6 +1,7 @@
 (ns NoteHub.views.pages
   (:require [hiccup.util :as util]
             [NoteHub.api :as api]
+            [NoteHub.storage :as storage]
             [cheshire.core :refer :all])
   (:use
     [NoteHub.storage] ; TODO: delete this
@@ -94,12 +95,19 @@
            (slurp "LANDING.md")]
           [:div.centered.helvetica.markdown (get-message :footer)]))

+; Displays the note
+(defpage "/:year/:month/:day/:title" {:keys [year month day title theme header-font text-font] :as params}
+  (wrap
+    (create-short-url params)
+    (select-keys params [:title :theme :header-font :text-font])
+    (:note (api/get-note (api/build-key [year month day] title)))))
+
 ; Update Note Page
 (defpage "/:year/:month/:day/:title/edit" {:keys [year month day title]}
   (let [noteID (api/build-key [year month day] title)]
     (input-form "/update-note" :update
                 (html (hidden-field :key noteID))
-                (get-note noteID) :enter-passwd)))
+                (:note (api/get-note noteID)) :enter-passwd)))

 ; New Note Page
 (defpage "/new" {}
@@ -108,29 +116,26 @@
                     (hidden-field {:id :session-value} :session-value))
               (get-message :loading) :set-passwd))

-; Displays the note
-(defpage "/:year/:month/:day/:title" {:keys [year month day title theme header-font text-font] :as params}
-  (wrap
-    (create-short-url params)
-    (select-keys params [:title :theme :header-font :text-font])
-    (get-note (api/build-key [year month day] title))))
-
 ; Provides Markdown of the specified note
 (defpage "/:year/:month/:day/:title/export" {:keys [year month day title]}
-  (when-let [md-text (get-note (api/build-key [year month day] title))]
+  (when-let [md-text (:note (api/get-note (api/build-key [year month day] title)))]
     (content-type "text/plain; charset=utf-8" md-text)))

 ; Provides the number of views of the specified note
 (defpage "/:year/:month/:day/:title/stats" {:keys [year month day title]}
-  (when-let [views (get-note-views (api/build-key [year month day] title))]
+  (when-let [stats (:statistics (api/get-note (api/build-key [year month day] title)))]
     (layout (get-message :statistics)
             [:table#stats.helvetica.central-element
              [:tr
               [:td (get-message :published)]
-              [:td (interpose "-" [year month day])]]
+              [:td (:published stats)]]
+             (when (:edited stats)
+               [:tr
+                [:td (get-message :edited)]
+                [:td (:edited stats)]])
              [:tr
               [:td (get-message :article-views)]
-              [:td views]]])))
+              [:td (:views stats)]]])))

 ; Updates a note
 (defpage [:post "/update-note"] {:keys [key draft password]}


Remove millisec count from timeout error (confusing).

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

--- acqEngine/src/org/micromanager/acq_engine.clj
+++ acqEngine/src/org/micromanager/acq_engine.clj
@@ -375,8 +375,7 @@
       (if-let [image (pop-tagged-image)]
         image
         (if (< timeout-ms (- (System/currentTimeMillis) start-time))
-          (throw-exception (str (- (System/currentTimeMillis) start-time)
-                                " Timed out waiting for image\nto arrive from camera."))
+          (throw-exception "Timed out waiting for image to arrive from camera.")
           (do
             (when (. mmc isBufferOverflowed)
                 (println "Circular buffer overflowed")


Try using map/pmap for retrieving images instead

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

--- acqEngine/src/org/micromanager/acq_engine.clj
+++ acqEngine/src/org/micromanager/acq_engine.clj
@@ -426,12 +426,15 @@
   [burst-events camera-channel-names timeout-ms out-queue]
   (let [total (* (count burst-events)
                  (count camera-channel-names))
-        camera-index-tag (str (. mmc getCameraDevice) "-CameraChannelIndex")]
-    (doseq [i (range total) :while (keep-collecting-from-circular-buffer?)]
+        camera-index-tag (str (. mmc getCameraDevice) "-CameraChannelIndex")
+        images (map (fn [_] (pop-burst-image timeout-ms)) (range total))]
+    (time
+    (doseq [image images]
       (.put out-queue
-            (-> (pop-burst-image timeout-ms)
+            (-> image
+                ;(time)
                 (tag-burst-image burst-events camera-channel-names camera-index-tag)
-                make-TaggedImage))))
+                make-TaggedImage)))))
   (burst-cleanup))

 (defn collect-burst-images [event out-queue]