doc for appium-test

doc for appium-test

Former-commit-id: c8d0f590c21797dfed5f7deb74e022c65b3d2a2c

--- test/clj/status_im/appium.clj
+++ test/clj/status_im/appium.clj
@@ -59,7 +59,25 @@
 (defn quit [driver]
   (.quit driver))

-(defmacro appium-test [name & body]
+(defmacro appium-test
+  "Defines test which will create new appium session and will pass that
+  session as first argument to each command inside it's body. After execution
+  of all commands session will be closed.
+
+  For instance,
+
+  (appium-test my-test
+    (click :button)
+    (write :input \"oops\"))
+
+  will be expanded to
+
+  (deftest my-test
+    (let [session (init)]
+      (click session :button)
+      (write session :input \"oops\")
+      (quit session)))"
+  [name & body]
   (let [sym (gensym)]
     `(deftest ~name
        (let [~sym (init)]


Make the ssh tail test block for a shorter amount of time.

--- test/clj_libssh2/test_ssh.clj
+++ test/clj_libssh2/test_ssh.clj
@@ -96,7 +96,8 @@
                                  (swap! output conj (String. b off len))))
             run-exec (future
                        (try
-                         (ssh/exec {:port 2222
+                         (ssh/exec {:blocking-timeout 5000
+                                    :port 2222
                                     :read-timeout 5000}
                                    (str "tail -F " tempfile)
                                    :out streaming-reader)


added more videos and categories

added more videos and categories

--- test/distillery/core_test.clj
+++ test/distillery/core_test.clj
@@ -33,7 +33,13 @@
         "Parabeln_Quadratische Funktion_en Übersicht (Scheitelpunkt,Stauchung,Streckung,etc.) (720)"]))

 (def videos [
+             ["11-01" "11.01 Theoretische, technische, praktische, angewandte Informatik"]
              ["12-01-1" "12.01.1 Datenstrukturen, Array, Queue, Stack"]
+             ["12-01-2" "12.01.2 Baum als Datenstruktur"]
+             ["Algo1" "Algorithmen und Datenstrukturen 001"]
+             ["Algo2" "Algorithmen und Datenstrukturen 002"]
+             ["Algo3" "Algorithmen und Datenstrukturen 003"]
+             ["Algo4" "Algorithmen und Datenstrukturen 004"]
              ["Bernoulli" "Binomialverteilung_Formel von Bernoulli, Stochastik, Nachhilfe online, Hilfe in Mathe (720)"]
              ["Hypothesentest" "Einseitiger(rechtsseitiger) Hypothesentest_mit Ablesen aus der Tabelle, Stochastik, Nachhilfe online (720)"]
              ["Parabeln" "Parabeln_Quadratische Funktion_en Übersicht (Scheitelpunkt,Stauchung,Streckung,etc.) (720)"]
@@ -41,7 +47,7 @@
              ["Lambda" "Der Lambda-Kalkül (720)"]
              ["IS-Kurve" "IS-Kurve im Vier-Quadrantenschema Die Herleitung (720)"]
              ["Makrooekonomie" "Makroökonomie online lernen - VWL Tutorium (360)"]
-             ;["Bankgeheimnis" "Bernd Senf 3. Bankgeheimnis Geldschöpfung - Monetative als Lösung (720)"]
+             ["Bankgeheimnis" "Bernd Senf 3. Bankgeheimnis Geldschöpfung - Monetative als Lösung (720)"]
              ])

 (def job-descr
@@ -53,7 +59,9 @@
                    :skip-wordclouds false
                    :skip-word-includes false
                    :skip-match-includes false
-                   :main-cloud {:precision :high}
+                   :main-cloud {:precision :medium
+                                :width 540
+                                :height 350}
                    :video-cloud {:precision :medium}
                    :category-cloud {:precision :medium}}
    :videos (->> videos
@@ -71,6 +79,16 @@
                               {:type :wikipedia, :url "http://de.wikipedia.org/wiki/Theoretische_Informatik"}
                               {:type :wikipedia, :url "http://de.wikipedia.org/wiki/Praktische_Informatik"}
                               {:type :wikipedia, :url "http://de.wikipedia.org/wiki/Technische_Informatik"}]}
+                 {:id "Queue"
+                  :name "Datenstrukturen - Warteschlange"
+                  :resources [{:type :wikipedia, :url "http://de.wikipedia.org/wiki/Warteschlange_%28Datenstruktur%29"}]}
+                 {:id "Stack"
+                  :name "Datenstrukturen - Stapel"
+                  :resources [{:type :wikipedia, :url "http://de.wikipedia.org/wiki/Stapelspeicher"}]}
+                 {:id "Tree"
+                  :name "Datenstrukturen - Baum"
+                  :resources [{:type :wikipedia, :url "http://de.wikipedia.org/wiki/Baum_%28Graphentheorie%29"}]}
+
                  {:id "Math"
                   :name "Mathematik"
                   :resources [{:type :wikipedia, :url "http://de.wikipedia.org/wiki/Mathematik"}


add with-path to request chain

add with-path to request chain

--- test/prometheus/core_test.clj
+++ test/prometheus/core_test.clj
@@ -14,11 +14,12 @@

 (deftest dump-metrics
   (let [registry (CollectorRegistry.)
+        request (ring/request :get "/test")
         handler (prometheus/instrument-handler test-handler "test" registry)
-        response (handler (ring/request :get "/test"))
+        response (prometheus/with-path request (handler request))
         metrics (prometheus/dump-metrics registry)]
     (testing "handler returns delegate's response"
-      (is (= response {:status 200 :body "ok"})))
+      (is (= {:status 200 :body "ok"} response)))
     (testing "metrics should be a ring response"
       (is (= 200 (:status metrics)))
       (is (= TextFormat/CONTENT_TYPE_004


fix tests to use a real Whale type rather than a list of values to shake out more bugs

--- dada-core/src/test/clojure/org/dada/core/test_dql.clj
+++ dada-core/src/test/clojure/org/dada/core/test_dql.clj
@@ -17,16 +17,40 @@
 ;;--------------------------------------------------------------------------------
 ;; data model

+(def whale-attributes
+     (list
+      [:id       (Integer/TYPE) false]
+      [:version  (Integer/TYPE) true]
+      ;;[:time     Date           true]
+      ;;[:reporter String         true]
+      [:type     clojure.lang.Keyword         false]	;a whale cannot change type
+      [:ocean    clojure.lang.Keyword         true]
+      [:length   (Float/TYPE)   true]
+      ;;[:weight   (Float/TYPE)   true]
+      ))
+
 (def whale-data
-     ;;[id, version, type, ocean, length]
      [[0 0 :blue :atlantic 100]
       [1 0 :blue :pacific  100]
       [2 0 :grey :atlantic 50]
       [3 0 :grey :pacific  50]])

-(def whales (model "Whales" (seq-metadata (count (first whale-data)))))
+;;(def whale-metadata (seq-metadata (count (first whale-data))))
+(def whale-metadata (custom-metadata "org.dada.core.tmp.Whale"
+				     Object
+				     [:id]
+				     [:version]
+				     int-version-comparator
+				     whale-attributes))
+
+(def whales (model "Whales" whale-metadata))
 (insert *metamodel* whales)
-(insert-n whales whale-data)
+
+;;(insert-n whales whale-data)
+(let [creator (.getCreator whale-metadata)]
+      (insert-n
+       whales
+       (map (fn [datum] (.create creator (into-array Object datum))) whale-data)))

 ;;--------------------------------------------------------------------------------
 ;; utils
@@ -37,11 +61,15 @@
 	value (first (.getExtant (.getData model)))]
     (.get (.getGetter #^Attribute (nth (.getAttributes (.getMetadata model)) 1)) value)))

+(defn to-list [#^Whale whale]
+  (map (fn [#^Attribute attribute] (.get (.getGetter attribute) whale)) (.getAttributes whale-metadata)))
+
 (defn flat-split-values [[metadata-fn data-fn]]
   (reduce
    (fn [values #^Result result]
        (println (.getModel result) (.getPrefix result) "," (.getPairs result) "," (.getOperation result))
-       (conj values [(map second (.getPairs result)) (.getExtant (.getData (.getModel result)))]))
+       (conj values [(map second (.getPairs result))
+		     (map to-list (.getExtant (.getData (.getModel result))))]))
    {}
    (.getExtant (.getData (.getModel (data-fn))))))

@@ -56,7 +84,7 @@
     [[key]
      (if (every? (fn [value] (instance? Result value)) values) ;TODO - is this the best I can do ?
        (reduce (fn [map value] (conj map (nested-split-values2 value))) {} values)
-       values)]))
+       (map to-list values))]))

 (defn nested-split-values [[metadata-fn data-fn]]
     (second (nested-split-values2 (data-fn))))
@@ -67,6 +95,8 @@
 (defn nested-group-by [[fns-head & fns-tail] data]
   (reduce (fn [current [key val]] (conj current [key (if fns-tail (nested-group-by fns-tail val) val)])) {} (group-by (juxt fns-head) data)))

+
+
 ;;--------------------------------------------------------------------------------
 ;; tests

@@ -75,20 +105,20 @@
 	 (count whale-data))))

 (deftest test-dsum
-  (is (= (reduction-value (? (dsum 4)(dfrom "Whales")))
+  (is (= (reduction-value (? (dsum :length)(dfrom "Whales")))
 	 (reduce (fn [total whale] (+ total (nth whale 4))) 0 whale-data))))

 ;; one dimension -  {[[key][whale...]]...}
 (deftest test-split-1d
-  (is (= (flat-split-values (? (dsplit 2)(dfrom "Whales")))
+  (is (= (flat-split-values (? (dsplit :type)(dfrom "Whales")))
 	 (flat-group-by [(fn [[_ _ type]] type)] whale-data))))

 ;; 2 dimensions - flat - {[[key1 key2][whale...]]...}
 (deftest test-flat-split-2d
-  (is (= (flat-split-values (? (dsplit 3)(dsplit 2)(dfrom "Whales")))
+  (is (= (flat-split-values (? (dsplit :ocean)(dsplit :type)(dfrom "Whales")))
 	 (flat-group-by [(fn [[_ _ type]] type)(fn [[_ _ _ ocean]] ocean)] whale-data))))

 ;;2 dimensions - nested - a map of {[[key1]{[[key2][whale...]]}]...}
 (deftest test-nested-split-2d
-  (is (= (nested-split-values (? (dsplit 2 list [(dsplit 3)])(dfrom "Whales")))
+  (is (= (nested-split-values (? (dsplit :type list [(dsplit :ocean)])(dfrom "Whales")))
 	 (nested-group-by [(fn [[_ _ type]] type)(fn [[_ _ _ ocean]] ocean)] whale-data))))


CMR-3399: Revert timbre logging library to the version before we started seeing timestamp issues

--- common-lib/project.clj
+++ common-lib/project.clj
@@ -6,7 +6,7 @@
                  [org.clojure/core.async "0.2.385"]
                  [org.ow2.asm/asm "5.1"]

-                 [com.taoensso/timbre "4.7.3"]
+                 [com.taoensso/timbre "4.1.4"]

                  [org.clojure/test.check "0.9.0"]
                  [com.gfredericks/test.chuck "0.2.7"]


CMR-1868 fixes ECHO 10 point parsing

CMR-1868 fixes ECHO 10 point parsing

--- umm-spec-lib/src/cmr/umm_spec/xml_to_umm_mappings/echo10/spatial.clj
+++ umm-spec-lib/src/cmr/umm_spec/xml_to_umm_mappings/echo10/spatial.clj
@@ -6,8 +6,9 @@

 (defn- parse-point
   [el]
-  {:Longitude (value-of el "PointLongitude")
-   :Latitude  (value-of el "PointLatitude")})
+  (when el
+    {:Longitude (Double. (value-of el "PointLongitude"))
+     :Latitude  (Double. (value-of el "PointLatitude"))}))

 (defn- parse-center-point-of
   [el]


Enable operation logging when generating the sample Swagger API

--- spec/rook/swagger_spec.clj
+++ spec/rook/swagger_spec.clj
@@ -12,6 +12,7 @@
             [clj-http.client :as client]
             [io.aviso.toolchest.collections :refer [pretty-print]]
             [qbits.jet.server :as jet]
+            [io.aviso.tracker :as t]
             [clojure.tools.logging :as l]
             [io.aviso.rook.server :as server])
   (:import [org.eclipse.jetty.server Server]))
@@ -52,11 +53,12 @@
                          (assoc-in [:template :info :title] "Hotels and Rooms API")
                          (assoc-in [:template :info :version] "Pre-Alpha")))

-(-> (swagger-object nil swagger-options
-                    ["hotels" 'hotels
-                     [[:hotel-id "rooms"] 'rooms]])
-    (json/generate-string {:pretty true})
-    println)
+(binding [t/*log-trace-level* :info]
+  (-> (swagger-object nil swagger-options
+                      ["hotels" 'hotels
+                       [[:hotel-id "rooms"] 'rooms]])
+      (json/generate-string {:pretty true})
+      println))

 (defn start-server
   []


Correct reference to vcs_type (#1874)

Correct reference to vcs_type (#1874)

--- src-cljs/frontend/routes.cljs
+++ src-cljs/frontend/routes.cljs
@@ -339,7 +339,7 @@
     nil. Nil responses are ignored."
   [{:keys [nav-point current-org]}]
   (let [org {:org (:login current-org)
-             :vcs_url (:vcs_url current-org)}]
+             :vcs_type (:vcs_type current-org)}]
     (case nav-point
       :admin-settings nil
       :add-projects (v1-add-projects-path org)


Replace forkjoin with standard fixed thread pool.

--- src/apio/concurrency/core.clj
+++ src/apio/concurrency/core.clj
@@ -1,6 +1,8 @@
 (ns apio.concurrency.core
-  (import (java.util.concurrent ForkJoinPool)))
+  (import (java.util.concurrent Executors)))

 ;; TODO: initialize forkjoin pool in dynamic context
 ;; using dynamic loaded configuration.
-(def *thread-pool* (ForkJoinPool.))
+
+(defn num-processes [] (.availableProcessors Runtime/getRuntime))
+(def *thread-pool* (Executors/newFixedThreadPool (* (num-processes) 2)))


comment

comment

--- src/babel/espanol/grammar.clj
+++ src/babel/espanol/grammar.clj
@@ -339,6 +339,9 @@
                                      :infl :present
                                      :sem {:tense :present}
                                      :cat :verb}})
+
+                   ;; e.g. used as: "tú te llamas Juan" -
+                   ;; [s-present-phrasal 'tú' [vp-pronoun-phrasal 'te' [vp32 'llamarse' 'Juan']]]
                    (unifyc h32
                            root-is-head
                            {:rule "vp-32"


Open file implemented

Open file implemented

--- src/blocks_editor/events.cljs
+++ src/blocks_editor/events.cljs
@@ -22,7 +22,17 @@
 (rf/reg-event-db
  :open-file
  (fn [db [_ _]]
-   (js/alert "OPEN FILE")))
+   (.showOpenDialog
+    dialog
+    #(when %
+       (.readFile fs (aget % 0) "utf-8"
+                  (fn [err content]
+                    (if-not err
+                      (-> content
+                          bx/textToDom (bx/domToWorkspace c/workspace))
+                      (js/alert (str
+                                 "Sorry, could not open your file: \n"
+                                 err)))))))))

 (rf/reg-event-db
  :save-file
@@ -32,8 +42,7 @@
       dialog
       #(when %
          (.writeFile fs % (-> c/workspace
-                              bx/workspaceToDom
-                              bx/domToPrettyText)
+                              bx/workspaceToDom bx/domToPrettyText)
                      (fn [err]
                        (when err
                          (js/alert "Sorry, could not save your file"))))))


Small cleanup in loader.clj

Small cleanup in loader.clj

--- src/clj/elephantdb/loader.clj
+++ src/clj/elephantdb/loader.clj
@@ -90,7 +90,7 @@
     ))

-(defn supervise-shard [domain shard-id max-kbs total-kb ^ShardState shard-state]
+(defn supervise-shard [max-kbs total-kb ^ShardState shard-state]
   (let [downloaded-kb (:downloaded-kb shard-state)
         sleep-interval (:sleep-interval shard-state)]
     (let [dl-kb @downloaded-kb
@@ -117,7 +117,7 @@
                  amount-shards)
           (doseq [[domain shard-states] domain-to-shard-states]
             (doseq [[s-id ^ShardState s-state] shard-states]
-              (supervise-shard domain s-id max-kbs total-kb s-state)))
+              (supervise-shard max-kbs total-kb s-state)))
           (recur))))))

 (defn start-download-supervisor [amount-shards max-kbs ^DownloadState state]


implement Mumbad City Hall

implement Mumbad City Hall

--- src/clj/game/cards-assets.clj
+++ src/clj/game/cards-assets.clj
@@ -517,6 +517,19 @@

    "Mumba Temple"
    {:recurring 2}
+
+   "Mumbad City Hall"
+   {:abilities [{:label "Search R&D for an Alliance card"
+                 :cost [:click 1]
+                 :prompt "Choose an Alliance card to play or install"
+                 :choices (req (cancellable (filter #(and (has-subtype? % "Alliance")
+                                                          (if (is-type? % "Operation")
+                                                            (<= (:cost %) (:credit corp)) true)) (:deck corp)) :sorted))
+                 :msg (msg "reveal " (:title target) " from R&D and "
+                           (if (= (:type target) "Operation") "play " "install ") " it")
+                 :effect (req (if (= (:type target) "Operation")
+                                (play-instant state side target)
+                                (corp-install state side target nil)))}]}

    "Mumbad Construction Co."
    {:derezzed-events {:runner-turn-ends corp-rez-toast}


Refactors the economic campaigns.

Refactors the economic campaigns.

--- src/clj/game/cards-assets.clj
+++ src/clj/game/cards-assets.clj
@@ -2,7 +2,7 @@

 ;;; Asset-specific helpers
 (defn installed-access-trigger
-  "Effect for triggering ambush on access.
+  "Effect for triggering ambush on access.
   Ability is what happends upon access. If cost is specified Corp needs to pay that to trigger."
   ([cost ability]
    (let [ab (if (> cost 0) (assoc ability :cost [:credit cost]) ability)
@@ -43,7 +43,7 @@
 (def cards-assets
   {"Adonis Campaign"
    (campaign 12 3)
-
+
    "Aggressive Secretary"
    (advance-ambush 2 {:effect
                       (req (let [agg card
@@ -51,7 +51,7 @@
                                         (assoc-in [:choices :max] (:advance-counter agg))
                                         (assoc :effect (effect (trash-cards targets))))]
                              (resolve-ability state side ab agg nil)))})
-
+
    "Alix T4LB07"
    {:events {:corp-install {:effect (effect (add-prop card :counter 1))}}
     :abilities [{:cost [:click 1] :label "Gain 2 [Credits] for each counter on Alix T4LB07"
@@ -84,7 +84,7 @@
    "Cerebral Overwriter"
    (advance-ambush 3 {:msg (msg "do " (:advance-counter card 0) " brain damage")
                       :effect (effect (damage :brain (:advance-counter card 0) {:card card}))})
-
+
    "Chairman Hiro"
    {:effect (effect (lose :runner :hand-size-modification 2))
     :leave-play (effect (gain :runner :hand-size-modification 2))
@@ -192,7 +192,7 @@

    "Edge of World"
    (letfn [(ice-count [state]
-             (count (get-in (:corp @state) [:servers (last (:server (:run @state))) :ices])))]
+             (count (get-in (:corp @state) [:servers (last (:server (:run @state))) :ices])))]
        (installed-access-trigger 3 {:msg (msg "do " (ice-count state) " brain damage")
                                     :effect (effect (damage :brain (ice-count state)
                                                             {:card card}))}))
@@ -324,7 +324,7 @@

    "Launch Campaign"
    (campaign 6 2)
-
+
    "Levy University"
    {:abilities [{:prompt "Choose an ICE"
                  :msg (msg "adds " (:title target) " to HQ")
@@ -426,7 +426,7 @@
                                              (:advancementcost target))))}
               card nil))}
     "Score an Agenda from HQ?")
-
+
    "Primary Transmission Dish"
    {:recurring 3}


Repeat transaction 10 times on update conflict, then fail.

--- src/clj/konserve/platform.clj
+++ src/clj/konserve/platform.clj
@@ -41,11 +41,12 @@
                                                                      (assoc-in (read-string v) rkey value)
                                                                      value)))))
                         (catch clojure.lang.ExceptionInfo e
-                          (log e)
-                          (.printStackTrace e)
-                          (if (< attempt 3)
+                          (if (< attempt 10)
                             (trans (cl/get-document db (pr-str fkey)) (inc attempt))
-                            (throw e))))) doc 0))
+                            (do
+                              (log e)
+                              (.printStackTrace e)
+                              (throw e)))))) doc 0))
           nil)))
   (-update-in [this key-vec up-fn]
     (go (let [[fkey & rkey] key-vec
@@ -65,7 +66,7 @@
                 (do (cl/delete-document db doc) [(get-in old rkey) nil])

                 :else
-                ((fn trans [doc]
+                ((fn trans [doc attempt]
                    (let [old (-> doc :edn-value read-string (get-in rkey))
                          new* (try (cl/update-document db
                                                        doc
@@ -75,11 +76,14 @@
                                                                                (update-in (read-string v) rkey up-fn)
                                                                                (up-fn (read-string v)))))))
                                    (catch clojure.lang.ExceptionInfo e
-                                     (log e)
-                                     (.printStackTrace e)
-                                     (trans (cl/get-document db (pr-str fkey)))))
+                                     (if (< attempt 10)
+                                       (trans (cl/get-document db (pr-str fkey)) (inc attempt))
+                                       (do
+                                         (log e)
+                                         (.printStackTrace e)
+                                         (throw e)))))
                          new (-> new* :edn-value read-string (get-in rkey))]
-                     [old new])) doc))))))
+                     [old new])) doc 0))))))

 (defn new-couch-store [db]


clean code

clean code

--- src/clj/salava/factory/db.clj
+++ src/clj/salava/factory/db.clj
@@ -56,10 +56,8 @@
      (let [id (db/save-user-badge! ctx
                            (-> {:id user-id :emails (user/verified-email-addresses ctx user-id)}
                                (p/str->badge (:assertion_url pending-assertion))))]
-       (if metabadge-fn (metabadge-fn ctx (assoc pending-assertion :user_id user-id) id ))
-       )
+       (if metabadge-fn (metabadge-fn ctx (assoc pending-assertion :user_id user-id) id )))
       (delete-duplicate-pending-badges! (assoc pending-assertion :user_id user-id) (u/get-db ctx))
-      ;;process metabadge?

       (catch Exception ex
         (log/error "save-pending-assertions: failed to save badge")
@@ -120,8 +118,7 @@
     (if (and email assertion_url)
       (if-let [id (select-badge-by-assertion {:email email :url assertion_url} (u/get-db-1 ctx))]
         (:id id)
-        (->> (db/save-user-badge! ctx (p/str->badge {:id 0 :emails [email]} assertion_url))
-             (metabadge-fn ctx {:assertion_url assertion_url})))
+        (db/save-user-badge! ctx (p/str->badge {:id 0 :emails [email]} assertion_url)))
       (log/error "receive-badge: failed to fetch pending badge"))
     (catch Exception ex
       (log/error "receive-badge: failed to fetch pending badge")


Added comment documentation for a few uncommented push-argmap keys.

--- src/clojush/pushgp/pushgp.clj
+++ src/clojush/pushgp/pushgp.clj
@@ -28,8 +28,8 @@
                                    (list
                                      (fn [] (lrand-int 100))
                                      (fn [] (lrand))))
-          :population-size 1000
-          :max-generations 1001
+          :population-size 1000 ;; Number of individuals in the population
+          :max-generations 1001 ;; The maximum number of generations to run GP
           :max-points 50 ;; Maximum size of push programs, as counted by points in the program
           :max-points-in-initial-program 50 ;; Maximum size of initial programs in generation 0
           :evalpush-limit 150 ;; The number of Push instructions that can be evaluated before stopping evaluation
@@ -39,6 +39,13 @@
           ;;----------------------------------------
           ;; Genetic operator probabilities
           ;;----------------------------------------
+          ;; The map supplied to :genetic-operator-probabilities should contain genetic operators
+          ;; that sum to 1.0. All available genetic operators are defined in clojush.pushgp.breed.
+          ;; Along with single operators, pipelines (vectors) containing multiple operators are
+          ;; also allowed, where each operator is applied to the child of the previous operator, along
+          ;; with newly selecting individuals where necessary. If an operator is preceeded by
+          ;; :make-next-operator-revertable, it will only keep the child if it is at least as good as
+          ;; its (first) parent on every test case.
           :genetic-operator-probabilities {:reproduction 0.0
                                            :alternation 0.7
                                            :uniform-mutation 0.1
@@ -70,7 +77,7 @@
           ;;----------------------------------------
           :epigenetic-markers [:close] ;; A vector of the epigenetic markers that should be used in the individuals. Implemented options include: :close, :silent
           :close-probabilities [0.772 0.206 0.021 0.001] ;; A vector of the probabilities for the number of parens ending at that position. See random-closes in clojush.random
-          :silent-instruction-probability 0.2
+          :silent-instruction-probability 0.2 ;; If :silent is used as an epigenetic-marker, this is the probability of random instructions having :silent be true
           ;;
           ;;----------------------------------------
           ;; Arguments related to parent selection


Fixed a problem in refactoring.

Fixed a problem in refactoring.

--- src/cmr/search/api/routes.clj
+++ src/cmr/search/api/routes.clj
@@ -11,10 +11,8 @@
             [cmr.common.mime-types :as mt]
             [cmr.search.services.query-service :as query-svc]
             [cmr.system-trace.http :as http-trace]
-            [cmr.search.api.atom-search-results]
             [cmr.search.services.parameters.legacy-parameters :as lp]
             [cmr.search.services.url-helper :as url]
-

             ;; Result handlers
             ;; required here to avoid circular dependency in query service


make a utility fn for converting from node-list to array

--- src-cljs/frontend/utils.cljs
+++ src-cljs/frontend/utils.cljs
@@ -283,3 +283,6 @@
   ([selector] (sel1 js/document selector))
   ([parent selector]
    (.querySelector parent selector)))
+
+(defn node-list->seqable [node-list]
+  (js/Array.prototype.slice.call node-list))


[network/print-layer-summary] First cut. (#62)

* [network/print-layer-summary] First cut.

A function that given a network prints a nice summary of connections between layers and layer parameter buffer shapes.

* [network/print-layer-summary] Thought of a slightly better way to express this.

--- cortex/src/cortex/nn/network.clj
+++ cortex/src/cortex/nn/network.clj
@@ -372,3 +372,67 @@
   (->> (get-node-parameters network node-id)
        (remove :non-trainable?)
        seq))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Print Layer Summary
+(defn- network->parameter-keys
+  [network]
+  (->> network
+       :layer-graph
+       :id->node-map
+       vals
+       (mapcat layers/get-parameter-descriptions)
+       (map :key)
+       (distinct)
+       (sort)))
+
+(defn- layer->input-str
+  [layer]
+  (if (:input-width layer)
+    (format "%sx%sx%s - %s"
+            (:input-channels layer)
+            (:input-height layer)
+            (:input-width layer)
+            (:input-size layer))
+    (str (:input-size layer))))
+
+(defn- layer->output-str
+  [layer]
+  (if (:output-width layer)
+    (format "%sx%sx%s - %s"
+            (:output-channels layer)
+            (:output-height layer)
+            (:output-width layer)
+            (:output-size layer))
+    (str (:output-size layer))))
+
+(defn- layer->buffer-shape
+  [network layer k]
+  (-> network
+      (get-in [:layer-graph :buffers (get-in layer [k :buffer-id]) :buffer])
+      m/shape))
+
+(defn print-layer-summary
+  "Given a network, prints a table summarizing layer input/output sizes as well
+as parameter buffer shapes. This function does not work with descriptions (as
+opposed to networks), but consider:
+
+    (->> description
+         network/build-network
+         traverse/auto-bind-io
+         traverse/network->training-traversal
+         network/print-layer-summary)"
+  [network]
+  (let [parameter-keys (network->parameter-keys network)]
+    (->> network
+         :traversal :forward
+         (mapv (fn [{:keys [id]}]
+                 (let [layer (network->node network id)]
+                   (into {"type" (:type layer)
+                          "input" (layer->input-str layer)
+                          "output" (layer->output-str layer)}
+                         (for [k parameter-keys]
+                                   [k (layer->buffer-shape network layer k)])))))
+         (clojure.pprint/print-table (concat ["type" "input" "output"] parameter-keys))))
+  (println "\nParameter count:" (:parameter-count network)))
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


bug fix commit-prune, now correctly collapsing single leaves into parent's :data attrib

--- org/babel/quadtree.clj
+++ org/babel/quadtree.clj
@@ -1,4 +1,4 @@
-(require '[thi.ng.geom [core :as g] [rect :as r]] '[thi.ng.math.core :as m])
+(require '[thi.ng.geom [core :as g] [rect :as r] [aabb :as a]] '[thi.ng.math.core :as m])

 (defprotocol TreeOps
   (child-index-for-point [this p])
@@ -6,7 +6,8 @@
   (make-child-for-point [this p add-p?])
   (node-bounds [this])
   (split-node [this])
-  (add-point [this p]))
+  (add-point [this p])
+  (delete-point [this p]))

 (defn commit-path
   [node path]
@@ -19,15 +20,20 @@

 (defn commit-prune
   [node path]
-  (if (seq path)
-    (let [[parent i] (peek path)]
-      (recur
-       (->> (if (some identity (:children node)) node)
-            (assoc (:children parent) i)
-            (assoc parent :children))
-       (pop path)))
-    (if (every? nil? (:children node))
-      (assoc node :children nil)
+  (let [children (filter identity (:children node))
+        node (if (seq children)
+               (if (= 1 (count children))
+                 (if-let [d (:data (first children))]
+                   (assoc node :data d :children nil)
+                   node)
+                 node))]
+    (if (seq path)
+      (let [[parent i] (peek path)]
+        (recur
+         (->> node
+              (assoc (:children parent) i)
+              (assoc parent :children))
+         (pop path)))
       node)))

 (defn add-point*
@@ -72,7 +78,8 @@
       (if (< py (+ y h)) 0 2)
       (if (< py (+ y h)) 1 3)))
   (child-for-point [this p]
-    (let [idx (child-index-for-point this p)] [(children idx) idx]))
+    (let [idx (child-index-for-point this p)]
+      [(children idx) idx]))
   (make-child-for-point [this p add?]
     (let [idx (child-index-for-point this p)]
       (if (children idx)
@@ -88,6 +95,11 @@
     [this p]
     (if (g/contains-point? (node-bounds this) p)
       (add-point* this p [])
+      this))
+  (delete-point
+    [this p]
+    (if (g/contains-point? (node-bounds this) p)
+      (delete-point* this p [])
       this)))

 (defrecord OctreeNode [x y z w h d children data]
@@ -98,7 +110,8 @@
          (if (< py (+ y h)) 0 2)
          (if (< py (+ y h)) 1 3))))
   (child-for-point [this p]
-    (let [idx (child-index-for-point this p)] [(children idx) idx]))
+    (let [idx (child-index-for-point this p)]
+      [(children idx) idx]))
   (make-child-for-point [this p add?]
     (let [idx (child-index-for-point this p)]
       (if (children idx)
@@ -115,6 +128,11 @@
     [this p]
     (if (g/contains-point? (node-bounds this) p)
       (add-point* this p [])
+      this))
+  (delete-point
+    [this p]
+    (if (g/contains-point? (node-bounds this) p)
+      (delete-point* this p [])
       this)))

 (defn quadtree


fixing require

fixing require

--- resources/leiningen/new/closp/clj/routes/home.clj
+++ resources/leiningen/new/closp/clj/routes/home.clj
@@ -1,6 +1,7 @@
 (ns {{ns}}.routes.home
   (:require [compojure.core :refer [defroutes GET]]
-            [{{ns}}.layout :as layout]))
+            [{{ns}}.layout :as layout]
+            [ring.util.response :refer [response]]))

 (defn home-page []
   (layout/render "home/index.html"))


(PDB-5022) eastwood: ignore constant-test warnings created by maplog

src/puppetlabs/puppetdb/scf/migrate.clj:1761:34: constant-test: Test
expression is always logical true or always logical
false: (clojure.core/coll? logger-level__31706__auto__) in
form (if (clojure.core/coll? logger-level__31706__auto__)
logger-level__31706__auto__ [#object[clojure.lang.Namespace 0x196d0ee
"puppetlabs.puppetdb.scf.migrate"] logger-level__31706__auto__])

--- eastwood.clj
+++ eastwood.clj
@@ -1,3 +1,12 @@
+
+;; Alphabetically ordered by :linter
+
+(disable-warning
+ {:linter :constant-test
+  :for-macro 'clojure.core/coll?
+  :if-inside-macroexpansion-of #{'puppetlabs.structured-logging.core/maplog}
+  :within-depth 2
+  :reason "maplog checks the logger type at compile time."})

 (disable-warning
  {:linter :deprecations


Add ability to have any comparison sheet, given by name, not just default ComparisonSheet

--- src/aerobio/htseq/rnaseq.clj
+++ src/aerobio/htseq/rnaseq.clj
@@ -24,6 +24,32 @@
 ;;; "/data1/NextSeq/TVOLab/AHL7L3BGXX"
 ;;; "/data1/NextSeq/TVOLab/AHL7L3BGXX/Docs/SampleSheet.csv"
 ;;; "/data1/NextSeq/TVOLab/AHL7L3BGXX/Docs/Exp-AntibioticsRTS_KZ_SD_index.csv"
+
+(defn get-comparison-files
+  "Compute the set of comparison bams and the corresponding output csv
+  for the count table matrix. Comparison sets are based on the
+  ComparisonSheet.csv for the experiment of eid (the experiment
+  id). If rep? is true, returns the comparison sets for replicates of
+  comparison pairs, else returns comparison sets for combined bams."
+  ([eid rep?]
+   (get-comparison-files eid "ComparisonSheet.csv" rep?))
+  ([eid comp-filename rep?]
+   (let [bpath (if rep? [:rep :bams] [:bams])
+         fpath (if rep? [:rep :fcnts] [:fcnts])
+         bams (apply cmn/get-exp-info eid bpath)
+         fcnts (apply cmn/get-exp-info eid fpath)
+         compvec (->> comp-filename
+                      (fs/join (pams/get-params :nextseq-base) eid)
+                      slurp csv/read-csv rest)
+         bamsvec (mapv (fn[v]
+                         (mapcat #(-> (fs/join bams (str % "*.bam"))
+                                      fs/glob sort)
+                                 v))
+                       compvec)
+         otcsvs (mapv (fn[v]
+                        (fs/join fcnts (str (cljstr/join "-" v) ".csv")))
+                      compvec)]
+     (mapv #(vector %1 %2) bamsvec otcsvs))))

 (defn run-rnaseq-phase-0


One more assoc-in -> assoc change

One more assoc-in -> assoc change

--- src/asciinema/player/vt.cljc
+++ src/asciinema/player/vt.cljc
@@ -464,7 +464,7 @@
                         (vec (concat top-lines [curr-line] bottom-lines))))))

 (defn clear-screen [{:keys [width height char-attrs] :as vt}]
-  (assoc-in vt [:lines] (empty-screen width height char-attrs)))
+  (assoc vt :lines (empty-screen width height char-attrs)))

 (defn execute-ed [vt]
   (let [n (get-param vt 0 0)]


Fix namespace name builder

Fix namespace name builder

--- etc/repl.clj
+++ etc/repl.clj
@@ -72,7 +72,7 @@

   Example: (R/start-system! 'foo)"
   [pj-ns-root]
-  (let [an-ns (symbol pj-ns-root ".user")]
+  (let [an-ns (symbol (str pj-ns-root ".user"))]
     (if (get @system-status an-ns)
       (println "!!  System possibly running")
       (do


Remove double input-stream.

Remove double input-stream.

--- dev/src/user.clj
+++ dev/src/user.clj
@@ -24,7 +24,7 @@

 (defn bootstrap []
   (let [db (:db/postgres system)
-        templates (extract-templates-from-gzip-stream (io/input-stream (io/input-stream "dev/resources/test_feed_big.clj.gz")))]
+        templates (extract-templates-from-gzip-stream (io/input-stream "dev/resources/test_feed_big.clj.gz"))]
     (doseq [template templates]
       (db/upsert-template db (adapt-template-to-db template)))))


Fix typo.

Fix typo.

--- src/afterglow/examples.clj
+++ src/afterglow/examples.clj
@@ -567,7 +567,7 @@
 (defn make-strobe-cue
   "_This is no longer used in the sample cue set, but is left as an
   example in case you want to create a strobe cue that depends only on
-  numeric parameters, rather than the newer color paramter
+  numeric parameters, rather than the newer color parameter
   capabilities._

   Create a cue which strobes a set of fixtures as long


CMR-3733: Addressed the PR comments

CMR-3733: Addressed the PR comments

--- search-app/src/cmr/search/data/query_to_elastic.clj
+++ search-app/src/cmr/search/data/query_to_elastic.clj
@@ -199,6 +199,9 @@
     (= length 5) 83
     (and (> length 0) (<= length 4)) 118))

+(def KEYWORD_WILDCARD_NUMBER_MAX
+  30)
+
 (defn- ^:pure validate-keyword-wildcards
   "Validates if the number of keyword strings with wildcards exceeds the max number allowed
    for the max length of the keyword strings."
@@ -208,9 +211,12 @@
           kw-number (count kw-with-wild-cards)
           max-kw-number-allowed (get-max-kw-number-allowed max-kw-length)
           msg (str "Max number of keyword strings with wildcard allowed is: " max-kw-number-allowed
-                    " given the max length of the keyword strings being: " max-kw-length)]
-      (when (> kw-number max-kw-number-allowed)
-        (errors/throw-service-errors :bad-request (vector msg))))))
+                   " given the max length of the keyword strings being: " max-kw-length)]
+      (when (or (> kw-number KEYWORD_WILDCARD_NUMBER_MAX) (> kw-number max-kw-number-allowed))
+        (let [msg (cond
+                    (> kw-number KEYWORD_WILDCARD_NUMBER_MAX) "Max # of keyword strings with * allowed is 30"
+                    :else msg)]
+          (errors/throw-service-errors :bad-request (vector msg)))))))

 (defmethod q2e/query->elastic :collection
   [query]
@@ -218,7 +224,7 @@
         {:keys [concept-type condition]} (query-expense/order-conditions query)
         core-query (q2e/condition->elastic condition concept-type)]
     (if-let [keywords (keywords-in-query query)]
-      (let [_ (validate-keyword-wildcards keywords)]
+      (let [_ (validate-keyword-wildcards keywords)]
         ;; Forces score to be returned even if not sorting by score.
         {:track_scores true
          ;; function_score query allows us to compute a custom relevance score for each document
@@ -227,7 +233,7 @@
          :query {:function_score {:score_mode :multiply
                                   :functions (k2e/keywords->boosted-elastic-filters keywords boosts)
                                   :query {:filtered {:query (eq/match-all)
-                                                     :filter core-query}}}}})
+                                                     :filter core-query}}}}})
       (if boosts
         (errors/throw-service-errors :bad-request ["Relevance boosting is only supported for keyword queries"])
         {:query {:filtered {:query (eq/match-all)


[#3027] Adapt legend value to null values

C

--- backend/specs/akvo/lumen/specs/visualisation/legend.clj
+++ backend/specs/akvo/lumen/specs/visualisation/legend.clj
@@ -8,7 +8,7 @@

 (s/def ::order.s/mode #{"auto" "custom"})

-(s/def ::order.s/value string?)
+(s/def ::order.s/value (s/nilable string?))

 (s/def ::order.s/list (s/coll-of ::order.s/value :distinct true))


getting towards 300 ms for a 6-word sentence

--- src/babel/english/lab.cljc
+++ src/babel/english/lab.cljc
@@ -102,24 +102,26 @@
 (defn basecamp []
   (let [tree the-static-tree]
     (morph (-> tree
-               (basecamp-at [:head :head])
+               (basecamp-at [:head :head] (first (take 1 (shuffle ["see"]))))
                (u/dissoc-paths [[:head :head]])
-               (basecamp-at [:head :comp :head :head])
+               (basecamp-at [:head :comp :head :head] (first (take 1 (shuffle ["game" "word" "book"]))))
                (u/dissoc-paths [[:head :comp :head :head]])
-               (basecamp-at [:head :comp :head :comp])
+               (basecamp-at [:head :comp :head :comp] (first (take 1 (shuffle ["new" "intelligent"]))))
                (u/dissoc-paths [[:head :comp :head]])
-               (basecamp-at [:head :comp :comp])
+               (basecamp-at [:head :comp :comp] "the")
                (u/dissoc-paths [[:head]])
-               (basecamp-at [:comp :head :head])
+               (basecamp-at [:comp :head :head] (first (take 1 (shuffle ["professor" "man" "woman" "pupil"]))))
                (u/dissoc-paths [[:comp :head :head]])
-               (basecamp-at [:comp :head :comp])
+               (basecamp-at [:comp :head :comp] (first (take 1 (shuffle ["tall" "small" "old"]))))
                (u/dissoc-paths [[:comp :head]])
-               (basecamp-at [:comp :comp])
+               (basecamp-at [:comp :comp] "the")
                (u/dissoc-paths [[:comp]])))))

-(defn basecamp-at [tree path]
-  (println (str "@" path))
-  (first (->> (shuffle lexemes)
+(defn basecamp-at [tree path lexeme-surface-form]
+;;  (println (str "@" path))
+  (first (->> (shuffle (filter #(= lexeme-surface-form
+                                   (u/get-in % [:english :english]))
+                               lexemes))
               (map (fn [lexeme]
                      (let [tree (u/copy tree)
                            lexeme (u/copy lexeme)]


add evidences to user data pdf

add evidences to user data pdf

--- src/clj/salava/user/data.clj
+++ src/clj/salava/user/data.clj
@@ -96,15 +96,15 @@
          user-following-fn (first (util/plugin-fun (util/get-plugins ctx) "db" "get-user-following-connections-user"))
          user-following (if-not (nil? user-followers-fn) (user-following-fn ctx user-id) ())]
      (replace-nils (assoc all-user-info
-                          :emails email-addresses
-                          :user_badges user-badges
-                          :user_pages user-pages
-                          :user_files user-files
-                          :events events
-                          :connections connections
-                          :pending_badges pending-badges
-                          :user_followers user-followers
-                          :user_following user-following
+                     :emails email-addresses
+                     :user_badges user-badges
+                     :user_pages user-pages
+                     :user_files user-files
+                     :events events
+                     :connections connections
+                     :pending_badges pending-badges
+                     :user_followers user-followers
+                     :user_following user-following
                      )))))

 (defn strip-html-tags [s]
@@ -196,9 +196,10 @@
         badge-template (pdf/template
                          [:paragraph.generic
                           (when-not (empty? $user_badges)
-                            [:spacer 0]
-                            [:heading.heading-name (t :badge/Mybadges ul)]
-                            (into [:paragraph]
+
+                            (into [:paragraph
+                                   [:spacer 0]
+                                   [:heading.heading-name (t :badge/Mybadges ul)]]
                                   (for [b $user_badges
                                         :let [more-badge-info (replace-nils (b/get-badge ctx (:id b) user-id))
                                               content (:content more-badge-info)
@@ -243,8 +244,19 @@
                                                                             [:chunk.chunk (str (t :badge/OBFurl ul) ": ")] [:anchor {:target (:obf_url b)} [:chunk.link (:obf_url b)]]"\n"
                                                                             [:chunk.chunk (str (t :badge/Assertionurl ul) ": ")] [:anchor {:target (:assertion_url more-badge-info) } [:chunk.link (str (:assertion_url more-badge-info))]]"\n"
                                                                             [:chunk.chunk (str (t :badge/Assertionjson ul) ": ")][:chunk (str (:assertion_json more-badge-info))]"\n"
-                                                                            [:chunk.chunk (str (t :badge/Badgerating ul) ": ") ] [:chunk (str (:rating more-badge-info) "  ")]
-                                                                            [:chunk.chunk (str (t :badge/Evidenceurl ul) ": ")] [:anchor {:target (:evidence_url more-badge-info)} [:chunk.link (str (:evidence_url more-badge-info) " ")]]"\n"
+                                                                            [:chunk.chunk (str (t :badge/Badgerating ul) ": ") ] [:chunk (str (:rating more-badge-info) "  ")]"\n"
+                                                                            ;[:chunk.chunk (str (t :badge/Evidenceurl ul) ": ")] [:anchor {:target (:evidence_url more-badge-info)} [:chunk.link (str (:evidence_url more-badge-info) " ")]]"\n"
+                                                                            (when-not (empty? (:evidences more-badge-info))
+                                                                              [:paragraph
+                                                                               [:spacer]
+                                                                               [:chunk.chunk (str (t :badge/Evidence ul) ": " (count (:evidences more-badge-info)))]"\n"
+                                                                               (reduce (fn [r evidence]
+                                                                                (conj r [:paragraph
+                                                                                (when-not (blank? (:name evidence))[:phrase [:chunk.chunk (str (t :badge/Name ul) ": ")] [:chunk (:name evidence)]])"\n"
+                                                                                (when-not (blank? (:narrative evidence)) [:phrase [:chunk.chunk (str (t :badge/Narrative ul) ": ")][:chunk (:narrative evidence)]])"\n"
+                                                                                (when-not (blank? (:description evidence)) [:phrase [:chunk.chunk (str (t :admin/Description ul) ": ")][:chunk (:description evidence)]])"\n"
+                                                                                [:anchor {:target (:url evidence)}[:phrase [:chunk.chunk (str (t :admin/Url ul) ": ")] [:chunk.link (:url evidence)]]]
+                                                                                [:spacer 0]]) )[:paragraph] (:evidences more-badge-info))])
                                                                             (when (not-empty (:alignment %))
                                                                               [:paragraph
                                                                                [:chunk.chunk (str (t :badge/Alignments ul) ": " (count (:alignment %)))]"\n"


cleanup utils

cleanup utils

--- src/cljc/swarmpit/utils.cljc
+++ src/cljc/swarmpit/utils.cljc
@@ -1,13 +1,14 @@
 (ns swarmpit.utils
   (:require [clojure.walk]
             #?(:clj [flatland.ordered.map :refer [ordered-map]])
-            #?(:clj [clojure.math.numeric-tower :refer [floor expt round]])))
+            #?(:clj [clojure.math.numeric-tower :refer [floor expt round]]))
+  #?(:clj (:import (java.lang Math))))

 #?(:cljs (def ^:private floor (.-floor js/Math)))
 #?(:cljs (def ^:private round (.-round js/Math)))
 #?(:cljs (def ^:private expt (.-pow js/Math)))
 #?(:cljs (def ^:private rounding-const 1000000))
-#?(:clj  (def ^:private log10 #(java.lang.Math/log10 %))
+#?(:clj  (def ^:private log10 #(Math/log10 %))
    :cljs (def ^:private log10 (or (.-log10 js/Math)
                                   #(/ (.round js/Math
                                               (* rounding-const
@@ -15,7 +16,7 @@
                                                     js/Math.LN10)))
                                       rounding-const))))

-#?(:clj  (def ^:private log #(java.lang.Math/log %))
+#?(:clj  (def ^:private log #(Math/log %))
    :cljs (def ^:private log (.-log js/Math)))

 (defn remove-el


Remove sneaky tags file

Remove sneaky tags file

--- src/cljs/retrobard/tags.cljs
+++ src/cljs/retrobard/tags.cljs
@@ -1,2 +0,0 @@
-(ns retroboard.tags
-  (:require [retroboard.resource :as resource]))


Seriously, please don't hit the debug statements when we don't want to debug... because, it's slow as shit.

--- src/clojure/picard/utils.clj
+++ src/clojure/picard/utils.clj
@@ -32,8 +32,10 @@

 (defmacro debug
   [cmpnt msg]
-  (let [logger-name (str "picard.internal." (name cmpnt))]
-    (when (.isDebugEnabled (Logger/getLogger logger-name))
+  (let [logger-name (str "picard.internal." (name cmpnt))
+        logger      (Logger/getLogger logger-name)]
+    (when (and (not (nil? (.getLevel logger)))
+               (.isDebugEnabled (Logger/getLogger logger-name)))
       `(log/log :debug ~msg nil ~logger-name))))

 (defmacro returning


clean up imports

clean up imports

--- src/bitsplit_cli/core.cljs
+++ src/bitsplit_cli/core.cljs
@@ -1,19 +1,13 @@
 (ns bitsplit-cli.core
     (:use [cljs.core.async :only (chan put! <!)]
-          bitsplit.client.protocol
-          bitsplit.storage.protocol
-          bitsplit-cli.commands
-          bitsplit-cli.bitcoind
-          bitsplit-cli.filesystem)
+          [bitsplit.storage.protocol :only (->File)]
+          [bitsplit-cli.commands :only (execute)])
     (:use-macros
         [cljs.core.async.macros :only (go-loop)]))
-
 (def prompt (js/require "prompt"))

 (def storage (->File "FAKE"))
 ; (def client (->Bitcoind ""))
-
-

 (defn read-prompt [p]
     (let [return (chan 1)]


Don't worry about serializers for now.

Don't worry about serializers for now.

--- src/com/lemonodor/gflags.clj
+++ src/com/lemonodor/gflags.clj
@@ -110,15 +110,7 @@
      present
      namespace
      parser
-     serializer
      allow-override])
-
-
-(defn string-parser [flag argument]
-  argument)
-
-(defn string-serializer [value]
-  value)

 (defn define-flag [flag ns]
@@ -139,11 +131,13 @@
     *ns*))

+(defn string-parser [flag argument]
+  argument)
+
 (defn define-string
   "Registers a flag whose value can be any string."
   [name default help & args]
   (apply define string-parser name default help
-         :serializer string-serializer
          args))

@@ -171,13 +165,9 @@
       (throw (Exception.
               (str "Could not parse as integer: \"" argument "\""))))))

-(defn integer-serializer [value]
-  (str value))
-
 (defn define-integer [name default help & args]
   "Registers a flag whose value must be an integer."
   (apply define integer-parser name default (or help "an integer value")
-         :serializer integer-serializer
          args))

@@ -188,14 +178,10 @@
       (throw (Exception.
               (str "Could not parse as float: \"" argument "\""))))))

-(defn float-serializer [value]
-  (str value))
-
 (defn define-float
   "Registers a flag whose value must be a float."
   [name default help & args]
   (apply define float-parser name default (or help "a float value")
-         :serializer float-serializer
          args))

@@ -205,14 +191,10 @@
     (throw (Exception. (str "Value should be one of "
                             (string/join "|" (:enum-values flag)))))))

-(defn enum-serializer [value]
-  (str value))
-
 (defn define-enum
   "Registers a flag whose value can be any string from enum_values."
   [name default enum-values help & args]
   (apply define enum-parser name default  (or help "an enum value")
-         :serializer enum-serializer
          :enum-values enum-values
          args))

@@ -237,7 +219,6 @@
   [name default help & args]
   (apply define (make-multi-parser string-parser)
          name default help
-         :serializer string-serializer
          args))

@@ -251,7 +232,6 @@
  [name default help & args]
   (apply define (make-multi-parser integer-parser)
          name default help
-         :serializer integer-serializer
          args))

@@ -266,7 +246,6 @@
   (apply define
          (make-multi-parser float-parser)
          name default help
-         :serializer float-serializer
          args))

@@ -353,7 +332,6 @@
                  (conj new-argv current-arg)))))))

-
 (defn parse-flags
   "Parses command line flags.  Sets *flags* to be the flag values, and
    returns unparsed arguments.  Note that args should start with


Add y-grid and zoom

Add y-grid and zoom

--- src-cljs/frontend/components/insights/project.cljs
+++ src-cljs/frontend/components/insights/project.cljs
@@ -68,6 +68,8 @@
                                          :columns [(concat ["date"] (map first build-times))
                                                    (concat ["Build Times"] (map last build-times))]}
                                   :legend {:hide true}
+                                  :grid {:y {:show true}}
+                                  :zoom {:enabled true}
                                   :axis {:x {:type "timeseries"
                                              :tick {:format "%m/%d"}}}}))))
     om/IRender


State scales/keys more concisely to show how simple they are.

--- src/african_polyphony_and_polyrhythm/talk.clj
+++ src/african_polyphony_and_polyrhythm/talk.clj
@@ -189,20 +189,9 @@

 ; Keys
-(defn A
-  "Convert a relative midi code into an absolute one in the key of A."
-  [relative-midi]
-  (+ relative-midi 69))
-
-(defn B
-  "Convert a relative midi code into an absolute one in the key of B."
-  [relative-midi]
-  (+ relative-midi 71))
-
-(defn C
-  "Convert a relative midi code into an absolute one in the key of C."
-  [relative-midi]
-  (+ relative-midi 72))
+(defn A [relative-midi] (+ relative-midi 69))
+(defn B [relative-midi] (+ relative-midi 71))
+(defn C [relative-midi] (+ relative-midi 72))

 (comment
   (->> (phrase (repeat 1/4) [0 2 4 5 7 9 11 12])
@@ -210,9 +199,9 @@
        live/play))

 ; Scales
-(def major "Happy seven-note scale" (scale [2 2 1 2 2 2 1]))
-(def minor "Sad seven-note scale" (scale [2 1 2 2 1 2 2]))
-(def pentatonic "Five-note scale" (scale [2 3 2 2 3]))
+(def major (scale [2 2 1 2 2 2 1]))
+(def minor (scale [2 1 2 2 1 2 2]))
+(def pentatonic (scale [2 3 2 2 3]))

 (comment
   (->> (phrase (repeat 1/4) (range 0 8))


Fix tag for UUID

Fix tag for UUID

--- src/clojure/clojurewerkz/cassaforte/uuids.clj
+++ src/clojure/clojurewerkz/cassaforte/uuids.clj
@@ -43,7 +43,7 @@
   [^long timestamp]
   (UUIDs/endOf timestamp))

-(defn ^long unix-timestamp
+(defn ^{:tag 'long} unix-timestamp
   "Return the unix timestamp contained by the provided time-based UUID."
   [^UUID uuid]
   (UUIDs/unixTimestamp uuid))


Minor changes.

Minor changes.

--- src/clojure/clojurewerkz/cassaforte/uuids.clj
+++ src/clojure/clojurewerkz/cassaforte/uuids.clj
@@ -1,9 +1,9 @@
 (ns clojurewerkz.cassaforte.uuids
-  "Provides utility methods to work with UUID"
+  "Provides utility methods to work with UUID."
   (:import [com.datastax.driver.core.utils UUIDs]
-            [java.util UUID]))
+           [java.util UUID]))

-(defn random
+(defn random
   "Creates a new random (version 4) UUID."
   []
   (UUID/randomUUID))


type hint for addFrag

type hint for addFrag

--- src/clj/neb/defragment.clj
+++ src/clj/neb/defragment.clj
@@ -8,11 +8,17 @@

 (set! *warn-on-reflection* true)

+(defn collect-frag* [^trunk ttrunk start end]
+  (locking (.getFragments ttrunk)
+    (.addFragment ttrunk start end)))
+
 (defn collecting-frags []
   (a/go-loop []
-    (let [[^trunk ttrunk start end] (a/<! pending-frags)]
-      (locking (.getFragments ttrunk)
-        (.addFragment ttrunk start end)))
+    (let [params (a/<! pending-frags)
+          ttrunk (params 0)
+          start (params 1)
+          end (params 2)]
+      (collect-frag* ttrunk start end))
     (recur)))

 (defn scan-trunk-and-defragment [^trunk ttrunk]


dead code removal

dead code removal

--- src/clj/omlab/db/query.clj
+++ src/clj/omlab/db/query.clj
@@ -18,17 +18,6 @@
         :db.cardinality/one (ffirst result)
         :db.cardinality/many (into #{} (map first result)))
       if-not)))
-
-(defn ref-keyword
-  "Returns db/ident of given attr or e or nil if missing."
-  [db e attr]
-  (when-let [result (seq (d/q '[:find ?v
-                          :in $ ?e ?a
-                          :where
-                          [?e ?a ?en]
-                          [?en :db/ident ?v]]
-                              db e attr))]
-    (-> result ffirst name keyword)))

 (def ref-rules
   '[[[ref-keyword ?e ?a ?v]


fix extract-dependencies in tasks

fix extract-dependencies in tasks

--- src/clj/protobuf/tasks.clj
+++ src/clj/protobuf/tasks.clj
@@ -32,24 +32,24 @@
     (ant ExecTask {:dir srcdir :executable "sudo"}
          (args ["make" "install"]))))

-(defn- proto-dependencies
-  "look for lines starting with import in proto-file"
+(defn- proto-dependencies "look for lines starting with import in proto-file"
   [proto-file]
   (for [line (line-seq (reader proto-file)) :when (.startsWith line "import")]
     (second (re-matches #".*\"(.*)\".*" line))))

 (defn extract-resource [name dest-dir]
   (if-let [url (.findResource (.getClassLoader clojure.lang.RT) name)]
-    (let [conn (.openConnection url)]
+    (let [dest (File. dest-dir name)
+          conn (.openConnection url)]
+      (.mkdirs (.getParentFile dest))
       (if (instance? JarURLConnection conn)
-        (let [jar  (cast JarURLConnection conn)
-              dest (File. dest-dir (.. jar getJarEntry getName))]
+        (let [jar (cast JarURLConnection conn)]
           (copy (.getInputStream jar) dest))
-        (copy (File. (.getFile url)) (File. dest-dir name))))
+        (copy (File. (.getFile url)) dest))
+      dest)
     (throw (Exception. (format "unable to find %s on classpath" name)))))

-(defn extract-dependencies
-  "extract all files proto is dependent on"
+(defn extract-dependencies "extract all files proto is dependent on"
   [proto-file]
   (loop [files (vec (proto-dependencies proto-file))]
     (when-not (empty? files)
@@ -57,7 +57,7 @@
             files (pop files)]
         (if (or (.exists (file "proto" proto)) (.exists (file "build/proto" proto)))
           (recur files)
-          (let [proto-file (extract-resource (str "proto/" proto) "build/proto")]
+          (let [proto-file (extract-resource (str "proto/" proto) "build")]
             (recur (into files (proto-dependencies proto-file)))))))))

 (defn protoc


Add site prefix to tile path

Add site prefix to tile path

--- src/clj/zetawar/views.cljs
+++ src/clj/zetawar/views.cljs
@@ -102,7 +102,7 @@
         image (terrain-image terrain)]
     [:image {:x x :y y
              :width 32 :height 34
-             :xlink-href (str "/images/game/" image)}]))
+             :xlink-href (site/prefix "/images/game/" image)}]))

 (defn tile [{:as view-ctx :keys [dispatch]} terrain]
   (let [{:keys [terrain/q terrain/r]} terrain]


enable browser console logging by default in development

--- src/cljs/dev/figwheel.cljs
+++ src/cljs/dev/figwheel.cljs
@@ -1,5 +1,7 @@
 (ns dev.figwheel
   (:require [figwheel.client :as fw :include-macros true]))

+(enable-console-print!)
+
 (fw/watch-and-reload :websocket-url "ws://localhost:3449/figwheel-ws"
                      :jsload-callback (fn [] ))


Cancel reminder buttons looks better in "danger" than "warning"

I figured "Warning" was more fitting, since it is not an irreversible
change, but I don't really like the yellowish look. Canceling a reminder
does have a destructive quality, since the reminder periodicity is lost,
so "Danger" fits.

Minor change from #87.

--- src/cljs/memento/core.cljs
+++ src/cljs/memento/core.cljs
@@ -231,9 +231,9 @@
                         :on-click #(dispatch [:reminder-viewed item])}
                  [:i {:class "fa fa-check"} " " label]]
                 (when (or next-leap (nil? day-idx))
-                  [:span {:class    "btn btn-warning btn-xs icon-margin-left"
+                  [:span {:class    "btn btn-danger btn-xs icon-margin-left"
                           :on-click #(dispatch [:reminder-cancel item])}
-                   [:i {:class "fa fa-trash"} " Cancel"]])]
+                   [:i {:class "fa fa-trash"} "Cancel"]])]
                ;; Showing only the buttons for Elaborate and Thread. I don't want to get into the potential mess
                ;; of editing or removing a thought while the reminder is shown yet.
                [:span {:class "col-sm-8" :style {:text-align "right"}}
@@ -348,7 +348,7 @@
                      :bsSize   "xsmall"
                      :on-click #(dispatch [:reminder-create memory "spaced"])}
              [:i {:class "fa fa-bell icon-margin-both"}] "Remind"]
-            [Button {:bsStyle  "warning"
+            [Button {:bsStyle  "danger"
                      :bsSize   "xsmall"
                      ;; doseq since a thought may have multiple reminders
                      :on-click #(doseq [item (:reminders memory)]


Bugfix: We were never getting the spinner since we cleared the results

https://app.asana.com/0/17212341701456/48518202582333

--- src/cljs/memento/core.cljs
+++ src/cljs/memento/core.cljs
@@ -233,7 +233,10 @@
                                      })
           (-> app-state
               (assoc-in [:ui-state :is-searching?] true)
-              (assoc :search-state {:query q :page-index p :list list})
+              (assoc :search-state {:query       q
+                                    :page-index  p
+                                    :list        list
+                                    :last-result (get-in app-state [:search-state :last-result])})
               ))
         app-state
         ))))


change reference image path

change reference image path

--- src/cljs/slice/config.cljs
+++ src/cljs/slice/config.cljs
@@ -11,7 +11,7 @@

 (defn configure! []
   (reset! st/app-state
-          {:image {:x 0 :y 0 :src "/images/home_signed.jpg"}
+          {:image {:x 0 :y 0 :src "/images/reference.png"}
            :mouse-old {:x 0 :y 0}
            :tools {:x 50 :y 50}
            :mouse-moving false


fix chans bug; turn two loops into one

fix chans bug; turn two loops into one

--- src/cljs/unfolds/core.cljs
+++ src/cljs/unfolds/core.cljs
@@ -35,14 +35,14 @@
 ;; =============================================================================
 ;; Helpers

-(defn add-item [item owner {:keys [event navigate]}]
+(defn add-item [item owner event-chan]
   (let [new-text (-> (om/get-node owner "new-item-text")
                      .-value)
         new-title (-> (om/get-node owner "new-item-title")
                       .-value)]
     (when (and new-title new-text)
-      (put! event {:op :create
-                   :data {:item/title new-title :item/text new-text}}))))
+      (put! event-chan {:op :create
+                        :data {:item/title new-title :item/text new-text}}))))

 (defn handle-item-text-change [e owner {:keys [text]}]
   (let [value (.. e -target -value)
@@ -93,12 +93,11 @@
                (apply dom/div nil
                       (prepare-item (:item/text item)))))))

-(defn item-add-view [item owner {:keys [navigate event]}]
+(defn item-add-view [item owner]
   (reify
     om/IRenderState
     (render-state [_ state] ;; keys chan as etc?
-      (let [opts {:navigate navigate
-                  :event event}]
+      (let [event-chan (om/get-state owner [:event-chan])]
         (dom/div #js {:id "item-add-view"}
         (dom/div #js {:id "item-info"}
                  (dom/div #js {:className "item-name editable"}
@@ -121,27 +120,30 @@
                            :onChange
                            #(handle-item-text-change % owner state)})

-            (dom/button #js {:onClick #(add-item item owner opts)}
+            (dom/button #js {:onClick #(add-item item owner event-chan)}
                         "Add item"))))))))

 (defn handle-search-change [e owner {:keys [text]}]
   (let [value (.. e -target -value)]
     (om/set-state! owner :text text)))

-(defn search [owner {:keys [event navigate]}]
+(defn search [owner event-chan]
   (let [search (-> (om/get-node owner "search")
                    .-value)]
     (when (and search (not= search ""))
-      (put! event {:op :search :data {:subs search}}))))
-
-(defn search-view [items owner {:keys [navigate event]}]
+      (put! event-chan {:op :search :data {:subs search}}))))
+
+(defn search-view [items owner]
+ ;;defn search-view [items owner {:keys [navigate event]}]
   (reify
     om/IRenderState
     (render-state [_ state]
-      (let [opts {:navigate navigate
-                  :event event}]
+      (let [event-chan (om/get-state owner [:event-chan])
+            ;; opts {:navigate navigate
+            ;;       :event event}
+            ]
         (dom/div #js {:id "search-view"}
-                 (dom/p nil "Currently only title's are searchable. It
+                 (dom/p nil "Currently only titles are searchable. It
                  might take a few seconds before entries are
                  indexed.")
           (str "Search: ")
@@ -150,7 +152,7 @@
                           :ref "search"
                           :onChange
                           #(handle-search-change % owner state)})
-          (dom/button #js {:onClick #(search owner opts)} "Search")
+          (dom/button #js {:onClick #(search owner event-chan)} "Search")

           (apply dom/ul #js {:id "items-list"}
                  (map (fn [item]
@@ -169,54 +171,36 @@
   (reify
     om/IInitState
     (init-state [_]
-      {:navigate (chan)
-       :event (chan)})
+      {:chans {:event-chan (chan (sliding-buffer 1))}
+       :navigate (chan)
+       :event (chan (sliding-buffer 1))})

     om/IWillMount
     (will-mount [_]
-
-      (defroute "/" []
-        (om/update! app :route
-                    [:view-item "ea72343d-89dc-4dfc-85af-25e1113b0948"]))
-
-      (defroute "/new" []
-        (om/update! app :route [:add-item]))
-
-      (defroute "/search" []
-        (om/update! app :route [:search-item]))
-
-      (defroute "/:id" {id :id}
-        (om/update! app :route [:view-item id])
-        (put! (om/get-state owner :event) {:op :get :data id}))
-
-      (.setEnabled history true)
-
-      ;; routing loop
-      (go (loop []
-            (let [id (<! (om/get-state owner :navigate))]
-              (cond
-               (= id :new)
-               (do
-                 (.setToken history "/new")
-                 (om/update! app :current-item
-                             {:item/title "New item"
-                              :item/text ""}))
-
-               (= id :search)
-               (.setToken history "/search")))
-            (recur)))
-
-      ;; event loop
-      (go (loop []
-            (let [event (om/get-state owner :event)
-                  {:keys [op data]} (<! event)]
+      (prn "MOUNTED.")
+      (let [event-chan (om/get-state owner [:chans :event-chan])]
+        (go
+          (while true
+            (let [{:keys [op data]} (<! event-chan)]
+              (prn "event-chan " op ": " data)
               (condp = op
+
+                :view-new
+                (do
+                  (.setToken history "/new")
+                  (om/update! app :current-item
+                              {:item/title "New item"
+                               :item/text ""}))
+
+                :view-search
+                (do
+                  (.setToken history "/search"))

                 :create
                 (let [data (<! (util/edn-chan
                                 {:method :post :url "/items"
                                  :data data}))]
-                  (.setToken history (str "/" (:item/id data))) ;; XXX
+                  (.setToken history (str "/" (:item/id data)))
                   (om/transact! app :current-item #(merge % data)))

                 :get
@@ -227,18 +211,31 @@
                 :search
                 (let [data (<! (util/edn-chan
                                 {:url (str "/search/" (:subs data))}))]
-                  ;; XXX: what if there's no hit?
-                  ;;(.setToken history (str "/items")) ;; XXX
-                  (om/transact! app :items (fn [_] data))
-                  )
-
-                (recur))))))
+                  ;;(.setToken history (str "/search/" (:subs data)))
+                  (om/update! app [:items] data)))))))
+
+      (defroute "/" []
+        (om/update! app :route
+                    [:view-item "ea72343d-89dc-4dfc-85af-25e1113b0948"]))
+
+      (defroute "/new" []
+        (om/update! app :route [:add-item]))
+
+      (defroute "/search" []
+        (om/update! app :route [:search-item]))
+
+      (defroute "/:id" {id :id}
+        (om/update! app :route [:view-item id])
+        (put! (om/get-state owner [:chans :event-chan]) {:op :get :data id}))
+
+      (.setEnabled history true))

     om/IRenderState
-    (render-state [_ {:keys [navigate event]}]
+    (render-state [_ {:keys [chans]}]
       (let [route (:route app)
-            opts {:opts {:navigate navigate
-                         :event event}}]
+            opts {:init-state chans}
+            event-chan (om/get-state owner [:chans :event-chan]) ;; XXX
+            ]
         ;; menu bar
         (dom/div nil
           (dom/p nil
@@ -249,19 +246,19 @@
             (dom/button
              #js {:id "add-item"
                   :className "button"
-                  :onClick (fn [e] (put! navigate :new))}
+                  :onClick (fn [e] (put! event-chan {:op :view-new :data nil}))}
              "Add")

             (dom/button
              #js {:id "search-item"
                   :className "button"
-                  :onClick (fn [e] (put! navigate :search))}
+                  :onClick (fn [e] (put! event-chan {:op :view-search :data nil}))}
              "Search"))

           (dom/div nil
             (case (first (:route app))
               :add-item (om/build item-add-view (:current-item app) opts)
-              :search-item (om/build search-view (:items app)  opts)
+              :search-item (om/build search-view (:items app) opts)
               :view-item (om/build item-view (:current-item app) opts))))))))

 (util/edn-xhr


bring back 1-word linking?

bring back 1-word linking?

--- src/cljs/unfolds/core.cljs
+++ src/cljs/unfolds/core.cljs
@@ -35,8 +35,6 @@
 ;; =============================================================================
 ;; Helpers

-(defn link [href str] (dom/a #js {:href href} str))
-
 (defn add-item [item owner {:keys [sync current-item]}]
   (let [new-text (-> (om/get-node owner "new-item-text")
                      .-value)
@@ -90,7 +88,9 @@
                (dom/h2 nil (:item/title item))
                (dom/br nil "")
                (link (str "#/" (:item/id item)) (:item/id item))
-               (dom/p nil (:item/text item))))))
+               ;; prepare-item
+               (apply dom/div nil
+                      (prepare-item (:item/text item)))))))

 (defn item-add-view [item owner {:keys [current-item sync]}]
   (reify


Rename events to traces in traces view

Rename events to traces in traces view

--- src/day8/re_frame/trace.cljs
+++ src/day8/re_frame/trace.cljs
@@ -307,7 +307,7 @@
               (when (pos? (count @filter-items))
                 (str (count visible-traces) " of "))
               (str (count @traces))]
-             " events "
+             " traces "
              (when (pos? (count @traces))
                [:span "(" [:button.text-button {:on-click #(do (trace/reset-tracing!) (reset! traces []))} "clear"] ")"])]
             [:th {:style {:text-align "right"}} "meta"]]


Replaced group-by in conexp.graphics.nodes-and-connections

by group-by-function, since group-by is now in clojure.core.

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

--- src/conexp/graphics/nodes_and_connections.clj
+++ src/conexp/graphics/nodes_and_connections.clj
@@ -310,7 +310,7 @@
 	       (recur neighbors (into (rest to-process) neighs) (conj visited next))
 	       (recur neighbors (into (rest to-process) neighs) visited))))))))

-(defn- group-by
+(defn- group-by-function
   "Categorizes elements in coll by their value under f."
   [f coll]
   (loop [elements coll,
@@ -328,7 +328,7 @@
   representing the influence by node."
   [node uppers lowers]
   (let [irrs (all-irreducible-neighbored-nodes node uppers),
-	others (group-by identity
+	others (group-by-function identity
 			 (apply concat (map #(all-neighbored-nodes % lowers) irrs))),

 	irr-count (count irrs)]


Check for System/console before using it

--- src/leiningen/droid/utils.clj
+++ src/leiningen/droid/utils.clj
@@ -270,7 +270,12 @@
   "Reads the password from the console without echoing the
   characters."
   [prompt]
-  (join (.readPassword (System/console) prompt nil)))
+  (if-let [console (System/console)]
+    (join (.readPassword console prompt nil))
+    (do
+      (print prompt)
+      (flush)
+      (read-line))))

 (defn append-suffix
   "Appends a suffix to a filename, e.g. transforming `sample.apk` into


Updated ring-server to 0.2.4

Updated ring-server to 0.2.4

--- src/leiningen/ring/server.clj
+++ src/leiningen/ring/server.clj
@@ -16,7 +16,7 @@
   [project options]
   (let [project (update-in project [:ring] merge options)]
     (eval-in-project
-     (update-in project [:dependencies] conj ['ring-server "0.2.3"])
+     (update-in project [:dependencies] conj ['ring-server "0.2.4"])
      `(ring.server.leiningen/serve '~project)
      (load-namespaces
       'ring.server.leiningen


Added experimental "smarter" function

Added experimental "smarter" function

--- src/clojure_club/x106_number_maze/brockturner.clj
+++ src/clojure_club/x106_number_maze/brockturner.clj
@@ -17,3 +17,70 @@
                   (apply hash-set))
              (into past current)
              (inc dist)))))
+
+(defn maze-printer [start end]
+  (loop [current #{start}
+         past #{}
+         dist 1]
+    (prn dist current)
+    (if (current end)
+      dist
+      (recur (->> (reduce
+                   (fn [nset n]
+                     (let [tmp (conj nset (+ 2 n) (* 2 n))]
+                       (if (= 0 (mod n 2))
+                         (conj tmp (/ n 2))
+                         tmp)))
+                   #{} current)
+                  (remove (into past current))
+                  (apply hash-set))
+             (into past current)
+             (inc dist)))))
+
+(defn next-step [goal path]
+  (let [current (-> path last last)]
+    (cond
+      (= current goal) nil
+      (and (= 2 current)
+           (odd? goal)
+           (<= goal 17)
+           (< current goal)) (conj path [["/"] -1 1])
+      (or (and (odd? current)
+               (odd? goal)
+               (<= goal 17)
+               (< current goal))
+          (and (= 4 current) (= 3 goal))
+          (and (= 1 current) (= 6 goal))
+          ) (conj path [["+"] 2 (+ current 2)])
+      (<= (* 2 current) goal) (conj path [["*"] current (* 2 current)])
+      (and (> current goal)
+           (even? current)) (conj path [["/"] (- (/ current 2)) (/ current 2)])
+      (and (> current goal)
+           (odd? current)) (conj path [["*" "+" "/" "/"] (-> current dec (/ 2) -) (-> current inc (/ 2))])
+      (or (and (odd? current) (odd? goal))
+          (and (even? current) (even? goal))) (conj path [["+"] 2 (+ 2 current)])
+      :else (conj path [["*" "+" "/"] 1 (inc current)]))))
+
+(defn optimize [path]
+  (->> (mapcat first path)
+       (reduce #(if (or (and (= %2 "/") (= "*" (peek %1)))
+                        (and (= %2 "*") (= "/" (peek %1))))
+                  (pop %1)
+                  (conj %1 %2)) [])))
+;; todo: [* + +] -> [+ *] and [* * + / + +] -> [+ * * + /]
+
+
+(defn line-runner [start end]
+  (->> [["s" start]]
+       (iterate (partial next-step end))
+       (take-while identity)
+       (take 30)
+       last
+       optimize))
+
+;; issues: 3 1
+(defn test-maze [r-start r-end]
+  (doseq [x (range r-start r-end) y (range r-start r-end)]
+    (let [[l m] ((juxt line-runner maze-runner) x y)]
+      (when (not= (count l) m)
+        (prn x y l m)))))


Test schema validation with rook.dispatcher

--- spec/rook/dispatcher_spec.clj
+++ spec/rook/dispatcher_spec.clj
@@ -163,8 +163,42 @@
           (-> (mock/request :get "/fred")
             handler
             :body
-            :message))))
-
-    (it "should send schema validation failures")
-
-    (it "should return a 500 response if a sync handler throws an exception")))
+            :message)))))
+
+  (describe "handlers with schema attached"
+
+    (it "should respond appropriately given a valid request"
+      (let [middleware (fn [handler]
+                         (-> handler
+                           rook-async/wrap-with-schema-validation
+                           rook/wrap-with-default-arg-resolvers))
+            handler    (->> (dispatcher/namespace-dispatch-table
+                              ["validating"] 'validating middleware)
+                         (dispatcher/compile-dispatch-table
+                           {:apply-middleware-fn dispatcher/apply-middleware-async})
+                         rook-async/wrap-with-loopback
+                         rook-async/async-handler->ring-handler)
+            response   (-> (mock/request :post "/validating")
+                         (merge {:params {:name "Vincent"}})
+                         handler)]
+        (should= HttpServletResponse/SC_OK (:status response))
+        (should= [:name] (:body response))))
+
+    (it "should send schema validation failures"
+      (let [middleware (fn [handler]
+                         (-> handler
+                           rook-async/wrap-with-schema-validation
+                           ring.middleware.keyword-params/wrap-keyword-params
+                           ring.middleware.params/wrap-params))
+            handler    (->> (dispatcher/namespace-dispatch-table
+                              ["validating"] 'validating middleware)
+                         (dispatcher/compile-dispatch-table
+                           {:apply-middleware-fn dispatcher/apply-middleware-async})
+                         rook-async/wrap-with-loopback
+                         rook-async/async-handler->ring-handler)
+            response   (-> (mock/request :post "/validating")
+                         handler)]
+        (should= HttpServletResponse/SC_BAD_REQUEST (:status response))
+        (should= "validation-error" (-> response :body :error))
+        ;; TODO: Not sure that's the exact format I want sent back to the client!
+        (should= "{:name missing-required-key}" (-> response :body :failures))))))


add project name input class

add project name input class

--- frontend/src/uxbox/main/ui/dashboard/projects.cljs
+++ frontend/src/uxbox/main/ui/dashboard/projects.cljs
@@ -200,7 +200,7 @@
      (grid-item-thumbnail project)
      [:div.item-info
       (if (:edition @local)
-        [:input {:type "text"
+        [:input.element-name {:type "text"
                  :auto-focus true
                  :on-key-down on-key-down
                  :on-blur on-blur


:sparkles: Better handle zoom on drawing.

--- frontend/src/uxbox/main/ui/workspace/drawarea.cljs
+++ frontend/src/uxbox/main/ui/workspace/drawarea.cljs
@@ -135,22 +135,21 @@
       ptk/WatchEvent
       (watch [_ state stream]
         (let [pid (get-in state [:workspace :current])
-              zoom (get-in state [:workspace pid :zoom])
-              flags (get-in state [:workspace pid :flags])
+              {:keys [zoom flags]} (get-in state [:workspace pid])
               align? (refs/alignment-activated? flags)

-              stoper (->> (rx/filter #(or (uws/mouse-up? %) (= % :interrupt)) stream)
-                          (rx/take 1))
+              stoper? #(or (uws/mouse-up? %) (= % :interrupt))
+              stoper (rx/filter stoper? stream)

               mouse (->> uws/mouse-position
                          (rx/mapcat #(conditional-align % align?))
-                         (rx/with-latest vector uws/mouse-position-ctrl))]
+                         (rx/map #(gpt/divide % zoom)))]
           (rx/concat
-           (->> uws/mouse-position
+           (->> mouse
                 (rx/take 1)
-                (rx/mapcat #(conditional-align % align?))
                 (rx/map (fn [pt] #(initialize-drawing % pt))))
            (->> mouse
+                (rx/with-latest vector uws/mouse-position-ctrl)
                 (rx/map (fn [[pt ctrl?]] #(update-drawing % pt ctrl?)))
                 (rx/take-until stoper))
            (rx/of handle-finish-drawing)))))))
@@ -189,17 +188,17 @@
       ptk/WatchEvent
       (watch [_ state stream]
         (let [pid (get-in state [:workspace :current])
-              zoom (get-in state [:workspace pid :zoom])
-              flags (get-in state [:workspace pid :flags])
+              {:keys [zoom flags]} (get-in state [:workspace pid])
+
               align? (refs/alignment-activated? flags)
-
-              last-point (volatile! @uws/mouse-position)
+              last-point (volatile! (gpt/divide @uws/mouse-position zoom))

               stoper (->> (rx/filter stoper-event? stream)
                           (rx/share))

               mouse (->> (rx/sample 10 uws/mouse-position)
-                         (rx/mapcat #(conditional-align % align?)))
+                         (rx/mapcat #(conditional-align % align?))
+                         (rx/map #(gpt/divide % zoom)))

               points (->> stream
                           (rx/filter uws/mouse-click?)
@@ -267,12 +266,14 @@
       ptk/WatchEvent
       (watch [_ state stream]
         (let [pid (get-in state [:workspace :current])
-              zoom (get-in state [:workspace pid :zoom])
-              flags (get-in state [:workspace pid :flags])
+              {:keys [zoom flags]} (get-in state [:workspace pid])
+
               align? (refs/alignment-activated? flags)
               stoper (rx/filter stoper-event? stream)
-              mouse (->> (rx/sample 10 uws/mouse-position)
-                         (rx/mapcat #(conditional-align % align?)))]
+              mouse  (->> (rx/sample 10 uws/mouse-position)
+                          (rx/mapcat #(conditional-align % align?))
+                          (rx/map #(gpt/divide % zoom)))]
+
           (rx/concat
            (rx/of initialize-drawing)
            (->> mouse


toggle edit mode with warning when changes would be discarded

--- iwaswhere-web/src/cljs/iwaswhere_web/ui/entry.cljs
+++ iwaswhere-web/src/cljs/iwaswhere_web/ui/entry.cljs
@@ -25,17 +25,34 @@

 (defn trash-icon
   "Renders a trash icon, which transforms into a warning button that needs to be clicked
-  again for actual deletion. This label is a little to the right, so it can't be clicked
-  accidentally, and disappears again within 5 seconds."
+   again for actual deletion. This label is a little to the right, so it can't be clicked
+   accidentally, and disappears again within 5 seconds."
   [trash-fn]
   (let [clicked (r/atom false)
         guarded-trash-fn (fn [_ev]
                            (swap! clicked not)
                            (.setTimeout js/window #(reset! clicked false) 5000))]
-    (fn [trash-entry]
+    (fn [trash-fn]
       (if @clicked
         [:span.delete-warn {:on-click trash-fn} [:span.fa.fa-trash] "  confirm delete?"]
         [:span.fa.fa-trash-o.toggle {:on-click guarded-trash-fn}]))))
+
+(defn edit-icon
+  "Renders an edit icon, which transforms into a warning button that needs to be clicked
+   again for actually discarding changes. This label is a little to the right, so it can't be
+   clicked accidentally, and disappears again within 5 seconds."
+  [toggle-edit edit-mode?]
+  (let [clicked (r/atom false)
+        guarded-edit-fn (fn [_ev]
+                           (swap! clicked not)
+                           (.setTimeout js/window #(reset! clicked false) 5000))]
+    (fn [toggle-edit edit-mode?]
+      (if edit-mode?
+        (if @clicked
+          [:span.delete-warn {:on-click #(do (toggle-edit) (swap! clicked not))}
+           [:span.fa.fa-trash] "  discard changes?"]
+          [:span.fa.fa-pencil-square-o.toggle {:on-click guarded-edit-fn}])
+        [:span.fa.fa-pencil-square-o.toggle {:on-click toggle-edit}]))))

 (defn new-link
   "Renders input for adding link entry."
@@ -114,7 +131,8 @@
        (when (pos? upvotes) [:span.upvotes " " upvotes])
        (when (pos? upvotes) [:span.fa.fa-thumbs-down.toggle {:on-click (upvote-fn dec)}])
        (when map? [:span.fa.fa-map-o.toggle {:on-click toggle-map}])
-       [:span.fa.fa-pencil-square-o.toggle {:on-click toggle-edit}]
+       ;[:span.fa.fa-pencil-square-o.toggle {:on-click toggle-edit}]
+       [edit-icon toggle-edit edit-mode?]
        (when-not (:comment-for entry) [:span.fa.fa-clock-o.toggle {:on-click create-pomodoro}])
        (when-not (:comment-for entry) [:span.fa.fa-comment-o.toggle {:on-click create-comment}])
        (when (seq (:comments entry))


Problem added - Re-implement Iterate

Problem added - Re-implement Iterate

--- src/foreclojure/data_set.clj
+++ src/foreclojure/data_set.clj
@@ -636,6 +636,17 @@
             :tags ["easy" "core-functions"]
             :tests ["(= (__ [:a :b :c] [1 2 3]) {:a 1, :b 2, :c 3})"
                     "(= (__ [1 2 3 4] [\"one\" \"two\" \"three\"]) {1 \"one\", 2 \"two\", 3 \"three\"})"
-                    "(= (__ [:foo :bar] [\"foo\" \"bar\" \"baz\"]) {:foo \"foo\", :bar \"bar\"})"]})))
+                    "(= (__ [:foo :bar] [\"foo\" \"bar\" \"baz\"]) {:foo \"foo\", :bar \"bar\"})"]})
+
+      (insert! :problems
+           {:_id 62
+            :title "Re-implement Iteration"
+            :times-solved 0
+            :restricted ["iterate"]
+            :description "Given a side-effect free function f and an initial value x write a function which returns an infinite lazy sequence of x, (f x), (f (f x)), (f (f (f x))), etc."
+            :tags ["easy" "seqs" "core-functions"]
+            :tests ["(= (take 5 (__ #(* 2 %) 1)) [1 2 4 8 16])"
+                    "(= (take 100 (__ inc 0)) (take 100 (range)))"
+                    "(= (take 9 (__ #(inc (mod % 3)) 1)) (take 9 (cycle [1 2 3])))"]})))

 (load-problems)


Pull out the list quoting, and re-fix test number 2


Dirs not files from the 0.4.0 /meta.edn change

--- src/grimoire/api/fs/read.clj
+++ src/grimoire/api/fs/read.clj
@@ -52,8 +52,8 @@
         _         (assert namespace)
         handle    (thing->handle config :else namespace)]
     (for [d     (.listFiles handle)
-          :when (.isFile d)]
-      (->T :def namespace (string/replace (.getName d) #".edn" "")))))
+          :when (.isDirectory d)]
+      (->T :def namespace (.getName d)))))

 ;; FIXME: this should really be handled in data generation not in data use
 (defn- normalize-version [x]


Patch to throw if the target doesn't exist

list-groups, list-artifacts, list-versions, list-namespaces and
list-defs should all throw exceptions if there is no such dir in the
filesystem as this denotes that the target handle isn't known and the
client should not generate meaningful output.

--- src/grimoire/api/fs/read.clj
+++ src/grimoire/api/fs/read.clj
@@ -9,33 +9,46 @@
             [clojure.edn :as edn]
             [version-clj.core :as semver]))

+(defmacro throw-e [& forms]
+  `(throw (Exception. (str ~@forms))))
+
 ;; List things
 ;;--------------------
 (defmethod api/list-groups :filesystem [config]
   (let [handle (io/file (-> config :datastore :docs))]
-    (for [d     (.listFiles handle)
-          :when (.isDirectory d)]
-      (->T :group nil (.getName d)))))
+    (if (.isDirectory handle)
+      (for [d     (.listFiles handle)
+            :when (.isDirectory d)]
+        (->T :group nil (.getName d)))
+      (throw
+       (Exception.
+        "Could not find store directory")))))

 (defmethod api/list-artifacts :filesystem [config thing]
   (let [thing  (ensure-thing thing)
         thing  (thing->group thing)
         _      (assert thing)
         handle (thing->handle config :else thing)]
-    (for [d     (.listFiles handle)
-          :when (.isDirectory d)]
-      (->T :artifact thing (.getName d)))))
+    (if (.isDirectory handle)
+      (for [d     (.listFiles handle)
+            :when (.isDirectory d)]
+        (->T :artifact thing (.getName d)))
+      (throw-e "No such group "
+               (:uri thing)))))

 (defmethod api/list-versions :filesystem [config thing]
   (let [thing    (ensure-thing thing)
         artifact (thing->artifact thing)
         _        (assert artifact)
         handle   (thing->handle config :else artifact)]
-    (->> (for [d     (reverse (sort (.listFiles handle)))
-             :when (.isDirectory d)]
-         (->T :version artifact (.getName d)))
-      (sort-by :name)
-      reverse)))
+    (if (.isDirectory handle)
+      (->> (for [d     (reverse (sort (.listFiles handle)))
+               :when (.isDirectory d)]
+           (->T :version artifact (.getName d)))
+         (sort-by :name)
+         reverse)
+      (throw-e  "No such artifact "
+                (:uri thing)))))

 (defmethod api/list-namespaces :filesystem [config thing]
   (let [thing   (ensure-thing thing)
@@ -43,9 +56,12 @@
         version (thing->version thing)
         _       (assert version)
         handle  (thing->handle config :else version)]
-    (for [d     (.listFiles handle)
-          :when (.isDirectory d)]
-      (->T :namespace version (.getName d)))))
+    (if (.isDirectory handle)
+      (for [d     (.listFiles handle)
+            :when (.isDirectory d)]
+        (->T :namespace version (.getName d)))
+      (throw-e "No such version "
+               (:uri thing)))))

 (defmethod api/list-defs :filesystem [config thing]
   (let [thing     (ensure-thing thing)
@@ -53,9 +69,12 @@
         namespace (thing->namespace thing)
         _         (assert namespace)
         handle    (thing->handle config :else namespace)]
-    (for [d     (.listFiles handle)
-          :when (.isDirectory d)]
-      (->T :def namespace (.getName d)))))
+    (if (.isDirectory handle)
+      (for [d     (.listFiles handle)
+            :when (.isDirectory d)]
+        (->T :def namespace (.getName d)))
+      (throw-e "No such namespace "
+               (:uri thing)))))

 ;; FIXME: this should really be handled in data generation not in data use
 (defn- normalize-version [x]
@@ -68,11 +87,11 @@
         currentv (thing->version thing)               ; version handle
         current  (normalize-version (:name currentv)) ; version string
         added    (-> config
-                   (api/read-meta thing)
-                   (get :added "0.0.0")
-                   normalize-version)               ; version string
+                    (api/read-meta thing)
+                    (get :added "0.0.0")
+                    normalize-version)               ; version string
         versions (->> (:parent currentv)
-                   (api/list-versions config))
+                    (api/list-versions config))
         unv-path (thing->relative-path :version thing)]
     (for [v     versions
           :when (<= 0 (semver/version-compare (:name v) added))
@@ -108,9 +127,9 @@
         handle (thing->meta-handle config thing)]
     (when (.exists handle) ;; guard against missing files
       (-> handle
-        slurp
-        (string/replace #"#<.*?>" "nil") ;; FIXME: Hack to ignore unreadable #<>s
-        edn/read-string))))
+         slurp
+         (string/replace #"#<.*?>" "nil") ;; FIXME: Hack to ignore unreadable #<>s
+         edn/read-string))))

 (defmethod api/read-related :filesystem [config thing]
   ;; FIXME: This assumes the old Grimoire 0.3.X related file format,
@@ -127,5 +146,5 @@
           line  (line-seq (io/reader h))
           :let  [sym (read-string line)]]
       (-> current-version
-        (->Ns  (namespace sym))
-        (->Def (name sym))))))
+         (->Ns  (namespace sym))
+         (->Def (name sym))))))


fix bug in save-todo

fix bug in save-todo

--- labs/architecture-examples/om/src/todomvc/app.cljs
+++ labs/architecture-examples/om/src/todomvc/app.cljs
@@ -82,7 +82,7 @@
   (om/replace! app [:editing] (:id todo)))

 (defn save-todo [todo text]
-  (om/replace! todo (update-in todo [:title] text)))
+  (om/replace! todo [:title] text))

 (defn cancel-action [app]
   (om/replace! app [:editing] nil))


added -index main arg

added -index main arg

--- src/help_me_im_dumb/core.clj
+++ src/help_me_im_dumb/core.clj
@@ -1,7 +1,19 @@
 (ns help-me-im-dumb.core
+  (:require [help-me-im-dumb.index :as index])
   (:gen-class))
+
+(defn usage
+  []
+  (println "usage: OPTIONS")
+  (println "\t-index json-data-file\tIndexes json data file"))

 (defn -main
   "I don't do a whole lot ... yet."
   [& args]
-  (println "Hello, World!"))
+  (cond
+    (nil? args) (usage)
+    (= "-index" (first args))
+    (do
+      (index/create-indicies (first args))
+      (println "Index created successfully!"))
+    :else (usage)))


Don't try to recover namespace with unloading disabled

Having 'disable-unload!' or 'disable-reload!' in a namespace could
cause errors when trying to "recover" the namespace mappings after a
failed reload.

--- src/main/clojure/clojure/tools/namespace/repl.clj
+++ src/main/clojure/clojure/tools/namespace/repl.clj
@@ -99,7 +99,9 @@
           ((ns-resolve *ns* after-sym))
           result)
         ;; There was an error, recover as much as we can:
-        (do (recover-ns current-ns-refers current-ns-aliases)
+        (do (when-not (or (false? (::unload (meta *ns*)))
+                          (false? (::load (meta *ns*))))
+              (recover-ns current-ns-refers current-ns-aliases))
             ;; Return the Exception to the REPL:
             result)))))