Refactor schema ns :as in async-zmq

Refactor schema ns :as in async-zmq

To s2, as a first step toward switching it to spec

--- src/com/frereth/common/async_zmq.clj
+++ src/com/frereth/common/async_zmq.clj
@@ -11,9 +11,10 @@
             [com.frereth.common.util :as util]
             [com.frereth.common.zmq-socket :as zmq-socket]
             [com.stuartsierra.component :as component]
+            [component-dsl.system :as cpt-dsl]
             [full.async :refer (<? <?? alts? go-try)]
             [hara.event :refer (raise)]
-            [schema.core :as s]
+            [schema.core :as s2]
             [taoensso.timbre :as log])
   (:import [com.frereth.common.async_component AsyncChannelComponent]
            [com.frereth.common.zmq_socket SocketDescription]
@@ -22,7 +23,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Schema

-(s/defrecord EventPairInterface
+(s2/defrecord EventPairInterface
     [;; send messages to this' async-chan to get them to 0mq.
      in-chan  :- AsyncChannelComponent
      ;; faces outside world.
@@ -37,10 +38,10 @@
      ;; reconnecting dropped sessions, etc.
      ;; Luckily (?) these are the server writer's problems.
      ;; TODO: Refactor-rename these to just reader/writer
-     external-reader :- (s/=> fr-sch/java-byte-array mq-cmn/Socket)
+     external-reader :- (s2/=> fr-sch/java-byte-array mq-cmn/Socket)
      ;; I *think* this returns bool, but, honestly,
      ;; it should return nil
-     external-writer :- (s/=> s/Any mq-cmn/Socket fr-sch/java-byte-array)
+     external-writer :- (s2/=> s2/Any mq-cmn/Socket fr-sch/java-byte-array)
      ;; For requesting status messages
      ;; Put the channel where you want the response
      status-chan :- AsyncChannelComponent]
@@ -85,8 +86,8 @@
 (declare run-async-loop! run-zmq-loop!
          do-signal-async-loop-exit
          do-wait-for-async-loop-to-exit)
-(s/defrecord EventPair
-  [_name :- s/Str  ; Because trying to figure out which is what is driving me crazy
+(s2/defrecord EventPair
+  [_name :- s2/Str  ; Because trying to figure out which is what is driving me crazy

    interface :- EventPairInterface

@@ -99,7 +100,7 @@
    ;; feed this into loops to stop them. Very important when everything hangs
    ;; Unless you just enjoy sitting around waiting for the JVM to
    ;; restart, of course
-   stopper :- s/Symbol
+   stopper :- s2/Symbol
    ;; Signals the 0mq portion of the loop that messages are ready to send
    ;; to the outside world
    in<->ex-sock :- mq/InternalPair
@@ -201,10 +202,10 @@
 (def event-loopless-pair
   "This is the almost-constructed EventPair that gets passed in to the messaging loops"
   (dissoc (map->EventPair {:interface EventPairInterface
-                           :stopper s/Symbol
+                           :stopper s2/Symbol
                            :async-sock mq-cmn/Socket
                            :->zmq-sock mq-cmn/Socket
-                           :_name s/Str
+                           :_name s2/Str
                            :ex-chan AsyncChannelComponent
                            :in<->ex-sock mq/InternalPair}) :async-loop :zmq-loop))

@@ -323,7 +324,7 @@
    (and val (not= val stopper))  ; got a message that wasn't stopper
    (and (not= c in-chan) (not= c status-chan))))

-(s/defn ^:always-validate run-async-loop! :- fr-sch/async-channel
+(s2/defn ^:always-validate run-async-loop! :- fr-sch/async-channel
   "TODO: Convert this to a pipeline"
   [{:keys [async->sock in<->ex-chan interface _name stopper] :as component}]
   (let [{:keys [in-chan status-chan]} interface
@@ -357,7 +358,7 @@
       (log/debug _name "Async Loop exited because we either received the stop signal or the internal channel closed")
       :exited-successfully)))

-(s/defn possibly-recv-internal!
+(s2/defn possibly-recv-internal!
   "Really just refactored to make data flow less opaque"
   [{:keys [_name ->zmq-sock interface stopper in<->ex-chan]
     :as component} :- EventPair
@@ -417,7 +418,7 @@
                 (recur (async/alts!! [(async/timeout 100) in<->ex-chan]))))))
         @exited))))

-(s/defn possibly-forward-msg-from-outside!
+(s2/defn possibly-forward-msg-from-outside!
   [{:keys [interface ex-chan _name]
     :as component} :- EventPair
    poller :- mq-cmn/Poller]
@@ -496,7 +497,7 @@
         (log/error ex "Unhandled 0mq Exception. 0mq loop exiting")
         :unhandled-0mq-exception))))

-(s/defn
+(s2/defn
   ^:always-validate
   run-zmq-loop!
   :- fr-sch/async-channel
@@ -552,7 +553,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Public

-(s/defn status-check
+(s2/defn status-check
   "Really just a synchronous wrapper over the basic idea"
   [event-pair :- EventPair]
   (let [interface (:interface event-pair)
@@ -561,11 +562,11 @@
     (async/>!! status-chan status-out)
     (async/<!! status-out)))

-(s/defn ctor-interface :- EventPairInterface
+(s2/defn ctor-interface :- EventPairInterface
   [cfg]
   (map->EventPairInterface (select-keys cfg [:ex-sock :in-chan :external-reader :external-writer])))

-(s/defn ctor :- EventPair
+(s2/defn ctor :- EventPair
   [cfg]
   (map->EventPair (select-keys cfg [:_name])))


io helper function has been added to the component ns

--- core/src/clj/hellhound/component.clj
+++ core/src/clj/hellhound/component.clj
@@ -182,6 +182,13 @@
             "::output should not be empty. Please file a bug")
     (::output new-component)))

+;; Public Functions ----------------------------------------
+(defn io
+  "Returns a vector containing the IO streams of the given `component`.
+
+  The return vector is in the following format: [input-stream, output-stream]."
+  [component]
+  [(input component) (output component)])

 ;; IComponent Implementations ------------------------------
 (extend-protocol IComponent
@@ -230,12 +237,7 @@
 ;;              :fn #(map? (:ret %)))
 ;;     #(s/gen #{(fn [component] component)})))
 (s/def ::start-fn fn?)
-
-
-
 (s/def ::stop-fn fn?)
-
-

 (s/def ::stream
   (s/with-gen stream/stream?


Visualize updated selection when starting to drag.

--- src-cljs/pepa/workflows/inbox2.cljs
+++ src-cljs/pepa/workflows/inbox2.cljs
@@ -105,6 +105,8 @@
         ;; this approach makes sure the pages arrive in the correct order
         page-ids (filterv (:selected selection)
                           (map :id (column-pages column state)))]
+    ;; Update `:selection' in `owner'
+    (om/set-state! owner :selection selection)
     (doto e.dataTransfer
       (.setData "application/x-pepa-pages" (pr-str page-ids))
       (.setData "text/plain" (pr-str page-ids)))))


Better assertions in the test code's encode and decode fns

--- test/ctia/test_helpers/core.clj
+++ test/ctia/test_helpers/core.clj
@@ -281,11 +281,21 @@
                   time/format-date-time)))

 (defn encode [s]
-  {:pre [(string? s) (seq s)]}
+  (assert (string? s)
+          (format "Assert Failed: %s of type %s must be a string"
+                  s (type s)))
+  (assert (seq s)
+          (format "Assert Failed: %s of type %s must be a seq"
+                  s (type s)))
   (url/encode s))

 (defn decode [s]
-  {:pre [(string? s) (seq s)]}
+  (assert (string? s)
+          (format "Assert Failed: %s of type %s must be a string"
+                  s (type s)))
+  (assert (seq s)
+          (format "Assert Failed: %s of type %s must be a seq"
+                  s (type s)))
   (url/decode s))

 (defmacro deftest-for-each-fixture [test-name fixture-map & body]


debugger: Persist -> Replay

debugger: Persist -> Replay

--- examples/_common/middleware/devtools.cljs
+++ examples/_common/middleware/devtools.cljs
@@ -35,7 +35,7 @@
                                              :result    {schema/Any schema/Any}}]
                :next-action-id             schema/Int

-               :persist?                   schema/Bool
+               :replay-mode?               schema/Bool

                :visible?                   schema/Bool
                :toggle-visibility-shortcut schema/Str}
@@ -54,7 +54,7 @@
                             :action-events              nil
                             :next-action-id             0

-                            :persist?                   false
+                            :replay-mode?               false

                             :visible?                   true
                             :toggle-visibility-shortcut toggle-visibility-shortcut}))
@@ -156,8 +156,8 @@
                [::on-log-action-result id]
                (-> (-find-action @model id) :result pr-str println)

-               ::on-toggle-persist
-               (dispatch-action ::toggle-persist)
+               ::on-toggle-replay-mode
+               (dispatch-action ::toggle-replay-mode)

                ::on-vacuum
                (dispatch-action ::vacuum)
@@ -235,8 +235,8 @@
                             (-update-action-event m id assoc :result (dissoc m ::debugger))))
                new-model))

-           ::toggle-persist
-           (update-in model [::debugger :persist?] not)
+           ::toggle-replay-mode
+           (update-in model [::debugger :replay-mode?] not)

            ::vacuum
            (as-> model m
@@ -311,7 +311,7 @@
         highlighted-signal-ids (reaction (into #{@highlighted-signal-id}
                                                (-signal-parent-ids @signal-events @highlighted-signal-id)))]
     (-> (mvsa/track-keys debugger
-                         [:initial-model :persist? :visible? :toggle-visibility-shortcut :action-events])
+                         [:initial-model :replay-mode? :visible? :toggle-visibility-shortcut :action-events])
         (assoc :signal-events (reaction
                                 ; mapv instead of map is essential, without it referenced reactions will be recalculated several times
                                 (mapv #(assoc % :highlighted? (contains? @highlighted-signal-ids (:id %))
@@ -356,14 +356,14 @@
             :value     ""}]])

 (defn -menu
-  [persist? toggle-visibility-shortcut dispatch]
+  [replay-mode? toggle-visibility-shortcut dispatch]
   [:div {:style {:text-align "center"}}
    [-menu-button {} "Clear" #(dispatch ::on-clear) "Clears debugger history"]
    [-menu-button {} "Vacuum" #(dispatch ::on-vacuum) "Removes disabled actions and signals with no actions from history"]
    [-menu-button {} "Reset" #(dispatch ::on-reset) "Removes all actions and signals resetting the model to initial state"]
    [-menu-button {} "Save" #(dispatch ::on-save) "Saves current debugger session into file"]
    [-menu-file-selector "Load" #(dispatch [::on-load %]) "Loads debugger session from file"]
-   [-menu-button (if persist? {} {:color "grey"}) "Persist✓" #(dispatch ::on-toggle-persist) "Persist debug session into local storage?"]
+   [-menu-button (if replay-mode? {} {:color "grey"}) "Replay✓" #(dispatch ::on-toggle-replay-mode) "Replay current session on next app start?"]
    [-menu-button {} "Hide" #(dispatch ::on-toggle-visibility) (str "Hides debugger view (" toggle-visibility-shortcut ")")]])

 (defn -actions-view
@@ -467,7 +467,7 @@
         body))

 (defn -view
-  [{:keys [visible? toggle-visibility-shortcut persist? initial-model signal-events action-events]}
+  [{:keys [visible? toggle-visibility-shortcut replay-mode? initial-model signal-events action-events]}
    dispatch]
   [-overlay
    [-resizable-div {:style {:display          (if @visible? "block" "none") ; using CSS instead of React in order to persist resized frame on toggling visibility
@@ -482,7 +482,7 @@
                             :font-family      "sans-serif"
                             :line-height      "1.4em"
                             :font-weight      "300"}}
-    [-menu @persist? @toggle-visibility-shortcut dispatch]
+    [-menu @replay-mode? @toggle-visibility-shortcut dispatch]

     [-autoscrollable-div
      {:style {:position "absolute"
@@ -502,7 +502,7 @@
   (fn wrapped-load-from-storage
     [model loaded-model dispatch-signal]
     ; load only if user set the flag during previous session
-    (when (-> loaded-model ::debugger :persist?)
+    (when (-> loaded-model ::debugger :replay-mode?)
       ; update :initial-model; otherwise, on hot reload, we will not see changes after modifying app init code
       (let [loaded-model (update loaded-model ::debugger merge (-> @model ::debugger (select-keys [:initial-model])))]
         (load-from-storage model loaded-model dispatch-signal)
@@ -510,6 +510,7 @@

 (defn add-debugger
   "Adds debugging capabilities to the app.
+
    All signals and actions will be recorded and stored in the model.
    After app is created use |connect-debugger-ui| for rendering the debugger.
    For correct work it must be the last middleware wrapping the app and


Un-yoda tests

Un-yoda tests

--- test/hiccup_find/core_test.cljc
+++ test/hiccup_find/core_test.cljc
@@ -27,9 +27,7 @@
   (is (hf/hiccup-symbol-matches? :p.more.class :p.class.more)))

 (deftest test-hiccup-find
-  (is (= (list [:p.image "Yes 1"]
-               [:p.image "Yes 2"])
-         (hf/hiccup-find
+  (is (= (hf/hiccup-find
           [:p.image]
           [:html
            [:body
@@ -37,11 +35,11 @@
             [:p.image "Yes 1"]
             [:p.images "No"]
             [:div.image
-             [:p.image "Yes 2"]]]])))
+             [:p.image "Yes 2"]]]])
+         (list [:p.image "Yes 1"]
+               [:p.image "Yes 2"])))

-  (is (= (list [:p {:class "image"} "Yes 1"]
-               [:p {:class "image"} "Yes 2"])
-         (hf/hiccup-find
+  (is (= (hf/hiccup-find
           [:p.image]
           [:html
            [:body
@@ -49,11 +47,11 @@
             [:p {:class "image"} "Yes 1"]
             [:p.images "No"]
             [:div.image
-             [:p {:class "image"} "Yes 2"]]]])))
+             [:p {:class "image"} "Yes 2"]]]])
+         (list [:p {:class "image"} "Yes 1"]
+               [:p {:class "image"} "Yes 2"])))

-  (is (= (list [:p "Yes 1"]
-               [:p "Yes 2"])
-         (hf/hiccup-find
+  (is (= (hf/hiccup-find
           [:div :p]
           [:html
            [:body
@@ -63,12 +61,11 @@
              [:table
               [:tr
                [:td
-                [:p "Yes 2"]]]]]]])))
+                [:p "Yes 2"]]]]]]])
+         (list [:p "Yes 1"]
+               [:p "Yes 2"])))

-  (is (= (list [:p "Yes 1"]
-               [:p "Yes 2"]
-               [:p "Yes 3"])
-         (hf/hiccup-find
+  (is (= (hf/hiccup-find
           [:div :p]
           [:html
            [:body
@@ -84,12 +81,12 @@
                 [:p "Yes 2"]]]
               [:tr
                [:td
-                [:p "Yes 3"]]]]]]])))
+                [:p "Yes 3"]]]]]]])
+         (list [:p "Yes 1"]
+               [:p "Yes 2"]
+               [:p "Yes 3"])))

-  (is (= (list [:p "Yes 1"]
-               [:p "Yes 2"]
-               [:p "Yes 3"])
-         (hf/hiccup-find
+  (is (= (hf/hiccup-find
           [:div :p]
           [:html
            [:body
@@ -105,46 +102,49 @@
                 [:p "Yes 2"]]]
               [:tr
                [:td
-                [:p "Yes 3"]]]]]]]))))
+                [:p "Yes 3"]]]]]]])
+         (list [:p "Yes 1"]
+               [:p "Yes 2"]
+               [:p "Yes 3"]))))

 (deftest test-hiccup-text
-  (is (= "Text here"
-         (hf/hiccup-text [:p "Text here"])))
+  (is (= (hf/hiccup-text [:p "Text here"])
+         "Text here"))

-  (is (= "Text here"
-         (hf/hiccup-text [:p [:span "Text here"]])))
+  (is (= (hf/hiccup-text [:p [:span "Text here"]])
+         "Text here"))

-  (is (= "Text here"
-         (hf/hiccup-text [:p {:class "something"} "Text here"])))
+  (is (= (hf/hiccup-text [:p {:class "something"} "Text here"])
+         "Text here"))

-  (is (= "Text here"
-         (hf/hiccup-text [:p {:class "something"} "Text " [:strong "here"]])))
+  (is (= (hf/hiccup-text [:p {:class "something"} "Text " [:strong "here"]])
+         "Text here"))

-  (is (= (str "Welcome, earthling\n"
-              "Hope you enjoy your stay")
-         (hf/hiccup-text
+  (is (= (hf/hiccup-text
           [:html
            [:body
             [:h1 "Welcome, earthling"]
-            [:p "Hope you " [:strong "enjoy"] " your stay"]]])))
+            [:p "Hope you " [:strong "enjoy"] " your stay"]]])
+         (str "Welcome, earthling\n"
+              "Hope you enjoy your stay")))

-  (is (= "Number 42"
-         (hf/hiccup-text
+  (is (= (hf/hiccup-text
           [:html
            [:body
-            [:p "Number " [:strong 42]]]]))))
+            [:p "Number " [:strong 42]]]])
+         "Number 42")))

 (deftest test-hiccup-string
-  (is (= "Welcome, earthling Hope you enjoy your stay"
-         (hf/hiccup-string
+  (is (= (hf/hiccup-string
           [:html
            [:body
             [:h1 "Welcome, earthling"]
-            [:p "Hope you " [:strong "enjoy"] " your stay"]]])))
+            [:p "Hope you " [:strong "enjoy"] " your stay"]]])
+         "Welcome, earthling Hope you enjoy your stay"))

-  (is (= "Welcome! Hope you enjoy your stay"
-         (hf/hiccup-string
+  (is (= (hf/hiccup-string
           [:html
            [:body
             [:h1 "Welcome!"]
-            [:p "Hope you   " [:strong "enjoy"] " your stay"]]]))))
+            [:p "Hope you   " [:strong "enjoy"] " your stay"]]])
+         "Welcome! Hope you enjoy your stay")))


Rename function parameter

Rename function parameter

--- src/reabledit/components.cljs
+++ src/reabledit/components.cljs
@@ -46,25 +46,26 @@
 ;;

 (defn default-editor
-  [_ edited-row-data k change-fn _]
+  [_ edited-row-data k change-edited! _]
   [:input.reabledit-cell-editor-input
    {:type "text"
     :auto-focus true
     :on-focus util/move-cursor-to-end!
     :value (get edited-row-data k)
-    :on-change #(change-fn (assoc edited-row-data
+    :on-change #(change-edited! (assoc edited-row-data
                                   k
                                   (-> % .-target .-value)))}])

 (defn int-editor
-  [initial-row-data edited-row-data k change-fn _]
+  [initial-row-data edited-row-data k change-edited! _]
   (let [initial-value (get initial-row-data k)
         input-candidate (str (get edited-row-data k))
+        parsed (util/parse-int input-candidate initial-value)
         input (reagent/atom input-candidate)]
-    (change-fn (assoc edited-row-data
-                      k
-                      (util/parse-int input-candidate initial-value)))
-    (fn [initial-row-data edited-row-data k change-fn _]
+    (change-edited! (assoc edited-row-data
+                           k
+                           parsed))
+    (fn [initial-row-data edited-row-data k change-edited! _]
       [:input.reabledit-cell-editor-input
        {:type "text"
         :class (if-not (util/int-coercable? @input)
@@ -73,15 +74,15 @@
         :on-focus util/move-cursor-to-end!
         :value @input
         :on-change (fn [e]
-                     (let [new-input (-> e .-target .-value)]
+                     (let [new-input (-> e .-target .-value)
+                           parsed (util/parse-int new-input initial-value)]
                        (reset! input new-input)
-                       (change-fn (assoc edited-row-data
-                                         k
-                                         (util/parse-int new-input
-                                                         initial-value)))))}])))
+                       (change-edited! (assoc edited-row-data
+                                              k
+                                              parsed))))}])))

 (defn- dropdown-editor-key-down
-  [e v change-fn options]
+  [e v change-edited! options]
   (let [keycode (.-keyCode e)
         position (first (keep-indexed #(if (= %2 v) %1)
                                       (map :key options)))]
@@ -89,26 +90,26 @@
       38 (do
            (.preventDefault e)
            (if (zero? position)
-             (change-fn (-> options last :key))
-             (change-fn (:key (nth options (dec position))))))
+             (change-edited! (-> options last :key))
+             (change-edited! (:key (nth options (dec position))))))
       40 (do
            (.preventDefault e)
            (if (= position (-> options count dec))
-             (change-fn (-> options first :key))
-             (change-fn (:key (nth options (inc position))))))
+             (change-edited! (-> options first :key))
+             (change-edited! (:key (nth options (inc position))))))
       nil)))

 (defn dropdown-editor
-  [_ edited-row-data k change-fn disable-edit! {:keys [options]}]
+  [_ edited-row-data k change-edited! disable-edit! {:keys [options]}]
   (reagent/create-class
    {:component-did-mount #(.focus (reagent/dom-node %))
     :reagent-render
-    (fn [_ edited-row-data k change-fn disable-edit! {:keys [options]}]
+    (fn [_ edited-row-data k change-edited! disable-edit! {:keys [options]}]
       (let [v (get edited-row-data k)
-            change-fn #(change-fn (assoc edited-row-data k %))]
+            change-edited! #(change-edited! (assoc edited-row-data k %))]
         [:div.reabledit-cell-editor-dropdown
          {:tabIndex 0
-          :on-key-down #(dropdown-editor-key-down % v change-fn options)}
+          :on-key-down #(dropdown-editor-key-down % v change-edited! options)}
          [:span.reabledit-cell__content
           (-> (filter #(= (:key %) v) options)
               first
@@ -121,7 +122,7 @@
                        "reabledit-cell-editor-dropdown-list__item--selected")
               :on-click (fn [e]
                           (.stopPropagation e)
-                          (change-fn key)
+                          (change-edited! key)
                           (disable-edit!))}
              [:span.reabledit-cell__content value]])]]))}))


Correct version results.

Correct version results.

--- src/rill/event_store/psql.clj
+++ src/rill/event_store/psql.clj
@@ -15,10 +15,10 @@
                        (throw (ex-info (str "Not a valid cursor: " cursor) {:cursor cursor}))))]
       (or (seq (map (fn [r]
                       (with-meta (assoc (nippy/thaw (:payload r))
-                                   ::message/number (or (:insert_order r)
-                                                        (:stream_order r)))
-                        {:cursor (or (:insert_order r)
-                                     (:stream_order r))}))
+                                   ::message/number (or (:stream_order r)
+                                                        (:insert_order r)))
+                        {:cursor (or (:stream_order r)
+                                     (:insert_order r))}))
                     (if (= stream-id all-events-stream-id)
                       (sql/query spec ["SELECT payload, insert_order FROM rill_events WHERE insert_order > ? ORDER BY insert_order ASC"
                                        cursor])


add swallow-errors

add swallow-errors

--- frontend/analytics/facebook.cljs
+++ frontend/analytics/facebook.cljs
@@ -6,8 +6,9 @@
   (.push js/window._fbq #js ["track" "6017231164176" {:value "0.01" :currency "USD"}]))

 (defn track-signup []
-  (if (aget js/window "_fbq")
-    (track-conversion)
-    (-> (goog.net.jsloader.load "//connect.facebook.net/en_US/fbds.js")
-        (.addCallback track-conversion)))
+  (utils/swallow-errors
+    (if (aget js/window "_fbq")
+      (track-conversion)
+      (-> (goog.net.jsloader.load "//connect.facebook.net/en_US/fbds.js")
+          (.addCallback track-conversion))))


Move logging configuration in stress test.

--- test/replikativ/stress_test.clj
+++ test/replikativ/stress_test.clj
@@ -14,12 +14,9 @@
             [replikativ.p2p
              [fetch :refer [fetch]]
              [hash :refer [ensure-hash]]
-             [hooks :refer [hook]]]))
+             [hooks :refer [hook]]]
+            [taoensso.timbre :as timbre]))

-
-(require '[taoensso.timbre :as timbre])
-(def prev-level (timbre/*config* :level))
-(timbre/set-level! :warn)

 (defn setup []
   ;; hooking map
@@ -162,14 +159,16 @@

 (defn each-fixture [f]
   (try
+    (def prev-level (timbre/*config* :level))
+    (timbre/set-level! :warn)
     (setup)
     (f)
     (finally
-      (stop-all))))
+      (stop-all)
+      (timbre/set-level! prev-level))))

 (use-fixtures :each each-fixture)

-(timbre/set-level! prev-level)

 (comment
   (->> (get-in @log-a [:pre-fetch :in])


SSE transport test: fix timing dependency

This relied on a race condition *and* a bug in the creation of the index
wrapper; both bugs were fragile and masked the other. Now we create the
index wrapper with a pubsub registry, and use the blocking lamina
channel->lazy-seq variant for dequeues.

--- test/riemann/transport_test.clj
+++ test/riemann/transport_test.clj
@@ -20,8 +20,6 @@
             [riemann.index :as index])
   (:import (org.jboss.netty.buffer ChannelBuffers)
            (java.io IOException)))
-
-(riemann.logging/init)

 (deftest ws-put-events-test
          (riemann.logging/suppress
@@ -57,10 +55,11 @@
    ["riemann.transport" "riemann.core" "riemann.pubsub"]
    (let [s1       (tcp-server)
          s2       (sse-server)
-         index    (wrap-index (index/index))
+         core     (core)
+         index    (wrap-index (index/index) (:pubsub core))
          pubsub   (pubsub/pubsub-registry)
          core     (transition!
-                   (core)
+                   core
                    {:index    index
                     :pubsub   pubsub
                     :services [s1 s2]
@@ -70,15 +69,17 @@
                         second
                         (partial re-matches #"data: (.*)\n\n")
                         formats/bytes->string)
-         response (http-request
-                   {:method :get
-                    :url    "http://127.0.0.1:5558/index?query=true"})]
+         response @(http-request
+                     {:method :get
+                      :url    "http://127.0.0.1:5558/index?query=true"})]
      (try
        (client/send-event client {:service "service1"})
        (client/send-event client {:service "service2"})
-       (Thread/sleep 500)
-       (let [[r2 r1] (channel->seq (map* convert (take* 2 (:body @response))))]
-
+       (let [[r2 r1] (->> response
+                          :body
+                          (take* 2)
+                          (map* convert)
+                          channel->lazy-seq)]
          (is (#{"service1" "service2"} (get r1 "service")))
          (is (#{"service1" "service2"} (get r2 "service"))))
        (finally


Renamed cookie created by session.

Renamed cookie created by session.

--- src/ardoq/swagger/server.clj
+++ src/ardoq/swagger/server.clj
@@ -7,7 +7,7 @@

 (defn app [system]
   (-> (swagger-api system)
-      wrap-session
+      (wrap-session {:cookie-name "reffie"})
       wrap-params))

 (defn start-server [system]


Comment out repl test code. Where are unit tests tho?!

--- src/bejeweled_bot/solver.clj
+++ src/bejeweled_bot/solver.clj
@@ -5,7 +5,6 @@
   (first (drop-while #(= nil %) (solve gem-array))))

 (defn solve
-  "puikula"
   [gem-array]
   (map-indexed
     (fn [colIdx col]
@@ -41,15 +40,6 @@
       :else nil)))

-(def x 0)
-(def y 1)
-(def down-y (+ y 1))
-(def gem-type :opal)
-(def down-gem-type (get-in testArray [x (+ y 1)]))
-(def swapd (assoc-in (assoc-in testArray [x (+ y 1)] gem-type) [x y] down-gem-type))
-(def down-swap swapd)
-(def gem-array swapd)
-(would-match x down-y gem-type down-swap) {:x x :y y :dir "down" :debug 2 :gemtype gem-type}
 (defn would-match [y x gem-type gem-array]
   (and (not (= gem-type nil))
   (or
@@ -78,14 +68,26 @@
       (get-in gem-array [x (+ y 1)])
       gem-type))))

-(def testArray
-  [[:ruby        :opal     :ruby       :diamond    :topaz    :amethyst   :sapphire :sapphire]
-   [:ruby        :diamond  :amethyst   :diamond    :opal     :smaragdine :sapphire :smaragdine]
-   [:topaz       :diamond  :smaragdine :topaz      :opal     :diamond    :amethyst :ruby]
-   [:sapphire    :opal     :sapphire   :topaz      :sapphire :smaragdine :ruby     :ruby]
-   [:amethyst    :opal     :diamond    :smaragdine :amethyst :ruby       :opal     :opal]
-   [:topaz       :amethyst :amethyst   :smaragdine :amethyst :topaz      :sapphire :amethyst]
-   [:smaragdine  :topaz    :opal       :opal       :sapphire :ruby       :amethyst :sapphire]
-   [:amethyst    :sapphire :diamond    :amethyst   :diamond  :topaz      :opal     :opal]])

-(getFirst testArray)
+;; Repl test code
+;
+;(def x 0)
+;(def y 1)
+;(def down-y (+ y 1))
+;(def gem-type :opal)
+;(def down-gem-type (get-in testArray [x (+ y 1)]))
+;(def swapd (assoc-in (assoc-in testArray [x (+ y 1)] gem-type) [x y] down-gem-type))
+;(def down-swap swapd)
+;(def gem-array swapd)
+;(would-match x down-y gem-type down-swap) {:x x :y y :dir "down" :debug 2 :gemtype gem-type}
+;(def testArray
+;  [[:ruby        :opal     :ruby       :diamond    :topaz    :amethyst   :sapphire :sapphire]
+;   [:ruby        :diamond  :amethyst   :diamond    :opal     :smaragdine :sapphire :smaragdine]
+;   [:topaz       :diamond  :smaragdine :topaz      :opal     :diamond    :amethyst :ruby]
+;   [:sapphire    :opal     :sapphire   :topaz      :sapphire :smaragdine :ruby     :ruby]
+;   [:amethyst    :opal     :diamond    :smaragdine :amethyst :ruby       :opal     :opal]
+;   [:topaz       :amethyst :amethyst   :smaragdine :amethyst :topaz      :sapphire :amethyst]
+;   [:smaragdine  :topaz    :opal       :opal       :sapphire :ruby       :amethyst :sapphire]
+;   [:amethyst    :sapphire :diamond    :amethyst   :diamond  :topaz      :opal     :opal]])
+;
+;(getFirst testArray)


Add 'distinct' to functions.

Add 'distinct' to functions.

--- src/cavm/query/functions.clj
+++ src/cavm/query/functions.clj
@@ -53,4 +53,5 @@
    'group-by group-by
    'mean meannan
    'count count
-   'apply apply}) ; XXX is this a security hole? Can the user pass in clojure symbols?
+   'distinct distinct
+   'apply apply})


fix NAMESPACE select

fix NAMESPACE select

--- src/clj/com/rpl/specter.cljc
+++ src/clj/com/rpl/specter.cljc
@@ -987,7 +987,7 @@
   NAMESPACE
   []
   (select* [this structure next-fn]
-    (next-fn (name structure)))
+    (next-fn (namespace structure)))
   (transform* [this structure next-fn]
     (let [name (name structure)
           new-ns (next-fn (namespace structure))]


Add QC and duplicate flag filtering for mpileup.

--- src/cljam/pileup/mpileup.clj
+++ src/cljam/pileup/mpileup.clj
@@ -85,6 +85,8 @@
   (and (:flag a)
        (sam-util/primary? (:flag a)) ;; primary
        (zero? (bit-and 0x4 (:flag a))) ;; mapped
+       (zero? (bit-and 0x200 (:flag a))) ;; QC pass
+       (zero? (bit-and 0x400 (:flag a))) ;; Not duplicated
        (or (zero? (bit-and 0x1 (:flag a))) ;; single-end
            (pos? (bit-and 0x2 (:flag a)))))) ;; properly-paired


Prop access fix for node.js

Prop access fix for node.js

--- src/cljs/cljs/nodejscli.cljs
+++ src/cljs/cljs/nodejscli.cljs
@@ -5,5 +5,5 @@
   (:require [cljs.nodejs :as nodejs]))

 ; Call the user's main function
-(apply cljs.core/*main-cli-fn* (drop 2 (.argv nodejs/process)))
+(apply cljs.core/*main-cli-fn* (drop 2 (.-argv nodejs/process)))


Change popup to trigger on hover

Change popup to trigger on hover

--- src/cljs/decktouch/core.cljs
+++ src/cljs/decktouch/core.cljs
@@ -23,6 +23,7 @@
          :data-toggle "tooltip"
          :data-placement "bottom"
          :data-html true
+         :data-trigger "hover"
          :title (img image-link)}
          (str (get card "name"))]]))


remove duplicate definition of forgot forms

--- src/cljs/netrunner/auth.cljs
+++ src/cljs/netrunner/auth.cljs
@@ -153,27 +153,6 @@
             [:span.fake-link {:on-click #(.modal (js/$ "#register-form") "show")
                               :data-dismiss "modal"} "Sign up!"]]]]]))))

-(defn forgot-form [cursor owner]
-  (reify
-    om/IInitState
-    (init-state [this] {:flash-message ""})
-
-    om/IRenderState
-    (render-state [this state]
-      (sab/html
-       [:div.modal.fade#forgot-form {:ref "forgot-form"}
-        [:div.modal-dialog
-         [:h3 "Reset your Password"]
-         [:p.flash-message (:flash-message state)]
-         [:form {:on-submit #(handle-post % owner "/forgot" "forgot-form")}
-          [:p [:input {:type "text" :placeholder "Email" :name "email"
-                       :on-blur #(check-email % owner)}]]
-          [:p [:button "Submit"]
-              [:button {:data-dismiss "modal"} "Cancel"]]
-          [:p "No account? "
-            [:span.fake-link {:on-click #(.modal (js/$ "#register-form") "show")
-                              :data-dismiss "modal"} "Sign up!"]]]]]))))
-
 (defn auth-forms [cursor owner]
   (om/component
    (sab/html


fix chat channel order

fix chat channel order

--- src/cljs/netrunner/chat.cljs
+++ src/cljs/netrunner/chat.cljs
@@ -100,8 +100,7 @@
        [:div.chat-app
         [:div.blue-shade.panel.channel-list
          [:h4 "Channels"]
-         (for [ch (select-keys (:channels cursor)
-                               [:general :america :europe :asia-pacific :united-kingdom :français :español :italia :português :sverige :stimhack-league])]
+         (for [ch [:general :america :europe :asia-pacific :united-kingdom :français :español :italia :português :sverige :stimhack-league]]
            (om/build channel-view {:channel ch :active-channel (:channel state)}
                      {:init-state {:channel-ch (:channel-ch state)}}))]
         [:div.chat-box


make in filter explicit

make in filter explicit

--- src/cljs/uberblick/core.cljs
+++ src/cljs/uberblick/core.cljs
@@ -22,7 +22,7 @@

 (defonce people-atom (atom []))
 (defonce filters (atom [
-
+             "(startsWith? :KeyscanStatus \"In\")"
                         ]))

 (def all-profile-keys '(:IsObjectivesAdmin :LaborCategoryID :FirstName :LaborRoleID :OversightPercent :WorkTeamID :BusinessUnitName :MobileNumber :PhotoFileName :IsCandidateAdmin :CanCommunicateClient :UserSystemID :Email :CreatedDate :BillingTargetHoursPerYear :Title :MobileNumberCountryCode :IsClient :IsScheduleConfirmationRulesEnforced :LastName :IsScheduleAdmin :UserName :Extension :TimeZoneName :HomeNumber :IsNotAPerson :UserID :KeyscanUpdated :HasDirectReports :IsAdmin :BusinessUnitID :CountryID :CompanyBusinessUnitID :TimeZoneID :PhotoPath :Name :Roles :CompanyBusinessUnitName :IsWeeklyReviewAdmin :Enabled :TagName :Supervisors :KeyscanStatus :OutOfOfficeReason :Status))
@@ -97,7 +97,7 @@
         replace-where-appropriate (fn [sym]
                                     (cond
                                       (not (keyword? sym)) sym
-                                      (some #{sym} thekeys) `(if (~sym ~my-user) (~sym ~my-user) [])
+                                      (some #{sym} thekeys) `(if (~sym ~my-user) (~sym ~my-user) "")
                                       :else sym))]
     (some->>  expr
               (read-string)
@@ -133,8 +133,8 @@
     (some->> all-the-people
              (group-by :KeyscanStatus)
              (nil->Out)  ; mark the OUT ones for better processing!
-             (genome/filter-in?)
              )))
+

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; filter functions
@@ -283,6 +283,7 @@
                                   "(>= :UserID $UserID)"
                                   "(= :KeyscanStatus \"In 4th Flr N\")"
                                   "(or (startsWith? :FirstName \"M\") (substring? :Title \"Edit\"))"
+                                  "(startsWith? :KeyscanStatus \"In\")"
                   ]]
        [:hr]
        [:h3 "References"]


fix doc route

fix doc route

--- frontend/components/project_settings.cljs
+++ frontend/components/project_settings.cljs
@@ -424,7 +424,7 @@
         (html
          [:div.tests-page
           [:h2 "Set up tests for " (vcs-url/project-name (:vcs_url project))]
-          [:p [:i "You can also set your test commands from your " [:a {:href "/docs/configuration#tests"} "circle.yml"] "."]]
+          [:p [:i "You can also set your test commands from your " [:a {:href "/docs/configuration#test"} "circle.yml"] "."]]
           [:div.tests-inner
            [:fieldset.spec_form
             [:textarea {:name "test",


When suggesting new person id, skip <prefix>1 variant

--- frontend/src/faceboard/helpers/utils.cljs
+++ frontend/src/faceboard/helpers/utils.cljs
@@ -61,8 +61,8 @@
 (defn provide-unique-human-friendly-id [prefix existing-ids]
   (let [ids (remove #(not (str/starts-with? % prefix)) existing-ids)
         non-colliding-id? (fn [id] (if (not-any? #(= % id) ids) id))
-        suggest-id (fn [num] (if (zero? num) prefix (str prefix num)))
-        suggestions (map #(suggest-id %) (iterate inc 0))]
+        suggest-id (fn [num] (str prefix num))
+        suggestions (concat [prefix] (map #(suggest-id %) (iterate inc 2)))]
     (some non-colliding-id? suggestions)))

 (defn generate-board-id []


Stop insertion of empty resolution attempts.

--- src/chronograph/import/resolver.clj
+++ src/chronograph/import/resolver.clj
@@ -46,6 +46,7 @@
           (when ok
             [first-redirect last-redirect (count redirects)]))
     (catch Exception ex (let [message (.getMessage ex)]
+                          (prn "EXCEPTION" ex)
                           ; When it's FTP we can't follow, but we can say that we tried.
                           ; Message is: Scheme 'ftp' not registered.
                           (when (.contains message "ftp")
@@ -61,9 +62,10 @@
 (defn insert-resolutions
   [doi first-direct last-redirect]
   (locking *out* (prn "Insert resolution" doi))
-    (let [[first-redirect last-redirect num-redirects] (get-resolutions doi)]
+    (when-let [result (get-resolutions doi)]
+      (let [[first-redirect last-redirect num-redirects] result]
         (data/insert-event doi resolved-type-id source-id (t/now) 1 first-redirect last-redirect (str num-redirects))
-        (k/update d/resolutions (k/where {:doi doi}) (k/set-fields {:resolved true}))))
+        (k/update d/resolutions (k/where {:doi doi}) (k/set-fields {:resolved true})))))

 ; Create a load of return channels for resolved DOIs.


Trigger loads sooner

Trigger loads sooner

For a better experience on the iPad or other slower devices (or with
slower internet connections).

--- src/cljs/comic_reader/handlers.cljs
+++ src/cljs/comic_reader/handlers.cljs
@@ -91,7 +91,7 @@
                                  (.getElementById "app")
                                  .-clientHeight)]
          (if (> screen-bottom
-                (- document-height 200))
+                (- document-height 800))
            (get-next-image db)
            db))
        db)))


Inline function go-to-location function

Inline function go-to-location function

--- src/cljs/comic_reader/handlers.cljs
+++ src/cljs/comic_reader/handlers.cljs
@@ -5,10 +5,6 @@
             [comic-reader.routes :as r]
             [re-frame.core :as rf]
             [secretary.core :as secretary]))
-
-(defn go-to-location [db {:keys [chapter page]
-                          :as location}]
-  (assoc db :location location))

 (defn get-next-image [{:keys [site page-list location]
                        {:keys [chapter]} :location
@@ -54,7 +50,7 @@
      (if (and (= (:site db) site)
               (= (get-in db [:location  :comic])
                  (get-in      location [:comic])))
-       (go-to-location db location)
+       (assoc db :location location)
        (do
          (api/get-comic-pages site location)
          (assoc db


Add alliances from Business First and mark it the datapack as released in deckbuilder

--- src/cljs/netrunner/deckbuilder.cljs
+++ src/cljs/netrunner/deckbuilder.cljs
@@ -190,6 +190,7 @@
                                            (case (:code (:card card))
                                              (list
                                                "10013" ; Heritage Committee
+                                               "10029" ; Product Recall
                                                "10067" ; Jeeves Model Bioroids
                                                "10068" ; Raman Rai
                                                "10071" ; Salem's Hospitality
@@ -200,6 +201,8 @@
                                              (>= 15 (card-count (filter #(= "ICE" (:type (:card %))) cards)))
                                              "10019" ; Museum of History
                                              (<= 50 (card-count cards))
+                                             "10038" ; PAD Factory
+                                             (= 3 (card-count (filter #(= "01109" (:code (:card %))) cards)))
                                              "10076" ; Mumbad Virtual Tour
                                              (<= 7 (card-count (filter #(= "Asset" (:type (:card %))) cards)))
                                              false))
@@ -270,8 +273,8 @@
   "Returns false if the card comes from a spoiled set or is out of competitive rotation."
   [card]
   (let [cid (js/parseInt (:code card))]
-    ;; Cards up to Kala Ghoda are currently released
-    (and cid (<= cid 10019))))
+    ;; Cards up to Business First are currently released
+    (and cid (<= cid 10038))))

 (defn mwl-legal?
   "Returns true if the deck's influence fits within NAPD MWL restrictions."


Regression fix

Regression fix

--- src/cljs/salava/badge/ui/modal.cljs
+++ src/cljs/salava/badge/ui/modal.cljs
@@ -123,7 +123,7 @@
               [:div {:id "assertion-link"}
                [:label (t :badge/Metadata)": "]
                [:a {:href     "#"
-                    :on-click #(mo/set-new-view [:badge :metadata] assertion)}
+                    :on-click #(mo/set-new-view [:badge :metadata] (dissoc assertion :evidence))}
                 (t :badge/Openassertion) "..."]])
             (if (pos? @show-recipient-name-atom)
               (if (and user-logged-in? (not owner?))
@@ -136,7 +136,7 @@
           [:div {:class "row criteria-html"}
            [:div.col-md-12
             {:dangerouslySetInnerHTML {:__html criteria_content}}]]
-          (if (and show_evidence evidence_url)
+          (if (and (pos? show_evidence) evidence_url)
             [:div.row
              [:div.col-md-12
               [:h2.uppercase-header (t :badge/Evidence)]


hide message link in invalid badge

hide message link in invalid badge

--- src/cljs/salava/badge/ui/modal.cljs
+++ src/cljs/salava/badge/ui/modal.cljs
@@ -113,7 +113,8 @@

 (defn below-image-block [state endorsement_count]
-  (let [{:keys [view_count owner? badge_id message_count user-logged-in? congratulated?]} @state]
+  (let [{:keys [view_count owner? badge_id message_count user-logged-in? congratulated? expires_on revoked]} @state
+        invalid? (or (bh/badge-expired? expires_on) (pos? revoked))]
     [:div.badge-info-container
      ;view count
      (when (and owner? (pos? view_count))
@@ -136,9 +137,10 @@
             [:i {:class "fa fa-heart"}]
             (str " " (t :badge/Congratulate) "!")]))]]
      ;messages
-     [:div.row
-      (if (session/get :user)
-        [badge-message-link message_count  badge_id])]
+     (when-not invalid?
+       [:div.row
+        (if (session/get :user)
+          [badge-message-link message_count  badge_id])])
      ;endorsements
      [:div.row (badge-endorsement-modal-link badge_id endorsement_count)]]))

@@ -160,7 +162,7 @@
         (if revoked
           [:div.revoked (t :badge/Revoked)])
         (if expired?
-          [:div.expired [:label (t :badge/Expiredon) ": "] (date-from-unix-time (* 1000 expires_on))])
+          [:div.expired [:label (str (t :badge/Expiredon) ":")] (date-from-unix-time (* 1000 expires_on))])
         [:h1.uppercase-header name]
         (if (< 1 (count (:content @state)))
           [:div.inline [:label (t :core/Languages)": "](content-language-selector selected-language (:content @state))])


Make shortcut hints readable with light-colored themes

--- src/clojure/nightcode/shortcuts.clj
+++ src/clojure/nightcode/shortcuts.clj
@@ -36,8 +36,7 @@
    :find-field "F"
    :replace-field "shift R"
    :repl-console "shift E"
-   :project-pane
-   "↑ ↓ ↵"
+   :project-pane "↑ ↓ ↵"
    :toggle-logcat-button "S"})

 (defn create-mappings
@@ -82,7 +81,10 @@
   "Creates a new hint on the given view with the given text."
   [^JComponent view ^String text]
   (when text
-    (let [style (ToolTipBalloonStyle. Color/DARK_GRAY Color/DARK_GRAY)
+    (let [text (str ""
+                    text
+                    "")
+          style (ToolTipBalloonStyle. Color/DARK_GRAY Color/DARK_GRAY)
           ^CenteredPositioner positioner (CenteredPositioner. 0)]
       (.enableFixedAttachLocation positioner true)
       (.setAttachLocation positioner 0.5 0.5)


Add alias spec

Add alias spec

--- src/com/wsscode/pathom/connect.cljc
+++ src/com/wsscode/pathom/connect.cljc
@@ -26,6 +26,7 @@
   (s/def ::attribute (s/or :attribute ::p/attribute :set ::attributes-set))
   (s/def ::attributes-set (s/coll-of ::p/attribute :kind set?))
   (s/def ::batch? boolean?)
+  (s/def ::alias? boolean?)

   (s/def ::resolve fn?)
   (s/def ::mutate fn?)


Add spec for mutation-join-globals

Add spec for mutation-join-globals

--- src/com/wsscode/pathom/connect.cljc
+++ src/com/wsscode/pathom/connect.cljc
@@ -29,6 +29,8 @@

 (s/def ::resolver-dispatch fn?)
 (s/def ::mutate-dispatch fn?)
+
+(s/def ::mutation-join-globals (s/coll-of ::attribute))

 (defn resolver-data
   "Get resolver map information in env from the resolver sym."


Fix to-chan

Fix to-chan

--- src/com/wsscode/pathom/connect.cljc
+++ src/com/wsscode/pathom/connect.cljc
@@ -1170,7 +1170,7 @@
 (defn reader3-run-and-node-async
   [env plan {::pcp/keys [run-and] :as node}]
   (go-promise
-    (let [from-chan (async/to-chan run-and)
+    (let [from-chan (async/to-chan! run-and)
           out-chan  (async/chan 10)]
       (async/pipeline-async 10
         out-chan


Fix tail taching

Fix tail taching

--- src/angelic/search/implicit/ah_astar.clj
+++ src/angelic/search/implicit/ah_astar.clj
@@ -18,14 +18,18 @@
 ;; tuples are [[reachable-set remaining-fs] reward status]
 (defrecord Plan [tupler opt-sol opt-seq pess-seq])

+(defmethod print-method angelic.search.implicit.ah-astar.Plan [o s]
+  (print-method (str "#<Plan " (first (:opt-seq o)) ">") s))
+
 (defn memo-tuple-seq []
   (let [h (HashMap.)]
-    (fn [[[s rfs] r :as init-tuple] next-f]
+    (fn ts* [[[s rfs] r :as init-tuple] next-f]
       (if-let [p (.get h [s rfs next-f])]
         (let [o (- r (second (first p)))]
-         (map
-          #(update-in % [1] + o)
-          p))
+          (cons init-tuple
+           (map
+           #(update-in % [1] + o)
+           (next p))))
         (let [ret
               (when s
                 (cons
@@ -33,7 +37,7 @@
                  (lazy-seq
                   (when-let [[fs & rfs] (seq rfs)]
                     (let [[next-s step-r stat] (next-f fs s)]
-                      (tuple-seq [[next-s rfs] (+ step-r r) stat] next-f))))))]
+                      (ts* [[next-s rfs] (+ step-r r) stat] next-f))))))]
           (.put h [s rfs next-f] ret)
           ret)))))

@@ -53,12 +57,14 @@
 (defn make-plan [tupler opt-sol init-exact]
   (assert (= (nth init-exact 2) :solved))
   (let [[exact-seq opt-seq] (split-exact-prefix (tupler init-exact fs/apply-opt))]
-    (when (-> opt-seq last first second empty?)
+    (if (-> opt-seq last first second empty?)
       (Plan.
        tupler
        (concat opt-sol (for [[[_ [fs]]] exact-seq] fs))
        opt-seq
-       (tupler (first opt-seq) fs/apply-pess)))))
+       (tupler (first opt-seq) fs/apply-pess))
+      (util/print-debug 2 "dead-end at " opt-seq )
+      )))

 (defn plan-refinements [{:keys [tupler opt-sol opt-seq]}]
   (let [[[s rfs] r stat] (first opt-seq)]


add replace-patterns-present-subjunctive

--- src/babel/italiano/morphology/verbs.cljc
+++ src/babel/italiano/morphology/verbs.cljc
@@ -665,6 +665,23 @@
          #"(.*)ano$"       "$1irsi" ;; vestano -> vestirsi
          ]}]))

+(defonce replace-patterns
+  (map (fn [each]   ;; unify with {:synsem {:cat :verb}} for all rules.
+         {:p (:p each)
+          :u (unify (:u each)
+                    {:synsem {:cat :verb}})
+          :g (:g each)})
+
+       (concat
+        ;; if more are added in the future, please
+        ;; preserve alphabetical ordering.
+        replace-patterns-conditional-tense
+        replace-patterns-future-tense
+        replace-patterns-gerund
+        replace-patterns-imperfect-past-tense
+        replace-patterns-past-tense
+        replace-patterns-present-subjunctive
+        replace-patterns-present-tense)))

 (def exceptions-rules
   [;; 1. past-tense exceptions


Make fns private

Make fns private

--- src/discuss/integration.cljs
+++ src/discuss/integration.cljs
@@ -13,7 +13,7 @@
             [discuss.tooltip :as tooltip]))

 ;;; Listener for mouse clicks
-(defn get-mouse-position
+(defn- get-mouse-position
   "Multi browser support for getting the current mouse position. Returns tuple of x and y: [x y]"
   [e]
   (if (.-pageX e)
@@ -24,7 +24,7 @@
     ;  [x y (.-clientX e) (.-clientY e)])
     ))

-(defn listen
+(defn- listen
   "Helper function for mouse-click events."
   [el type]
   (let [out (chan)]
@@ -34,7 +34,7 @@
     out))

 ;; http://www.thesoftwaresimpleton.com/blog/2014/12/30/core-dot-async-dot-mouse-dot-down/
-(defn save-selected-text
+(defn- save-selected-text
   "Get the users selection and save it."
   []
   (let [selection (str (.getSelection js/window))]
@@ -49,7 +49,7 @@
         (<! clicks)
         (save-selected-text))))

-(defn minify-doms
+(defn- minify-doms
   "Removes dom-elements, which can never be used as a reference."
   [doms]
   (remove #(or (= "script" (lower-case (.-nodeName %)))
@@ -62,7 +62,7 @@
                (= "button" (lower-case (.-nodeName %))))
           doms))

-(defn get-parent
+(defn- get-parent
   "Assuming that the last occurence of my reference is the closest parent of it,
    this function will return it."
   [doms ref]
@@ -73,7 +73,7 @@

 ;;; Integrate references and highlight them in the article
-(defn convert-reference
+(defn- convert-reference
   "Find parent of reference, split it into parts and wrap the original reference for highlighting and interaction."
   [ref]
   (let [ref-text (vlib/html->str (:text ref))


removed unnecessary requirement

removed unnecessary requirement

--- src/distillery/view/base.clj
+++ src/distillery/view/base.clj
@@ -2,8 +2,7 @@
   (:require [net.cgrand.enlive-html :as eh])
   (:require [distillery.files :refer :all])
   (:require [distillery.view.defaults :as defaults])
-  (:require [distillery.view.html :refer :all])
-  (:require [distillery.view.dependencies :refer (save-dependencies)]))
+  (:require [distillery.view.html :refer :all]))

 (defn render
   "Renders the layout template."


Minor enhancements/fixes, intertwined spirals.

20101204: - Added pushgp-map, which allows pushgp calls on maps of arguments,
            and a demonstration of its use in argmap_regression.clj.
          - Added :gen-class and -main definition (thanks Kyle Harrington).
          - Fixed eval-push termination to return :abnormal for exceeding
            time-limit (thanks Kyle Harrington).
20101205: - Added modified version of Kyle's version of the intertwined
            spirals problem.
          - Minor changes to this README.

--- src/examples/intertwined_spirals.clj
+++ src/examples/intertwined_spirals.clj
@@ -8,7 +8,6 @@
 ;; few different instruction sets by changing :basic to :exec or :tag in
 ;; intertwined-spirals-demo.
 ;; For Kyle's full version see https://github.com/kephale/Clojush
-

 (ns examples.intertwined-spirals
   (:require [clojush] [clojure.contrib.duck-streams :as ds])


Change alias.

Change alias.

--- src/fhofherr/simple/core.clj
+++ src/fhofherr/simple/core.clj
@@ -3,7 +3,7 @@
   (:require [fhofherr.simple.core.dsl] ; Required to pass it to load-config
             [fhofherr.simple.core [config :as config]
              [job-fn :as job-fn]
-             [job-descriptor :as jobs]
+             [job-descriptor :as jobs-desc]
              [job-execution :as job-ex]
              [job-execution-context :as ex-ctx]
              [subsystems :as subsystems]]))
@@ -11,7 +11,7 @@
 (defn- configure-jobs-subsystem
   [cidef-ns]
   (as-> cidef-ns $
-        (config/filter-publics $ jobs/job-descriptor?)
+        (config/filter-publics $ jobs-desc/job-descriptor?)
         (map (fn [[s v]] [(name s) (var-get v)]) $)
         (into {} $)))

@@ -56,4 +56,4 @@
           (:project-dir $)
           (ex-ctx/make-job-execution-context $)
           (job-ex/make-job-execution $)
-          (jobs/schedule-job! jd $))))
+          (jobs-desc/schedule-job! jd $))))


wip: introspection fixes for graphiql

wip: introspection fixes for graphiql

--- src/graphql_clj/resolver.clj
+++ src/graphql_clj/resolver.clj
@@ -16,7 +16,11 @@
       (match/match
        [type-name field-name]
        [root-query-name "__schema"] (fn [context parent & args]
-                                      {:types (vals (:types schema))
+                                      {:types (concat (vals (:types schema))
+                                                      ;; Work around for graphiql to treat interface as type.
+                                                      (vals (:interfaces schema))
+                                                      ;; Work around for graphiql to treat enum as type.
+                                                      (vals (:enums schema)))
                                        :queryType (type/get-type-in-schema schema root-query-name)
                                        :mutationType nil
                                        :directives []})
@@ -30,25 +34,30 @@
                                      :enumValues nil
                                      :inputFields nil
                                      :ofType nil})
-       ["__Schema" "types"] (fn [context parent & rest]
-                              (vals (:types schema)))
        ["__Schema" "directives"] (fn [context parent & rest]
                                    [])
        ["__Type" "fields"] (fn [context parent & rest]
-                             (:fields parent))
+                             (let [kind (:kind parent)]
+                               (case kind
+                                 (:OBJECT :INTERFACE) (:fields parent)
+                                 [])))
        ["__Type" "interfaces"] (fn [context parent & rest]
-                                 (println "interfaces parent: " parent)
                                  (let [implements (get-in parent [:implements :type-names])]
                                    (map (fn type-interfaces [interface-name]
                                           (type/get-interface-in-schema schema interface-name))
                                         implements)))
        ["__Type" "possibleTypes"] (fn [& rest]
                                     [])
-       ["__Type" "enumValues"] (fn [& rest]
-                                 [])
+       ["__Type" "enumValues"] (fn [context parent & rest]
+                                 (if (and (= :ENUM (:kind parent)) (:fields parent))
+                                   (vals (:fields parent))
+                                   []))
        ["__Type" "inputFields"] (fn [& rest]
-                                  [{:name "test"
+                                  [{:name "deleteme"
                                     :type (type/get-type-in-schema schema root-query-name)}])
+       ["__Type" "ofType"] (fn [context parent & rest]
+                             (if (:inner-type parent)
+                               (type/get-type-in-schema schema (get-in parent [:inner-type :type-field-type :name]))))
        ["__Field" "name"] (fn [context parent & rest]
                             (let [[name _] parent]
                               name))
@@ -61,9 +70,8 @@
                                 (type/get-type-in-schema schema type-name))))
        ["__Field" "args"] (fn [& rest]
                             [])
-       ["__Type" "ofType"] (fn [context parent & rest]
-                             (if (:inner-type parent)
-                               (type/get-type-in-schema schema (get-in parent [:inner-type :type-field-type :name]))))
+       ["__EnumValue" "name"] (fn [context parent & rest]
+                                (:name parent))
        :else nil))))

 (defn create-resolver-fn


removed unnecessary helpers file

removed unnecessary helpers file

--- src/hatti/utils/helpers.cljs
+++ src/hatti/utils/helpers.cljs
@@ -1,7 +0,0 @@
-(ns hatti.utils.helpers)
-
-(defn uses-search-expression?
-    "Checks if the appearance-value has the search expression"
-    [appearance-value]
-    (and (string? appearance-value)
-         (re-matches #"^search\(.*\)$" appearance-value)))


Removed :workers keyword from query arguments

--- src/hivewing_core/worker.clj
+++ src/hivewing_core/worker.clj
@@ -32,7 +32,7 @@
 (defn worker-in-hive?
   "Is this worker in the given hive?"
   [worker-uuid hive-uuid]
-  (jdbc/query sql-db :workers ["SELECT uuid FROM workers WHERE uuid = ? AND hive_uuid = ? LIMIT 1"
+  (jdbc/query sql-db ["SELECT uuid FROM workers WHERE uuid = ? AND hive_uuid = ? LIMIT 1"
                       (ensure-uuid worker-uuid)
                       (ensure-uuid hive-uuid)] :result-set-fn first))
 (defn worker-get


Remove temporary debugging output

Remove temporary debugging output

--- src/io/aviso/rook/client.clj
+++ src/io/aviso/rook/client.clj
@@ -95,7 +95,6 @@

 (defn- process-async-response
   [request uuid {:keys [status] :as response}]
-  (l/debug "process-async-response" response)
   (assert response
           (format "Handler closed channel for request %s without sending a response." uuid))
   (let [callback (-> request :callbacks (identify-callback status))]


documentation for when-authenticated

documentation for when-authenticated

--- src/wishwheel/models/user.clj
+++ src/wishwheel/models/user.clj
@@ -38,7 +38,10 @@
     (when user
       (= token (:token user)))))

-(defn when-authenticated [token success-fn]
+(defn when-authenticated
+  "Finds a user with a matching api token and passes it into the succcess
+  function. If the user is not found, returns a 403 map."
+  [token success-fn]
   (let [api-user (first (find-by-token {:token token}))]
     (if-not api-user
       {:status 403 :body "Unauthorized"}


Use native GUI

Use native GUI

--- src/sqls/core.clj
+++ src/sqls/core.clj
@@ -7,6 +7,7 @@

 (defn -main
   [& args]
+  (native!)
   (invoke-later
     (let [settings (stor/load-settings!)
           connections (stor/load-connections!)


~rules-for-spec: if :spec has a :rule, use that rather than looking in the cache.

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -63,7 +63,15 @@
   (if (not use-spec-cache?)
     (matching-rules spec model)
     (let [plain-spec (strip-refs spec)
-          looked-up (get @(:rules-for-spec model) plain-spec ::none)]
+          looked-up
+          (cond
+            ;; 1. if the spec gives a rule, simple return a singleton vector of that rule.
+            (not (= ::none (u/get-in spec [:rule] ::none)))
+            [(get (:grammar-map model) (keyword (u/get-in spec [:rule])))]
+
+            ;; 2. lookup spec in cache.
+            true
+            (get @(:rules-for-spec model) plain-spec ::none))]
       (if (not (= ::none looked-up))
         looked-up
         (let [matching-rules (matching-rules spec model)]


speed up generation of complements with (take)

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -18,6 +18,7 @@
 ;; during generation, will not decend deeper than this when creating a tree:
 ;; should also be possible to override per-language.
 (def ^:const max-total-depth 20)
+(def ^:const max-generated-complements 100)

 ;; use map or pmap.
 (def ^:const mapfn map)
@@ -170,9 +171,10 @@
                                        (unifyc (get-in child [:synsem] :top)
                                                (get-in child-in-bolt [:synsem] :top))))))

-        filtered-lexical-complements (filter (fn [lexeme]
-                                               (complement-pre-check lexeme bolt path))
-                                             complement-candidate-lexemes)]
+        filtered-lexical-complements (lazy-shuffle
+                                      (filter (fn [lexeme]
+                                                (complement-pre-check lexeme bolt path))
+                                              complement-candidate-lexemes))]
     (filter #(not (fail? %))
             (mapfn (fn [complement]
                      (let [unified
@@ -205,15 +207,17 @@

                           (and (empty? filtered-lexical-complements)
                                (empty? phrasal-complements))
-                          (log/warn (str "add-complement-to-bolt: could generate neither phrasal nor lexical complements for bolt:" (show-bolt bolt language-model) "; immediate parent: "
+                          (log/warn (str "add-complement-to-bolt: could generate neither phrasal "
+                                         "nor lexical complements for "
+                                         "bolt:" (show-bolt bolt language-model) "; immediate parent: "
                                           (get-in bolt (concat (butlast path) [:rule]) :norule) " "
                                           "while trying to create a complement: " (spec-info spec)))

                           lexemes-before-phrases
-                          (lazy-cat (lazy-shuffle filtered-lexical-complements) phrasal-complements)
-
+                          (take max-generated-complements
+                                (lazy-cat filtered-lexical-complements phrasal-complements))
                           true
-                          (lazy-cat phrasal-complements (lazy-shuffle filtered-lexical-complements))))))))
+                          (take max-generated-complements (lazy-cat phrasal-complements filtered-lexical-complements))))))))

 (defn spec-info [spec]
   "give a human-readable summary of _spec_."


Watcher: print summary of load-time exception below stacktrace

--- src/main/clojure/lazytest/watch.clj
+++ src/main/clojure/lazytest/watch.clj
@@ -2,6 +2,7 @@
   (:gen-class)
   (:use	[lazytest.reload :only (reload)]
 	[lazytest.tracker :only (tracker)]
+	[lazytest.color :only (colorize)]
 	[clojure.java.io :only (file)]
 	[clojure.string :only (join)])
   (:require lazytest.runner.console
@@ -23,7 +24,10 @@
 	(println "\nDone.")))
     (catch Throwable t
       (println "ERROR:" t)
-      (.printStackTrace t))))
+      (.printStackTrace t)
+      (newline)
+      (println (colorize "ERROR while loading:" :red))
+      (println t))))

 (defn reloading-runner [dirs run-fn report-fn]
   (let [dirs (map file dirs)


Start switching to clojure.test from clojure.contrib.test-is.

--- test/clj_record/core_test.clj
+++ test/clj_record/core_test.clj
@@ -4,7 +4,7 @@
     [clj-record.query :as query]
     [clj-record.test-model.manufacturer :as manufacturer]
     [clj-record.test-model.product :as product])
-  (:use clojure.contrib.test-is
+  (:use clojure.test
         clj-record.test-helper))

@@ -12,9 +12,8 @@
   (is (= "productos" (core/table-name "product"))))

 (deftest table-name-is-available-on-each-model-namespace
-  (are (= _1 _2)
-    "manufacturers"  (manufacturer/table-name)
-    "productos"       (product/table-name)))
+  (is (= "manufacturers"  (manufacturer/table-name)))
+  (is (= "productos"      (product/table-name))))

 (defdbtest insert-returns-id-of-new-record
   (let [id (manufacturer/insert (valid-manufacturer-with {:name "ACME"}))
@@ -92,7 +91,8 @@
     (is (= 0 (manufacturer/record-count {:name "bogus"})))))

 (deftest to-conditions
-  (are (= _1 (core/to-conditions _2))
+  (are [expected-sql-conditions conditions-map]
+    (= expected-sql-conditions (core/to-conditions conditions-map))
     ["a = ?" 1] {:a 1}
     ["a = ?" "one"] {:a "one"}
     ["a IS NULL"] {:a nil}


adjava gen

adjava gen

--- src/bitcoinrpc/core.clj
+++ src/bitcoinrpc/core.clj
@@ -335,11 +335,13 @@
 (defn arg-vals-of [args]
   (reduce (fn [acc v] (if (empty? acc) (format "%s" v) (format "%s, %s" acc v))) "" args))

+(defn java-fn-name-of [m] (format "btc%s" (normalize-name (:name m))))
+
 (defn java-method-of
   ([m]
    (reduce (fn [acc v] (format "%s\n%s" acc v)) (flatten (map (comp (partial java-method-of m) rest) (:arglists m)))))
   ([m args]
-    (let [n (normalize-name (:name m))
+    (let [n (java-fn-name-of m)
           args (map normalize-name args)
           arg-vals (arg-vals-of args)]
       ["/**"
@@ -365,7 +367,7 @@
   ))

 (defn java-signature-of [m]
-  (format "buildSignatureFromThreadSafeMethod(\"%s\")" (:name m))
+  (format "buildSignatureFromThreadSafeMethod(\"%s\")" (java-fn-name-of m))
   )

 (defn java-plugin-source-of [package classname]
@@ -404,3 +406,13 @@
   (spit (dbg filename)
         (java-plugin-source-of package classname))))

+
+
+(comment
+  (gen-java-plugin-source!
+  "/Users/anderse/src/mz-dev2/mz-main/mediationzone/packages/bitcoin/src/main/java"
+  "com.digitalroute.mz.bitcoin.agent" "BitcoinRpc" )
+  (gen-java-executor-source!
+  "/Users/anderse/src/mz-dev2/mz-main/mediationzone/packages/bitcoin/src/main/java"
+  "com.digitalroute.mz.bitcoin.agent" "BitcoinRpcExecutor" "AbstractBitcoinRpc")
+  )


Bind *command-line-args* to the arguments passed to the run command which, in a real script, would effectively become the script's command-line arguments. This will make it easier to write scripts and make it feel more like a shell scripting environment.

--- src/cake/tasks/eval.clj
+++ src/cake/tasks/eval.clj
@@ -4,6 +4,7 @@
         [cake.file :only [file]]
         [bake.repl :only [repl]]))

+(def ^:dynamic *script-opts*)

 (defn- read-form [string]
   (let [form (if (= "-" string)
@@ -38,7 +39,8 @@
                    (if (.isAbsolute fscript)
                      fscript
                      (file *pwd* script))))]
-        (load-file script)))
+        (binding [*command-line-args* (-> *opts* :run rest)]
+          (load-file script))))

 (deftask repl #{compile}
   "Start an interactive shell with history and tab completion."


use meta in queries

use meta in queries

--- src/cellophane/next.clj
+++ src/cellophane/next.clj
@@ -358,11 +358,15 @@
     expr))

 (defn- bind-query [query params]
-   (letfn [(replace-var [expr]
-             (if (var? expr)
-               (get params (var->keyword expr) expr)
-               expr))]
-     (walk/prewalk replace-var query)))
+  (let [qm (meta query)
+        tr (map #(bind-query % params))
+        ret (cond
+              (seq? query) (sequence tr query)
+              (instance? clojure.lang.IMapEntry query) (into [] tr query)
+              (coll? query) (into (empty query) tr query)
+              :else (replace-var query params))]
+    (cond-> ret
+      (and qm (instance? clojure.lang.IObj ret)) (with-meta qm))))

 (defn- get-local-query-data [component]
   ;; TODO: change when we implement `set-query!`
@@ -382,7 +386,9 @@
 (defn- get-component-query [c]
   (let [qps (get-local-query-data c)
         q   (:query qps (query c))]
-    (bind-query q (:params qps (params c)))))
+    (with-meta
+      (bind-query q (:params qps (params c)))
+      {:component (class c)})))

 (defn get-query
   "Return a IQuery/IParams instance bound query. Works for component classes
@@ -391,7 +397,7 @@
   (when (iquery? x)
     (if (component? x)
       (get-component-query x)
-      (bind-query (class-query x) (class-params x)))))
+      (with-meta (bind-query (class-query x) (class-params x)) {:component x}))))

 (defn subquery
   "Given a class or mounted component x and a ref to an instantiated component


define first data model

define first data model

--- src/ceres/warehouse.clj
+++ src/ceres/warehouse.clj
@@ -3,6 +3,9 @@
             [monger.collection :as mc]
             [monger.operators :refer :all]
             [monger.conversion :refer [from-db-object]]
+            [ceres.inspector :refer [levenshtein]]
+            [clojure.string :refer [split]]
+            [clojure.data.json :as json]
             [clj-time.format :as f]
             [clj-time.core :as t]))

@@ -12,8 +15,14 @@

 (def coll "tweets")

+(defn read-data [path]
+  (split (slurp path) #"\n"))
+
+#_(time (doall (map #(insert (json/read-str % :key-fn keyword)) (read-data "/home/konny/data/tweets.json"))))
+
 (defn insert [tweet]
   (mc/insert db coll tweet))
+

 (defn inverted-index [news-accounts]
   (->> (mc/find db coll {"entities.user_mentions.screen_name" {$in news-accounts}})
@@ -49,24 +58,30 @@
        (map #(from-db-object % true))))

+(defn get-replies [id]
+  (->> (mc/find db coll {"in_reply_to_status_id" id})
+       seq
+       (map #(from-db-object % true))))
+
+
+(defn assemble [news-accounts]
+  (->> (map
+        (fn [account]
+          (vec [account
+                (->> (get-news account)
+                     (map #(vec [(:id %)
+                                 (into {} [[:tweet %]
+                                           [:retweets {}]
+                                           [:replies {}]
+                                           [:shared {}]])]))
+                     vec
+                     (into {}))]))
+        news-accounts)
+       vec
+       (into {})))
+
 (comment

   (def news-accounts ["FAZ_NET" "dpa" "tagesschau" "SPIEGELONLINE" "SZ"])

-  (reduce + (map #(count (get-news %)) news-accounts))
-
-  (->> (get-news "dpa")
-       (sort-by :created_at t/after?))
-
-  (->> (reduce (fn [old [k v]] (update-in old [k] (fn [x] (conj (or x #{}) v)))) {} (inverted-index news-accounts)) (map #(vec [(key %) (count (val %))]))
-       (sort-by second >)
-       (map second)
-       frequencies
-       (sort-by val >)
-       time)
-
-  (->> (mc/find db coll)
-       seq
-       last)
-
 )


fixed path matching with new keyword variables

--- src/io/sarnowski/swagger1st/core.clj
+++ src/io/sarnowski/swagger1st/core.clj
@@ -59,7 +59,7 @@
   [definition parent-definition]
   ; TODO security, consumes, produces, ...
   ; parameters
-  (let [parameters        (get definition "parameters")
+  (let [parameters (get definition "parameters")
         parent-parameters (get parent-definition "parameters")
         merged-parameters (merge parent-parameters parameters)]
     (assoc definition "parameters" merged-parameters)))
@@ -70,36 +70,44 @@
   (let [split (fn [^String s] (.split s "/"))]
     (-> path split rest)))

-(defn- mark-variables
+(defn- variable-to-keyword
   "Replaces a variable path segment (like /{username}/) with the variable name as keyword (like :username)."
   [seg]
-  (if-let [variable-name (re-matches #"\{(.*)\}" seg)]
+  (if-let [variable-name (second (re-matches #"\{(.*)\}" seg))]
     ; use keywords for variable names
     (keyword variable-name)
     ; no variable found, return original segment
     seg))

+(defn- create-request-tuple
+  "Generates easier to digest request tuples from operations and paths."
+  [operation operation-definition path path-definition]
+  [; request-key
+   {:operation operation
+    :path      (->> path
+                    split-path
+                    (map variable-to-keyword))}
+   ; swagger-request
+   (denormalize-inheritance
+     operation-definition
+     path-definition)])
+
 (defn- extract-requests
   "Extracts request-key->operation-definition from a swagger definition."
   [definition]
   (let [non-path-keys #{"parameters"}]
-    (into {}
-          (remove nil?
-                  (apply concat
-                         (for [[path path-definition] (get definition "paths")]
-                           (when-not (contains? non-path-keys path)
-                             (let [path-definition (denormalize-inheritance path-definition definition)]
-                               (for [[operation operation-definition] path-definition]
-                                 (when-not (contains? non-path-keys path)
-                                   [; request-key
-                                    {:operation operation
-                                     :path      (->> path
-                                                     split-path
-                                                     (map mark-variables))}
-                                    ; swagger-request
-                                    (denormalize-inheritance
-                                      operation-definition
-                                      path-definition)]))))))))))
+    (->>
+      ; create request-key / swagger-request tuples
+      (for [[path path-definition] (get definition "paths")]
+        (when-not (contains? non-path-keys path)
+          (let [path-definition (denormalize-inheritance path-definition definition)]
+            (for [[operation operation-definition] path-definition]
+              (when-not (contains? non-path-keys path)
+                (create-request-tuple operation operation-definition path path-definition))))))
+      ; streamline tuples and bring into a map
+      (apply concat)
+      (remove nil?)
+      (into {}))))

 (defn- create-swagger-requests
   "Creates a map of 'request-key' -> 'swagger-definition' entries. The request-key can be used to efficiently lookup
@@ -115,7 +123,7 @@
    a nil value, it is a dynamic segment."
   [path-template path-real]
   (when (= (count path-template) (count path-real))
-    (let [pairs         (map #(vector %1 %2) path-template path-real)
+    (let [pairs (map #(vector %1 %2) path-template path-real)
           pair-matches? (fn [[t r]] (or (keyword? t) (= t r)))]
       (every? pair-matches? pairs))))

@@ -141,8 +149,8 @@
 (defn swagger-mapper
   "A ring middleware that uses a swagger definition for mapping a request to the specification."
   [chain-handler swagger-definition-type swagger-definition]
-  (let [definition             (schema/validate s/swagger-schema
-                                                (load-swagger-definition swagger-definition-type swagger-definition))
+  (let [definition (schema/validate s/swagger-schema
+                                    (load-swagger-definition swagger-definition-type swagger-definition))
         lookup-swagger-request (create-swagger-request-lookup definition)]
     (log/debug "swagger-definition" definition)


Disables all tests involving channels for the moment.

--- test/loudmoauth/core_test.clj
+++ test/loudmoauth/core_test.clj
@@ -66,19 +66,32 @@
    :auth-url (str "https://www.example.com/authorize/?" test-custom-param-query-param-string)
    })

-(defn general-fixture
-  "Needed for all tests."
+(defn drain!
+  [ch]
+  (a/go-loop []
+           (if (some? (a/poll! ch))
+             (recur))))
+
+(defn reset-channels
+  []
+  "Reset our interaction and code channels to be able to start fresh."
+  (drain! code-chan)
+  (drain! interaction-chan))
+
+(defn put-values-on-channels
+  []
+  "Put a value on each channel."
+     (a/>!! code-chan (:code final-state-map))
+     )
+
+(defn reset
+  "Reset the state of our app."
   [f]
   (reset! app-state {})
-  (a/>!! code-chan (:code final-state-map))
-  (a/>!! interaction-chan (:token-response final-state-map))
-  (with-fake-routes
-    {(:token-url final-state-map) (fn [request] (:token-response final-state-map))
-     (:auth-url final-state-map) (fn [request] (parse-code test-code-http-response))}
-    (f)))
-
-(use-fixtures :each general-fixture)
-
+  (f))
+
+(use-fixtures :each reset)
+
 (deftest test-generate-query-param-string
   (testing "Testing generation of query param string with and without :other key"
     (is (= (query-param-string final-state-map) test-custom-param-query-param-string))
@@ -98,15 +111,25 @@
     (parse-code test-code-http-response)
     (is (= (:code final-state-map) (a/<!! code-chan)))))

+;Hangs forever
+(comment
 (deftest test-fetch-code
   (testing "Test issuing http get for auth-code from oauth provider."
-      (is (= final-state-map (fetch-code final-state-map)))))
-
+    (reset-channels)
+    (with-fake-routes
+      {(:token-url final-state-map) (fn [request] (:token-response final-state-map))
+       (:auth-url final-state-map) (fn [request] (parse-code test-code-http-response))}
+      (is (= final-state-map (fetch-code final-state-map)))))))
+
+;Hangs forever.
+(comment
 (deftest test-user-interaction
   (testing "Pull response from http-requests for authorization and deliver to browser.
            In the first test we have something on the channel, in the second one the channel is empty."
+    (a/poll! interaction-chan)
+    (a/>!! interaction-chan (:token-response final-state-map))
     (is (= (:token-response final-state-map) (user-interaction {:status 200})))
-    (is (= "No user interaction nescessary." (user-interaction {:status 200})))))
+    (is (= "No user interaction nescessary." (user-interaction {:status 200}))))))

 (deftest test-string-to-base64-string
   (testing "Conversion from normal string to base64 encoded string."
@@ -146,7 +169,11 @@

 (deftest test-get-tokens
   (testing "Test retrieving tokens through http requests."
-    (is (= final-state-map (update-in (get-tokens (dissoc final-state-map [:access_token :refresh_token :expires_in])) [:token-response :request-time] (fn [x] 0))))))
+    (with-fake-routes
+      {(:token-url final-state-map) (fn [request] (:token-response final-state-map))
+       (:auth-url final-state-map) (fn [request] (parse-code test-code-http-response))}
+
+      (is (= final-state-map (update-in (get-tokens (dissoc final-state-map [:access_token :refresh_token :expires_in])) [:token-response :request-time] (fn [x] 0)))))))

 (deftest test-token-url
   (testing "Create token-url."
@@ -166,16 +193,26 @@

 (deftest test-request-access-and-refresh-tokens
   (testing "Build url and retrieve tokens."
-      (is (= final-state-map (update-in (request-access-and-refresh-tokens (dissoc final-state-map [:access_token :refresh_token :expires_in])) [:token-response :request-time] (fn [x] 0))))))
-
-(deftest test-request-access-to-data
-  (testing "Build auth url and fetch code."
-       (is (= final-state-map) (update-in  (request-access-to-data (dissoc final-state-map :code)) [:token-response :request-time] (fn [x] 0)))))
-
-(deftest test-init
+    (with-fake-routes
+      {(:token-url final-state-map) (fn [request] (:token-response final-state-map))
+       (:auth-url final-state-map) (fn [request] (parse-code test-code-http-response))}
+      (is (= final-state-map (update-in (request-access-and-refresh-tokens (dissoc final-state-map [:access_token :refresh_token :expires_in])) [:token-response :request-time] (fn [x] 0)))))))
+
+(comment
+  (deftest test-request-access-to-data
+    (testing "Build auth url and fetch code."
+      (with-fake-routes
+        {(:token-url final-state-map) (fn [request] (:token-response final-state-map))
+         (:auth-url final-state-map) (fn [request] (parse-code test-code-http-response))}
+        (is (= final-state-map) (update-in  (request-access-to-data (dissoc final-state-map :code)) [:token-response :request-time] (fn [x] 0)))))))
+
+(comment (deftest test-init
   (testing "Test init function setting parameters and retrieving code and tokens."
     (reset! app-state middle-state-map)
-      (is (= final-state-map (update-in (init) [:token-response :request-time] (fn [x] 0))))))
+    (with-fake-routes
+      {(:token-url final-state-map) (fn [request] (:token-response final-state-map))
+       (:auth-url final-state-map) (fn [request] (parse-code test-code-http-response))}
+      (is (= final-state-map (update-in (init) [:token-response :request-time] (fn [x] 0))))))))

 (deftest test-set-oauth-params
   (testing "Test setting oauth-params."


Simplify test.streams/rate-fast.

Simplify test.streams/rate-fast.

--- test/riemann/test/streams.clj
+++ test/riemann/test/streams.clj
@@ -649,32 +649,28 @@

              )))

-(deftest rate-fast
-         (let [output (atom [])
-               interval 1
+(deftest rate-threaded
+         (let [output (atom nil)
+               interval 5/2
                total 10000
                threads 4
                r (rate interval
-                        (fn [event] (dosync (swap! output conj event))))
-               t0 (unix-time)]
-
-           ; Generate events
-           (doseq [f (map (fn [t] (future
-                                 (dotimes [i (/ total threads)]
-                                   (r {:metric 1 :time (unix-time)}))))
-                          (range threads))]
-                   (deref f))
-
+                        (fn [event] (dosync (reset! output event))))
+               t0 (unix-time)
+
+               ; Generate events
+               workers (map (fn [t] (future
+                                      (dotimes [i (/ total threads)]
+                                        (r {:metric 1 :time (unix-time)}))))
+                            (range threads))]
+
+           ; Wait for workers
+           (dorun (map deref workers))
+
            (advance! interval)

-           (let [t1 (unix-time)
-                 duration (- t1 t0)]
-
-             ; All events recorded
-             (is (= duration interval))
-             (is (approx-equal total (reduce + (map :metric @output))))
-
-             )))
+           ; All events recorded
+           (is (= (/ total interval) (:metric @output)))))

 (deftest fold-interval-test
          (test-stream-intervals (riemann.streams/fold-interval 1 :metric incanter.stats/sd)


Putting a map in.

Putting a map in.

--- src/numerics/runge_kutta.clj
+++ src/numerics/runge_kutta.clj
@@ -46,9 +46,9 @@
 ;      [(* dt (Math/pow (/ tol error-estimate) 0.25)) y])))

 ;;;; 1 D
-(defn ki [f tn yn dt a c k]
-  (f [(+ tn (* dt c))
-      (+ yn (* dt (reduce + 0 (for [j (range (count k))] (* (a j) (get k j 0))))))]))
+(defn ki [f [tn yn] dt a c k]
+  (let [ys (+ yn (* dt (reduce + 0 (for [j (range (count k))] (* (a j) (k j))))))]
+    (f (into [(+ tn (* dt c))] [ys]))))

 (defn f [[x y]] (- (* 4.0 (Math/exp (* 0.8 x))) (* 0.5 y)))
 (prn (ks [f] [0 2] 0.5 tableaus/classic-fourth-order))
@@ -74,6 +74,6 @@
 (def kk (loop [ks [] ai a ci c]
   (if-not (first ci)
     ks
-    (recur (conj ks (ki f tn yn dt (first ai) (first ci) ks)) (rest ai) (rest ci)))))
+    (recur (conj ks (ki f [tn yn] dt (first ai) (first ci) ks)) (rest ai) (rest ci)))))

 (prn kk)


Add support for building a list of messages

Signed-off-by: Gregory Haskins <640d9fe47775e6723f0355b7315e38f7d98d3539@gmail.com>

--- src/obcc/build/interface.clj
+++ src/obcc/build/interface.clj
@@ -79,7 +79,21 @@
 (defn buildmessage [ast]
   (let [name (->> ast zip/right zip/node)
         fields (buildfields (->> ast zip/right zip/right))]
-      (->Message name fields)))
+    (->Message name fields)))
+
+(defn buildmessages [ast]
+  (loop [loc ast msgs '()]
+    (cond
+
+      (or (nil? loc) (zip/end? loc))
+      msgs
+
+      :else
+      (let [node (->> loc zip/node)]
+        (recur (->> loc zip/next)
+               (if (= node :message)
+                 (cons (buildmessage loc) msgs)
+                 msgs))))))

 ;;(defn generateproto [intf ast template]
 ;;  (loop [loc ast]


Stuff bytes into buffer.

Stuff bytes into buffer.

--- src/onyx/messaging/aeron.clj
+++ src/onyx/messaging/aeron.clj
@@ -13,13 +13,14 @@
              [uk.co.real_logic.aeron.common.concurrent.logbuffer DataHandler]
              [uk.co.real_logic.aeron.common BackoffIdleStrategy]
              [java.util.function Consumer]
-             [java.util.concurrent TimeUnit]
-             [java.nio ByteBuffer]))
+             [java.util.concurrent TimeUnit]))

 (defn handle-sent-message [inbound-ch buffer offset length header]
-  (let [thawed (decompress buffer)]
-    (doseq [message thawed]
-      (>!! inbound-ch message))))
+  (let [dst (byte-array length)]
+    (.getBytes buffer offset dst)
+    (let [thawed (decompress dst)]
+      (doseq [message thawed]
+        (>!! inbound-ch message)))))

 (defn handle-acker-message [daemon buffer offset length header]
   (let [thawed (decompress buffer)]
@@ -113,7 +114,7 @@
   [messenger event {:keys [channel send-stream-id]}]
   (let [ctx (Aeron$Context.)
         aeron (Aeron/connect ctx)]
-    (.addPublication aeron channel send-stream-id))  )
+    (.addPublication aeron channel send-stream-id)))

 (defmethod extensions/receive-messages AeronConnection
   [messenger {:keys [onyx.core/task-map] :as event}]
@@ -130,23 +131,23 @@
 (defmethod extensions/send-messages AeronConnection
   [messenger event peer-link]
   (let [messages (:onyx.core/compressed event)
-        compressed-batch (compress messages)
-        len (count (.getBytes compressed-batch))
-        unsafe-buffer (UnsafeBuffer. (ByteBuffer/allocateDirect len))]
+        compressed (compress messages)
+        len (count compressed)
+        unsafe-buffer (UnsafeBuffer. compressed)]
     (.offer peer-link unsafe-buffer 0 len)))

 (defmethod extensions/internal-ack-message AeronConnection
   [messenger event peer-link message-id completion-id ack-val]
-  (let [contents (compress {:id message-id :completion-id completion-id :ack-val ack-val})
-        len (count (.getBytes contents))
-        unsafe-buffer (UnsafeBuffer. (ByteBuffer/allocateDirect len))]
+  (let [compressed (compress {:id message-id :completion-id completion-id :ack-val ack-val})
+        len (count compressed)
+        unsafe-buffer (UnsafeBuffer. compressed)]
     (.offer peer-link unsafe-buffer 0 len)))

 (defmethod extensions/internal-complete-message AeronConnection
   [messenger event id peer-link]
-  (let [contents (compress {:id id})
-        len (count (.getBytes contents))
-        unsafe-buffer (UnsafeBuffer. (ByteBuffer/allocateDirect len))]
+  (let [compressed (compress {:id id})
+        len (count compressed)
+        unsafe-buffer (UnsafeBuffer. compressed)]
     (.offer peer-link unsafe-buffer 0 len)))

 (defmethod extensions/close-peer-connection AeronConnection


The whole intro is working again, though it probably has mistakes.

--- src/overtunes/songs/canone_alla_quarta.clj
+++ src/overtunes/songs/canone_alla_quarta.clj
@@ -42,8 +42,17 @@
 (def call {:time (concat (repeat 2 1/4) [1/2] (repeat 14 1/4) [3/2])
            :pitch (concat [0] (run -1 3) (run 2 0) [4] (run 1 8))})

-(def response {:time (concat (repeat 10 1/4) [1/2] (repeat 3 1/4))
+(def response {:time (concat (repeat 10 1/4) [1/2] (repeat 2 1/4) [9/4])
                :pitch (concat (run 7 -1) [0] (run 0 -3))})
+
+(def development {:time (concat [3/4] (repeat 12 1/4) [1/2 1 1/2] (repeat 12 1/4) [3])
+               :pitch (concat [4] (run 4 -2) [-1 -2 0] (run 3 5) (repeat 3 1) [2] (run -1 1) [0 -1] (run 5 0))})
+
+(defn lower [v] (- v 7))
+(def bass (update-all
+                           {:time (range 25)
+                           :pitch (map lower (mapcat (partial repeat 3) (concat (run 0 -3) (run -5 -3) [0 7])))}
+  [:pitch :time] natural-map ))

 (defn subsequent [melody1 melody2]
   (merge-with concat melody1 melody2))
@@ -51,7 +60,7 @@
 (def melody
   (let [functionalise #(update-all % [:time :pitch] natural-map)
         ground-time #(update-in % [:time] sums)]
-    (functionalise (ground-time (subsequent call response)))))
+    (functionalise (ground-time (reduce subsequent [call response development])))))

 (defn melody# [melody]
   (let [notes (update-all melody [:pitch :time] natural-seq)
@@ -64,13 +73,20 @@
 (defn transpose [interval] (update :pitch #(shift % interval)))
 (def canone-alla-quarta (reduce connect [(after 3) (transpose -3) mirror]))

+(defn sharps [notes] #(if (contains? notes %) (inc %) %))
+(defn flats [notes] #(if (contains? notes %) (dec %) %))
+
 (defn play# []
   (let [from-now #(translate % 0 (now))
-        beat (from-now (bpm 120))
+        beat (from-now (bpm 90))
         with-beat (update :time (partial connect beat))
-        in-key (update :pitch (partial connect g-major))]
-    (-> melody canone-alla-quarta in-key with-beat melody#)
-    (-> melody in-key with-beat melody#)
+        in-key (update :pitch (partial connect g-major))
+        after-a-half (after 1/2)
+        with-sharps (update :pitch #(comp (sharps [12 22]) %))
+        with-flats (update :pitch #(comp (flats [37]) %))]
+  (-> bass in-key with-beat melody#)
+   (-> melody after-a-half canone-alla-quarta in-key with-beat melody#)
+   (-> melody after-a-half in-key with-sharps with-flats with-beat melody#)
     ))

 (play#)


non-functional test code

non-functional test code

--- src/philly_show_checker/server/scraper.clj
+++ src/philly_show_checker/server/scraper.clj
@@ -48,6 +48,12 @@
         (scheduler/delete-trigger s trigger-key)
         (scheduler/schedule s job trigger)))))

+(defn test-scrapers
+  []
+  (doseq [[job-name job-def] @jobs]
+    ))
+
 (comment
+  (test-scrapers)
   (init-jobs!)
   )


Added rm_case_master_spec/drop-create fn

--- src/pg_demo/rm_case_master_spec.clj
+++ src/pg_demo/rm_case_master_spec.clj
@@ -13,12 +13,12 @@
     :subprotocol "postgresql"
     :subname "//localhost:5432/alan"
   ; :user "alan"
-  ; :pass "secret"
+  ; :pass "secret"
   })

 (def table-name "rm_case_master" )

-(def creation-sql "
+(def creation-sql-str "
   CREATE TABLE rm_case_master (
           ENTERPRISE_ID numeric NOT NULL,
           CASE_ID numeric NOT NULL,
@@ -126,7 +126,107 @@
           PRIMARY KEY (ENTERPRISE_ID,CASE_ID,DLP_REVISION_NUMBER)
   ); " )

-(defn v0 []
+(def insert2-str
+  "
+  Insert into RM_CASE_MASTER
+     (ENTERPRISE_ID, CASE_ID, CASE_NUM, REV, WORKFLOW_SEQ_NUM,
+      LAST_WORKFLOW_SEQ_NUM, CREATE_TIME, INIT_REPT_DATE, USER_ID, LAST_UPDATE_TIME,
+      LAST_UPDATE_USER_ID, REQUIRES_FOLLOWUP, FOLLOWUP_DATE, OWNER_ID, STATE_ID,
+      COUNTRY_ID, LANG_ID, PRIORITY, SITE_ID, SERIOUSNESS,
+      RPT_TYPE_ID, LAST_STATE_ID, ASSESSMENT_NEEDED, PRIORITY_OVERRIDE, SID,
+      SAFETY_DATE, NORMAL_TIME, MAX_TIME, REPORT_SCHEDULING, PRIORITY_ASSESSMENT,
+      CLOSE_USER_ID, CLOSE_DATE, CLOSE_NOTES, DATE_LOCKED, UD_TEXT_1,
+      UD_TEXT_2, UD_TEXT_3, UD_TEXT_4, UD_TEXT_5, UD_TEXT_6,
+      UD_TEXT_7, UD_TEXT_8, UD_TEXT_9, UD_TEXT_10, UD_TEXT_11,
+      UD_TEXT_12, UD_DATE_1, UD_DATE_2, UD_DATE_3, UD_DATE_4,
+      UD_DATE_5, UD_DATE_6, UD_DATE_7, UD_DATE_8, UD_DATE_9,
+      UD_DATE_10, UD_DATE_11, UD_DATE_12, UD_NUMBER_1, UD_NUMBER_2,
+      UD_NUMBER_3, UD_NUMBER_4, UD_NUMBER_5, UD_NUMBER_6, UD_NUMBER_7,
+      UD_NUMBER_8, UD_NUMBER_9, UD_NUMBER_10, UD_NUMBER_11, UD_NUMBER_12,
+      DELETED, DUE_SOON, GLOBAL_NUM, PRIORITY_DATE_ASSESSED, LAM_ASSESS_DONE,
+      E2B_WW_NUMBER, WORKLIST_OWNER_ID, SUSAR, LAST_UPDATE_EVENT, INITIAL_JUSTIFICATION,
+      FORCE_SOON, DUE_SOON_J, FOLLOWUP_DATE_J, INIT_REPT_DATE_J, JUST_INIT_REPT_DATE_J,
+      UD_TEXT_1_J, UD_TEXT_2_J, UD_TEXT_3_J, UD_TEXT_4_J, UD_TEXT_5_J,
+      UD_TEXT_6_J, UD_TEXT_7_J, UD_TEXT_8_J, UD_TEXT_9_J, UD_TEXT_10_J,
+      UD_TEXT_11_J, UD_TEXT_12_J, INITIAL_JUSTIFICATION_J, DLP_REVISION_NUMBER, REVISION_DELETE_FLAG,
+      DELETED_FLAG, EFFECTIVE_START_DATE, EFFECTIVE_END_DATE)
+   Values
+     (1, 100022, '13US000015', 0, NULL,
+      NULL, TO_DATE('10/29/2013 01:34:21', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('10/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100009, TO_DATE('10/29/2013 01:46:53', 'MM/DD/YYYY HH24:MI:SS'),
+      100009, 0, NULL, 0, 3,
+      223, NULL, NULL, 100000, 1,
+      3, 4, 0, NULL, 'RXARGUS7',
+      NULL, NULL, NULL, NULL, 1,
+      NULL, NULL, NULL, NULL, NULL,
+      NULL, NULL, NULL, NULL, NULL,
+      NULL, NULL, NULL, NULL, NULL,
+      NULL, NULL, NULL, NULL, NULL,
+      NULL, NULL, NULL, NULL, NULL,
+      NULL, NULL, NULL, NULL, NULL,
+      NULL, NULL, NULL, NULL, NULL,
+      NULL, NULL, NULL, NULL, NULL,
+      NULL, NULL, NULL, NULL, 0,
+      NULL, NULL, NULL, NULL, NULL,
+      NULL, NULL, NULL, NULL, NULL,
+      NULL, NULL, NULL, NULL, NULL,
+      NULL, NULL, NULL, NULL, NULL,
+      NULL, NULL, NULL, 198, 0,
+      0, TO_DATE('10/29/2013 01:46:53', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('10/29/2013 20:38:47', 'MM/DD/YYYY HH24:MI:SS'));
+  Insert into RM_CASE_MASTER
+     (ENTERPRISE_ID, CASE_ID, CASE_NUM, REV, WORKFLOW_SEQ_NUM,
+      LAST_WORKFLOW_SEQ_NUM, CREATE_TIME, INIT_REPT_DATE, USER_ID, LAST_UPDATE_TIME,
+      LAST_UPDATE_USER_ID, REQUIRES_FOLLOWUP, FOLLOWUP_DATE, OWNER_ID, STATE_ID,
+      COUNTRY_ID, LANG_ID, PRIORITY, SITE_ID, SERIOUSNESS,
+      RPT_TYPE_ID, LAST_STATE_ID, ASSESSMENT_NEEDED, PRIORITY_OVERRIDE, SID,
+      SAFETY_DATE, NORMAL_TIME, MAX_TIME, REPORT_SCHEDULING, PRIORITY_ASSESSMENT,
+      CLOSE_USER_ID, CLOSE_DATE, CLOSE_NOTES, DATE_LOCKED, UD_TEXT_1,
+      UD_TEXT_2, UD_TEXT_3, UD_TEXT_4, UD_TEXT_5, UD_TEXT_6,
+      UD_TEXT_7, UD_TEXT_8, UD_TEXT_9, UD_TEXT_10, UD_TEXT_11,
+      UD_TEXT_12, UD_DATE_1, UD_DATE_2, UD_DATE_3, UD_DATE_4,
+      UD_DATE_5, UD_DATE_6, UD_DATE_7, UD_DATE_8, UD_DATE_9,
+      UD_DATE_10, UD_DATE_11, UD_DATE_12, UD_NUMBER_1, UD_NUMBER_2,
+      UD_NUMBER_3, UD_NUMBER_4, UD_NUMBER_5, UD_NUMBER_6, UD_NUMBER_7,
+      UD_NUMBER_8, UD_NUMBER_9, UD_NUMBER_10, UD_NUMBER_11, UD_NUMBER_12,
+      DELETED, DUE_SOON, GLOBAL_NUM, PRIORITY_DATE_ASSESSED, LAM_ASSESS_DONE,
+      E2B_WW_NUMBER, WORKLIST_OWNER_ID, SUSAR, LAST_UPDATE_EVENT, INITIAL_JUSTIFICATION,
+      FORCE_SOON, DUE_SOON_J, FOLLOWUP_DATE_J, INIT_REPT_DATE_J, JUST_INIT_REPT_DATE_J,
+      UD_TEXT_1_J, UD_TEXT_2_J, UD_TEXT_3_J, UD_TEXT_4_J, UD_TEXT_5_J,
+      UD_TEXT_6_J, UD_TEXT_7_J, UD_TEXT_8_J, UD_TEXT_9_J, UD_TEXT_10_J,
+      UD_TEXT_11_J, UD_TEXT_12_J, INITIAL_JUSTIFICATION_J, DLP_REVISION_NUMBER, REVISION_DELETE_FLAG,
+      DELETED_FLAG, EFFECTIVE_START_DATE, EFFECTIVE_END_DATE)
+   Values
+     (1, 100022, '13US000015', 0, NULL,
+      NULL, TO_DATE('10/29/2013 01:34:21', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('10/28/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100009, TO_DATE('10/29/2013 20:38:47', 'MM/DD/YYYY HH24:MI:SS'),
+      100009, 0, NULL, 0, 3,
+      223, NULL, NULL, 100000, 1,
+      3, 4, 0, NULL, 'RXARGUS7',
+      NULL, NULL, NULL, NULL, 1,
+      NULL, NULL, NULL, NULL, NULL,
+      NULL, NULL, NULL, NULL, NULL,
+      NULL, NULL, NULL, NULL, NULL,
+      NULL, NULL, NULL, NULL, NULL,
+      NULL, NULL, NULL, NULL, NULL,
+      NULL, NULL, NULL, NULL, NULL,
+      NULL, NULL, NULL, NULL, NULL,
+      NULL, NULL, NULL, NULL, NULL,
+      NULL, NULL, NULL, NULL, 0,
+      NULL, NULL, NULL, NULL, NULL,
+      NULL, NULL, NULL, NULL, NULL,
+      NULL, NULL, NULL, NULL, NULL,
+      NULL, NULL, NULL, NULL, NULL,
+      NULL, NULL, NULL, 207, 0,
+      0, TO_DATE('10/29/2013 20:38:47', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('11/13/2013 22:57:12', 'MM/DD/YYYY HH24:MI:SS'));
+  ")
+
+(defn drop-create []
+  (newline)
+  (println (format "drop   %s" table-name))
+  (jdbc/execute! db-spec [ (format "drop table if exists %s cascade" table-name) ] )
+  (println (format "create %s" table-name))
+  (jdbc/execute! db-spec [creation-sql-str] )
+)
+
+(defn test0 []
   (newline)
   (println "-----------------------------------------------------------------------------")
   (println "rm-case-master-spec")
@@ -134,25 +234,20 @@
   (spy :msg "drop table"
     (jdbc/execute! db-spec [ (format "drop table if exists %s cascade" table-name) ] ))

-  (spy :msg "create table"
-    (jdbc/db-do-commands db-spec
-      (ddl/create-table
-        table-name
-        [:id        :serial "primary key"]
-        [:name      :text   "not null"] )))
-
-  (spy :msg "insert"
-    (jdbc/insert! db-spec table-name
-      {:name "Clojure"}
-      {:name "Java"} ))
+  (spy :msg "create2"
+    (jdbc/execute! db-spec [creation-sql-str] ))
+
+  (spy :msg "insert2"
+    (jdbc/execute! db-spec [insert2-str] ))

   (spy :msg "query"
     (jdbc/query db-spec
-      (jdbc-sql/select * table-name (jdbc-sql/where {:name "Clojure"} ))))
+      (jdbc-sql/select * table-name  )))
+
  (newline))

-
 (defn -main []
-  (v0)
+  (drop-create)
+  (test0)
 )


Improve usage of updater

Improve usage of updater

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

--- plugins/SlideExplorer2/src/slide_explorer/display.clj
+++ plugins/SlideExplorer2/src/slide_explorer/display.clj
@@ -304,22 +304,22 @@
 (defn handle-zoom [window zoom-atom]
   (bind-window-key window "ADD" #(swap! zoom-atom update-in [:zoom] inc))
   (bind-window-key window "SUBTRACT" #(swap! zoom-atom update-in [:zoom] dec)))
-
-(def updater (GUIUpdater.))

 (defn display-follow [panel reference]
   (add-watch reference "display"
     (fn [_ _ _ _]
-      (.post updater #(.repaint panel)))))
+      (.repaint panel))))

 (defn main-panel [screen-state available-tiles]
   (doto
-    (proxy [JPanel] []
-      (paintComponent [^Graphics graphics]
-                      (proxy-super paintComponent graphics)
-                      (paint-screen graphics screen-state available-tiles)))
-    (.setBackground Color/BLACK)
-    ))
+    (let [updater (GUIUpdater.)]
+      (proxy [JPanel] []
+        (paintComponent [^Graphics graphics]
+                        (proxy-super paintComponent graphics)
+                        (paint-screen graphics screen-state available-tiles))
+        (repaint []
+                 (.post updater #(proxy-super repaint)))))
+    (.setBackground Color/BLACK)))

 (defn main-frame []
   (doto (JFrame. "Slide Explorer II")


helloworld sample; desktop runner utils

helloworld sample; desktop runner utils

--- src/flatgui/samples/forms/helloworld.clj
+++ src/flatgui/samples/forms/helloworld.clj
@@ -11,6 +11,7 @@
             [flatgui.base :as fg]
             [flatgui.util.matrix :as m]
             [flatgui.awt :as awt]
+            [flatgui.widgets.component :as component]
             [flatgui.widgets.window :as window]
             [flatgui.widgets.checkbox :as checkbox]
             [flatgui.widgets.label :as label]
@@ -57,5 +58,6 @@
     panel/panel
     :main
     {:clip-size  (m/defpoint 6 4)
-     :background (awt/color 9 17 26)}
+     :background (awt/color 9 17 26)
+     :evolvers {:clip-size component/clip-size-to-host}}
     hello-window))


add :none style

add :none style

--- src/strictly_specking/ansi_util.clj
+++ src/strictly_specking/ansi_util.clj
@@ -24,7 +24,8 @@
    :warning-key [:bright]
    :focus-path  [:magenta]
    :message     [:magenta]
-   :pointer     [:magenta]})
+   :pointer     [:magenta]
+   :none        [:reset]})

 (defmacro black-and-white [body]
   (binding [*print-styles* {}]


Rename `fix-for-equality` to `clean`

Rename `fix-for-equality` to `clean`

--- src/test/cljc/mikron/test_util.cljc
+++ src/test/cljc/mikron/test_util.cljc
@@ -14,7 +14,7 @@
      [value]
      (seq (.from js/Array (js/Int8Array. value)))))

-(defn fix-for-equality*
+(defn clean*
   "Returns a more 'equal friendly' value, if necessary."
   [value]
   (condp contains? (type value)
@@ -30,13 +30,13 @@

     value))

-(defn fix-for-equality
+(defn clean
   "Returns a more 'equal friendly' value, if necessary."
   [value]
-  (walk/postwalk fix-for-equality* value))
+  (walk/postwalk clean* value))

 (defn equal?
   "Checks whether the given values are equal."
   [value-1 value-2]
-  (= (fix-for-equality value-1)
-     (fix-for-equality value-2)))
+  (= (clean value-1)
+     (clean value-2)))