Act on @otfrom's comments.

Act on @otfrom's comments.

--- src-cljs/kixi/hecuba/widgets/datetimepicker.cljs
+++ src-cljs/kixi/hecuba/widgets/datetimepicker.cljs
@@ -49,19 +49,19 @@
 (defn date-mover [data owner {:keys [k]}]
   (reify
     om/IRenderState
-    (render-state [_ {:keys [chevron-chan]}]
+    (render-state [_ {:keys [date-move-chan]}]
       (html
        [:div
         [:table.table.borderless {:style {:font-size "90%"}}
          [:tbody
           [:tr
-           [:td.datemover {:on-click (fn [_] (put! chevron-chan {:event :day-plus :k k}))} "+1 Day"]
-           [:td.datemover {:on-click (fn [_] (put! chevron-chan {:event :week-plus :k k}))} "+1 Week"]
-           [:td.datemover {:on-click (fn [_] (put! chevron-chan {:event :month-plus :k k}))} "+1 Month"]]
+           [:td.datemover {:on-click (fn [_] (put! date-move-chan {:event :day-plus :k k}))} "+1 Day"]
+           [:td.datemover {:on-click (fn [_] (put! date-move-chan {:event :week-plus :k k}))} "+1 Week"]
+           [:td.datemover {:on-click (fn [_] (put! date-move-chan {:event :month-plus :k k}))} "+1 Month"]]
           [:tr
-           [:td.datemover {:on-click (fn [_] (put! chevron-chan {:event :day-minus :k k}))} "-1 Day"]
-           [:td.datemover {:on-click (fn [_] (put! chevron-chan {:event :week-minus :k k}))} "-1 Week"]
-           [:td.datemover {:on-click (fn [_] (put! chevron-chan {:event :month-minus :k k}))} "-1 Month"]]]]]))))
+           [:td.datemover {:on-click (fn [_] (put! date-move-chan {:event :day-minus :k k}))} "-1 Day"]
+           [:td.datemover {:on-click (fn [_] (put! date-move-chan {:event :week-minus :k k}))} "-1 Week"]
+           [:td.datemover {:on-click (fn [_] (put! date-move-chan {:event :month-minus :k k}))} "-1 Month"]]]]]))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Date-time picker
@@ -114,12 +114,12 @@
     (init-state [_]
       {:start-date (-> data :start-date)
        :end-date   (-> data :end-date)
-       :chevron-chan (chan)})
+       :date-move-chan (chan)})
     om/IWillMount
     (will-mount [_]
       (go-loop []
-        (let [{:keys [chevron-chan]} (om/get-state owner)
-              {:keys [event k]}      (<! chevron-chan)
+        (let [{:keys [date-move-chan]} (om/get-state owner)
+              {:keys [event k]}      (<! date-move-chan)
               current-date           (k (om/get-state owner))
               date (calculate-new-range event current-date)]
           (om/set-state! owner k date))
@@ -129,7 +129,7 @@
       (om/set-state! owner :start-date start-date)
       (om/set-state! owner :end-date end-date))
     om/IRenderState
-    (render-state [_ {:keys [date-range-chan chevron-chan]}]
+    (render-state [_ {:keys [date-range-chan date-move-chan]}]
       (html
        (let [history (om/get-shared owner :history)]
          [:div
@@ -150,7 +150,7 @@
            [:form.form-inline {:role "form"}
             [:div.col-md-5
              (om/build date-mover data {:opts {:div-id "date-mover" :k :start-date}
-                                        :init-state {:chevron-chan chevron-chan}})]
+                                        :init-state {:date-move-chan date-move-chan}})]
             [:div.col-md-5
              (om/build date-mover data {:opts {:div-id "date-mover" :k :end-date}
-                                        :init-state {:chevron-chan chevron-chan}})]]]])))))
+                                        :init-state {:date-move-chan date-move-chan}})]]]])))))


get rewind working

get rewind working

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

--- src/aurora/join.cljs
+++ src/aurora/join.cljs
@@ -2,12 +2,61 @@
   (:require [aurora.btree :refer [tree iterator key-lt key-lte key-gt key-gte]])
   (:require-macros [aurora.macros :refer [typeof]]))

-(defn lt [a b]
+(defn nilless-lt [a b]
   (if (== a nil)
     false
     (or (and (identical? (typeof a) (typeof b))
              (< a b))
         (< (typeof a) (typeof b)))))
+
+(defn gt [a b]
+  (and (not (identical? a b))
+       (or (and (identical? (typeof a) (typeof b))
+                (> a b))
+           (> (typeof a) (typeof b)))))
+
+(defn lt [a b]
+  (and (not (identical? a b))
+       (or (and (identical? (typeof a) (typeof b))
+                (< a b))
+           (< (typeof a) (typeof b)))))
+
+(defn nilless-key-compare [as bs]
+  (let [as-len (alength as)
+        bs-len (alength bs)]
+    (assert (== as-len bs-len) (pr-str as bs))
+    (loop [i 0]
+      (if (< i as-len)
+        (let [a (aget as i)
+              b (aget bs i)]
+          (if (or (identical? a nil)
+                  (identical? b nil))
+            (recur (+ i 1))
+            (if (identical? a b)
+              (recur (+ i 1))
+              (if (lt a b)
+                -1
+                1))))
+        0))))
+
+(defn rewind-or-store
+  "Returns #js[ix, store?, rewind?]"
+  [as bs nil-ixs]
+  (let [len (alength nil-ixs)]
+    (loop [ix 0]
+      (if (< ix len)
+        (let [cur (aget nil-ixs ix)
+              rewind? (gt (aget as cur) (aget bs cur))]
+          (cond
+           (and (identical? cur 0) rewind?) #js [0 false rewind?]
+           (> cur 0) (let [store? (gt (aget as (- cur 1)) (aget bs (- cur 1)))]
+                       (if store?
+                         #js [cur store? false]
+                         (if rewind?
+                           #js [cur false rewind?]
+                           (recur (+ 1 ix)))))
+           :else (recur (+ 1 ix))))
+        #js [0 false false]))))

 (defn filled-key-compare [as bs fill]
   (let [as-len (alength as)
@@ -31,14 +80,36 @@
     (aset as ix (or (aget as ix) (aget fill ix))))
   as)

-(deftype MagicIterator [iterator map map-len ^:mutable cur-key ^:mutable cur-seek ^:mutable marked]
+(defn reverse-fill! [as fill]
+  (dotimes [ix (alength as)]
+    (aset fill ix (or (aget as ix) (aget fill ix))))
+  fill)
+
+;; (rewind-or-store #js [2 0 1] #js [1 0 1] #js[1])
+;; (rewind-or-store #js [2 2 1] #js [1 0 1] #js[1])
+;; (rewind-or-store #js [1 2 1] #js [1 0 1] #js[1])
+;; (rewind-or-store #js [0 0 1] #js [1 0 1] #js[1])
+;; if the number preceding a nil increased, store
+;; if the nil increased reset
+;; [1 0 1] [1 2 3] [1 3 1] [1 4 4]
+;; [1 nil 1] [1 nil 3] [1 nil 4]
+;; [nil 2 3] [nil 4 4]
+;; [1 2 1 3] [1 2 2 5] [1 2 3 3]
+;; [nil 2 nil 3] [nil 2 nil 5] [nil 4 nil 4]
+;; store index preceding a nil, iff not last, if first root
+;; if the value of the new seek is > previous, restore, find first greatest index reset to that index's last node
+
+(deftype MagicIterator [iterator map nil-ixs map-len ^:mutable cur-key ^:mutable cur-seek ^:mutable prev-seek ^:mutable marked-nodes ^:mutable marked-ixs]
   Object
-  (mark [this]
-        (set! marked node))
-  (rewind [this]
-          (set! (.-node iterator) marked)
-          (set! (.-ix iterator) 0)
-          (set! (.-end? iterator) false))
+  (mark [this i]
+        (aset marked-nodes i (.-node iterator))
+        (aset marked-ixs i (.-ix iterator))
+        )
+  (rewind [this i]
+          (set! (.-node iterator) (aget marked-nodes i))
+          (set! (.-ix iterator) (aget marked-ixs i))
+          (set! (.-end? iterator) false)
+          (.set-key this))
   (key [this]
        (.-cur-key this))
   (val [this]
@@ -54,26 +125,34 @@
                    (if-not (nil? map-ix)
                      (aset cur-key ix (aget found map-ix))
                      (aset cur-key ix nil)))
-                 (recur (inc ix))))))
+                 (recur (+ 1 ix))))))
   (seek [this key]
-        (loop [ix 0]
-          (when (< ix map-len)
-            (let [map-ix (aget map ix)]
-              (when-not (== map-ix nil)
-                (aset cur-seek map-ix (aget key ix))))
-            (recur (inc ix))))
-        (.seek iterator cur-seek)
-        (.set-key this)
+        (let [ros (rewind-or-store key prev-seek nil-ixs)
+              ros-ix (aget ros 0)]
+          (when (identical? (aget ros 2) true)
+            (.rewind this (aget ros 0)))
+          (when (identical? (aget ros 1) true)
+            (dotimes [x (alength cur-seek)]
+              (aset cur-seek x false))
+            (aset cur-seek (aget map ros-ix) (aget key ros-ix))
+            (.seek iterator cur-seek)
+            (.mark this ros-ix)
+            (.set-key this))
+          (when (identical? -1 (nilless-key-compare (.-cur-key this) key))
+            (loop [ix 0]
+              (when (< ix map-len)
+                (let [map-ix (aget map ix)]
+                  (when-not (== map-ix nil)
+                    (aset cur-seek map-ix (aget key ix))))
+                (recur (+ 1 ix))))
+            (.seek iterator cur-seek)
+            (.set-key this))
+          (set! prev-seek key)
+          )
         ))

-(deftype MagicIteratorWrapper [iterator map ^:mutable marked]
+(deftype MagicIteratorWrapper [iterator map]
   Object
-  (mark [this]
-        (set! marked node))
-  (rewind [this]
-          (set! (.-node iterator) marked)
-          (set! (.-ix iterator) 0)
-          (set! (.-end? iterator) false))
   (key [this]
        (.key iterator))
   (val [this]
@@ -81,15 +160,23 @@
   (next [this]
         (.next iterator))
   (seek [this key]
-        (.seek iterator key)))
+        (when (key-lt (.key iterator) key)
+          (.seek iterator key))))

 (defn magic-iterator
   ([tree] (let [itr (iterator tree)]
-            (MagicIteratorWrapper. itr (.key itr) (.-root tree))))
+            (MagicIteratorWrapper. itr (.key itr))))
   ([tree map]
-   (let [itr (MagicIterator. (iterator tree) map (alength map) (array) (array) (.-root tree))]
-     (.set-key itr)
-     itr)))
+   (let [nil-ixs (array)
+         itr (iterator tree)
+         marked-nodes (js-obj 0 (.-node itr))
+         marked-ixs (js-obj 0 0)
+         magic (MagicIterator. itr map nil-ixs (alength map) (array) (array) (.key itr) marked-nodes marked-ixs)]
+     (dotimes [ix (alength map)]
+       (when (identical? nil (aget map ix))
+         (.push nil-ixs ix)))
+     (.set-key magic)
+     magic)))

 (defn ->keys [iterators keys len]
   (dotimes [x len]
@@ -103,22 +190,17 @@
     (if (>= ix len)
       (do
         (aset min-fill col least)
-        (let [next (inc col)]
+        (let [next (+ 1 col)]
           (if (< next tuple-len)
             (recur 0 next nil))))
       (let [cur (-> (aget keys ix)
                     (aget col))]
-        (recur (inc ix) col (if (lt cur least)
+        (recur (+ 1 ix) col (if (nilless-lt cur least)
                               cur
                               least))))))

-(let [fill (array)]
-  (find-least #js [#js [0 1 2] #js [nil 1 4] #js [nil 0 3]] 3 3 fill)
-  (find-least #js [#js [0 1 2] #js [8 nil 10] #js [nil 9 10]] 3 3 fill)
-  fill)
-
 (defn find-greatest [iterators keys len results min-fill]
-  (loop [ix 0
+  (loop [ix 1
          greatest (aget keys 0)
          found? true]
     (if (>= ix len)
@@ -127,11 +209,11 @@
           (.push results (fill! (.slice greatest 0) min-fill))
           (.next root)
           (.key root))
-        (fill! (.slice greatest 0) min-fill))
+        (reverse-fill! greatest min-fill))
       (let [comped (filled-key-compare greatest (aget keys ix) min-fill)
             comped-v (or comped greatest)]
-        (println "greatest: " comped-v comped (and found? (not comped)))
-        (recur (inc ix) comped-v (and found? (not comped)))))))
+        ;(println "greatest: " comped-v comped (and found? (not comped)))
+        (recur (+ 1 ix) comped-v (and found? (not comped)))))))

@@ -140,10 +222,9 @@
     (if (< ix len)
       (let [cur (aget iterators ix)
             cur-key (.key cur)]
-        (when (key-lt (fill! (.slice cur-key 0) key) key)
-          (.seek cur key))
+        (.seek cur key)
         (when-not (.-iterator.end? cur)
-          (recur (inc ix))))
+          (recur (+ 1 ix))))
       true)))

 (defn join [iterators]
@@ -153,23 +234,20 @@
         results (array)
         keys (array)
         min-fill (array)
-        tuple-len (alength (.-map (aget iterators 0)))
-        start (let [arr (array)]
-                (dotimes [x tuple-len]
-                  (.push arr false))
-                arr)]
-    (loop [key start
+        tuple-len (alength (.-map (aget iterators 0)))]
+    (->keys iterators keys len)
+    (find-least keys len tuple-len min-fill)
+    (loop [key (find-greatest iterators keys len results min-fill)
            i 10]
       (when (and key (> i 0))
-        (println "key: " key)
         (when (seek-all iterators len key)
           (->keys iterators keys len)
-          (println keys)
           (find-least keys len tuple-len min-fill)
-          (println "Min: " min-fill)
-          (recur (find-greatest iterators keys len results min-fill) (dec i)))))
+          (recur (find-greatest iterators keys len results min-fill) (- i 1)))))
     results
     ))
+
+

 (comment

@@ -208,6 +286,7 @@
         tree2 (tree 10)
         _ (doseq [x [#js [0 3]
                      #js [0 6]
+                     #js [1 3]
                      #js [1 7]]]
             (.assoc! tree2 x 0))
         itr1 (magic-iterator tree1)


s/unifyc/unify/

s/unifyc/unify/

--- src/babel/latin.cljc
+++ src/babel/latin.cljc
@@ -9,7 +9,7 @@
    [clojure.java.io :refer [resource]]
    [clojure.repl :refer [doc]]
    [clojure.tools.logging :as log]
-   [dag_unify.core :refer [fail? get-in strip-refs unifyc]]))
+   [dag_unify.core :refer [fail? get-in strip-refs unify]]))

 (def index-lexicon-on-paths
   [[:synsem :cat]
@@ -90,7 +90,7 @@
         (first (shuffle
                 (filter #(not (fail? %))
                         (map (fn [val]
-                               (unifyc spec val))
+                               (unify spec val))
                              (flatten (vals lexicon))))))]
     (if expr
       (conj {:surface (fo expr)}
@@ -129,10 +129,10 @@

 (defn intersection [spec curriculum model]
   (cond false ;; TODO implement this stub and set to true
-        (unifyc spec
-                ;; e.g. support curriculum was
-                ;; drilling on imperfect, we would have:
-                {:synsem {:sem {:tense :past
+        (unify spec
+               ;; e.g. support curriculum was
+               ;; drilling on imperfect, we would have:
+               {:synsem {:sem {:tense :past
                                :aspect :imperfect}}})
         true
         spec))


whitespace

whitespace

--- src/babel/writer.clj
+++ src/babel/writer.clj
@@ -358,7 +358,6 @@
     (catch Exception e
       (do
         (log/error (str "Exception when truncating lexicon: " e))))))
-

 (defn delete-from-expressions [language spec]
   (try


hex enc/dec: kalium -> commons-codec

hex enc/dec: kalium -> commons-codec

--- src/caesium/util.clj
+++ src/caesium/util.clj
@@ -1,7 +1,7 @@
 (ns caesium.util
   "Internal utilities."
   (:import (java.util Arrays)
-           (org.abstractj.kalium.encoders Encoder)))
+           (org.apache.commons.codec.binary Hex)))

 (defn array-eq
   "Compares two byte arrays for equality.
@@ -10,11 +10,13 @@
   [^bytes a ^bytes b]
   (Arrays/equals a b))

-(defn unhexify [s]
-  (.decode Encoder/HEX s))
+(defn unhexify
+  [^String s]
+  (.decode (Hex.) (.getBytes s)))

-(defn hexify [b]
-  (.encode Encoder/HEX b))
+(defn hexify
+  [b]
+  (Hex/encodeHexString b))

 (defn n->bytes
   "Turns n into a byte array of length len."


Update readers docs.

Update readers docs.

--- src/cavm/readers.clj
+++ src/cavm/readers.clj
@@ -5,16 +5,19 @@
 ;
 ; Readers are split into two parts: a file type detector, and a reader multimethod.
 ; This split is maintained because there is a not a one-to-one relationship between
-; dectecting a file type and having a reader, e.g. we identify all cgdata file types
-; with a single method that reads file type from the json metadata.
-;
-; XXX Note that this strategy opens each file repeatedly to determine its type.
+; detecting a file type and having a reader, e.g. we identify all cgdata file types
+; with a single method that the reads file type from the json metadata.
 ;

 (defmulti reader
-  (fn [filetype url] filetype))
+  (fn [filetype file] filetype))

-(defn detector [& detectors]
+; XXX Note that this strategy opens each file repeatedly to determine its type.
+(defn detector
+  "Returns a function that invokes file type detectors in order
+  until the file is identified, then returns the file type and its
+  registered reader"
+  [& detectors]
   (fn [file]
     (let [file-type (some #(% file) detectors)]
       {:file-type file-type


Go away, x\!

Go away, x\!

--- src/wishlistd/views/wishlist.clj
+++ src/wishlistd/views/wishlist.clj
@@ -1,5 +1,5 @@
 (ns wishlistd.views.wishlist
-  (:require x[wishlistd.models.sql :as model])
+  (:require [wishlistd.models.sql :as model])
   (:use noir.fetch.remotes))

 (def layout (slurp "resources/public/index.html"))


Stub requestAnimationFrame using a JavaScript timeout for compatibility with PhantomJS.

--- src/cljs/c2/dom.cljs
+++ src/cljs/c2/dom.cljs
@@ -1,5 +1,5 @@
 (ns c2.dom
-  (:use-macros [c2.util :only [p]]
+  (:use-macros [c2.util :only [p timeout]]
                [clojure.core.match.js :only [match]]
                [iterate :only [iter]])
   (:require [clojure.string :as string]
@@ -79,9 +79,10 @@
 (defn text [el v]
   (gdom/setTextContent el v))

-(defn request-animation-frame
-  ([cb] (.webkitRequestAnimationFrame js/window cb))
-  ([cb el] (.webkitRequestAnimationFrame js/window cb el)))
+(def request-animation-frame
+  (or (.-requestAnimationFrame js/window)
+      (.-webkitRequestAnimationFrame js/window)
+      #(timeout 10 %)))

 (defn merge-dom!
   "Walks an existing dom-node and makes sure that it has the same attributes and children as the given el."


Needs quotes

Needs quotes

--- src/cljs/go/core.clj
+++ src/cljs/go/core.clj
@@ -314,7 +314,7 @@
    'js/Function "func"})

 (defn js-obj* [kvs]
-  (let [kvs-str (->> (repeat "~{}:~{}")
+  (let [kvs-str (->> (repeat "\"~{}\":~{}")
                      (take (count kvs))
                      (interpose ",")
                      (apply core/str))]


Another IFn note

Another IFn note

--- src/cljs/go/core.clj
+++ src/cljs/go/core.clj
@@ -764,21 +764,12 @@
             ~(with-meta `(fn ~f ~meth) (meta form)))))
      (map #(adapt-proto-params type proto-fn %) meths))))

-;; This generates off-by-one arities, needs fixing.
+;; This generates off-by-one arities, needs fixing. It should also add the missing arities which throws arity.
 (defn add-ifn-methods [type type-sym [f & meths :as form]]
   (let [meths    (map #(adapt-ifn-params type %) meths)
         this-sym (with-meta 'self__ {:tag type})
         argsym   (gensym "args")]
-    (concat
-      ;; [`(set! ~(extend-prefix type-sym 'call) ~(with-meta `(fn ~@meths) (meta form)))
-      ;;  `(set! ~(extend-prefix type-sym 'apply)
-      ;;     ~(with-meta
-      ;;        `(fn ~[this-sym argsym]
-      ;;           (this-as ~this-sym
-      ;;             (.apply (.-call ~this-sym) ~this-sym
-      ;;               (.concat (array ~this-sym) (aclone ~argsym)))))
-      ;;        (meta form)))]
-      (ifn-invoke-methods type type-sym form))))
+    (ifn-invoke-methods type type-sym form)))

 (defn proto-slot-name [fname sig]
   (core/str (-> fname cljs.compiler/munge cljs.compiler/go-public)


Improve documentation for :preserve-frontier

--- src/clojush/args.clj
+++ src/clojush/args.clj
@@ -444,10 +444,10 @@
           ;; been produced since the previous time this was done.

          :preserve-frontier false
-          ;; If truthy, then each child population will be the product of a frontier-preservation
-          ;; process in which individuals are repeatedly selected, without re-selection
-          ;; from the concatenation of the parent population and the children that were
-          ;; produced by the genetic operators.
+          ;; If truthy, then each child population will be replaced, after its errors have
+          ;; been evaluated, with the product of a frontier-preservation process in which
+          ;; individuals are repeatedly selected, without re-selection, from the concatenation
+          ;; of the parent population with the collection of evaluated children.

           ;;----------------------------------------
           ;; Arguments related to the Push interpreter


if-let Clojure macros demonstrated

if-let Clojure macros demonstrated

--- src/zerohedgecl/models/pageM.clj
+++ src/zerohedgecl/models/pageM.clj
@@ -43,7 +43,6 @@

 (defn download-story [reference]
   (let [
-    ;page (slurp (URLDecoder/decode reference))

     page (
       if (= (count (filter #(= (compare (% :reference) reference) 0 ) @stories )) 0)
@@ -110,7 +109,6 @@
  (createMessage

     ;title
-    ;"hgjjhhjghjghj"
     (subs source
       (+
         (.indexOf source ">"
@@ -126,7 +124,6 @@

     ;updated
-    ;"jhgjhgjhghjghj"
     (subs source
       (+
         (.indexOf source " on"
@@ -142,7 +139,6 @@

     ;introduction
-    ;"kjjhkhkjhjkhjk"
     (subs source
       (+
         (.indexOf source " on"
@@ -160,7 +156,6 @@

     ;reference
-    ;"jkhjhkhkjhjk"
     (str
       (URLEncoder/encode
         (subs source
@@ -189,6 +184,31 @@
      (swap! pages #(remove (fn [page] (= (:pageid page) num)) %)))

+(defn download-zerohedge-byid [id]
+  ;(println id)
+  (slurp (str "http://www.zerohedge.com/?page=" id))
+)
+
+(defn check-page-cache-need-refresh [id]
+  (if(
+    or
+      (< (count (filter #(= (compare (% :pageid) id) 0 ) @pages )) 1)
+      (
+        >
+        (t/in-minutes
+          (t/interval
+            (f/parse  (f/formatters :date-hour-minute-second-ms) (.format (java.text.SimpleDateFormat. "yyyy-MM-dd'T'HH:mm:ss.SSS") (:downloaded (first (filter #(= (compare (% :pageid) id) 0 ) @pages ) ))))
+            (f/parse  (f/formatters :date-hour-minute-second-ms) (.format (java.text.SimpleDateFormat. "yyyy-MM-dd'T'HH:mm:ss.SSS") (now)) )
+
+          )
+        )
+        (pagelifetime)
+      )
+    )
+    (download-zerohedge-byid id)
+  )
+)
+
 (defn refresh-page-cache [id array]

   (delete-page-by-number id)
@@ -196,12 +216,21 @@
   (doseq [x array]

      (swap! pages conj
-
-        ;{:pageid pageid :updated "jhkjh"}
         {:pageid id :downloaded (now) :updated (:updated x) :introduction (:introduction x) :title (:title x) :reference (:reference x) }
      )
   )
 )
+
+(defn parse-zerohedge-page [page id]
+  (
+    let [outarr   (take-last (- (count (map get-introduction (str/split page #"
"))) 1)
+      (map get-introduction (str/split page #"
")))
+    ]
+    (refresh-page-cache id outarr)
+    outarr
+  )
+)
+

 (defn loadPage [pageid]
   (let [
@@ -211,80 +240,19 @@
         (Integer. pageid)
         pageid
     )
-    page (
-      if (
-        or
-          (< (count (filter #(= (compare (% :pageid) id) 0 ) @pages )) 1)
-          (
-            >
-            (t/in-minutes
-              (t/interval
-                (f/parse  (f/formatters :date-hour-minute-second-ms) (.format (java.text.SimpleDateFormat. "yyyy-MM-dd'T'HH:mm:ss.SSS") (:downloaded (first (filter #(= (compare (% :pageid) id) 0 ) @pages ) ))))
-                (f/parse  (f/formatters :date-hour-minute-second-ms) (.format (java.text.SimpleDateFormat. "yyyy-MM-dd'T'HH:mm:ss.SSS") (now)) )
-
-              )
-            )
-            (pagelifetime)
-          )
-        )
-        (slurp (str "http://www.zerohedge.com/?page=" id))
+    ]
+
+    (if-let [
+      page (check-page-cache-need-refresh id)
+        ]
+
+
+        (if-let [outarr
+                    (parse-zerohedge-page page id)
+          ]
+          outarr)
+        (reverse(filter #(= (compare (% :pageid) id) 0 ) @pages ))

     )
-
-
-    outarr (into []
-        (
-
-
-          if (
-            or
-              (< (count (filter #(= (compare (% :pageid) id) 0 ) @pages )) 1)
-              (
-                >
-                (t/in-minutes
-                  (t/interval
-                    (f/parse  (f/formatters :date-hour-minute-second-ms) (.format (java.text.SimpleDateFormat. "yyyy-MM-dd'T'HH:mm:ss.SSS") (:downloaded (first (filter #(= (compare (% :pageid) id) 0 ) @pages ) ))))
-                    (f/parse  (f/formatters :date-hour-minute-second-ms) (.format (java.text.SimpleDateFormat. "yyyy-MM-dd'T'HH:mm:ss.SSS") (now)) )
-
-                  )
-                )
-                (pagelifetime)
-              )
-            )
-              (take-last (- (count (map get-introduction (str/split page #"
"))) 1)
-                (map get-introduction (str/split page #"
")))
-              (reverse(filter #(= (compare (% :pageid) id) 0 ) @pages ))
-
-        )
-
-      )
-
-    ]
-
-
-    (
-      if (or
-           ( < (count (filter #(= (compare (% :pageid) id) 0 ) @pages )) 5)
-           (
-            >
-            (t/in-minutes
-              (t/interval
-                (f/parse  (f/formatters :date-hour-minute-second-ms) (.format (java.text.SimpleDateFormat. "yyyy-MM-dd'T'HH:mm:ss.SSS") (:downloaded (first (filter #(= (compare (% :pageid) id) 0 ) @pages ) ))))
-                (f/parse  (f/formatters :date-hour-minute-second-ms) (.format (java.text.SimpleDateFormat. "yyyy-MM-dd'T'HH:mm:ss.SSS") (now)) )
-
-              )
-            )
-            (pagelifetime)
-           )
-        )
-
-        (
-          refresh-page-cache id outarr
-        )
-    )
-
-
-    outarr
-
-    )
+  )
 )


use let-bound dbdir instead of recalculating

--- test/mirthsync/fixture_tools.clj
+++ test/mirthsync/fixture_tools.clj
@@ -72,7 +72,7 @@
     (let [dbdir (mirth-db-dir mirth)]
       (and (clojure.string/ends-with? dbdir "mirthdb")
            (= 0 @(:exit-code (system-test "-d" dbdir {:throw false :verbose true})))
-           (rm "-f" "-v" "--preserve-root=all" "--one-file-system" "-r" (mirth-db-dir mirth))))))
+           (rm "-f" "-v" "--preserve-root=all" "--one-file-system" "-r" dbdir)))))

 ;;;; A couple of helper functions to track the flow of
 ;;;; tracking the flow and outcomes


add test for cursor variadic swap!

add test for cursor variadic swap!

--- test/reagenttest/testcursor.cljs
+++ test/reagenttest/testcursor.cljs
@@ -336,6 +336,12 @@
     (is (= (get-in @test-atom [])
            {:z 3}))

+    (reset! test-cursor {}) ;; empty map
+    (swap! test-cursor assoc :x 1 :y 2 :z 3 :w)
+    (is (= @test-cursor {:x 1 :y 2 :z 3 :w nil}))
+    (is (= (get-in @test-atom [:a :b :c :d])
+           {:x 1 :y 2 :z 3 :w nil}))
+
     (is (= runs (running)))))


Refactor results component.

Refactor results component.

--- src/cljs/clj_templates/pages/templates/page.cljs
+++ src/cljs/clj_templates/pages/templates/page.cljs
@@ -43,20 +43,22 @@
      (for [page (range 1 (inc page-count))]
        ^{:key page} [pagination-link page current-page-index])]))

+(defn error-message [query-string]
+  [:div.results-for (str "Something went wrong when getting templates for \"" query-string "\"")])
+
+(defn no-results-message [query-string]
+  [:div.results-for (str "No results for \"" query-string "\"")])
+
+(defn templates-listing [templates]
+  [:div.templates-listing
+   (for [{:keys [template-name build-system] :as template} templates]
+     ^{:key (str template-name build-system)} [template-panel template])])
+
 (defn results [templates query-string error?]
   (cond
-    error?
-    [:div.results-for (str "Something went wrong when getting templates for \"" query-string "\"")]
-
-    ;; No error, templates returned
-    (seq templates)
-    [:div.templates-listing
-     (for [{:keys [template-name build-system] :as template} templates]
-       ^{:key (str template-name build-system)} [template-panel template])]
-
-    ;; No templates, string is not blank
-    (not (str/blank? query-string))
-    [:div.results-for (str "No results for \"" query-string "\"")]))
+    error? [error-message query-string]
+    (seq templates) [templates-listing templates]
+    (not (str/blank? query-string)) [no-results-message query-string]))

 (defn results-for-text [templates query-string hit-count]
   (when (seq templates)


don't throw exception for underspecified morphology since this situation can happen when debug-logging generation

--- src/babel/italiano/morphology.cljc
+++ src/babel/italiano/morphology.cljc
@@ -125,18 +125,11 @@
                       (get-string-1 (get-in word [:b]))])

     (and (= :verb (get-in word [:cat]))
-         (= :top (get-in word [:infl])))
+         (= :top (get-in word [:infl] :top)))
     (get-in word [:italiano])

     (= :verb (get-in word [:cat]))
-    (let [conjugated (verbs/conjugate word)]
-      (if (or (nil? conjugated) (empty? conjugated))
-        (let [message (str "failed to conjugate verb: "
-                           (dag_unify.core/strip-refs word))
-              pprint (println (clojure.pprint/pprint (dag_unify.core/strip-refs word)))]
-          (log/error message
-                     (throw (Exception. message))))
-        conjugated))
+    (or (verbs/conjugate word) (get-in word [:italiano]))

     (and (not (= ::none (get-in word [:a] ::none)))
          (not (= ::none (get-in word [:b] ::none))))


explicitly qualify merge so that dag_unify.core/merge can be identified and later removed

--- src/babel/italiano/morphology.cljc
+++ src/babel/italiano/morphology.cljc
@@ -1,5 +1,5 @@
 (ns babel.italiano.morphology
-  (:refer-clojure :exclude [get-in merge resolve])
+  (:refer-clojure :exclude [get-in resolve])
   (:require
    [babel.pos :refer (noun)]
    [babel.italiano.morphology.adjectives :as adjectives]
@@ -20,7 +20,7 @@
    [clojure.string :refer (trim)]
    #?(:clj [clojure.tools.logging :as log])
    #?(:cljs [babel.logjs :as log])
-   [dag_unify.core :refer (copy dissoc-paths fail? get-in merge ref? unifyc)]))
+   [dag_unify.core :refer (copy dissoc-paths fail? get-in ref? unifyc)]))

 ;; TODO: convert all morphology rules to this format used for prepositions:
 (def preposition-plus-article
@@ -637,8 +637,8 @@
         (str infinitive )

         :else
-        (merge word
-               {:error 1})))
+        (clojure.core/merge word
+                            {:error 1})))

      (and
       (get-in word '(:a))
@@ -1429,7 +1429,7 @@
                                                    (if (not (= :none (get-in lexeme path :none)))
                                                      (do (log/debug (str (first lexeme-kv) " generating lexeme exceptional surface form: " (surface-form-fn lexeme)))
                                                          (list {(surface-form-fn lexeme)
-                                                                (merge
+                                                                (dag_unify.core/merge
                                                                  lexeme
                                                                  (unifyc (merge-fn lexeme)
                                                                          {:italiano {:infinitive (get-in lexeme [:italiano :italiano])


s/()/[]/

s/()/[]/

--- src/babel/italiano/morphology.cljc
+++ src/babel/italiano/morphology.cljc
@@ -111,16 +111,16 @@
   (let [person (get-in word '(:agr :person))
         number (get-in word '(:agr :number))]
     (cond
-      (and (string? (get-in word '(:a)))
-           (string? (get-in word '(:b))))
-      (get-string (get-in word '(:a))
-                  (get-in word '(:b)))
-      (and (string? (get-in word '(:a)))
-           (map? (get-in word '(:b))))
-      (get-string (get-in word '(:a))
-                  (get-in word '(:b)))
-      (and (map? (get-in word '(:a)))
-           (map? (get-in word '(:b))))
+      (and (string? (get-in word [:a]))
+           (string? (get-in word [:b])))
+      (get-string (get-in word [:a])
+                  (get-in word [:b]))
+      (and (string? (get-in word [:a]))
+           (map? (get-in word [:b])))
+      (get-string (get-in word [:a])
+                  (get-in word [:b]))
+      (and (map? (get-in word [:a]))
+           (map? (get-in word [:b])))
       (get-string
        (get-string (get-in word [:a]))
        (get-string (get-in word [:b])))
@@ -138,10 +138,10 @@
       ;; that look in :a and :b. Either remove those following rules
       ;; if they are redundant and not needed, or move this general rule
       ;; below the following rules.
-      (and (not (= :none (get-in word '(:a) :none)))
-           (not (= :none (get-in word '(:b) :none))))
-      (get-string (get-in word '(:a))
-                  (get-in word '(:b)))
+      (and (not (= :none (get-in word [:a] :none)))
+           (not (= :none (get-in word [:b] :none))))
+      (get-string (get-in word [:a])
+                  (get-in word [:b]))

       (and
        (string? (get-in word '(:a :italiano)))
@@ -153,12 +153,12 @@
            " "
            (string/trim (get-in word '(:b :italiano))))
       (and
-       (string? (get-in word '(:a)))
+       (string? (get-in word [:a]))
        (string? (get-in word '(:b :italiano)))
        (or (= :none (get-in word '(:b :agr :number) :none))
            (= :top (get-in word '(:b :agr :number) :none)))
        )
-      (str (string/trim (get-in word '(:a)))
+      (str (string/trim (get-in word [:a]))
            " "
            (string/trim (get-in word '(:b :italiano))))
       (and
@@ -168,7 +168,7 @@
            (= :top (get-in word '(:b :agr :number) :none)))
        (= (get-in word '(:a :infl)) :top))
       (string/trim (str (get-in word '(:a :italiano))
-                        " " (get-string-1 (get-in word '(:b)))))
+                        " " (get-string-1 (get-in word [:b]))))

       ;; TODO: all of the rules that handle exceptions should be removed:
       ;; exceptions are dealt with at compile-time now, via babel.italiano.morphology/exception-generator
@@ -299,11 +299,11 @@
       (get-in word '(:italiano))

       (and
-       (get-in word '(:a))
-       (get-in word '(:b)))
+       (get-in word [:a])
+       (get-in word [:b]))
       (str
-       (trim (get-string-1 (get-in word '(:a)))) " "
-       (trim (get-string-1 (get-in word '(:b)))))
+       (trim (get-string-1 (get-in word [:a]))) " "
+       (trim (get-string-1 (get-in word [:b]))))

      (and
       (string? (get-in word '(:italiano)))
@@ -318,25 +318,25 @@
      (str (get-in word '(:italiano)))

      (and
-      (get-in word '(:a))
-      (get-in word '(:b)))
+      (get-in word [:a])
+      (get-in word [:b]))
      (get-string
-      (get-in word '(:a))
-      (get-in word '(:b)))
-
-     (= (get-in word '(:a)) :top)
+      (get-in word [:a])
+      (get-in word [:b]))
+
+     (= (get-in word [:a]) :top)
      (str
-      ".." " " (get-string-1 (get-in word '(:b))))
+      ".." " " (get-string-1 (get-in word [:b])))

      (and
-      (= (get-in word '(:b)) :top)
-      (string? (get-string-1 (get-in word '(:a)))))
+      (= (get-in word [:b]) :top)
+      (string? (get-string-1 (get-in word [:a]))))
      (str
-      (get-string-1 (get-in word '(:a)))
+      (get-string-1 (get-in word [:a]))
       " " "..")

      (and
-      (= (get-in word '(:b)) :top)
+      (= (get-in word [:b]) :top)
       (string? (get-in word '(:a :italiano))))
      (str
       (get-string-1 (get-in word '(:a :italiano)))
@@ -374,10 +374,10 @@
      (get-in word '(:italiano))

      (or
-      (not (= :none (get-in word '(:a) :none)))
-      (not (= :none (get-in word '(:b) :none))))
-     (get-string (get-in word '(:a))
-                 (get-in word '(:b)))
+      (not (= :none (get-in word [:a] :none)))
+      (not (= :none (get-in word [:b] :none))))
+     (get-string (get-in word [:a])
+                 (get-in word [:b]))

      (and (map? word)
           (nil? (:italiano word)))


Remove TODO notes

Remove TODO notes

--- src/braid/client/quests/views.cljs
+++ src/braid/client/quests/views.cljs
@@ -46,12 +46,3 @@
         "Quests"]
        [quests-menu-view]])))

-; TODO
-; don’t have all of them displayed at the beginning
-; notify when a task is completed
-; notify when a new task added
-; show overall progress
-; show instructions when click show-me
-; update descriptions
-; update listeners
-; consider requiring multiple of certain actions (and have progress)


Refactoring

Refactoring

--- src/clj/algorithms_clj/huffman.clj
+++ src/clj/algorithms_clj/huffman.clj
@@ -71,7 +71,10 @@
 (defn encode
   "Encode a stream, using the stream frequences to build the huffman tree"
   [values]
-  (encode-with (tree->decoder (make-tree (frequencies values))) values))
+  (-> (frequencies values)
+      (make-tree)
+      (tree->decoder)
+      (encode-with values)))

 ;; -----------------------------------------------------------


Remove an unused protocol

Remove an unused protocol

--- src/clj/momentum/core/deferred.clj
+++ src/clj/momentum/core/deferred.clj
@@ -14,28 +14,6 @@
    [java.io
     Writer]))

-(defprotocol DeferredValue
-  (receive   [_ success error]))
-
-(extend-protocol DeferredValue
-  Async
-  (receive [val success error]
-    (doto val
-      (.receive
-       (reify Receiver
-         (success [_ val] (success val))
-         (error   [_ err] (error err))))))
-
-  Object
-  (receive [o success _]
-    (success o)
-    o)
-
-  nil
-  (receive [_ success _]
-    (success nil)
-    nil))
-
 (defprotocol DeferredRealizer
   (put [_ v])
   (abort [_ err]))


Get printing working after a return value

Thanks @cemerick! refs #49

--- src/clj/reply/eval_modes/nrepl.clj
+++ src/clj/reply/eval_modes/nrepl.clj
@@ -18,23 +18,28 @@
     "INT"
     (fn [sig] (print "^C") (flush)
       (when-let [command-id @current-command-id]
-        (client {:op "interrupt" :session @current-session :interrupt-id command-id})))))
+        (client {:op "interrupt"
+                 :session @current-session
+                 :interrupt-id command-id})))))

 (defn execute-with-client [client options form]
   (let [command-id (nrepl.misc/uuid)
         session (or (:session options) @current-session)
-        response-seq (nrepl/message client {:op "eval" :code form :id command-id :session session})]
+        session-sender (nrepl/client-session client :session session)
+        response-seq (session-sender {:op "eval" :code form :id command-id})]
     (reset! current-command-id command-id)
     (doall (for [{:keys [ns value out err] :as res}
-                   (take-while #(not (some #{"done" "interrupted" "error"} (:status %)))
-                               response-seq)]
+                   (#'nrepl/take-until
+                     #(and (= command-id (:id %))
+                           (some #{"done" "interrupted" "error"} (:status %)))
+                                     response-seq)]
       (do
         (when (some #{"need-input"} (:status res))
           (.readLine *in*) ; pop off leftover newline from pushback
           (let [input-result (.readLine *in*)]
-            (nrepl/message client
+            (session-sender
               {:op "stdin" :stdin (str input-result "\n")
-               :id (nrepl.misc/uuid) :session session})))
+               :id (nrepl.misc/uuid)})))
         (when value ((:value options print) value))
         (when out ((:out options print) out))
         (when err ((:err options print) err))
@@ -123,10 +128,12 @@
                client
                options
                (pr-str (list 'do
-                         (reply.initialization/export-definition 'reply.signals/set-signal-handler!)
+                         (reply.initialization/export-definition
+                           'reply.signals/set-signal-handler!)
                          '(set-signal-handler! "INT" (fn [s]))
                          (reply.initialization/construct-init-code options)
                          nil)))

       (handle-client-interruption! client)
       (run-repl client options))))
+


Skip unnecessary newlines when hitting only Enter

--- src/clj/reply/eval_modes/nrepl.clj
+++ src/clj/reply/eval_modes/nrepl.clj
@@ -56,6 +56,7 @@
           (flush)
           (when (and ns (not (:session options)))
             (reset! current-ns ns)))))
+    (when (:interactive options) (println))
     (reset! current-command-id nil)
     @current-ns))

@@ -64,7 +65,6 @@
   ([connection {:keys [prompt] :as options}]
     (let [{:keys [major minor incremental qualifier]} *clojure-version*]
       (loop [ns (execute-with-client connection options "")]
-        (println)
         (prompt ns)
         (flush)
         (let [eof (Object.)
@@ -83,7 +83,7 @@
                 :else
                   (recur (execute-with-client
                            connection
-                           options
+                           (assoc options :interactive true)
                            (binding [*print-meta* true]
                              (pr-str read-result))))))))))


Allow arbitrary options to interactive evals.

--- src/clj/reply/eval_modes/nrepl.clj
+++ src/clj/reply/eval_modes/nrepl.clj
@@ -75,8 +75,8 @@
         session (or (:session options) @current-session)
         session-sender (nrepl/client-session client :session session)
         message-to-send (let [msg {:op "eval" :code form :id command-id}]
-                          (if-let [renderer (:nrepl-renderer options)]
-                            (assoc msg :renderer renderer)
+                          (if-let [eval-options (:nrepl-interactive-eval-options options)]
+                            (merge eval-options msg)
                             msg))
         read-input-line-fn (:read-input-line-fn options)]
     (session-sender message-to-send)


Throw in case of :parallel-build

Throw in case of :parallel-build

--- src/cljs/bundled/lumo/closure.cljs
+++ src/cljs/bundled/lumo/closure.cljs
@@ -852,7 +852,9 @@
    (compile-sources inputs (:compiler-stats opts) opts))
   ([inputs compiler-stats opts]
    (if (:parallel-build opts)
-     nil ;; (parallel-compile-sources inputs compiler-stats opts)
+     ;; (parallel-compile-sources inputs compiler-stats opts)
+     (throw
+      (ex-info (str "Invalid option :parallel-build - not yet supported") {}))
      (util/measure compiler-stats
        "Compile sources"
        (binding [comp/*inputs* (zipmap (map :ns inputs) inputs)]


Refactor out some of the more monstrous functions. Add some hopefully helpful documentation

--- src/cljs/mandelbrot_cljs/core.cljs
+++ src/cljs/mandelbrot_cljs/core.cljs
@@ -10,12 +10,12 @@
 (def overlay-context (.getContext overlay-canvas "2d"))

 (def initial-rendering-data
-  {:escape-radius  10000
-   :scale          350 ; How many pixels a distance of 1 in the complex plane takes up
+  {:scale          350 ; How many pixels a distance of 1 in the complex plane takes up
    :x0             -3
    :y0             1.2})

-(defonce app-state (atom {:rendering-data initial-rendering-data}))
+(defonce app-state (atom {:escape-radius 10000
+                          :rendering-data initial-rendering-data}))

 (defn reset-rendering-data!
   "Resets the rendering data to the original (i.e. reset the zoom)
@@ -34,7 +34,8 @@
   (aset overlay-canvas "height"(.-innerHeight js/window)))

 (defn render-mandelbrot!
-  [{:keys [scale x0 y0 escape-radius] :as render-state}]
+  [{escape-radius                          :escape-radius
+    {:keys [scale x0 y0] :as render-state} :rendering-data}]

   (println render-state)

@@ -73,13 +74,13 @@

     (.log js/console "Done in: " (int (* 1000 (/ (* height width)  (- (.getTime (js/Date.)) start)))) "px/s")))

-(set! (.-onresize js/window) (fn [] (render-mandelbrot! (:rendering-data @app-state))))
+(set! (.-onresize js/window) (fn [] (render-mandelbrot! @app-state)))

 (add-watch app-state :state-changed
            (fn [_ _ old-state new-state]
              (when-not (= (:rendering-data old-state)
                           (:rendering-data new-state))
-               (render-mandelbrot! (:rendering-data new-state)))))
+               (render-mandelbrot! new-state))))

 (defn add-overlay-rectangle!
   "Adds a rectangle to the overlay canvas (and optionally clears all other rectangles)"
@@ -109,57 +110,65 @@
                                           :color "green"))))

+(defn zoom-to-enclose-rectangle!
+  "Returns a new rendering-data map to zoom the view of the mandelbrot to enclose a given
+  rectangle in the current screen. If the aspect ratio of the given rectangle
+  is not the same as that of the screen, it centers the given rectangle in the
+  screen (hard to explain.. imagine I've drawn a really nice picture of this here)"
+  [{:keys [scale] old-x0 :x0 old-y0 :y0} rect-x0 rect-y0 rect-x1 rect-y1]
+  (let [width            (aget canvas "width")
+        height           (aget canvas "height")

-(set! (.-onmouseup overlay-canvas) (fn [e]
-                                     (swap! app-state
-                                            (fn [{:keys [mousedown-event rendering-data] :as old-state}]
-                                              (let [scale            (:scale rendering-data)
+        portrait?        (< (- rect-x1 rect-x0) (- rect-y1 rect-y0))

-                                                    old-x0           (:x0 rendering-data)
-                                                    old-y0           (:y0 rendering-data)
+        new-scale        (if portrait?
+                           (/ height (/ (- rect-y1 rect-y0) scale))
+                           (/ width (/ (- rect-x1 rect-x0) scale)))

-                                                    start-x          (aget mousedown-event "pageX")
-                                                    start-y          (aget mousedown-event "pageY")
-                                                    finish-x         (aget e "pageX")
-                                                    finish-y         (aget e "pageY")
+        new-aspect-ratio (/ (- rect-x1 rect-x0) (- rect-y1 rect-y0))

-                                                    width            (aget canvas "width")
-                                                    height           (aget canvas "height")
+        padding          (* 0.5
+                            (if portrait?
+                              (- width (* height new-aspect-ratio))
+                              (- height (/ width new-aspect-ratio))))

-                                                    portrait?        (< (- finish-x start-x) (- finish-y start-y))
+        new-x0           (if portrait?
+                           (- (+ old-x0 (/ rect-x0 scale))
+                              (/ padding new-scale))

-                                                    new-scale        (if portrait?
-                                                                       (/ height (/ (- finish-y start-y) scale))
-                                                                       (/ width (/ (- finish-x start-x) scale)))
+                           (+ old-x0 (/ rect-x0 scale)))

-                                                    new-aspect-ratio (/ (- finish-x start-x)
-                                                                        (- finish-y start-y))
+        new-y0           (if portrait?
+                           (- old-y0 (/ rect-y0 scale))

-                                                    padding          (* 0.5
-                                                                        (if portrait?
-                                                                          (- width (* height new-aspect-ratio))
-                                                                          (- height (/ width new-aspect-ratio))))
+                           (+ (- old-y0 (/ rect-y0 scale))
+                              (/ padding new-scale)))]

-                                                    new-x0           (if portrait?
-                                                                       (- (+ old-x0 (/ start-x scale))
-                                                                          (/ padding new-scale))
-
-                                                                       (+ old-x0 (/ start-x scale)))
-
-                                                    new-y0           (if portrait?
-                                                                       (- old-y0 (/ start-y scale))
-
-                                                                       (+ (- old-y0 (/ start-y scale))
-                                                                          (/ padding new-scale)))]
-                                                (-> old-state
-                                                    (assoc-in [:rendering-data :x0] new-x0)
-                                                    (assoc-in [:rendering-data :y0] new-y0)
-                                                    (assoc-in [:rendering-data :scale] new-scale)
-
-                                                    (dissoc :mousedown-event)))))))
+    {:x0 new-x0
+     :y0 new-y0
+     :scale new-scale}))

-(render-mandelbrot! (:rendering-data @app-state))
+(defn handle-mouseup
+  "On mouseup, we zoom the mandelbrot to the specified box and remove the
+   :mousedown-event key from the app-state"
+  [e]
+  (swap! app-state
+         (fn [{:as old-state :keys [mousedown-event]}]
+
+           (let [x1 (aget e "pageX")
+                 y1 (aget e "pageY")
+                 x0 (aget mousedown-event "pageX")
+                 y0 (aget mousedown-event "pageY")]
+
+             (-> old-state
+                 (dissoc :mousedown-event)
+                 (update-in [:rendering-data] zoom-to-enclose-rectangle! x0 y0 x1 y1))))))
+
+(set! (.-onmouseup overlay-canvas) handle-mouseup)
+
+
+(render-mandelbrot! @app-state)

 (defn on-js-reload
   "A figwheel thing"


specs for the board

specs for the board

--- src/cljs/triboard/logic/board.cljs
+++ src/cljs/triboard/logic/board.cljs
@@ -75,6 +75,14 @@
 (s/fdef new-board
   :ret ::board)

+(s/fdef convert-cell
+  :args (s/cat :board ::board :coord ::coord :owner ::player/player)
+  :ret ::board)
+
+(s/fdef get-owner-at
+  :args (s/cat :board ::board :coord ::coord)
+  :ret ::player/player)
+
 (s/fdef to-seq
   :args (s/cat :board ::board)
   :ret (s/every (s/tuple ::coord ::player/cell)))


ring-servlet: removed the newline at the end of the response body

--- ring-servlet/src/ring/util/servlet.clj
+++ ring-servlet/src/ring/util/servlet.clj
@@ -75,7 +75,7 @@
   (cond
     (string? body)
       (with-open [writer (.getWriter response)]
-        (.println writer body))
+        (.print writer body))
     (seq? body)
       (with-open [writer (.getWriter response)]
         (doseq [chunk body]


Add logging...this version has hints about what's going on. I think it's actually choking on a final nil message

--- src/frereth_server/auth_socket.clj
+++ src/frereth_server/auth_socket.clj
@@ -8,7 +8,9 @@

 (defn- log [msg]
   "FIXME: Debug only.
-Really?"
+Q: Really?
+A: Well, if nothing else, this is mostly useless. Desperately need something
+that resembles real logging."
   (spit "/tmp/log.txt" (str msg)))

 (defn- read-message [s]
@@ -44,27 +46,40 @@
 (defmethod dispatch "dieDieDIE!!"
   [_]
   ;; Really just a placeholder message indicting that it's OK to quit
+  (log "Quit permission")
   "K")

 (defmethod dispatch "ping"
   [_]
+  (log "Heartbeat")
   "pong")

 (defmethod dispatch :list [msgs]
   ;; Based on the next line, I have something like a Vector of byte arrays.
   ;; Which seems pretty reasonable.
   (log msgs)
+  (log "\n(that's some sort of SEQ of messages)")

-  ;; What are the odds that I can call a method this way?
+  ;; Q: What are the odds that I can call a method this way?
   (comment (dorun dispatch msgs))
   ;; That's failing. Then again, so is this:
   (print "Dispatching a sequence of messages: " msgs)
+  ;; Well, at least, I'm not seeing any output there.
   ;; Apparently, expectations redirects STDOUT
   ;;(throw (RuntimeException. "Why didn't that show up?"))
-  (dorun #(dispatch %) msgs)
+
+  ;; This fails in the same way: cannot convert a MultiFn to a java.lang.Number:
+  (comment (dorun #(dispatch %) msgs))
   ;; Or possibly my real problem is laziness?
   (comment (for [m msgs]
-             (throw (RuntimeException. (str m))))))
+             (throw (RuntimeException. (str m)))))
+  (if-let [car (first msgs)]
+    (do
+      (log car)
+      (dispatch (rest msgs)))
+    (do
+      (log (str "Empty CAR. CDR: " (rest msgs)))))
+  (throw (RuntimeException. (str (first msgs)))))

 (defmethod dispatch :default
   [echo]
@@ -151,7 +166,7 @@
               (log (str "REQUEST: " (doall request)))
               (doseq [msg request]
                 (log msg))
-              (throw (RuntimeException. "WTF?"))
+              (comment (throw (RuntimeException. "WTF?")))
               (let [response (dispatch request)]
                 (send-message listener response)))
             (throw (RuntimeException. "How'd we get here?"))))


Improve updating of sensor_metadata for calcs.

--- src/kixi/hecuba/data/calculate.clj
+++ src/kixi/hecuba/data/calculate.clj
@@ -112,10 +112,11 @@
             new-type                    (ext-type type)
             calculated                  (diff-seq measurements)
             page-size                   10
-            {:keys [min-date max-date]} (measurements/insert-measurements store {:device_id device_id :type new-type}
-                                                                          page-size calculated)]
-        (db/with-session [session (:hecuba-session store)]
-          (sensors/update-sensor-metadata session sensor min-date max-date))))))
+            calculated-sensor           {:device_id device_id :type new-type}]
+        (when calculated
+          (measurements/insert-measurements store calculated-sensor page-size calculated)
+          (db/with-session [session (:hecuba-session store)]
+            (sensors/update-sensor-metadata session calculated-sensor (:start-date range) (:end-date range))))))))

 (defn kWh->co2
   "Converts measurements from kWh to co2."
@@ -130,11 +131,12 @@
                                       convert)
         page-size                10]
     (when calculated
-      (let [{:keys [min-date max-date]} (measurements/insert-measurements store
-                                                                          {:device_id device_id :type new-type}
+      (let [calculated-sensor {:device_id device_id :type new-type}
+            {:keys [min-date max-date]} (measurements/insert-measurements store
+                                                                          calculated-sensor
                                                                           page-size calculated)]
         (db/with-session [session (:hecuba-session store)]
-          (sensors/update-sensor-metadata session sensor min-date max-date))))))
+          (sensors/update-sensor-metadata session calculated-sensor (:start-date range) (:end-date range)))))))

 (defn gas-volume->kWh
   "Converts measurements from m^3 and ft^3 to kWh."
@@ -149,11 +151,10 @@
                                       convert)
         page-size                10]
     (when calculated
-      (let [{:keys [min-date max-date]} (measurements/insert-measurements store
-                                                                          {:device_id device_id :type new-type}
-                                                                          page-size calculated)]
+      (let [calculated-sensor {:device_id device_id :type new-type}]
+        (measurements/insert-measurements store calculated-sensor page-size calculated)
         (db/with-session [session (:hecuba-session store)]
-          (sensors/update-sensor-metadata session sensor min-date max-date))))))
+          (sensors/update-sensor-metadata session calculated-sensor (:start-date range) (:end-date range)))))))

 ;;;;;;;;;;; Rollups of measurements ;;;;;;;;;

@@ -435,11 +436,11 @@
                  sensor                        {:device_id device_id :type new-type}
                  calculated                    (compute-datasets-using-field operation device_id new-type measurements field-value)
                  {:keys [start-date end-date]} range
-                 page-size                     10
-                 {:keys [min-date max-date]}   (measurements/insert-measurements store sensor page-size calculated)]
-
-             (db/with-session [session (:hecuba-session store)]
-               (sensors/update-sensor-metadata session sensor min-date max-date))
+                 page-size                     10]
+             (when calculated
+               (measurements/insert-measurements store sensor page-size calculated)
+               (db/with-session [session (:hecuba-session store)]
+                 (sensors/update-sensor-metadata session sensor (:start-date range) (:end-date range))))
              (log/info "Finished calculation for operands: " operands "and operation: " operation))
            (log/info "There are not enough data to calculate.")))))
   ([store ds sensors range]
@@ -457,10 +458,11 @@
                    sensor                        {:device_id device_id :type new-type}
                    calculated                    (apply compute-datasets operation device_id new-type padded)
                    {:keys [start-date end-date]} range
-                   page-size                     10
-                   {:keys [min-date max-date]}  (measurements/insert-measurements store sensor page-size calculated)]
-               (db/with-session [session (:hecuba-session store)]
-                 (sensors/update-sensor-metadata session sensor min-date max-date))
+                   page-size                     10]
+               (when calculated
+                 (measurements/insert-measurements store sensor page-size calculated)
+                 (db/with-session [session (:hecuba-session store)]
+                   (sensors/update-sensor-metadata session sensor (:start-date range) (:end-date range))))
                (log/info "Finished calculation for operands: " operands "and operation: " operation))
              (log/info "Sensors do not have enough measurements to calculate.")))
          (log/info "Sensors do not meet requirements for calculation.")))))


improved regex

improved regex

--- iwaswhere-web/src/cljs/iwaswhere_web/ui/entry/capture.cljs
+++ iwaswhere-web/src/cljs/iwaswhere_web/ui/entry/capture.cljs
@@ -48,7 +48,7 @@
               (when-not value
                 (when (and (= input-type :number) edit-mode?)
                   (let [p1 (-> (:md entry) (s/split tag) first)
-                        last-n (last (re-seq #"\d+" p1))]
+                        last-n (last (re-seq #"[0-9]*\.?[0-9]+" p1))]
                     (when last-n
                       (let [updated (assoc-in entry path (js/parseFloat last-n))]
                         (put-fn [:entry/update-local updated]))))))


more refactoring

more refactoring

--- src/main/clojure/org/dada/core.clj
+++ src/main/clojure/org/dada/core.clj
@@ -393,11 +393,8 @@
 ;;----------------------------------------

 (defn make-reducer
-  [#^Model src-model #^Object key-key #^Collection key-values #^Reducer$Strategy strategy #^Metadata tgt-metadata name-fn]
-  ;;[#^Model src-model #^Collection key-keys #^Collection key-values #^Reducer$Strategy strategy #^Metadata tgt-metadata name-fn]
-  (let [key-keys (Tuple. key-key)
-	key-name (apply str (interpose "," key-keys))
-	view-name (str (.getName src-model) "." (name-fn key-name))]
+  [#^String name-prefix #^Object reduction-key #^Collection key-values #^Reducer$Strategy strategy #^Metadata tgt-metadata name-fn]
+  (let [view-name (str name-prefix "." (name-fn reduction-key))]
     (Reducer. view-name tgt-metadata key-values strategy)))

 ;; sum specific stuff - should be in its own file
@@ -442,7 +439,7 @@
   ([#^Model model #^Keyword attribute-key attribute-type attribute-value #^Metadata tgt-metadata]
    (let [strategy (make-sum-reducer-strategy attribute-key (.getMetadata model) tgt-metadata)
 	 view-name-fn #(str "sum(" % ")")
-	 reducer (make-reducer model attribute-key [attribute-value] strategy tgt-metadata view-name-fn)]
+	 reducer (make-reducer (.getName model) attribute-key [attribute-value] strategy tgt-metadata view-name-fn)]
      (connect model reducer)))
   )

@@ -475,7 +472,7 @@
 (defn do-reduce-count [#^Model model #^Collection values #^Metadata tgt-metadata count-key]
   (let [strategy (make-count-reducer-strategy (.getMetadata model) tgt-metadata)
 	view-name-fn (fn [arg] "count()")]
-    (make-reducer model count-key values strategy tgt-metadata view-name-fn)))
+    (make-reducer (.getName model) count-key values strategy tgt-metadata view-name-fn)))

 ;;----------------------------------------
 ;; refactored to here


good one

good one

--- src/epicea/utils.clj
+++ src/epicea/utils.clj
@@ -7,8 +7,8 @@
 (defn compute-matrix-index [sizes indices]
   (assert (count sizes)
           (count indices))
-  (loop [S sizes
-         I indices
+  (loop [S (vec sizes)
+         I (vec indices)
          i 0]
     (if (empty? I)
       i


Use advanced optimizations on build script.

--- scripts/build.clj
+++ scripts/build.clj
@@ -9,7 +9,7 @@
     :output-to "out/tests.js"
     :output-dir "out"
     :target :nodejs
-    :optimizations :none
+    :optimizations :advanced
     :pretty-print true
     :language-in  :ecmascript5
     :language-out :ecmascript5


getting db first time setup to work

getting db first time setup to work

--- server/src/gratefulplace/db/manage.clj
+++ server/src/gratefulplace/db/manage.clj
@@ -9,9 +9,13 @@
   []
   (d/create-database db/*db-uri*))

+(defn delete
+  []
+  (d/delete-database db/*db-uri*))
+
 (defn recreate
   []
-  (d/delete-database db/*db-uri*)
+  (delete)
   (create))

 (defn load-schema
@@ -27,4 +31,4 @@
 (defn setup
   []
   (if (create)
-    (load-schema)))+    (doall (load-schema))))


continue to isolate/encapsulate join internal rep

--- dada2-core/src/test/clojure/org/dada2/test_join_model.clj
+++ dada2-core/src/test/clojure/org/dada2/test_join_model.clj
@@ -47,14 +47,18 @@
 ;;--------------------------------------------------------------------------------
 ;; this layer encapsulates access to rhs indeces

+(defn- rhses-get [rhs-indeces keys lhs]
+  "return a lazy seq of seqs where each seq contains the rhses which
+join the lhs via corresponding key"
+  (map (fn [index key] (index (key lhs))) rhs-indeces keys))
+
 ;;--------------------------------------------------------------------------------
 ;; this layer encapsulates access to both lhs and rhs at the same time...

-
-(defn- derive-joins [v rhs-indeces ks join-fn]
+(defn- derive-joins [lhs rhs-indeces keys join-fn]
   (map
-   (fn [args] (apply join-fn v args))
-   (permute [[]] (map (fn [index key] (index (key v))) rhs-indeces ks))))
+   (fn [args] (apply join-fn lhs args))
+   (permute [[]] (rhses-get rhs-indeces keys lhs))))

 ;;--------------------------------------------------------------------------------


Fix missing xmlns in test suite

Fix missing xmlns in test suite

--- src/test/clojure/clojure/data/xml/test_names.clj
+++ src/test/clojure/clojure/data/xml/test_names.clj
@@ -3,6 +3,7 @@
             [clojure.test :refer :all]))

 (declare-ns
+ :xml.dav "DAV:"
  :test.xmlns.u "uri-u:"
  "test.xmlns.v" "uri-v:"
  'test.xmlns.w "uri-w:"


Inline eval!

Inline eval!

--- src/fugue/space.cljs
+++ src/fugue/space.cljs
@@ -57,9 +57,6 @@
              (cb {:lang :clj :source source})
              (cb nil)))})

-(defn eval-active [eval-state app-state cb]
-  (cljs.js/eval-str eval-state (current-buffer-text app-state) nil (eval-settings app-state) cb))
-
 (defn on-eval [state result]
   (-> state
       (assoc-in [:files (:next-id state)] (str result))
@@ -77,7 +74,11 @@
   (let [eval-state (cljs.js/empty-state load-namespace)
         app-state (r/atom init-state-m)]
     (defn eval! []
-      (eval-active eval-state @app-state (partial swap! app-state on-eval)))
+      (let [state @app-state
+            source (current-buffer-text state)
+            settings (eval-settings state)
+            cb (partial swap! app-state on-eval)]
+        (cljs.js/eval-str eval-state source nil settings cb)))
     (fn []
       [:div
        [:button {:on-click eval!}


Add doc strings to triangle funcs.

Add doc strings to triangle funcs.

--- src/videotest/triangles/static_rotation_core.clj
+++ src/videotest/triangles/static_rotation_core.clj
@@ -45,7 +45,10 @@
 (def PI_3_2 (* 1.5 Math/PI))
 (def ORIENTATIONS [0 PI_2 Math/PI PI_3_2])

-(defn update-triangles [state]
+(defn update-triangles
+  "Saves origin points for each triangle, which is a vector pair of
+   x and y positions in the image material [col row]."
+  [state]
   (let [pts (for [col-bin (range 0 NUM-COL-BINS)
                   row-bin (range 0 NUM-ROW-BINS)
                   :let [mat-col (+ (* col-bin MOSAIC-BIN-SIZE)
@@ -57,6 +60,7 @@
     (assoc-in state [:triangle-points] pts)))

 (defn update-triangle-orientations
+  "Radian orientations associated to triangle origin points."
   [{:keys [triangle-points triangle-orientations] :as state}]
   (if (< (q/frame-count) 10)
     (let [orients (reduce (fn [memo [pt1 pt2]]


Add a new todo item

Add a new todo item

Add a new todo item

--- src/webapp/framework/client/components/main.cljs
+++ src/webapp/framework/client/components/main.cljs
@@ -23,7 +23,28 @@
                        (section {:id "todoapp" :style {:padding "20px"}}
                               (h2 nil "todos")
                              (div {:style {:padding "20px" :backgoundColor "white"}}
-                              (input {:className "newTodo"})
+                              (input {
+                              :id "new_todo_item"
+                              :className "newTodo"
+                              :value (read-ui  app [:newitem2])
+
+                              :onChange (fn [event2]
+                                            (let [newtext      (.. event2 -target -value  )]
+                                                  (write-ui  app  [:newitem2]  newtext)))
+
+                              :onKeyDown  (fn [e]
+                                             (do
+;                                               (js/alert (pr-str (.-keyCode e  )))
+                                                   (if (= (.-keyCode e  ) 13)
+                                                             (go
+                                                                 (js/alert newtext)
+                                                                 ;(log "ISERT :** "  newtext)
+
+                                                                 (log (pr-str (sql "insert into  todo_items   (item) values (?)"   [(read-ui  app [:newitem2])]  )))
+                                                                 (write-ui  app  [:newitem2]  "")
+                                                        ))))
+
+                              })
                                 (select id, item from todo_items
                                           {}
                                         (container
@@ -50,12 +71,22 @@

                               (div {:style {:height "30px"}})
                               (div {:id "footer" :style {:backgroundColor "white"}})
-                              )))
+                             )))

 (def-coils-app     main-view   cc2)

 (go
-  (log "SQL: " (select id ,item from todo_items   []  ))
+  (log "SQL: " (select id, item  from todo_ites   []  ))
 )
+
+(go
+  ;(log "INSERT: " (sql "insert into  todo_items   (item) values (?)"   ["make jello"]  ))
+  )
+
+
+
+(go
+  ;(log "Delete: " (sql "delete from  todo_items"  []  ))
+  )


CM + CW | #21 | fix integration tests

CM + CW | #21 | fix integration tests

--- src/objective8/storage/storage.clj
+++ src/objective8/storage/storage.clj
@@ -272,13 +272,15 @@
    (let [objective-id (:objective_id sanitised-query)]
     (apply vector (map unmap-questions-with-answer-count
           (korma/exec-raw ["SELECT questions.*, answer_count.answer_count, answer_count.username
-                           FROM questions
+                           FROM objective8.questions AS questions
                            JOIN  (SELECT questions._id, COUNT(answers.*) AS answer_count, questions.username
                            FROM (SELECT questions.*, users.username
-                           FROM questions
-                           JOIN users ON questions.created_by_id = users._id
+                           FROM objective8.questions AS questions
+                           JOIN objective8.users AS users
+                           ON questions.created_by_id = users._id
                            WHERE objective_id=?) AS questions
-                           LEFT JOIN answers ON answers.question_id = questions._id
+                           LEFT JOIN objective8.answers AS answers
+                           ON answers.question_id = questions._id
                            GROUP BY questions._id, questions.username) AS answer_count
                            ON questions._id = answer_count._id
                            ORDER BY answer_count DESC"


Update query comment.

Update query comment.

--- src/oc/api/resources/dashboard.clj
+++ src/oc/api/resources/dashboard.clj
@@ -96,7 +96,8 @@
          (slug/valid-slug? slug)]}
   (first (db-common/read-resources conn table-name "slug-org-uuid" [slug org-uuid])))

-;r.db('open_company_dev').table('sections').getAll('green-labs', {index: 'company-slug'}).group('section-name').max('created-at')
+; filter for archived topics
+;r.db('open_company_dev').table('entries').getAll('1234-1234-1234', {index: 'dashboard-uuid'}).group('topic-slug').max('created-at')

 ;; ----- Collection of dashboards -----


stupid typo

stupid typo

--- src/pc/http/sente/sliding_send.clj
+++ src/pc/http/sente/sliding_send.clj
@@ -44,7 +44,7 @@

 (defn pop-or-unlock [send-state-atom msg-type uid]
   (loop [val @send-state-atom]
-    (let [message (get-in val [:message msg-type uid])
+    (let [message (get-in val [:messages msg-type uid])
           new-val (if message
                     (dissoc-in val [:messages msg-type uid])
                     (update-in val [:sending msg-type] disj uid))]


Document name-stringifier

Document name-stringifier

--- src/grimoire/doc.clj
+++ src/grimoire/doc.clj
@@ -112,7 +112,9 @@
             (str "Don't know how to stringify " x)))))

 (defn name-stringifier
-
+  "Function from something (either a symbol, string or something else) which if
+  possible computes the logical \"name\" of the input as via clojure.core/name
+  otherwise throws an explicit exception."
   [x]
   (cond (symbol? x)
         ,,(name x)


Problem 0104.

Problem 0104.

--- src/project_euler/problem_0104.clj
+++ src/project_euler/problem_0104.clj
@@ -12,18 +12,20 @@
 ;; Given that Fk is the first Fibonacci number for which the first nine digits
 ;; AND the last nine digits are 1-9 pandigital, find k.

-(defn lz-digits [x]
-  (lazy-seq
-   (let [d  (rem x 10)
-         x' (quot x 10)]
-     (if (zero? x')
-       [d]
-       (cons d (lz-digits x'))))))

-(defn lz-fibo-seq []
+(defn digits [x]
+  (loop [x  x
+         ds [(rem x 10)]]
+    (let [x' (quot x 10)]
+      (if (zero? x')
+        ds
+        (recur x' (conj ds (rem x' 10))))
+      )))
+
+(defn lz-fibo-mod-seq []
   (iterate
    (fn [[f-0 f-1 n]]
-     [(+' f-0 f-1) f-0 (inc n)])
+     [(rem  (+ f-0 f-1) 1000000000) f-0 (inc n)])
    [1 1 2]
    ))

@@ -35,26 +37,28 @@
 (def sqrt5 (Math/sqrt 5))
 (def log-sqrt5 (Math/log10 sqrt5))

+(defn h-fibo [n]
+  (let [log-f (- (* log-phi n) log-sqrt5)]
+    (->> (if (< log-f 9)
+          log-f
+          (+ 8 (- log-f (int log-f))))
+        (Math/pow 10)
+        (int)
+        )))
+
 (defn solution []
-  (->> (iterate inc 1)
-       (map (fn [n]
-                 (-> (- (* log-phi n) log-sqrt5)
-                     (#(+ 10 (- % (int %))))
-                     (Math/pow 10)
-                     )))
-       (take 10)
+  (->> (lz-fibo-mod-seq)
+       (filter (fn [[f _ n]]
+                 (let [ds (digits f)]
+                   (and (= the-digits-1-to-9
+                           (set ds))
+                        (= the-digits-1-to-9
+                           (set (digits (h-fibo n))))
+                       )
+                   )))
+       (first)
+       (last)
        ))

+;;-> 329468

-;; (defn solution []
-;;   (->> (lz-fibo-seq)
-;;        (filter (fn [[f _ n]]
-;;                  (let [ds (lz-digits f)]
-;;                    (and (= the-digits-1-to-9
-;;                            (set (take 9 ds)))
-;;                         (= the-digits-1-to-9
-;;                            (set (take-last 9 ds))))
-;;                    )))
-;;        (first)
-;;        (last)
-;;        ))


Fix typo.

Fix typo.

--- src/re_frame/std_interceptors.cljc
+++ src/re_frame/std_interceptors.cljc
@@ -211,7 +211,7 @@
   eddting operation. Nice and efficient, but fiddly. A bug generator
   approach.

-  So, instead, we create an `f` which recalcualtes warnings from scratch
+  So, instead, we create an `f` which recalculates warnings from scratch
   every time there is ANY change. It will inspect all the todos, and
   reset ALL FLAGS every time (overwriting what was there previously)
   and fully recalculate the list of duplicates (displayed at the bottom?).


[Fix #269] Ensure namespace sorting does all comparisons as strings

shadow-cljs supports string namespaces for requiring NPM dependencies,
eg:

  (:require [reagent.core :as r]
            ["react-virtualized/dist/commonjs/List" :refer [List]])

By comparing all namespaces as strings, we fix a ClassCast crash trying
to compare such a string to a normal symbol.

--- src/refactor_nrepl/ns/libspecs.clj
+++ src/refactor_nrepl/ns/libspecs.clj
@@ -16,7 +16,7 @@
 (defn- aliases-by-frequencies [libspecs]
   (->> libspecs
        (mapcat aliases) ; => [[str clojure.string] ...]
-       (sort-by second)
+       (sort-by (comp str second))
        (group-by first) ; => {str [[str clojure.string] [str clojure.string]] ...}
        (map (comp seq frequencies second)) ; => (([[set clojure.set] 4] [set set] 1) ...)
        (map (partial sort-by second >)) ; by decreasing frequency


another atom renamed

another atom renamed

--- src/cljs/infinitelives/pixi/texture.cljs
+++ src/cljs/infinitelives/pixi/texture.cljs
@@ -1,30 +1,30 @@
 (ns infinitelives.pixi.texture
   (:require [cljsjs.pixi]))

-(defonce texture-store (atom {}))
+(defonce !texture-store (atom {}))

 (defn assoc!
   "Add a texture object to the texture cache under
   the key `key`"
   [key texture]
-  (swap! texture-store assoc key texture))
+  (swap! !texture-store assoc key texture))

 (defn dissoc!
   "Remove the texture keyed as `key` from the
   texture cache"
   [key]
-  (swap! texture-store dissoc key))
+  (swap! !texture-store dissoc key))

 (defn empty!
   "Empty the texture cache of all its textures"
   []
-  (reset! texture-store {}))
+  (reset! !texture-store {}))

 (defn get-texture
   "Get a texture from the cache by `key`"
   [key]
   (or
-   (@texture-store key)
+   (@!texture-store key)
    (throw (js/Error. (str "Texture " texture " not loaded")))))

 (defn sub-texture [texture [x y] [w h]]
@@ -44,5 +44,5 @@
   }
   "
   [texture asset-description]
-  (swap! texture-store into (for [[key {:keys [pos size]}] asset-description]
+  (swap! !texture-store into (for [[key {:keys [pos size]}] asset-description]
                               [key (sub-texture texture pos size)])))


def socket in motor-cortex for easier repl usage

--- src/clojure/life/daemon/motor_cortex.clj
+++ src/clojure/life/daemon/motor_cortex.clj
@@ -37,10 +37,13 @@

 (defn create-socket-with-mr-robot [mr-robot]
-   (.createRfcommSocketToServiceRecord
-    (:device mr-robot)
-    (.getUuid
-     (first (.getUuids (:device mr-robot))))))
+  (let [s
+        (.createRfcommSocketToServiceRecord
+         (:device mr-robot)
+         (.getUuid
+          (first (.getUuids (:device mr-robot)))))]
+    (def socket s)
+    s))

 (defn connect-with-mr-robot [socket]
   (.connect socket))
@@ -104,8 +107,3 @@

        (mapcat seq)
        (byte-array)))
-
-
-
-
-


Added icon to indicate if list is private.

--- src/clojure/staircase/views/projects.clj
+++ src/clojure/staircase/views/projects.clj
@@ -12,7 +12,6 @@
     [:div.row
      [:p "Welcome to the project page."]]
     ])
-

 (defn create []
   [:div.panel.panel-primary
@@ -29,14 +28,21 @@
       [:div.form-group
       [:div.btn {:ng-click "createProject"} ]]]]])

+(def explorerfilter
+  [:input.form-control {:ng-model "explorerfilter"
+                        :type "text"
+                        :name "explorerfilter"
+                        :placeholder "Filter"}])

 (def list-group
   [:ul.list-group.cap
    [:li.list-group-item {:ng-repeat "list in lists" :droppable "list" :ng-click "setInspection(list)"}
     [:span.badge.origin {:title "{{list.short}}"} "{{ list.short | limitTo:1 }}"]
+    [:span.badge.origin {:ng-show "list.authorized"} [:i.fa.fa-user]]
     [:h4 "{{list.title}}"
          [:i.fa.fa-ellipsis-h
           {:ng-show "list.description" :ng-click "showDescription = !showDescription"}]]
+
     [:p.text-muted.list-group-item-text {:ng-show "showDescription"} "{{list.description }}"]
     ]])

@@ -77,9 +83,6 @@
     [:div.col-sm-4.col-md-3.project-container
       {:ng-repeat "project in allProjects"}
      (project)]]]))
-
-
-

 (defn project-details []
   (html [:div.panel.panel-primary


better excel results output

better excel results output

--- src/clojure/zensols/model/classifier.clj
+++ src/clojure/zensols/model/classifier.clj
@@ -32,7 +32,8 @@
             [clojure.string :as str])
   (:require [clj-excel.core :as excel]
             [taoensso.nippy :as nippy])
-  (:require [zensols.actioncli.resource :as res])
+  (:require [zensols.actioncli.resource :as res]
+            [zensols.util.spreadsheet :as ss])
   (:require [zensols.model.weka :as weka]))

 (def ^:private zero-arg-arr (into-array String []))
@@ -516,15 +517,16 @@
                              RMSE Classifier Attributes)]
       (-> (excel/build-workbook
            (excel/workbook-hssf)
-           (apply
-            merge
-            (map (fn [res]
-                   (let [sheet-no-header (create-sheet-data (:results res))
-                         extra-headers (map :header (:extra-cols (first (:results res))))
-                         sheet-data (prepend-header sheet-no-header
-                                                    (concat headers extra-headers))]
-                     {(:sheet-name res) sheet-data}))
-                 sheet-name-results)))
+           (->> sheet-name-results
+                (map (fn [res]
+                       (let [sheet-no-header (create-sheet-data (:results res))
+                             extra-headers (map :header (:extra-cols (first (:results res))))
+                             sheet-data (prepend-header sheet-no-header
+                                                        (concat headers extra-headers))]
+                         {(:sheet-name res)
+                          (ss/headerize sheet-data)})))
+                (apply merge)))
+          (ss/autosize-columns)
           (excel/save out-file))
       (log/infof "wrote results file: %s" out-file))))


Trippled the number of Median training cases

--- src/clojush/problems/software/median.clj
+++ src/clojush/problems/software/median.clj
@@ -34,13 +34,13 @@
 ;; inputs is either a list or a function that, when called, will create a
 ;; random element of the set.
 (def median-data-domains
-  [[(list [2 6 8] [2 8 6] [6 2 8] [6 8 2] [8 2 6] [8 6 2] ; Permutations of [2 6 8]
-          [-5 0 5] [-5 5 0] [0 -5 5] [0 5 -5] [5 -5 0] [5 0 -5] ; Permutations of [-5 0 5]
-          [23 0 0] [0 23 0] [0 0 23] [-31 0 0] [0 -31 0] [0 0 -31]) 18 0] ; Two zeroes
-   [(fn [] (repeatedly 3 #(- (lrand-int 201) 100))) 52 500] ;; Each input includes 3 integers in range [-100,100]
+  [#_[(list [2 6 8] [2 8 6] [6 2 8] [6 8 2] [8 2 6] [8 6 2] ; Permutations of [2 6 8]
+           [-5 0 5] [-5 5 0] [0 -5 5] [0 5 -5] [5 -5 0] [5 0 -5] ; Permutations of [-5 0 5]
+           [23 0 0] [0 23 0] [0 0 23] [-31 0 0] [0 -31 0] [0 0 -31]) 18 0] ; Two zeroes
+   [(fn [] (repeatedly 3 #(- (lrand-int 201) 100))) 180 500] ;; Each input includes 3 integers in range [-100,100]
    [(fn [] (shuffle (conj (repeat 2 (- (lrand-int 201) 100))
-                          (- (lrand-int 201) 100)))) 20 300] ;; Edge cases where two of three are the same
-   [(fn [] (repeat 3 (- (lrand-int 201) 100))) 10 100] ;; Edge cases where all are the same
+                          (- (lrand-int 201) 100)))) 90 300] ;; Edge cases where two of three are the same
+   [(fn [] (repeat 3 (- (lrand-int 201) 100))) 30 100] ;; Edge cases where all are the same
    ])

 (defn test-and-train-data-from-domains


functions for testing byte buffer

functions for testing byte buffer

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

--- acqEngine/src/org/micromanager/test.clj
+++ acqEngine/src/org/micromanager/test.clj
@@ -5,6 +5,7 @@
            (org.json JSONArray JSONObject)
            (org.micromanager MMStudioMainFrame)
            (org.micromanager.api DataProcessor)
+           (java.nio ByteBuffer ByteOrder)
            (org.micromanager.acquisition TaggedImageStorageMultipageTiff))
   (:require [org.micromanager.mm :as mm])
   (:use [org.micromanager.mm :only (edt load-mm core gui mmc)]))
@@ -234,15 +235,17 @@
   (let [tags (.tags image)
         summary (image-test-summary "test1" 1)
         storage (TaggedImageStorageMultipageTiff.
-                  "fast" true summary false true)]
+                  "G:/acquisitions/" true summary false true)]
+    (doto tags
+      (.put "Slice" 0)
+      (.put "ChannelIndex" 0)
+      (.put "PositionIndex" 0)
+      (.put "PixelType" "GRAY16"))
     (time
       (dotimes [i n]
         (.put tags "Frame" i)
-        (.put tags "Slice" 0)
-        (.put tags "ChannelIndex" 0)
-        (.put tags "PositionIndex" 0)
-        (.put tags "PixelType" "GRAY16")
-        (.putImage storage image)))
+        (.putImage storage image)
+        ))
     (doto storage .finished .close)))

  (defn fast-image-saving-test [n]
@@ -250,6 +253,18 @@
    (let [image (core popNextTaggedImage)]
      (println "Start saving procedure...")
        (save-images-fast image n)))
+
+(defn image-to-byte-buffer [pix]
+  (let [buffer (.. ByteBuffer
+                         (allocate (* (count pix) 2))
+                         (order ByteOrder/BIG_ENDIAN))]
+    (.. buffer asShortBuffer (put pix))))
+
+(defn byte-buffer-test [n]
+  (let [img (core getImage)]
+    (time
+      (dorun
+        (repeatedly n #(image-to-byte-buffer img))))))


configuration/*config* is defined only once

--- src/ruuvi_server/configuration.clj
+++ src/ruuvi_server/configuration.clj
@@ -59,4 +59,4 @@
 ;; when this namespace is imported.

 ;; TODO maybe config should be created on-demand?
-(def ^:dynamic *config* (create-config))
+(defonce ^:dynamic *config* (create-config))


tweaked the test incentive to count documented instructions

--- test/push/interpreter/interpreter_setup_test.clj
+++ test/push/interpreter/interpreter_setup_test.clj
@@ -398,11 +398,14 @@

 (fact "`make-classic-interpreter` knows all kinds of instructions already"
   (let [benchmarker (make-classic-interpreter)]
-    (println (str "[Classic interpreter knows "
+    (println (str "«Classic interpreter knows "
                   (count (keys (:instructions benchmarker)))
-                  " different instructions and recognizes "
+                  " different instructions (of which "
+                  (count (remove #(re-find #"docstring!" (:docstring %))
+                    (vals (:instructions benchmarker))))
+                  " have docstrings), and recognizes "
                   (count (:router benchmarker))
-                  " types.]"))
+                  " types.»"))
     (keys (:instructions benchmarker)) =>  ;; just a sampling as a rough check
       (contains [:integer-add :boolean-and :char≥? :string-concat] :in-any-order :gaps-ok)))


Delete debug logging

Delete debug logging

--- src/export_server/utils/rasterizator.clj
+++ src/export_server/utils/rasterizator.clj
@@ -59,8 +59,6 @@
                    x         :pdf-x
                    y         :pdf-y}]
   (try
-    (with-open [out (output-stream (clojure.java.io/file "/media/ssd/sibental/export-server-data/1.png"))]
-      (.write out img))
     (with-open [out (new ByteArrayOutputStream)]
       (pdf [{:size          (or size [(* 0.75 width) (* 0.75 height)])
              :orientation   (if landscape :landscape nil)


remove output

remove output

--- src/k_means/core.clj
+++ src/k_means/core.clj
@@ -24,7 +24,7 @@
     (k-means l k (p :choose-initial-centroids (choose-initial-centroids l k)) (vector/make-vector k) max-iterations))
   ([l k c g max-iterations]
     (let [t c g (p :cluster (cluster/cluster l c)) c (p :mean-centroids (cluster/mean-centroids g))]
-      (println "Iteration" (- 100 max-iterations) c)
+      ; (println "Iteration" (- 100 max-iterations) c)
       (cond
         (> 0 max-iterations) g
         (still-moving? t c) ; Keep shifting centroids until equilibrium
@@ -37,7 +37,7 @@
     (k-means-p l k (p :choose-initial-centroids (choose-initial-centroids l k)) (vector/make-list k) max-iterations))
   ([l k c g max-iterations]
     (let [t c g (p :cluster-parallel (cluster/cluster-p l c)) c (p :mean-centroids-parallel (cluster/mean-centroids-p g))]
-      (println "Iteration" (- 100 max-iterations) c)
+      ; (println "Iteration" (- 100 max-iterations) c)
       (cond
         (> 0 max-iterations) g
         (still-moving? t c) ; Keep shifting centroids until equilibrium
@@ -47,6 +47,7 @@
 (defn -main
   "Main function for k-means"
   [& args]
+  (println cluster/n-cpu)
   (cond
     (= (first args) "seq")
       (let [c (profile :info :Arithmetic (k-means (vector/make-list-rand 500000) 5 100)) => "Done"]


Create tr.cljs

Create tr.cljs

--- src/status_im/translations/tr.cljs
+++ src/status_im/translations/tr.cljs
@@ -4,7 +4,7 @@
   {
    ;common
    :members-title                         "Üyeler"
-   :not-implemented                       "!uygulanmadı"
+   :not-implemented                       "Uygulanmadı!"
    :chat-name                             "Sohbet adı"
    :notifications-title                   "Bildirimler ve sesler"
    :offline                               "Çevrimdışı"
@@ -33,10 +33,10 @@

    ;sync
    :sync-in-progress                      "Eşitleniyor..."
-   :sync-synced                           "Eşitleme"
+   :sync-synced                           "Eşitlendi"

    ;messages
-   :status-sending                        "Gönderiliyor"
+   :status-sending                        "Gönderiliyor..."
    :status-pending                        "Beklemede"
    :status-sent                           "Gönderildi"
    :status-seen-by-everyone               "Herkes tarafından görüldü"
@@ -62,18 +62,18 @@
    :profile                               "Profil"
    :report-user                           "KULLANICIYI ŞİKAYET ET"
    :message                               "Mesaj"
-   :username                              "Kullanıcı adı"
+   :username                              "Kullanıcı Adı"
    :not-specified                         "Belirtilmemiş"
    :public-key                            "Ortak Anahtar"
-   :phone-number                          "Telefon numarası'"
+   :phone-number                          "Telefon Numarası'"
    :email                                 "E-posta"
    :profile-no-status                     "Durum yok"
    :add-to-contacts                       "Kişi listesine ekle"
-   :error-incorrect-name                  "Lütfen başka bir isim seçin"
+   :error-incorrect-name                  "Hatalı isim"
    :error-incorrect-email                 "Hatalı e-posta adresi"

-   ;;make_photo
-   :image-source-title                    "Profil resmi"
+   ;make_photo
+   :image-source-title                    "Profil Fotoğrafı"
    :image-source-make-photo               "Çek"
    :image-source-gallery                  "Galeriden seç"
    :image-source-cancel                   "İptal"
@@ -81,17 +81,17 @@
    ;sign-up
    :contacts-syncronized                  "Kişi listeniz eşitlendi"
    :confirmation-code                     (str "Teşekkürler! Size onay kodunu içeren bir kısa mesaj "
-                                               "gönderdik. Telefon numaranızı onaylamak için lütfen bu kodu girin")
-   :incorrect-code                        (str "Üzgünüz kod hatalıydı, lütfen yeniden girin")
+                                               "gönderdim. Telefon numaranızı onaylamak için lütfen bu kodu girin")
+   :incorrect-code                        (str "Üzgünüm kod hatalıydı, lütfen yeniden girin")
    :generate-passphrase                   (str "sizin için bir parola oluşturacağım, böylece başka bir cihazdan "
-                                               "erişim ya da girişinizi kurtarabileceksiniz")
+                                               "erişebilecek ya da girişinizi kurtarabileceksiniz")
    :phew-here-is-your-passphrase          "*Oh* bu oldukça zor oldu işte parolanız, *bu parolayı bir yere not ederek saklayın!* Hesabınızı kurtarmak için bu parolaya ihtiyacınız olacaktır."
    :here-is-your-passphrase               "İşte parolanız, *bu parolayı bir yere not ederek saklayın!* Hesabınızı kurtarmak için bu parolaya ihtiyacınız olacaktır."
    :written-down                          "Güvenli bir şekilde not ettiğinizden emin olun"
    :phone-number-required                 "Telefon numaranızı girmek için buraya dokunun, arkadaşlarınızı ben bulacağım"
    :intro-status                          "Hesabınızı kurmak ve ayarlarınızı değiştirmek için benimle sohbet edin!"
    :intro-message1                        "Status'e hoş geldiniz\nŞifrenizi oluşturmak ve hemen başlamak için bu mesaja dokunun!"
-   :account-generation-message            "Bana birkaç saniye ayırın, hesabınızı oluşturmak için biraz matematik yapmam gerekecek!"
+   :account-generation-message            "Bana birkaç saniye ayırın, hesabınızı oluşturmak için biraz matematik hesabı yapmam gerekecek!"

    ;chats
    :chats                                 "Sohbetler"
@@ -99,9 +99,9 @@
    :new-group-chat                        "Yeni grup sohbeti"

    ;discover
-   :discover                             "Keşfet"
+   :discover                              "Keşfet"
    :none                                  "Hiçbiri"
-   :search-tags                           "Arama etiketlerinizi buraya girin"
+   :search-tags                           "Aramak istediğiniz etiketleri buraya girin"
    :popular-tags                          "Popüler etiketler"
    :recent                                "Güncel"
    :no-statuses-discovered                "Herhangi bir durum keşfedilmedi"
@@ -127,7 +127,7 @@
    :delete-and-leave                      "Sil ve ayrıl"
    :chat-settings                         "Sohbet ayarları"
    :edit                                  "Düzenle"
-   :add-members                           "Üye Ekle"
+   :add-members                           "Üye ekle"
    :blue                                  "Mavi"
    :purple                                "Mor"
    :green                                 "Yeşil"
@@ -142,7 +142,7 @@
    :confirmation-code-request-text        "Onay kodu iste"
    :send-command-description              "Konum gönder"
    :request-command-description           "İstek gönder"
-   :keypair-password-command-description  ""
+   :keypair-password-command-description  "Şifre gönder"
    :help-command-description              "Yardım"
    :request                               "İstek"
    :chat-send-eth                         "{{amount}} ETH"
@@ -159,7 +159,7 @@
    :remove-participants                   "Katılımcıları Sil"

    ;protocol
-   :received-invitation                   "grup sohbeti daveti alındı"
+   :received-invitation                   "sohbet daveti alındı"
    :removed-from-chat                     "sizi grup sohbetinden sildi"
    :left                                  "ayrıldı"
    :invited                               "davet edildi"
@@ -168,7 +168,7 @@

    ;new-contact
    :add-new-contact                       "Yeni kişi ekle"
-   :import-qr                             "İçe¨aktar"
+   :import-qr                             "İçe aktar"
    :scan-qr                               "Kare Kod tara"
    :name                                  "İsim"
    :whisper-identity                      "Whisper Kimliği"
@@ -184,15 +184,15 @@
    :address                               "Adres"
    :password                              "Şifre"
    :login                                 "Oturum Aç"
-   :wrong-password                        "Hatalı şifre"
+   :wrong-password                        "Hatalı Şifre"

    ;recover
    :recover-from-passphrase               "Parolayı kullanarak kurtar"
    :recover-explain                       "Erişimi kurtarmak için lütfen şifreniz için parolanızı girin"
    :passphrase                            "Parola"
    :recover                               "Kurtar"
-   :enter-valid-passphrase                "Lütfen bir parola girin"
-   :enter-valid-password                  "Lütfen bir şifre girin"
+   :enter-valid-passphrase                "Lütfen geçerli bir parola girin"
+   :enter-valid-password                  "Lütfen geçerli bir şifre girin"

    ;accounts
    :recover-access                        "Erişimi kurtar"


Use ->X instead of X.

Use ->X instead of X.

--- src/main/cljc/mikron/runtime/buffer.cljc
+++ src/main/cljc/mikron/runtime/buffer.cljc
@@ -487,7 +487,7 @@

 (def ^mikron.runtime.buffer.IMikronByteBufferFactory byte-buffer-factory
   "The default byte buffer factory."
-  (MikronByteBufferFactory.))
+  (->MikronByteBufferFactory))

 (defn set-byte-buffer-factory!
   "Sets the byte buffer factory."


dimacs-sub-vars doc string enhanced

dimacs-sub-vars doc string enhanced

--- src/logic/dimacs.clj
+++ src/logic/dimacs.clj
@@ -59,8 +59,8 @@
                                        dimacs-map)))))

 (defn dimacs-sub-vars
-  "Takes a dimacs string and a map of literals to symbol (e.g. {a t_1}. Returns the
-  dimacs file with the symbols replaced by the literals."
+  "Takes a dimacs string and a map of literals to symbol (e.g. {a t_1}). The map is like
+  (:lits (tseitin-transform ...)). Returns the dimacs file with the symbols replaced by the literals."
   [dimacs lits]
   (let [subs (zipmap (map (comp re-pattern str) (vals lits)) (map str (keys lits)))]
     (loop [txt dimacs, [k v] (first subs), rest-s (rest subs)]


added def-db to adaptive functions

added def-db to adaptive functions

--- src/clj_hypergraph_db/adaptive_model_parsing_functions.clj
+++ src/clj_hypergraph_db/adaptive_model_parsing_functions.clj
@@ -21,3 +21,8 @@
   (if (nil? attribute-list)
     {:type type :name name}
     {:type type :name name :attributes (apply merge-attributes attribute-list)}))
+
+
+(defn def-db
+  [& args]
+  nil)


Use nio instead of Java interop

Use nio instead of Java interop

--- src/mdr2/dtb/xml.clj
+++ src/mdr2/dtb/xml.clj
@@ -6,6 +6,7 @@
             [clojure.java.shell :as shell]
             [clojure.tools.logging :as log]
             [clojure.string :as s]
+            [org.tobereplaced.nio.file :as nio]
             [mdr2.data.xml :as xml-new]
             [clojure.walk :as w]
             [clojure.zip :as zip]
@@ -117,11 +118,11 @@
    (let [updated (with-open [r (io/reader manifest)]
                   (update-meta-data (xml/parse r :support-dtd false)
                                     production handle-manifest-node))]
-     (let [tmp-file (java.io.File/createTempFile "mdr2-" ".xml")]
+     (let [tmp-file (io/file (nio/create-temp-file! "mdr2-" ".xml"))]
        (with-open [w (io/writer tmp-file)]
          (xml-new/emit updated w :doctype manifest-doctype))
        (xml-format! tmp-file manifest)
-       (.delete tmp-file)))))
+       (nio/delete! tmp-file)))))

 (defn update-master-smil!
   "Update the master smil file of `volume` for `production` in-place
@@ -132,11 +133,11 @@
                   (update-meta-data
                    (xml/parse r :support-dtd false)
                    production handle-smil-node))]
-    (let [tmp-file (java.io.File/createTempFile "mdr2-" ".smil")]
+    (let [tmp-file (io/file (nio/create-temp-file! "mdr2-" ".smil"))]
       (with-open [w (io/writer tmp-file)]
         (xml-new/emit updated w :doctype smil-doctype))
       (xml-format! tmp-file smil)
-      (.delete tmp-file))))
+      (nio/delete! tmp-file))))

 (defn update-meta-data!
   "Update the manifest and the smil file of a `volume` for


Remove unused namespace.

Remove unused namespace.

--- src/oc/storage/representations/label.clj
+++ src/oc/storage/representations/label.clj
@@ -1,7 +1,6 @@
 (ns oc.storage.representations.label
   (:require [cheshire.core :as json]
             [oc.storage.urls.label :as label-urls]
-            [oc.storage.urls.entry :as entry-urls]
             [oc.lib.hateoas :as hateoas]
             [oc.storage.config :as config]
             [oc.storage.representations.media-types :as mt]))


cleanup

cleanup

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

--- plugins/DataBrowser/src/org/micromanager/browser/core.clj
+++ plugins/DataBrowser/src/org/micromanager/browser/core.clj
@@ -53,14 +53,12 @@
         sc (JScrollPane. t)
         tf (JTextField.)
         search-label (JLabel.)
-        font-height (.getFont tf)
         index-button (JButton. "Add folder...")
         columns-button (JButton. "Columns...")]
     (set-model t model)
     (doto p (.add sc) (.add tf) (.add index-button)
             (.add columns-button) (.add search-label))
     (doto t (.setAutoCreateRowSorter true)
-            (.setShowVerticalLines true)
             (.setShowGrid false)
             (.setGridColor Color/LIGHT_GRAY)
             (.setShowVerticalLines true))
@@ -73,6 +71,7 @@
     (constrain-to-parent columns-button :n 5 :w 330 :n 28 :w 450)
     (constrain-to-parent search-label :n 5 :w 5 :n 28 :w 25)
     (.setEnabled columns-button false)
+    (.setEnabled index-button false)
     (connect-search tf t)
     (listen-to-open t)
     (attach-action-key tf "ESCAPE" #(.setText tf ""))