added bootlaces

added bootlaces

--- build.boot
+++ build.boot
@@ -19,6 +19,7 @@
     [adzerk/boot-reload "0.2.4"          :scope "test"]
     [tonsky/boot-anybar "0.1.0"          :scope "test"]
     [pandeiro/boot-http "0.6.3-SNAPSHOT" :scope "test"]
+    [adzerk/bootlaces   "0.1.11"         :scope "test"]
 ])

 (require
@@ -26,6 +27,7 @@
   '[adzerk.boot-reload :refer [reload]]
   '[tonsky.boot-anybar :refer [anybar]]
   '[pandeiro.boot-http :refer [serve]]
+  '[adzerk.bootlaces   :refer [push-release]]
 )

 (def compiler-opts
@@ -61,3 +63,6 @@
 (deftask advanced []
   (comp (advanced-opts)
         (serving)))
+
+(deftask clojars []
+  (comp (pom) (jar) (push-release)))


Bump version

Bump version

--- build.boot
+++ build.boot
@@ -23,7 +23,7 @@

 (task-options!
   pom  {:project     'moxaj/mikron
-        :version     "0.6.3-SNAPSHOT"
+        :version     "0.6.4-SNAPSHOT"
         :description "mikron is a schema-based serialization library for Clojure and ClojureScript"
         :url         "http://github.com/moxaj/mikron"
         :license     {"Eclipse Public License" "http://www.eclipse.org/legal/epl-v10.html"}}


Implemented the "save" action.

Implemented the "save" action.

--- src/fm/simrunner/actions.clj
+++ src/fm/simrunner/actions.clj
@@ -57,8 +57,24 @@
     (run-task app open-config widget file)
     (rdg/unlock! app)))

-(defn- save-config [app widget file]
-  (rdg/unlock! app))
+(defn- write-config-file [app widget config file]
+  (try
+    (cfg/write-config-file config file)
+    (catch Exception read-error
+      (gui/gui-do
+        (JOptionPane/showMessageDialog (:widget widget)
+                                       "Failed to read config file!"
+                                       "Open Config"
+                                       JOptionPane/ERROR_MESSAGE)
+        (rdg/unlock! app))
+      nil)))
+
+(defn- save-config [{app-state :state :as app} widget file]
+  (let [config (-> @app-state :model :config)
+        config (write-config-file app widget config file)]
+    (when config
+      (swap! app-state mod/apply-config config file)
+      (rdg/unlock! app))))

 (defmethod on-action :save-config [_ app & [widget]]
   (if-let [file (-> app :state deref :model :file)]


Newlines switched to <br/>

Newlines switched to <br/>

--- src/foreclojure/data_set.clj
+++ src/foreclojure/data_set.clj
@@ -931,7 +931,7 @@
            {:_id 82
             :title "Word Chains"
             :times-solved 0
-            :description "A word chain consists of a set of words ordered so that each word differs by only one letter from the words directly before and after it.  The one letter difference can be either an insertion, a deletion, or a substitution.  Here is an example word chain:\n\ncat -> cot -> coat -> oat -> hat -> hot -> hog -> dog\n\nWrite a function which takes a sequence of words, and returns true if they can be arranged into one continous word chain, and false if they cannot."
+            :description "A word chain consists of a set of words ordered so that each word differs by only one letter from the words directly before and after it.  The one letter difference can be either an insertion, a deletion, or a substitution.  Here is an example word chain:

cat -> cot -> coat -> oat -> hat -> hot -> hog -> dog

Write a function which takes a sequence of words, and returns true if they can be arranged into one continous word chain, and false if they cannot."
             :approved true
             :tags ["hard" "seqs"]
             :tests ["(= true (__ #{\"hat\" \"coat\" \"dog\" \"cat\" \"oat\" \"cot\" \"hot\" \"hog\"}))"


Bug fix

Bug fix

--- src/foreclojure/problems.clj
+++ src/foreclojure/problems.clj
@@ -376,7 +376,7 @@
   (GET "/problem/:id" [id] (code-box id))
   (GET "/problems/submit" [] (problem-submission-page))
   (POST "/problems/submit" [prob-id author title tags description code]
-        (create-problem title tags description code (when prob-id (Integer. prob-id)) author))
+        (create-problem title tags description code (when (not= "" prob-id) (Integer. prob-id)) author))
   (GET "/problems/unapproved" [] (unapproved-problems))
   (POST "/problem/edit" [id]
         (edit-problem (Integer. id)))


fixes

fixes

--- src/rester/core.clj
+++ src/rester/core.clj
@@ -45,7 +45,7 @@
                                                                       (diff* (:attrs a) (:attrs b))
                                                                       (diff* (:content a) (:content b)))
                 (map? a) (if (map? b)
-                           (let [d (filter #(diff* (second %) (b (first %))) a)]
+                           (let [d (filter #(diff* (second %) (get b (first %))) a)]
                              (if (empty? d) nil (into {} d)))
                            a)
                 (coll? a) (if (coll? b)
@@ -106,7 +106,7 @@
                        {:keys [exp-status exp-headers exp-body]}]
   (let [body* (condp re-find (or (:Content-Type headers) "")
                 #"json" (json->clj body)
-                #"xml" (parse-str body)
+                #"xml" (try (parse-str body) (catch Exception e (log/error e "failed parsing xml:" body) body))
                 body)
         error (or
                (and (not= status exp-status)
@@ -160,8 +160,10 @@
 (defn -main
   "Given a CSV file with HTTP request, executes the requests are verifies the expected response"
   [& args]
-  (set-agent-send-executor! (Executors/newFixedThreadPool
-                             (or (System/getProperty "thread-pool-size") 4)))
+  (let [pool-size (Integer/parseInt (or (System/getProperty "thread-pool-size") "4"))]
+    (log/info "thread pool size:" pool-size)
+    (set-agent-send-executor! (Executors/newFixedThreadPool pool-size))
+    (set-agent-send-off-executor! (Executors/newFixedThreadPool pool-size)))
   (try
     (let [opts (apply hash-map (map-indexed #(if (even? %1) (subs %2 1) %2) (rest args)))
           _ (println "running with arguments:" opts)


experimenting with new data schema

experimenting with new data schema

--- src/clj/ceres/analyzer.clj
+++ src/clj/ceres/analyzer.clj
@@ -38,12 +38,30 @@
    (find-reactions pub)))

+(defn find-full-reactions
+  "extended reaction tree recursion"
+  [pid]
+  (let [publication (mc/find-map-by-id @db "publications" pid)
+        reactions (mc/find-maps @db "reactions" {:source pid})]
+    (Publication. publication (vec (pmap #(find-full-reactions (:publication %)) reactions)))))
+
+
+(defn full-reaction-tree [pub]
+  (zip/zipper
+   (fn [node] true)
+   (fn [node] (:reactions node))
+   (fn [node new-children] (assoc-in node [:reactions] new-children))
+   (find-reactions pub)))
+
+
 (defn summary [tree]
   (loop [size 0
          max-path 0
+         delays []
          loc tree]
     (if (zip/end? loc)
       {:size size
+       :delays delays
        :height max-path}
       (recur
        (if (zip/node loc) (inc size) size)
@@ -64,6 +82,7 @@
          (sort-by second >)
          (take 25))))

+
 (defn users-of-the-day
   "Get user with most posts of given date"
   [date]
@@ -82,6 +101,7 @@
 (comment

+  ;; hashtag distribution of one-time-posters
   (let [user-freq (->> (mc/find-maps @db "publications")
                        (map :user)
                        frequencies)]
@@ -101,6 +121,7 @@
          time))

+  ;; hashtag distribution
   (->> (mc/find-maps @db "publications")
        (map :hashtags)
        (remove nil?)
@@ -114,6 +135,17 @@
        time)

+  (let [users (map :_id (mc/find-maps @db "users" {:screen_name {$in news-accounts}}))]
+    (->> (mc/find-maps @db "publications" {:user {$in users}})
+         rand-nth
+         :_id
+         full-reaction-tree
+         aprint
+         time))

+  ((comp aprint float /)
+    (mc/count @db "reactions" {:source nil})
+    (mc/count @db "reactions"))
+
   )


enable printing in Node.js REPL

enable printing in Node.js REPL

--- src/clj/cljs/repl/node.clj
+++ src/clj/cljs/repl/node.clj
@@ -106,9 +106,11 @@
           (str "require('"
             (.getPath root-path)
             File/separator "node_repl_deps.js')")))
-      ;(repl/evaluate-form repl-env
-      ;  env "<cljs repl>"
-      ;  '(set! *print-fn* (fn [x] (js/node_repl_print (pr-str x)))))
+      (repl/evaluate-form repl-env
+        env "<cljs repl>"
+        '(do
+           (.require js/goog "cljs.core")
+           (set! *print-fn* (.-print (js/require "util")))))
       )))

 (defrecord NodeEnv [host port socket loaded-libs]
@@ -136,4 +138,4 @@
   (def bldr (ProcessBuilder. (into-array ["node"])))

-  )+  )


added a Parasite to card-str test to test for a basic hosting case

--- src/clj/test/core-game.clj
+++ src/clj/test/core-game.clj
@@ -47,7 +47,7 @@
   "ensure card-str names cards in simple situations properly"
   (do-game
     (new-game (default-corp [(qty "Ice Wall" 3) (qty "Jackson Howard" 2)])
-              (default-runner [(qty "Corroder" 1) (qty "Desperado" 1) (qty "Paparazzi" 1)]))
+              (default-runner [(qty "Corroder" 1) (qty "Clone Chip" 1) (qty "Paparazzi" 1) (qty "Parasite" 1)]))
     (core/gain state :corp :click 2)
     (play-from-hand state :corp "Ice Wall" "HQ")
     (play-from-hand state :corp "Ice Wall" "R&D")
@@ -57,26 +57,29 @@
     (core/end-turn state :corp nil)
     (core/start-turn state :runner nil)
     (play-from-hand state :runner "Corroder")
-    (play-from-hand state :runner "Desperado")
+    (play-from-hand state :runner "Clone Chip")
     (play-from-hand state :runner "Paparazzi")
+    (play-from-hand state :runner "Parasite")
     (let [hqiwall0 (get-in @state [:corp :servers :hq :ices 0])
           hqiwall1 (get-in @state [:corp :servers :hq :ices 1])
           rdiwall (get-in @state [:corp :servers :rd :ices 0])
           jh1 (first (get-in @state [:corp :servers :remote1 :content]))
           jh2 (first (get-in @state [:corp :servers :remote2 :content]))
           corr (get-in @state [:runner :rig :program 0])
-          desp (get-in @state [:runner :rig :hardware 0])
+          cchip (get-in @state [:runner :rig :hardware 0])
           pap (get-in @state [:runner :rig :resource 0])]
       (core/rez state :corp hqiwall0)
       (core/rez state :corp jh1)
+      (prompt-select :runner (refresh hqiwall0))
       (is (= (core/card-str state (refresh hqiwall0)) "Ice Wall protecting HQ at position 0"))
       (is (= (core/card-str state (refresh hqiwall1)) "ICE protecting HQ at position 1"))
       (is (= (core/card-str state (refresh rdiwall)) "ICE protecting R&D at position 0"))
       (is (= (core/card-str state (refresh jh1)) "Jackson Howard in Server 1"))
       (is (= (core/card-str state (refresh jh2)) "a card in Server 2"))
       (is (= (core/card-str state (refresh corr)) "Corroder"))
-      (is (= (core/card-str state (refresh desp)) "Desperado"))
+      (is (= (core/card-str state (refresh cchip)) "Clone Chip"))
       (is (= (core/card-str state (refresh pap)) "Paparazzi"))
+      (is (= (core/card-str state (first (:hosted (refresh hqiwall0)))) "Parasite hosted on Ice Wall protecting HQ at position 0"))
       )))

 (deftest invalid-score-attempt


Fix starting new game not working more than once

--- src/clj/zetawar/views.cljs
+++ src/clj/zetawar/views.cljs
@@ -333,8 +333,10 @@
          [:button.btn.btn-default {:on-click hide-settings}
           "Cancel"]]]]]]))

+;; TODO: move default-scenario-id to data ns?
 (defn new-game-settings [{:keys [conn dispatch] :as app}]
-  (with-let [selected-scenario-id (r/atom :sterlings-aruba-multiplayer)
+  (with-let [default-scenario-id :sterlings-aruba-multiplayer
+             selected-scenario-id (r/atom default-scenario-id)
              hide-settings #(do
                               (.preventDefault %)
                               (dispatch [::events.ui/hide-new-game-settings]))
@@ -342,7 +344,7 @@
              start-new-game #(do
                                (.preventDefault %)
                                (dispatch [::events.ui/start-new-game @selected-scenario-id])
-                               (reset! selected-scenario-id nil)
+                               (reset! selected-scenario-id default-scenario-id)
                                (dispatch [::events.ui/hide-new-game-settings]))]
     [:> js/ReactBootstrap.Modal {:show @(subs/configuring-new-game? conn)
                                  :on-hide hide-settings}


Implement test server ongoing request reporting by reporting every 50 ms.

--- src/clj_tutorials/main.clj
+++ src/clj_tutorials/main.clj
@@ -1,23 +1,31 @@
 (ns clj-tutorials.main
   (:require [compojure.core :refer :all]
             [compojure.handler :as handler]
-            [org.httpkit.server :refer [run-server]]))
+            [org.httpkit.server :refer [run-server]])
+  (:import [java.util.concurrent TimeUnit ScheduledThreadPoolExecutor]))

 (def ongoing-requests (atom 0))

 (defn- pong []
   (let [ongoing-reqs (swap! ongoing-requests inc)
         start (System/currentTimeMillis)]
-    (when (= 0 (mod ongoing-reqs 10))
-      (prn "Ongoing requests " ongoing-reqs))
-    (Thread/sleep 50)
-    (swap! ongoing-requests #(- % 1))
+    (Thread/sleep (+ 20 (rand-int 80)))
+    (swap! ongoing-requests dec)
     "pong"))

 (defroutes app-routes
   (GET "/ping" [] (pong)))

-(defn run []
-  (run-server (handler/api app-routes) {:port 8080 :join? false :thread 1000}))
+(defn print-ongoing-requests []
+  (let [requests @ongoing-requests]
+    (when (> requests 0)
+      (println "Ongoing requests:" requests))))

-
+(defn run [threads]
+  (let [executor (ScheduledThreadPoolExecutor. 1)
+        stop-server-fn (run-server (handler/api app-routes) {:port 8080 :join? false :thread threads})]
+    (.scheduleAtFixedRate executor print-ongoing-requests 0 50 TimeUnit/MILLISECONDS)
+    (println "Server started at port 8080 with" threads "threads.")
+    (fn []
+      (stop-server-fn)
+      (.shutdownNow executor))))


assertions for add-raw-delta

assertions for add-raw-delta

--- src/cljc/commos/delta.cljc
+++ src/cljc/commos/delta.cljc
@@ -209,10 +209,15 @@
   [val op new-val]
   (case op
     :is new-val
-    :in (into (or val #{}) new-val)
+    :in (do (assert (some #(% val) [nil? set? vector? list?])
+                    ":in applies to nil, sets, vectors or lists")
+            (into (or val #{}) new-val))
     :ex (if (map? val)
           (apply dissoc val new-val)
-          (set/difference val new-val))))
+          (do
+            (assert (set? val)
+                    ":ex applies to maps or sets")
+            (set/difference val new-val)))))

 (defn- update-in'
   "Like update-in but auto dissocs the val at ks if it is an empty set


fix naming

fix naming

--- src/cljs/lambdacd/api.cljs
+++ src/cljs/lambdacd/api.cljs
@@ -22,5 +22,5 @@
 (defn trigger [trigger-id data]
   (ajax/POST (str "api/dynamic/" trigger-id) data confirm-triggered))

-(defn retrigger [build-number first-part-of-step-id]
-  (ajax/POST (str "api/builds/" build-number "/" first-part-of-step-id "/retrigger") {} after-retriggered))+(defn retrigger [build-number step-id]
+  (ajax/POST (str "api/builds/" build-number "/" step-id "/retrigger") {} after-retriggered))


Add errors view component

Add errors view component

--- src/cljs/re_form/core.cljs
+++ src/cljs/re_form/core.cljs
@@ -234,6 +234,18 @@
 (defn field [props]
   [ctx/get-context props binded-field])

+(defn- error* [{:keys [form-name path error-paths] :as props}]
+  (let [flags @(rf/subscribe [:re-form/input-flags form-name path])
+        is-form-submitting @(rf/subscribe [:re-form/is-form-submitting form-name])
+        errors @(rf/subscribe [:re-form/input-errors form-name (into [path] error-paths)])]
+    [(:view props)
+     (merge (dissoc props :form-name :path :input :validators)
+            {:errors (if (or (:touched flags) is-form-submitting)
+                       errors [])})]))
+
+(defn error [props]
+  [ctx/get-context props error*])
+
 (defn input [& args]
   (.error js/console "Warning! `re-form.input` is deprecated. Please use `re-form.field` instead. Caused by " (into ["re-form.input"] args))
   (fn [& args]


added fullscreen mode

added fullscreen mode

--- src/cljs/redditv/core.cljs
+++ src/cljs/redditv/core.cljs
@@ -93,7 +93,9 @@
          :subreddit subreddit
          :playlist-selected-index (parse-int index)
          :playlist-selected-search search
-         :settings-video-category "hot")
+         :settings-video-category "hot"
+         :settings-video-count (parse-int (get-in query-params [:query-params :count] "100"))
+         :fullscreen (parse-bool (get-in query-params [:query-params :fullscreen] "false")))
   (force-app-reload! app-state)
   (storage/save-app-state! @app-state))


cljs/skyport.core: Only timeout on actions

--- src/cljs/skyport/core.cljs
+++ src/cljs/skyport/core.cljs
@@ -112,28 +112,27 @@
     :position (parse-coords
                (:position player))))

+(defn timeout [ms]
+  (let [c (chan)]
+    (js/setTimeout (fn [] (close! c)) ms)
+    c))
+
 (defmulti handle-message! :message)

 (defmethod handle-message! "gamestate"
   [gamestate]
   (let [new-state (update-in gamestate [:players]
                              (partial map parse-position))]
-    (println new-state)
-    (reset! state new-state)))
+    (reset! state new-state)
+    (timeout 0)))

 (defmethod handle-message! "action"
   [action]
-  (handle-action action))
+  (handle-action action)
+  (timeout 1000))

 (defmethod handle-message! :default [message]
-  ;; Do nothing.
-  (println message))
-
-(defn timeout [ms]
-  (let [c (chan)]
-    (js/setTimeout (fn [] (close! c)) ms)
-    c))
-
+  (timeout 0))

 (go-loop [{:keys [ws-channel error]}
           (<! (ws-ch "ws://localhost:54331"
@@ -148,9 +147,8 @@
       (if error
         (println "-- " error)
         (do
-          (handle-message! (keywordize-keys message))
-          ;; Wait a second before doing the next message.
-          (<! (timeout 1000))
+          (println "MESSAGE: " message)
+          (<! (handle-message! (keywordize-keys message)))
           (recur (<! ws-channel))))))
   ;; wait 1 second before continuing.
   (<! (timeout 1000))


Add show-end-turn-alert? track

Add show-end-turn-alert? track

--- src/cljs/zetawar/subs.cljs
+++ src/cljs/zetawar/subs.cljs
@@ -569,3 +569,6 @@
   (some
    (fn [[q r] coordinates] @(unit-can-act? conn q r))
    @(friend-locations conn)))
+
+(deftrack show-end-turn-alert? [conn]
+  (:app/end-turn-alert @(app conn)))


Fixed missing age args.

Fixed missing age args.

--- src/clojush/individual.clj
+++ src/clojush/individual.clj
@@ -5,9 +5,9 @@
 ;; Populations are vectors of agents with individuals as their states (along with error and
 ;; history information).

-(defrecord individual [genome program errors total-error normalized-error weighted-error meta-errors history ancestors uuid parent-uuids genetic-operators])
+(defrecord individual [genome program errors total-error normalized-error weighted-error meta-errors history ancestors uuid parent-uuids genetic-operators age])

-(defn make-individual [& {:keys [genome program errors total-error normalized-error weighted-error meta-errors history ancestors uuid parent-uuids genetic-operators]
+(defn make-individual [& {:keys [genome program errors total-error normalized-error weighted-error meta-errors history ancestors uuid parent-uuids genetic-operators age]
                           :or {genome nil
                                program nil
                                errors nil
@@ -36,3 +36,4 @@
         (let [k '(:genome :program :errors :total-error :normalized-error :weighted-error :meta-errors :history :ancestors :uuid :parent-uuids :genetic-operators :age)]
           (interleave k  (map #(printable (get i %)) k)))))

+


Mess with levels.

Mess with levels.

--- src/kolmogorov_music/geb.clj
+++ src/kolmogorov_music/geb.clj
@@ -35,14 +35,14 @@

 (comment
   (map fx-chorus [0 1])
-  (map fx-distortion [0 1] [0.8 0.6] [0.3 0.5])
+  (map fx-distortion [0 1] [2 2] [0.3 0.25])
   (volume 0.8)
   (live/jam (var geb))
   (def geb nil)
   )

 ; Instrumentation
-(definst overchauffeur [freq 110 dur 1.0 vol 0.5]
+(definst overchauffeur [freq 110 dur 1.0 vol 0.3]
   (-> (sin-osc freq)
       (+ (* 1/3 (sin-osc (* 2.01 freq))))
       (+ (* 1/2 (sin-osc (* 3.01 freq))))
@@ -50,7 +50,7 @@
       (+ (* 2 (sin-osc (* 0.5 freq))))
       (clip2 0.7)
       (lpf 1500)
-      (* (env-gen (adsr 0.01 0.3 0.9 0.2) (line:kr 1 0 dur) :action FREE))
+      (* (env-gen (adsr 0.01 0.2 0.8 0.2) (line:kr 1 0 dur) :action FREE))
       (* vol)))

 (defmethod live/play-note :default


test hook to see if service restarts

test hook to see if service restarts

--- src/main/cawala/api/read.clj
+++ src/main/cawala/api/read.clj
@@ -6,7 +6,7 @@
                      :person/relation :friend}
                  2  {:db/id 2 :person/name "Sally" :person/age 22
                      :person/relation :friend}
-                 3  {:db/id 3 :person/name "Allie" :person/age 55
+                 3  {:db/id 3 :person/name "Allie" :person/age 54
                      :person/relation :enemy}
                  4  {:db/id 4 :person/name "Zoe" :person/age 32
                      :person/relation :friend}


remove function that has been moved to a different namespace

--- src/babel/francais.clj
+++ src/babel/francais.clj
@@ -9,7 +9,7 @@
 (require '[babel.forest :as forest])
 (require '[babel.francais.grammar :refer [grammar]])
 (require '[babel.francais.lexicon :refer [lexicon-source]])
-(require '[babel.francais.morphology :refer [analyze exception-generator fo get-string passe-compose phonize]])
+(require '[babel.francais.morphology :refer [analyze exception-generator fo get-string phonize]])
 (require '[babel.lexiconfn :refer (compile-lex map-function-on-map-vals unify)])

 (require '[babel.parse :as parse])


Set a default for classify-schema defmethod.

--- src/onyx/static/analyzer.clj
+++ src/onyx/static/analyzer.clj
@@ -42,6 +42,10 @@
 (defmethod classify-schema clojure.lang.PersistentVector
   [path ve]
   (map (partial classify-schema path) ve))
+
+(defmethod classify-schema :default
+  [path ve]
+  (throw (ex-info "Unhandled schema classification case" {:validation-error ve})))

 (defmulti classify-error
   (fn [job path ve] (type (.schema ve))))


Don't swallow exceptions in sparql result-set seqs.

--- src/grafter/rdf/sesame.clj
+++ src/grafter/rdf/sesame.clj
@@ -512,7 +512,7 @@
                        (if (.hasNext results)
                          (let [current-result (try
                                                 (converter-f (.next results))
-                                                (catch Exception e
+                                                (finally
                                                   (.close results)))]
                            (lazy-cat
                             [current-result]


uncapitalise Nil so it's clear it refers to the clojure value

--- src/grafter/rdf/sparql.clj
+++ src/grafter/rdf/sparql.clj
@@ -71,11 +71,11 @@

                 (nil? v)
                 (throw
-                  (ex-info (str "Nil value SPARQL binding found for key " k
-                                ". Consider explicitly binding value as ::sparql/undef")
-                           {:bindings bindings
-                            :sparql-query q
-                            :error :nil-sparql-binding}))
+                 (ex-info (str "nil value SPARQL binding found for key " k
+                               ". Consider explicitly binding value as ::sparql/undef")
+                          {:bindings bindings
+                           :sparql-query q
+                           :error :nil-sparql-binding}))
                 :else
                 [k v])))
        (filter (comp sequential? second))


Enable documentation on statements

Enable documentation on statements

--- src/grafter_2/rdf4j/io.clj
+++ src/grafter_2/rdf4j/io.clj
@@ -694,7 +694,7 @@
   org.eclipse.rdf4j.model.Graph
   (->-rdf4j-uri [this] (URIImpl. (str this))))

-(defn ^:no-doc statements
+(defn statements
   "Attempts to coerce an arbitrary source of RDF statements into a
   sequence of grafter Statements, using the RDF4j backend.


Add submission review fields if submission-review? is true

Signed-off-by: ivermac <cd640042a8f3b0ff08bacdf4feae34fdd495051d@gmail.com>

--- src/hatti/views/table.cljs
+++ src/hatti/views/table.cljs
@@ -136,7 +136,7 @@
     (vec
      (flatten
       (conj
-       data forms/comment-field forms/review-status-field actions)))))
+       data forms/review-comment-field forms/review-status-field actions)))))

 (defmethod actions-column :default
   [owner has-hxl?]
@@ -155,6 +155,7 @@
 (defn- flat-form->sg-columns
   "Get a set of slick grid column objects when given a flat form."
   [form & {:keys [hide-actions-column?
+                  submission-review?
                   get-label?
                   language
                   owner]
@@ -180,7 +181,7 @@
     (clj->js (cond-> columns
                (not hide-actions-column?)
                (conj (actions-column owner has-hxl?))
-               true  submission-review-fields))))
+               submission-review?  submission-review-fields))))

 (defn init-sg-pager [grid dataview]
   (let [Pager (.. js/Slick -Controls -Pager)]
@@ -282,13 +283,15 @@
    Returns [grid dataview]."
   [data form current-language owner
    {:keys [grid-event-handlers dataview-event-handlers]}]
-  (let [{{{:keys [num-displayed-records
+  (let [{:keys [submission-review?]
+         {{:keys [num-displayed-records
                   total-page-count]} :paging
           :keys [hide-actions-column?]} :table-page} @shared/app-state
         columns (flat-form->sg-columns
                  form
                  :language current-language
                  :hide-actions-column? hide-actions-column?
+                 :submission-review? submission-review?
                  :owner owner)
         SlickGrid (.. js/Slick -Grid)
         DataView (.. js/Slick -Data -DataView)


db/docids.clj: added 1 digits to number format

Just in case we ever have more than 100 million documents :)

--- src/org/altlaw/db/docids.clj
+++ src/org/altlaw/db/docids.clj
@@ -11,7 +11,7 @@
     (if (< (count s) 1024)
       s (subs s 0 1024))))

-(def #^{:private true} *number-format* "%09d")
+(def #^{:private true} *number-format* "%010d")

 (def #^{:private true} *base-number-string*
      (format *number-format* 10000))


Refactor write records.

Refactor write records.

--- src/incognito/fressian.clj
+++ src/incognito/fressian.clj
@@ -2,32 +2,31 @@
   (:require [clojure.edn :as edn]
             [clojure.data.fressian :as fress]
             [incognito.base :refer [incognito-reader incognito-writer]])
-  (:import [org.fressian.handlers WriteHandler ReadHandler]))
-
+  (:import [org.fressian StreamingWriter]
+           [org.fressian.handlers WriteHandler ReadHandler]))

 (defn record-reader [read-handlers]
   (reify ReadHandler
-    (read [_ reader _ component-count]
-      (let [len (.readInt reader)
-            tag (.readObject reader)
-            val (->> (range len)
-                     (map (fn [_] (.readObject reader)))
-                     (map vec)
-                     (into {}))]
+    (read [_ reader tag component-count]
+      (let [tag (.readObject reader)
+            val (.readObject reader)]
         (incognito-reader @read-handlers
-                          {:tag tag :value val})))))
+                          {:tag tag :value (:value val)})))))

 (defn record-writer [write-handlers]
   (reify WriteHandler
-    (write [_ writer record]
-      (let [{:keys [tag value]} (if (isa? (type record) incognito.base.IncognitoTaggedLiteral)
-                                  (into {} record) ;; carry on as map
-                                  (incognito-writer @write-handlers record))]
-        (.writeTag writer "irecord" 2)
-        (.writeInt writer (count value))
-        (.writeObject writer tag)
-        (doseq [e value]
-          (.writeObject writer e))))))
+    (write [_ w rec]
+      (let [{:keys [tag] :as r} (if (isa? (type rec) incognito.base.IncognitoTaggedLiteral)
+                                  (into {} rec) ;; carry on as map
+                                  (incognito-writer @write-handlers rec))]
+        (.writeTag w "record" 2)
+        (.writeObject w tag)
+        (.writeTag w "map" 1)
+        (.beginClosedList ^StreamingWriter w)
+        (doseq [[field value] r]
+          (.writeObject w field true)
+          (.writeObject w value))
+        (.endList ^StreamingWriter w)))))

 (def plist-reader
   (reify ReadHandler
@@ -69,17 +68,17 @@
         (into #{} l)))))

 (defn incognito-read-handlers [read-handlers]
-  {"irecord" (record-reader read-handlers)
-   "plist" plist-reader
-   "pvec" pvec-reader
-   "set" set-reader})
+  {"record" (record-reader read-handlers)
+   "plist"  plist-reader
+   "pvec"   pvec-reader
+   "set"    set-reader})

 (defn incognito-write-handlers [write-handlers]
-  {clojure.lang.PersistentList {"plist" plist-writer}
+  {clojure.lang.PersistentList           {"plist" plist-writer}
    clojure.lang.PersistentList$EmptyList {"plist" plist-writer}
-   clojure.lang.IRecord {"irecord" (record-writer write-handlers)}
-   clojure.lang.LazySeq {"plist" plist-writer}
-   clojure.lang.PersistentVector {"pvec" pvec-writer}})
+   clojure.lang.IRecord                  {"record" (record-writer write-handlers)}
+   clojure.lang.LazySeq                  {"plist" plist-writer}
+   clojure.lang.PersistentVector         {"pvec" pvec-writer}})

 (comment
@@ -91,16 +90,28 @@

   (with-open [baos (ByteArrayOutputStream.)]
     (let [read-handlers (atom {'incognito.fressian.Foo map->Foo})
-          write-handlers (atom {'incognito.fressian.Foo (fn [foo] (println "foos") (assoc foo :c "donkey"))})
+          write-handlers (atom {'incognito.fressian.Foo (fn [foo]
+                                                          (println "foos")
+                                                          (assoc foo :c "donkey"))})
           w (fress/create-writer baos :handlers (-> (merge fress/clojure-write-handlers
                                                            (incognito-write-handlers write-handlers))
                                                     fress/associative-lookup
                                                     fress/inheritance-lookup))] ;
-      (fress/write-object w #{1 2 3} #_(map->Foo {:a [1 2 3] :b {:c "Fooos"}}))
+      (fress/write-object w (map->Foo {:a [1 2 3] :b {:c "Fooos"}}))
       (let [bais (ByteArrayInputStream. (.toByteArray baos))]
-        (type (fress/read bais
+        (prn (fress/read bais
                           :handlers (-> (merge fress/clojure-read-handlers
                                                (incognito-read-handlers #_(atom {}) read-handlers))
                                         fress/associative-lookup))))))

+
+
+
+
+
+
+
+
+
+
   )


Add useful coment.

Add useful coment.

--- src/uxbox/core.cljs
+++ src/uxbox/core.cljs
@@ -30,4 +30,8 @@
   (ui/init)

   (rs/emit! (dl/load-data))
+
+  ;; During development, you can comment the
+  ;; following call for disable temprary the
+  ;; local persistence.
   (main))


can jump and have gravity

can jump and have gravity

--- src/jumpy_monkey/core.cljs
+++ src/jumpy_monkey/core.cljs
@@ -5,18 +5,18 @@
 (enable-console-print!)

 (defn log [v]
-  (js/console.log (str v))
+  (js/console.log v)
   v)
-
-(def config
-  {:game {:width 200
-          :height 200}
-   :pipe {:width 20
-          :gap 20}})

 (def game-state
   (atom {:monkey {:height 50 :velocity 0}
-         :pipes [[50 20] [110 40] [170 60]]}))
+         :pipes  [[50 20] [110 40] [170 60]]
+         :last-update (js/Date.)
+
+         :screen {:width 200 :height 200}
+         :pipe   {:width 20 :gap 20}
+         :gravity 0.005
+         :flapv   -5}))

 (defn pipe-to-top [[x y]]
   [:rect {:x x
@@ -45,23 +45,39 @@
        (mapcat (juxt pipe-to-top pipe-to-bottom))
        (into '())))

-(defn render-debug [game]
-  [:p [:strong "config"]
-   [:pre (str config)]
-   [:strong "game"]
-   [:pre (str (into {} game))]])
-
-(defn c-game [{:keys [monkey pipes] :as game}]
+(defn c-game [{:keys [monkey pipes screen] :as game}]
   (reify om/IRender
     (render [this]
-      (let [width  (:width  (:game config))
-            height (:height (:game config))]
-        (html
+      (html
         [:div
-         [:svg {:width width :height height :style {:border "1px solid black"}}
-             (render-monkey monkey)
-             (render-pipes pipes)]
-         (render-debug game)])))))
+         [:svg {:width (:width screen)
+                :height (:height screen)
+                :style {:border "1px solid black"}}
+          (render-monkey monkey)
+          (render-pipes pipes)]]))))

 (om/root game-state c-game (js/document.getElementById "my-app"))

+(defn tick [{{:keys [height velocity]} :monkey
+             :keys [last-update gravity] :as game}]
+  (let [new-update   (js/Date.)
+        time-diff    (- new-update last-update)
+        grav-effect  (/ (* gravity 1000) time-diff)
+        new-velocity (+ velocity grav-effect)
+        new-height   (+ height velocity)
+        new-monkey   {:velocity new-velocity :height new-height}]
+    (assoc game :monkey new-monkey
+                :last-update new-update)))
+
+(js/setInterval
+  #(swap! game-state tick)
+  16)
+
+(let [my-app (js/document.getElementById "my-app")]
+  (aset my-app "tabIndex" 0)
+  (.focus my-app)
+  (aset my-app "onkeypress"
+        (fn [event]
+          (if (= 119 (aget event "charCode"))
+           (swap! game-state assoc-in [:monkey :velocity]
+                  (:flapv @game-state))))))


varied welcome messages

varied welcome messages

--- src/overtone/helpers/lib.clj
+++ src/overtone/helpers/lib.clj
@@ -266,6 +266,17 @@
   [m]
   (into {} (map (fn [[k v]] [k (if (keyword? v) (name v) (str v))]) m)))

+(defn- welcome-message
+  [user-name]
+  (let [opts [(str "Hello " user-name ", may this be the start of a beautiful music hacking session...")
+              (str "Cometh the hour, cometh " user-name ", the overtone hacker.")
+              (str "Hello " user-name ", may algorithmic beauty pour forth from your fingertips today.")
+              (str "Hey " user-name ", I feel something magical is only just beyond the horizon...")
+              (str "Hello " user-name ", just take a moment to pause and focus your creative powers...")
+              (str "Hello " user-name ". Do you feel it? I do. Creativity is rushing through your veins today!")]]
+    (rand-nth opts)))
+
+
 (defn print-ascii-art-overtone-logo
   [user-name version-str]
   (println (str "
@@ -278,7 +289,8 @@
               Collaborative Programmable Music. "version-str "

-Hello " user-name ", may this be the start of a beautiful music hacking session...")))
+" (welcome-message user-name) "
+")))

 (defn normalize-ugen-name
   "Normalizes both SuperCollider and overtone-style names to squeezed lower-case.


Iron out some creases in match-note.

Iron out some creases in match-note.

--- src/overtone/music/pitch.clj
+++ src/overtone/music/pitch.clj
@@ -117,20 +117,20 @@

 (defn validate-midi-string!
   "Throws a friendly exception if midi-keyword mk is not
-  valid. Returns regexp match object if valid."
+  valid. Returns matches if valid."
   [mk]
-  (let [matcher (midi-string-matcher mk)]
-    (when-not matcher
+  (let [matches (midi-string-matcher mk)]
+    (when-not matches
       (throw (IllegalArgumentException.
               (str "Invalid midi-string. " mk
                    " does not appear to be in MIDI format i.e. C#4"))))

-    (let [[match pictch-class octave] matcher]
+    (let [[match pictch-class octave] matches]
       (when (< (Integer. octave) -1)
         (throw (IllegalArgumentException.
                 (str "Invalid midi-string: " mk
                      ". Octave is out of range. Lowest octave value is -1")))))
-    matcher))
+    matches))

 (defn note-map
   "Takes a match array returned by a regexp match and returns a map of note info"
@@ -193,10 +193,11 @@
   ([s] (match-note s "" ""))
   ([s prev-str post-str]
      (let [look-behind (if prev-str (str "(?<=" prev-str ")") "")
-           look-ahead (if post-str (str "(?=" post-str ")") "")
-           match (re-find (re-pattern (str look-behind MIDI-NOTE-RE-STR look-ahead)) s)]
+           look-ahead  (if post-str (str "(?=" post-str ")") "")
+           match       (re-find (re-pattern (str look-behind MIDI-NOTE-RE-STR look-ahead)) s)]
        (when match
-         (note-map match)))))
+         (let [[match pitch-class octave] match]
+           (note-map match))))))


add m7+9 chord (synonym of m9)

add m7+9 chord (synonym of m9)


Teach midi-capture-next-control-input to return the full event key.

- Also extract MIDI event key generation to a separate fn for re-use.

--- src/overtone/studio/midi.clj
+++ src/overtone/studio/midi.clj
@@ -10,12 +10,19 @@

 (def EXCLUDED-DEVICES #{"Real Time Sequencer" "Java Sound Synthesizer"})

+(defn midi-mk-full-device-event-key
+  "Creates the full key used for events generated by incoming MIDI
+  events. Using this key can allow you to detect events from specific
+  devices rather than just general control events."
+  [dev command]
+  [:midi-device (dev :vendor) (dev :name) (dev :description) command])
+
 (defn midi-event
   "Trigger a global midi event."
   [dev msg & [ts]]
   (let [command (:command msg)]
     (event [:midi command] msg)
-    (event [:midi-device (dev :vendor) (dev :name) (dev :description) command] msg)))
+    (event (midi-mk-full-device-event-key dev command (:data1 msg)) msg)))

 (defn- detect-midi-devices
   "Designed to run periodically and update the midi-devices* atom with
@@ -129,13 +136,20 @@

 (defn midi-capture-next-control-input
   "Returns a simple map representing next modified controller. Useful
-  for detecting controller information."
-  []
-  (let [p (promise)]
-    (oneshot-event [:midi :control-change]
-                   (fn [msg]
-                     (let [{controller :data1 val :data2} msg
-                           device-name                    (get-in msg [:device :name])]
-                       (deliver p {:device device-name, :controller controller :value val})))
-                   ::print-next-control-input)
-    @p))
+  for detecting controller information. If the argument with-key? is set
+  to true, the full event key will associated with the resulting map."
+  ([] (midi-capture-next-control-input false))
+  ([with-key?]
+     (let [p (promise)]
+       (oneshot-event [:midi :control-change]
+                      (fn [msg]
+                        (let [{controller :data1 val :data2} msg
+                              device-name                    (get-in msg [:device :name])
+                              res {:controller controller :value val}
+                              res (if with-key?
+                                    (assoc res :key (midi-mk-full-device-event-key (:device msg) :control-change))
+                                    res)]
+
+                          (deliver p res)))
+                      ::print-next-control-input)
+       @p)))


Add move-x and move-y

Add move-x and move-y

--- src/play_clj/core_render.clj
+++ src/play_clj/core_render.clj
@@ -110,12 +110,22 @@
   [screen new-width]
   (size! screen new-width (* new-width (/ (game :height) (game :width)))))

-(defn move!
-  [{:keys [^Camera camera]} x y]
+(defn move-x!
+  [{:keys [^Camera camera]} x]
   (assert camera)
   (when x (set! (. (. camera position) x) x))
+  (.update camera))
+
+(defn move-y!
+  [{:keys [^Camera camera]} y]
+  (assert camera)
   (when y (set! (. (. camera position) y) y))
   (.update camera))
+
+(defn move!
+  [screen x y]
+  (move-x! screen x)
+  (move-y! screen y))

 ; interop


Update angle in 2D physics

Update angle in 2D physics

--- src/play_clj/g2d_physics.clj
+++ src/play_clj/g2d_physics.clj
@@ -263,6 +263,7 @@
            (if (u/get-obj e :body)
              (assoc e
                     :x (body-x e)
-                    :y (body-y e))
+                    :y (body-y e)
+                    :angle (body-angle e))
              e))
          entities)))


Make create-recording-productions-with-obi work for projects with no wav files

--- src/mdr2/abacus/import.clj
+++ src/mdr2/abacus/import.clj
@@ -165,7 +165,6 @@
 (defn recording-with-wav? [production] (and (recording? production)
                                             (some wav-file? (get-all-files production))))
 (defn recording-with-obi? [production] (and (recording? production)
-                                            (some wav-file? (get-all-files production))
                                             (some obi-project? (get-all-files production))))
 (defn recording-with-wav-no-obi? [production] (and (recording? production)
                                                    (some wav-file? (get-all-files production))
@@ -243,17 +242,18 @@
     production))

 (defn create-recording-productions-with-obi!
-  "Create all productions with state \"recording\" with wav files that
-  contain an obi project. Add to the db and create the directories.
-  Copy the obi project to the new place. Place an obi config file
-  inside the obi project"
-  [productions]
-  (doseq [p (filter recording-with-obi? productions)]
-    (-> p
-        prod/create!
-        prod/set-state-structured!
-        copy-obi-project!
-        create-obi-config-file!)))
+  "Create all productions with state \"recording\" that contain an obi
+  project. Add to the db and create the directories. Copy the obi
+  project to the new place. Place an obi config file inside the obi
+  project"
+  [productions]
+  (transaction
+   (doseq [p (filter recording-with-obi? productions)]
+     (-> p
+         prod/create!
+         prod/set-state-structured!
+         copy-obi-project!
+         create-obi-config-file!))))

 (defn format-sigtuna-move [production]
   (let [old (nio/resolve-path old-production-root (prod/dam-number production))]


write-chunk job-scheduler/messaging has no id

--- src/onyx/log/zookeeper.clj
+++ src/onyx/log/zookeeper.clj
@@ -420,26 +420,26 @@
         (extensions/emit monitoring args)))))

 (defmethod extensions/write-chunk [ZooKeeper :job-scheduler]
-  [{:keys [conn opts prefix monitoring] :as log} kw chunk id]
+  [{:keys [conn opts prefix monitoring] :as log} kw chunk _]
   (let [bytes (zookeeper-compress chunk)]
     (measure-latency
      #(clean-up-broken-connections
        (fn []
          (let [node (str (job-scheduler-path prefix) "/scheduler")]
            (zk/create conn node :persistent? true :data bytes))))
-     #(let [args {:event :zookeeper-write-job-scheduler :id id
+     #(let [args {:event :zookeeper-write-job-scheduler
                   :latency % :bytes (count bytes)}]
         (extensions/emit monitoring args)))))

 (defmethod extensions/write-chunk [ZooKeeper :messaging]
-  [{:keys [conn opts prefix monitoring] :as log} kw chunk id]
+  [{:keys [conn opts prefix monitoring] :as log} kw chunk _]
   (let [bytes (zookeeper-compress chunk)]
     (measure-latency
      #(clean-up-broken-connections
        (fn []
          (let [node (str (messaging-path prefix) "/messaging")]
            (zk/create conn node :persistent? true :data bytes))))
-     #(let [args {:event :zookeeper-write-messaging :id id
+     #(let [args {:event :zookeeper-write-messaging
                   :latency % :bytes (count bytes)}]
         (extensions/emit monitoring args)))))


Temporary fix for #344.

Temporary fix for #344.

--- src/onyx/peer/function.clj
+++ src/onyx/peer/function.clj
@@ -36,6 +36,17 @@

 (defrecord Function [replica peer-replica-view state messenger egress-tasks]
   p-ext/Pipeline
+
+  ;;; Start temp fix for: https://github.com/onyx-platform/onyx/issues/344
+  (ack-segment [this event message-id])
+
+  (retry-segment [this event message-id])
+
+  (pending? [this event message-id])
+
+  (drained? [this event])
+  ;;; End temp fix.
+
   (read-batch
     [_ event]
     (read-batch event messenger))


Bump macrowbar version

Bump macrowbar version

--- build.boot
+++ build.boot
@@ -7,7 +7,7 @@
                     [org.clojure/clojurescript   "1.9.946"]

                     ;; utility
-                    [moxaj/macrowbar             "0.2.0"]
+                    [moxaj/macrowbar             "0.2.1"]

                     ;; testing
                     [org.clojure/test.check      "0.10.0-alpha1" :scope "test"]


Use boot-alt-test

Use boot-alt-test

--- build.boot
+++ build.boot
@@ -14,7 +14,7 @@
                   [weasel                 "0.7.0"      :scope "test"]
                   [org.clojure/tools.nrepl "0.2.12"    :scope "test"]
                   [adzerk/boot-reload     "0.4.7"      :scope "test"]
-                  [adzerk/boot-test       "1.1.1"      :scope "test"]
+                  [metosin/boot-alt-test  "0.1.0"      :scope "test"]
                   [deraen/boot-less       "0.5.0"      :scope "test"]
                   ;; For boot-less
                   [org.slf4j/slf4j-nop    "1.7.21"     :scope "test"]
@@ -43,7 +43,7 @@
   '[adzerk.boot-cljs      :refer [cljs]]
   '[adzerk.boot-cljs-repl :refer [cljs-repl start-repl repl-env]]
   '[adzerk.boot-reload    :refer [reload]]
-  '[adzerk.boot-test      :refer [test]]
+  '[metosin.boot-alt-test  :refer [alt-test]]
   '[deraen.boot-less      :refer [less]]
   '[deraen.boot-sass      :refer [sass]]
   '[deraen.boot-ctn       :refer [init-ctn!]]
@@ -83,15 +83,16 @@
     (start-app :port port)
     (if speak (boot.task.built-in/speak) identity)))

-(deftask run-tests []
+(deftask run-tests
+  [c ci bool "If process should exit after test failure"]
   (comp
-   (test)
-   (test-cljs :namespaces #{"frontend.core-test"})))
+    (alt-test :fail (if (nil? ci) true ci))
+    (test-cljs :namespaces #{"frontend.core-test"})))

 (deftask autotest []
   (comp
     (watch)
-    (run-tests)))
+    (run-tests :ci false)))

 (deftask package
   "Build the package"


Move require to fix compile error

Move require to fix compile error

--- build.boot
+++ build.boot
@@ -3,9 +3,6 @@
   :resource-paths #{"resources"}
   :dependencies '[[org.clojure/clojure "1.7.0"]
                   [prismatic/schema "0.4.3"]])
-
-(require
-  '[net.sekao.nightcode.core :as app])

 (task-options!
   pom {:project 'nightcode
@@ -19,7 +16,8 @@
   (comp
     (aot)
     (with-pre-wrap fileset
-      (app/-main)
+      (require '[net.sekao.nightcode.core :refer [-main]])
+      ((resolve '-main))
       fileset)))

 (deftask build []


add description, url & license to the pom task

--- build.boot
+++ build.boot
@@ -37,7 +37,11 @@
 (task-options!
   pom {:project 'compassus
        :version +version+
-       :scm {:url "https://github.com/anmonteiro/compassus"}}
+       :description "A routing library for Om Next."
+       :url "https://github.com/anmonteiro/compassus"
+       :scm {:url "https://github.com/anmonteiro/compassus"}
+       :license {"name" "Eclipse Public License"
+                 "url"  "http://www.eclipse.org/legal/epl-v10.html"}}
   push {:ensure-clean false})

 (deftask build-jar []


Update play-cljs template

Update play-cljs template

--- build.boot
+++ build.boot
@@ -7,7 +7,7 @@
                   [leiningen "2.7.0" :exclusions [leiningen.search]]
                   [ring "1.4.0"]
                   [clojail "1.0.6"]
-                  [play-cljs/lein-template "0.6.2.1"]])
+                  [play-cljs/lein-template "0.6.3"]])

 (task-options!
   sift {:include #{#"\.jar$"}}


Add clojars release support

Add clojars release support

--- build.boot
+++ build.boot
@@ -6,6 +6,7 @@
           ;; :source-paths   #{"test"}
           :dependencies   '[[org.clojure/clojure "1.9.0-alpha15"]
                             [boot/new "0.5.2"]
+                            [adzerk/bootlaces "0.1.13" :scope "test"]
                             [adzerk/boot-test "1.2.0" :scope "test"]])

 (task-options!
@@ -23,4 +24,7 @@
   (comp (pom) (jar) (install)))

 (require '[adzerk.boot-test :refer [test]]
+         '[adzerk.bootlaces :refer :all]
          '[boot.new :refer [new]])
+
+(bootlaces! version)


Revert "Update build.boot with last version and some additional tasks for deploy."

This reverts commit d46cbe24aaa19be941ce8df2bebbf0956f37003e.

--- build.boot
+++ build.boot
@@ -1,8 +1,8 @@
 (set-env!
- :source-paths #{"src"}
- :resource-paths #{"assets"}
+ :source-paths #{"src" "assets"}
  :dependencies '[[cats "0.4.0"]
                  [adzerk/boot-cljs "0.0-2814-3" :scope "test"]
+                 [adzerk/bootlaces "0.1.11" :scope "test"]
                  [boot-cljs-test/node-runner "0.1.0" :scope "test"]
                  [org.clojure/clojurescript "0.0-3123"  :scope "test"]
                  [org.clojure/clojure "1.7.0-beta3" :scope "test"]
@@ -10,62 +10,19 @@

 (require
  '[adzerk.boot-cljs :refer [cljs]]
- '[boot-cljs-test.node-runner :refer :all])
+ '[boot-cljs-test.node-runner :refer :all]
+ '[adzerk.bootlaces :refer :all])

-(def +version+ "0.1.2")
+(def +version+ "0.1.2-SNAPSHOT")
+(bootlaces! +version+)

-(deftask clojars-credentials
-  []
-  (fn [next-handler]
-    (fn [fileset]
-      (let [clojars-creds (atom {})]
-        (print "Username: ")
-        (swap! clojars-creds assoc :username (read-line))
-        (print "Password: ")
-        (swap! clojars-creds assoc :password
-               (apply str (.readPassword (System/console))))
-        (merge-env!
-         :repositories [["deploy-clojars" (merge @clojars-creds {:url "https://clojars.org/repo"})]])
-        (next-handler fileset)))))
-
-(deftask push-snapshot
-  "Deploy snapshot version to Clojars."
-  [f file PATH str "The jar file to deploy."]
-  (comp (clojars-credentials)
-        (push :file file
-              :ensure-snapshot true
-              :repo "deploy-clojars"
-              :ensure-version +version+
-              :ensure-clean false
-              :ensure-branch "master")))
-
-(deftask push-release
-  "Deploy snapshot version to Clojars."
-  [f file PATH str "The jar file to deploy."]
-  (comp (clojars-credentials)
-        (push :file file
-              :ensure-release true
-              :repo "deploy-clojars"
-              :ensure-version +version+
-              :ensure-clean true
-              :ensure-branch "master")))
-
-(deftask build []
-  (comp (pom :project     'funcool/promesa
-             :version     +version+
-             :description "A promise library for ClojureScript"
-             :url         "https://github.com/funcool/promise"
-             :scm         {:url "https://github.com/funcool/promise"}
-             :license     {"BSD (2 Clause)" "http://opensource.org/licenses/BSD-2-Clause"})
-        (jar)))
-
-(deftask deploy-snapshot []
-  (comp (build)
-        (push-snapshot)))
-
-(deftask deploy-release []
-  (comp (build)
-        (push-release)))
+(task-options!
+  pom  {:project     'funcool/promesa
+        :version     +version+
+        :description "A promise library for ClojureScript"
+        :url         "https://github.com/funcool/promise"
+        :scm         {:url "https://github.com/funcool/promise"}
+        :license     {"BSD (2 Clause)" "http://opensource.org/licenses/BSD-2-Clause"}})

 (deftask dev []
   (set-env! :source-paths #{"src" "test" "assets"})
@@ -73,3 +30,7 @@
         (cljs-test-node-runner :namespaces '[promesa.core-tests])
         (cljs :source-map true :optimizations :none)
         (run-cljs-test)))
+
+;; (deftask build []
+;;   (set-env! :source-paths #{"src"})
+;;   (comp (cljs :optimizations :advanced)))


Removed unused parser

Removed unused parser

--- src/instaskip/core.clj
+++ src/instaskip/core.clj
@@ -1,14 +1,6 @@
 (ns instaskip.core
   (:require [instaparse.core :as insta])
   (:gen-class))
-
-(def as-and-bs
-  (insta/parser
-    "S = AB*
-     AB = A B
-     A = 'a'+
-     B = 'b'+"))
-

 (def eskip
   (insta/parser


Add a bunch of Closure stuff

Add a bunch of Closure stuff

Hand-picked a bunch of stuff that might be
useful outside of a browser

--- planck-cljs/src/planck/bundle.cljs
+++ planck-cljs/src/planck/bundle.cljs
@@ -3,7 +3,146 @@
   (:require
     cljs.pprint
     cljs.test
+    goog.Delay
+    goog.Disposable
+    goog.Promise
+    goog.Throttle
+    goog.Timer
+    goog.Uri
+    goog.array.ArrayLike
+    goog.color
+    goog.color.Hsl
+    goog.color.Hsv
+    goog.color.Rgb
+    goog.color.alpha
+    goog.color.names
+    goog.crypt
+    goog.crypt.Aes
+    goog.crypt.Arc4
+    goog.crypt.BlobHasher
+    goog.crypt.Cbc
+    goog.crypt.Hash
+    goog.crypt.Hmac
+    goog.crypt.JpegEncoder
+    goog.crypt.Md5
+    goog.crypt.Sha1
+    goog.crypt.Sha2
+    goog.crypt.Sha224
+    goog.crypt.Sha256
+    goog.crypt.Sha2_64bit
+    goog.crypt.Sha512
+    goog.crypt.Sha512_256
+    goog.crypt.base64
+    goog.crypt.baseN
+    goog.crypt.hash32
+    goog.crypt.hashTester
+    goog.crypt.pbkdf2
     goog.date.Date
+    goog.date.DateLike
+    goog.date.DateRange
     goog.date.DateTime
+    goog.date.Interval
     goog.date.UtcDateTime
-    goog.i18n.TimeZone))
+    goog.date.duration
+    goog.date.month
+    goog.date.relative.TimeDeltaFormatter
+    goog.date.relative.Unit
+    goog.date.relativeWithPlurals
+    goog.date.weekDay
+    goog.format
+    goog.format.EmailAddress
+    goog.format.HtmlPrettyPrinter
+    goog.format.InternationalizedEmailAddress
+    goog.format.JsonPrettyPrinter
+    goog.i18n.BidiFormatter
+    goog.i18n.CharListDecompressor
+    goog.i18n.CharPickerData
+    goog.i18n.DateTimeFormat
+    goog.i18n.DateTimeParse
+    goog.i18n.GraphemeBreak
+    goog.i18n.MessageFormat
+    goog.i18n.NumberFormat
+    goog.i18n.TimeZone
+    goog.i18n.bidi
+    goog.i18n.bidi.Dir
+    goog.i18n.bidi.Format
+    goog.i18n.collation
+    goog.i18n.currency
+    goog.i18n.mime
+    goog.i18n.ordinalRules
+    goog.i18n.pluralRules
+    goog.i18n.uChar
+    goog.i18n.uChar.LocalNameFetcher
+    goog.i18n.uChar.RemoteNameFetcher
+    goog.i18n.uCharNames
+    goog.iter
+    goog.iter.Iterable
+    goog.iter.Iterator
+    goog.json
+    goog.json.EvalJsonProcessor
+    goog.json.HybridJsonProcessor
+    goog.json.NativeJsonProcessor
+    goog.json.Replacer
+    goog.json.Reviver
+    goog.json.Serializer
+    goog.json.hybrid
+    goog.locale
+    goog.locale.TimeZoneFingerprint
+    goog.locale.defaultLocaleNameConstants
+    goog.locale.genericFontNames
+    goog.locale.timeZoneDetection
+    goog.math
+    goog.math.AffineTransform
+    goog.math.Bezier
+    goog.math.Box
+    goog.math.Coordinate
+    goog.math.Coordinate3
+    goog.math.ExponentialBackoff
+    goog.math.Integer
+    goog.math.Line
+    goog.math.Long
+    goog.math.Matrix
+    goog.math.Path
+    goog.math.Path.Segment
+    goog.math.Range
+    goog.math.RangeSet
+    goog.math.Rect
+    goog.math.Size
+    goog.math.Vec2
+    goog.math.Vec3
+    goog.math.interpolator.Linear1
+    goog.math.interpolator.Pchip1
+    goog.math.interpolator.Spline1
+    goog.math.paths
+    goog.math.tdma
+    goog.spell.SpellCheck
+    goog.string
+    goog.string.Const
+    goog.string.StringBuffer
+    goog.string.Unicode
+    goog.string.format
+    goog.string.newlines
+    goog.string.newlines.Line
+    goog.structs
+    goog.structs.AvlTree
+    goog.structs.AvlTree.Node
+    goog.structs.CircularBuffer
+    goog.structs.Heap
+    goog.structs.InversionMap
+    goog.structs.LinkedMap
+    goog.structs.Map
+    goog.structs.Node
+    goog.structs.Pool
+    goog.structs.PriorityPool
+    goog.structs.PriorityQueue
+    goog.structs.QuadTree
+    goog.structs.QuadTree.Node
+    goog.structs.QuadTree.Point
+    goog.structs.Queue
+    goog.structs.Set
+    goog.structs.SimplePool
+    goog.structs.StringSet
+    goog.structs.TreeNode
+    goog.structs.Trie
+    goog.structs.weak
+    goog.text.LoremIpsum))


Simmplify new cursor a bit

Simmplify new cursor a bit

--- src/reagent/ratom.cljs
+++ src/reagent/ratom.cljs
@@ -152,9 +152,10 @@
   {:pre [(ifn? f)]}
   (Monitor. #(apply f args) [f args] nil))

+
 ;;; cursor

-(deftype RCursor [ratom path setter ^:mutable reaction
+(deftype RCursor [ratom path ^:mutable reaction
                   ^:mutable state ^:mutable watches]
   IAtom
   IReactiveAtom
@@ -184,7 +185,7 @@
                      (let [f (if (satisfies? IDeref ratom)
                                #(get-in @ratom path)
                                #(ratom path))]
-                       (cached-reaction f [ratom path ::cursor] this)))]
+                       (cached-reaction f [::cursor ratom path] this)))]
       (._set-state this oldstate newstate)
       newstate))

@@ -192,7 +193,11 @@
   (-reset! [this new-value]
     (let [oldstate state]
       (._set-state this oldstate new-value)
-      (setter path new-value)
+      (if (satisfies? IDeref ratom)
+        (if (= path [])
+          (reset! ratom new-value)
+          (swap! ratom assoc-in path new-value))
+        (ratom path new-value))
       new-value))

   ISwap
@@ -230,12 +235,7 @@
                    (not (vector? src))))
           (str "src must be a reactive atom or a function, not "
                (pr-str src)))
-  (let [s (if (satisfies? IDeref src)
-            (if (= path [])
-              #(reset! src %2)
-              #(swap! src assoc-in path %2))
-            #(src path %2))]
-    (RCursor. src path s nil nil nil)))
+  (RCursor. src path nil nil nil))


Remove debug print

Remove debug print

--- tasks/leiningen/fatdeb.clj
+++ tasks/leiningen/fatdeb.clj
@@ -102,7 +102,6 @@
                            (get-version project) "_"
                            "all" ".deb")
         deb-file (file (:root project) "target" deb-file-name)]
-    (println deb-file-name deb-file)
     (write (str deb-file ".md5")
            (str (md5 (slurp deb-file)) "  " deb-file-name))))


Fix drum loading

Fix drum loading

--- src/overtone/inst/drum.clj
+++ src/overtone/inst/drum.clj
@@ -1,5 +1,5 @@
 (ns overtone.inst.drum
-  (:use [overtone.sc ugens envelope]
+  (:use [overtone.sc ugens envelope synth]
         [overtone.studio rig]))

 (definst kick [freq 80 mod-freq 5 mod-index 5


adding another type of distortion effect

--- src/overtone/studio/fx.clj
+++ src/overtone/studio/fx.clj
@@ -48,7 +48,7 @@
                     slope-below slope-above
                     clamp-time relax-time))))

-(defsynth fx-reverb1
+(defsynth fx-freeverb
   "Uses the free-verb ugen."
   [bus 0 wet-dry 0.5 room-size 0.5 dampening 0.5]
   (let [source (in bus)
@@ -91,6 +91,16 @@
   (let [src (in bus)]
     (replace-out bus (distort (* boost (clip2 src level))))))

+; Equation for distortion:
+; k = 2*amount/(1-amount)
+; f(x) = (1+k)*x/(1+k*abs(x))
+(defsynth fx-distortion2
+  [bus 0 amount 0.5]
+  (let [src (in bus)
+        k (/ (* 2 amount) (- 1 amount))
+        snd (/ (* src (+ 1 k)) (+ 1 (* k (abs src))))]
+    (replace-out bus snd)))
+
 (defsynth fx-rlpf
   [bus 0 cutoff 20000 res 0.6]
   (let [src (in bus)]


add delete-parens anims

add delete-parens anims

--- src/parinfer/vcr_data.cljs
+++ src/parinfer/vcr_data.cljs
@@ -1690,20 +1690,34 @@
     :recording? false})

 (def splice
-  '{:loop-delay 2000
+  '{:timescale 2
     :changes
-    [{:selections ({:anchor {:line 0, :ch 6}, :head {:line 0, :ch 6}}),
+    [{:selections ({:anchor {:line 0, :ch 0}, :head {:line 0, :ch 0}}),
       :dt 0}
-     {:selections ({:anchor {:line 0, :ch 6}, :head {:line 0, :ch 5}}),
-      :dt 220}
+     {:change
+      {:from {:line 0, :ch 0},
+       :to {:line 0, :ch 0},
+       :text ("(foo [1 2 3 4 5 6])" "(bar a b c)"),
+       :origin "paste"},
+      :dt 917}
+     {:selections ({:anchor {:line 0, :ch 6}, :head {:line 0, :ch 6}}),
+      :dt 1006}
      {:change
       {:from {:line 0, :ch 5},
        :to {:line 0, :ch 6},
        :text (""),
        :origin "+delete"},
-      :dt 1372}],
-    :init-value "(foo (+ 1 2 3 4 5 6))",
-    :last-time 1444256056155,
+      :dt 746}
+     {:selections ({:anchor {:line 1, :ch 1}, :head {:line 1, :ch 1}}),
+      :dt 970}
+     {:change
+      {:from {:line 1, :ch 0},
+       :to {:line 1, :ch 1},
+       :text (""),
+       :origin "+delete"},
+      :dt 446}],
+    :init-value "",
+    :last-time 1444575352287,
     :recording? false})

 (def barf
@@ -1738,25 +1752,34 @@
     :recording? false})

 (def slurp-
-  '{:changes
-    [{:selections ({:anchor {:line 0, :ch 12}, :head {:line 0, :ch 11}}),
+  '{:timescale 2
+    :changes
+    [{:selections ({:anchor {:line 0, :ch 0}, :head {:line 0, :ch 0}}),
       :dt 0}
+     {:change
+      {:from {:line 0, :ch 0},
+       :to {:line 0, :ch 0},
+       :text ("(foo [1 2 3] 4 5 6)" "(bar a b) c"),
+       :origin "paste"},
+      :dt 626}
+     {:selections ({:anchor {:line 0, :ch 12}, :head {:line 0, :ch 12}}),
+      :dt 755}
      {:change
       {:from {:line 0, :ch 11},
        :to {:line 0, :ch 12},
        :text (""),
        :origin "+delete"},
-      :dt 3259}
-     {:selections ({:anchor {:line 0, :ch 15}, :head {:line 0, :ch 15}}),
-      :dt 662}
-     {:change
-      {:from {:line 0, :ch 15},
-       :to {:line 0, :ch 15},
-       :text (")"),
-       :origin "+input"},
-      :dt 967}],
-    :init-value "(foo (+ 1 2) 3 4 5 6)",
-    :last-time 1444256562984,
+      :dt 706}
+     {:selections ({:anchor {:line 1, :ch 9}, :head {:line 1, :ch 9}}),
+      :dt 824}
+     {:change
+      {:from {:line 1, :ch 8},
+       :to {:line 1, :ch 9},
+       :text (""),
+       :origin "+delete"},
+      :dt 515}],
+    :init-value "",
+    :last-time 1444575467477,
     :recording? false})

 (def string


committing missing project file

committing missing project file

--- core/project.clj
+++ core/project.clj
@@ -1,4 +1,4 @@
-(defproject samsara/samsara-core "0.4.0"
+(defproject samsara/samsara-core "0.5.0-SNAPSHOT"
   :description "Event stream processing pipeline"

   :url "https://samsara.github.com/"
@@ -11,7 +11,7 @@
                  [org.slf4j/slf4j-log4j12 "1.7.12"]
                  [org.apache.samza/samza-api        "0.9.1"]
                  [org.apache.samza/samza-kafka_2.10 "0.9.1"]
-                 [samsara/moebius "0.3.0"]
+                 [samsara/moebius "0.4.0"]
                  [samsara/samsara-utils "0.4.0"]
                  [samsara/trackit "0.2.2"]
                  [com.taoensso/timbre "3.4.0"]


Test contents of project.clj

Test contents of project.clj

--- test/jcf/template_test.clj
+++ test/jcf/template_test.clj
@@ -15,10 +15,24 @@
    "system.properties"
    "test/{{path}}/config_test.clj"])

+(def manifest
+  (render-files (get-manifest clojurish-templates)
+                {:name "example/app"
+                 :ns "example.app"
+                 :path "example/app"
+                 :project-name "app"}))
+
 (deftest test-render-files
-  (let [manifest (render-files (get-manifest clojurish-templates)
-                               {:name "example/app"
-                                :ns "example.app"
-                                :path "example/app"
-                                :project-name "app"})]
-    (is (= (-> manifest keys sort) expected-manifest))))
+  (is (= (-> manifest keys sort) expected-manifest)))
+
+(deftest test-project-definition
+  (let [[_ named version & kvs] (-> manifest (get "project.clj") read-string)
+        props (apply hash-map kvs)]
+    (is (= named 'example/app))
+    (is (= version "0.1.0-SNAPSHOT"))
+    (is (= (:dependencies props)
+           '[[com.stuartsierra/component "0.2.2"]
+             [environ "1.0.0"]
+             [listora/constraint-config "0.2.0"]
+             [org.clojure/clojure "1.7.0"]
+             [prismatic/schema "0.4.3"]]))))


fixed install signature

fixed install signature

--- integration/src/dda/pallet/dda_managed_vm/app/instantiate_existing.clj
+++ integration/src/dda/pallet/dda_managed_vm/app/instantiate_existing.clj
@@ -21,7 +21,7 @@
     [dda.pallet.dda-managed-vm.app :as app]))

 (defn install
-  [count & options]
+  [& options]
   (let [{:keys [domain targets summarize-session]
          :or {domain "integration/resources/jem-vm.edn"
               targets "targets.edn"


change startup messages so cider can properly find nrepl port

--- src/main/shadow/cljs/devtools/server.clj
+++ src/main/shadow/cljs/devtools/server.clj
@@ -293,14 +293,8 @@
            @app-ref]

        (println (str "shadow-cljs - server running at http" (when ssl-context "s") "://" (:host http) ":" (:port http)))
-
-       (when (get-in config [:socket-repl :port])
-         (println (str "shadow-cljs - socket repl running at " (:host socket-repl) ":" (:port socket-repl))))
-
-       (when (get-in config [:nrepl :port])
-         (println (str "shadow-cljs - nrepl running at "
-                       (-> (:server-socket nrepl) (.getInetAddress))
-                       ":" (:port nrepl))))
+       (println (str "shadow-cljs - socket repl running at " (:host soch ket-repl) ":" (:port socket-repl)))
+       (println (str "shadow-cljs - nREPL server started on port " (:port nrepl)))

        ::started
        ))))


Add `status` prop to story response.

Add `status` prop to story response.

--- src/oc/storage/representations/story.clj
+++ src/oc/storage/representations/story.clj
@@ -16,7 +16,7 @@

 (def representation-props [:uuid :title :banner-url :banner-width :banner-height :body
                            :org-name :org-logo-url :org-logo-width :org-logo-height
-                           :storyboard-name
+                           :storyboard-name :status
                            :author :created-at])

 (defun url


Write typical-extent-of-horizontal

Write typical-extent-of-horizontal

--- src/test_utils/fracture_diagnostics.cljc
+++ src/test_utils/fracture_diagnostics.cljc
@@ -124,16 +124,23 @@
      :ft (make-measurement (tuc/draw-normal 5280 500) :ft)
      :m (length-as (typical-measured-depth-of-vertical :ft) :m))))

+(defn typical-extent-of-horizontal
+  "Calculates a typical 'extent' (from the heel) of the horizontal portion of a well."
+  ([]
+   (typical-extent-of-horizontal (rand-length-unit)))
+  ([length-unit]
+   (case length-unit
+     :ft (make-measurement (tuc/draw-normal 8000 1667) length-unit)
+     :m (length-as (typical-extent-of-horizontal :ft) length-unit))))
+
 (defn typical-measured-depth
   ([] (typical-measured-depth (rand-length-unit)))
   ([length-unit]
-   (let [typical-measured-depth-in-feet
-         (fn [] (make-measurement (+ (tuc/draw-normal 8000 1216)  ;; horizontal
-                                     (* 5280 (rand)))  ;; typical vertical
-                                  :ft))]
-     (condp = length-unit
-       :ft (typical-measured-depth-in-feet)
-       :m (length-as (typical-measured-depth-in-feet) :m)))))
+   (case length-unit
+     :ft (make-measurement (+ (tuc/draw-normal 8000 1216)  ;; horizontal portion
+                              (typical-measured-depth-of-vertical length-unit))
+                           length-unit)
+     :m (length-as (typical-measured-depth) length-unit))))

 (defn typical-toe-measured-depth
   ([] (typical-toe-measured-depth (rand-length-unit)))


covers.clj: refactored and added a function

--- clojure/org/gavrog/clojure/covers.clj
+++ clojure/org/gavrog/clojure/covers.clj
@@ -2,14 +2,23 @@
   (:use (org.gavrog.clojure
          delaney
          fundamental
-         cosets)))
+         cosets
+         [generators :only [results]])))
+
+(defn- cover-for-table [ds table edge-to-word]
+  (cover ds (count table) (fn [k i D]
+                            (reduce (fn [k g] ((table k) g))
+                                    k (edge-to-word [D i])))))

 (defn subgroup-cover [ds subgroup-gens]
   (let [{:keys [nr-generators relators edge-to-word]} (fundamental-group ds)
         table (coset-table nr-generators relators subgroup-gens)]
-    (cover ds (count table) (fn [k i D]
-                              (reduce (fn [k g] ((table k) g))
-                                      k (edge-to-word [D i]))))))
+    (cover-for-table ds table edge-to-word)))

 (defn finite-universal-cover [ds]
   (subgroup-cover ds []))
+
+(defn covers [ds max-degree]
+  (let [{:keys [nr-generators relators edge-to-word]} (fundamental-group ds)]
+    (for [table (results (tables-generator nr-generators relators max-degree))]
+      (cover-for-table ds table edge-to-word))))


began user analysis in newware

began user analysis in newware

--- src/Miscellaneous/newware.clj
+++ src/Miscellaneous/newware.clj
@@ -612,6 +612,34 @@

 ;(write-excel (drill-down "都敏俊" "xuetestsegs" "xuetestentries" [2013 12 1] [2014 3 1]) "haha" "D:/data/教授.xlsx")

+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;user analysis;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defn get-keys
+  [coll]
+  (reduce #(apply conj %1 (keys %2)) #{} coll))
+
+
+(def abcd (mc/find-maps "shejian2_weibo_realtime_detaileduser"))
+
+(doall (get-keys abcd))
+
+(defn accumulator
+  [the-key coll]
+  (let [func (fn [x] (->> x frequencies (clojure.core/sort #(> (val %1) (val %2)))))]
+    (loop [c coll]
+      (if-not (nil? (first c))
+        (if (vector? (first c))
+          (func (mapcat the-key coll))
+          (func (map the-key coll)))
+        (recur (rest coll))))))
+
+(accumulator :性别 abcd)
+
+
+
+
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;working zone;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 (mg/connect! {:host "192.168.1.184" :port 7017})


ui -> swing

ui -> swing

--- mtg-pairings-wer/src/mtg_pairings/core.clj
+++ mtg-pairings-wer/src/mtg_pairings/core.clj
@@ -1,7 +1,7 @@
 (ns mtg-pairings.core
   (:gen-class)
   (:require [cheshire.generate :as json-gen]
-            [seesaw.core :as ui]
+            [seesaw.core :as swing]
             [seesaw.color :as color]
             [seesaw.table :as table]
             [seesaw.chooser :as chooser]
@@ -18,7 +18,7 @@
            org.joda.time.LocalDate))

-(ui/native!)
+(swing/native!)

 (def version "0.2.0")

@@ -83,46 +83,46 @@
   (keyword (str "resultscombo" tournament-id)))

 (defn disable-buttons [tournament-id]
-  (doseq [btn (ui/select (ui/to-root tabbed-pane) [(id->selector (tab-id tournament-id)) :JButton])]
-    (ui/config! btn :enabled? false))
-  (-> (ui/select (ui/to-root tabbed-pane) [(id->selector (reset-button-id tournament-id))])
-    (ui/config! :enabled? true)))
+  (doseq [btn (swing/select (swing/to-root tabbed-pane) [(id->selector (tab-id tournament-id)) :JButton])]
+    (swing/config! btn :enabled? false))
+  (-> (swing/select (swing/to-root tabbed-pane) [(id->selector (reset-button-id tournament-id))])
+    (swing/config! :enabled? true)))

 (defn update-pairings-combo [tournament-id]
-  (let [combo (ui/select (ui/to-root tabbed-pane) [(id->selector (pairings-combo-id tournament-id))])
+  (let [combo (swing/select (swing/to-root tabbed-pane) [(id->selector (pairings-combo-id tournament-id))])
         cnt (watcher/get-pairings-count tournament-id)]
-    (ui/config! combo :model (range 1 (inc cnt)))
-    (ui/selection! combo (long cnt))))
+    (swing/config! combo :model (range 1 (inc cnt)))
+    (swing/selection! combo (long cnt))))

 (defn update-results-combo [tournament-id]
-  (let [combo (ui/select (ui/to-root tabbed-pane) [(id->selector (results-combo-id tournament-id))])
+  (let [combo (swing/select (swing/to-root tabbed-pane) [(id->selector (results-combo-id tournament-id))])
         cnt (watcher/get-results-count tournament-id)]
-    (ui/config! combo :model (range 1 (inc cnt)))
-    (ui/selection! combo (long cnt))))
+    (swing/config! combo :model (range 1 (inc cnt)))
+    (swing/selection! combo (long cnt))))

 (defn enable-buttons [tournament-id]
-  (let [root (ui/to-root tabbed-pane)]
+  (let [root (swing/to-root tabbed-pane)]
     (when (watcher/get-tournament tournament-id)
-      (-> (ui/select root [(id->selector (tournament-button-id tournament-id))])
-        (ui/config! :enabled? true)))
+      (-> (swing/select root [(id->selector (tournament-button-id tournament-id))])
+        (swing/config! :enabled? true)))
     (when (watcher/get-teams tournament-id)
-      (-> (ui/select root [(id->selector (teams-button-id tournament-id))])
-        (ui/config! :enabled? true)))
+      (-> (swing/select root [(id->selector (teams-button-id tournament-id))])
+        (swing/config! :enabled? true)))
     (when (watcher/get-seatings tournament-id)
-      (-> (ui/select root [(id->selector (seatings-button-id tournament-id))])
-        (ui/config! :enabled? true)))
+      (-> (swing/select root [(id->selector (seatings-button-id tournament-id))])
+        (swing/config! :enabled? true)))
     (when (pos? (watcher/get-pairings-count tournament-id))
-      (-> (ui/select root [(id->selector (pairings-button-id tournament-id))])
-        (ui/config! :enabled? true)))
+      (-> (swing/select root [(id->selector (pairings-button-id tournament-id))])
+        (swing/config! :enabled? true)))
     (when (pos? (watcher/get-results-count tournament-id))
-      (-> (ui/select root [(id->selector (results-button-id tournament-id))])
-        (ui/config! :enabled? true))
-      (-> (ui/select root [(id->selector (publish-button-id tournament-id))])
-        (ui/config! :enabled? true)))
-    (-> (ui/select root [(id->selector (reset-button-id tournament-id))])
-      (ui/config! :enabled? true))
-    (-> (ui/select root [(id->selector (check-button-id tournament-id))])
-      (ui/config! :enabled? true))))
+      (-> (swing/select root [(id->selector (results-button-id tournament-id))])
+        (swing/config! :enabled? true))
+      (-> (swing/select root [(id->selector (publish-button-id tournament-id))])
+        (swing/config! :enabled? true)))
+    (-> (swing/select root [(id->selector (reset-button-id tournament-id))])
+      (swing/config! :enabled? true))
+    (-> (swing/select root [(id->selector (check-button-id tournament-id))])
+      (swing/config! :enabled? true))))

 (defmacro upload [action done tournament-id & params]
   `(fn [_#]
@@ -137,81 +137,81 @@
 (defn check-results-window [tournament-id]
   (fn [& _]
     (->
-      (ui/dialog
+      (swing/dialog
         :type :info
         :content (clojure.string/join \newline (cons "Seuraavien pöytien tulos puuttuu:" (watcher/get-missing-results tournament-id))))
-      ui/pack!
-      ui/show!)))
+      swing/pack!
+      swing/show!)))

 (defn create-tab [tournament-id]
-  (let [pairings-combo (ui/combobox :model []
+  (let [pairings-combo (swing/combobox :model []
                                     :id (pairings-combo-id tournament-id))
-        results-combo (ui/combobox :model []
+        results-combo (swing/combobox :model []
                                    :id (results-combo-id tournament-id))
-        info (ui/label "")
-        info! (fn [& args] (ui/text! info (apply str args)))
+        info (swing/label "")
+        info! (fn [& args] (swing/text! info (apply str args)))
         tab (mig/mig-panel :constraints ["fill, wrap 3"
                                          "[100!][100!][200!]"
                                          ""]
                            :id (tab-id tournament-id)
-                           :items [[(ui/label "Turnaus")]
-                                   [(ui/label "")]
-                                   [(ui/button :text "Lähetä"
-                                               :listen [:action (upload uploader/upload-tournament! (info! "Turnaus lähetetty") tournament-id)]
-                                               :id (tournament-button-id tournament-id)
-                                               :enabled? false)]
-
-                                   [(ui/label "Tiimit")]
-                                   [(ui/label "")]
-                                   [(ui/button :text "Lähetä"
-                                               :listen [:action (upload uploader/upload-teams! (info! "Tiimit lähetetty") tournament-id)]
-                                               :id (teams-button-id tournament-id)
-                                               :enabled? false)]
-
-                                   [(ui/label "Seatingit")]
-                                   [(ui/label "")]
-                                   [(ui/button :text "Lähetä"
-                                               :listen [:action (upload uploader/upload-seatings! (info! "Seatingit lähetetty") tournament-id)]
-                                               :id (seatings-button-id tournament-id)
-                                               :enabled? false)]
-
-                                   [(ui/label "Pairingit")]
+                           :items [[(swing/label "Turnaus")]
+                                   [(swing/label "")]
+                                   [(swing/button :text "Lähetä"
+                                                  :listen [:action (upload uploader/upload-tournament! (info! "Turnaus lähetetty") tournament-id)]
+                                                  :id (tournament-button-id tournament-id)
+                                                  :enabled? false)]
+
+                                   [(swing/label "Tiimit")]
+                                   [(swing/label "")]
+                                   [(swing/button :text "Lähetä"
+                                                  :listen [:action (upload uploader/upload-teams! (info! "Tiimit lähetetty") tournament-id)]
+                                                  :id (teams-button-id tournament-id)
+                                                  :enabled? false)]
+
+                                   [(swing/label "Seatingit")]
+                                   [(swing/label "")]
+                                   [(swing/button :text "Lähetä"
+                                                  :listen [:action (upload uploader/upload-seatings! (info! "Seatingit lähetetty") tournament-id)]
+                                                  :id (seatings-button-id tournament-id)
+                                                  :enabled? false)]
+
+                                   [(swing/label "Pairingit")]
                                    [pairings-combo]
-                                   [(ui/button :text "Lähetä"
-                                               :listen [:action (upload uploader/upload-pairings!
-                                                                        (info! "Pairingit " (ui/selection pairings-combo) " lähetetty")
-                                                                        tournament-id
-                                                                        (ui/selection pairings-combo))]
-                                               :id (pairings-button-id tournament-id)
-                                               :enabled? false)]
-
-                                   [(ui/label "Tulokset")]
+                                   [(swing/button :text "Lähetä"
+                                                  :listen [:action (upload uploader/upload-pairings!
+                                                                           (info! "Pairingit " (swing/selection pairings-combo) " lähetetty")
+                                                                           tournament-id
+                                                                           (swing/selection pairings-combo))]
+                                                  :id (pairings-button-id tournament-id)
+                                                  :enabled? false)]
+
+                                   [(swing/label "Tulokset")]
                                    [results-combo]
-                                   [(ui/vertical-panel :items [(ui/button :text "Lähetä"
-                                                                          :listen [:action (upload uploader/upload-results!
-                                                                                (info! "Tulokset " (ui/selection pairings-combo) " lähetetty")
-                                                                                tournament-id
-                                                                                (ui/selection results-combo))]
-                                                                          :id (results-button-id tournament-id)
-                                                                          :enabled? false)
-                                                               (ui/button :text "Julkaise"
-                                                                          :listen [:action (upload uploader/publish-results!
-                                                                                (info! "Tulokset " (ui/selection pairings-combo) " julkaistu")
-                                                                                tournament-id
-                                                                                (ui/selection results-combo))]
-                                                                          :id (publish-button-id tournament-id)
-                                                                          :enabled? false)
-                                                               (ui/button :text "Tarkista"
-                                                                          :listen [:action (check-results-window tournament-id)]
-                                                                          :id (check-button-id tournament-id)
-                                                                          :enabled? false)])]
-
-                                   [(ui/label "Resetoi")]
-                                   [(ui/label "")]
-                                   [(ui/button :text "Resetoi"
-                                               :listen [:action (upload uploader/reset-tournament! (info! "Turnaus resetoitu") tournament-id)]
-                                               :id (reset-button-id tournament-id)
-                                               :enabled? false)]
+                                   [(swing/vertical-panel :items [(swing/button :text "Lähetä"
+                                                                                :listen [:action (upload uploader/upload-results!
+                                                                                (info! "Tulokset " (swing/selection pairings-combo) " lähetetty")
+                                                                                tournament-id
+                                                                                (swing/selection results-combo))]
+                                                                                :id (results-button-id tournament-id)
+                                                                                :enabled? false)
+                                                                  (swing/button :text "Julkaise"
+                                                                                :listen [:action (upload uploader/publish-results!
+                                                                                (info! "Tulokset " (swing/selection pairings-combo) " julkaistu")
+                                                                                tournament-id
+                                                                                (swing/selection results-combo))]
+                                                                                :id (publish-button-id tournament-id)
+                                                                                :enabled? false)
+                                                                  (swing/button :text "Tarkista"
+                                                                                :listen [:action (check-results-window tournament-id)]
+                                                                                :id (check-button-id tournament-id)
+                                                                                :enabled? false)])]
+
+                                   [(swing/label "Resetoi")]
+                                   [(swing/label "")]
+                                   [(swing/button :text "Resetoi"
+                                                  :listen [:action (upload uploader/reset-tournament! (info! "Turnaus resetoitu") tournament-id)]
+                                                  :id (reset-button-id tournament-id)
+                                                  :enabled? false)]

                                    [info "span 3"]])]
     (disable-buttons tournament-id)
@@ -223,7 +223,7 @@
   (let [name (:name (watcher/get-tournament tournament-id))]
     (if track?
       (.addTab tabbed-pane name (create-tab tournament-id))
-      (let [tab (ui/select (ui/to-root tabbed-pane) [(id->selector (tab-id tournament-id))])]
+      (let [tab (swing/select (swing/to-root tabbed-pane) [(id->selector (tab-id tournament-id))])]
         (.remove tabbed-pane tab)))))

 (defn tournament-table-model [tournaments]
@@ -270,8 +270,8 @@
         row-sorter (doto (TableRowSorter. table-model)
                      (.setComparator 1 local-date-comparator)
                      (.setSortable 2 false))]
-    (doto (ui/table :model table-model
-                    :show-vertical-lines? false)
+    (doto (swing/table :model table-model
+                       :show-vertical-lines? false)
       (.setRowSorter row-sorter)
       (set-column-width 0 230)
       (set-column-width 1 100)
@@ -304,38 +304,38 @@
   (enable-buttons id))

 (def about-window
-  (ui/frame
+  (swing/frame
     :on-close :dispose
     :title "About MTG pairings"
     :size [100 :by 100]
-    :content (ui/border-panel
+    :content (swing/border-panel
                :vgap 5
                :hgap 5
                :border ""
                :north "This is the WER database sniffer and result uploader"
-               :south (ui/button :text "Close" :listen [:action (fn [event] (-> about-window ui/hide!))]))))
+               :south (swing/button :text "Close" :listen [:action (fn [event] (-> about-window swing/hide!))]))))

 (defn about-handler [event]
-  (-> about-window ui/pack! ui/show!))
+  (-> about-window swing/pack! swing/show!))

 (defn exit-handler [event]
   (System/exit 0))

 (defn apikey-window []
-  (ui/dialog
+  (swing/dialog
     :option-type :ok-cancel
     :title "API key"
     :size [300 :by 100]
-    :content (ui/text :id :key
+    :content (swing/text :id :key
                       :text (property :api-key))
-    :success-fn (fn [p] (let [value (ui/text (ui/select (ui/to-root p) [:#key]))]
+    :success-fn (fn [p] (let [value (swing/text (swing/select (swing/to-root p) [:#key]))]
                           (set-property! :api-key value)))))

 (defn apikey-handler [& args]
-  (-> (apikey-window) ui/pack! ui/show!))
+  (-> (apikey-window) swing/pack! swing/show!))

 (defn new-version-window []
-  (ui/dialog
+  (swing/dialog
     :type :warning
     :content "Pairings-ohjelmasta on uusi versio. Lataa uusi versio painamalla OK."
     :success-fn (fn [p]
@@ -343,28 +343,28 @@
                   (System/exit 0))))

 (defn new-version-handler []
-  (-> (new-version-window) ui/pack! ui/show!))
+  (-> (new-version-window) swing/pack! swing/show!))

 (defn get-version-from-server []
   (let [url (str (-> @state :properties :url) "/version")]
     (-> @(http/get url) :body slurp edn/read-string :client)))

-(def about-action (ui/menu-item :text "About" :listen [:action about-handler]))
-
-(def apikey-action (ui/menu-item :text "API key..." :listen [:action apikey-handler]))
-
-(def exit-action (ui/menu-item :text "Sulje" :listen [:action exit-handler]))
-
-(def tabbed-pane (ui/tabbed-panel :tabs [{:title "Turnaukset"
-                                          :content (ui/scrollable tournament-table)}]))
+(def about-action (swing/menu-item :text "About" :listen [:action about-handler]))
+
+(def apikey-action (swing/menu-item :text "API key..." :listen [:action apikey-handler]))
+
+(def exit-action (swing/menu-item :text "Sulje" :listen [:action exit-handler]))
+
+(def tabbed-pane (swing/tabbed-panel :tabs [{:title "Turnaukset"
+                                          :content (swing/scrollable tournament-table)}]))

 (def main-window
-  (ui/frame
+  (swing/frame
     :on-close :exit
     :title "MtgSuomi Pairings"
     :size [300 :by 300]
-    :menubar (ui/menubar :items
-               [(ui/menu :text "Asetukset" :items [apikey-action exit-action])])
+    :menubar (swing/menubar :items
+               [(swing/menu :text "Asetukset" :items [apikey-action exit-action])])
     :content (mig/mig-panel
                :constraints ["fill, wrap 1"
                              "[500!]"
@@ -382,7 +382,7 @@
                                      default-properties)))
   (watcher/stop!)
   (watcher/load-state! "wer.edn")
-  (-> main-window ui/pack! ui/show!)
+  (-> main-window swing/pack! swing/show!)
   (let [tournaments (watcher/get-tournaments)]
     (update-tournaments! tournaments)
     (doseq [tournament tournaments


Improve error messages when "unknown monad command in bind".

--- src/active/clojure/monad.cljc
+++ src/active/clojure/monad.cljc
@@ -318,7 +318,7 @@

 (defn run-no-commands
   "For use in [[make-monad-command-config]] when there are no commands."
-  [run-any env state m]
+  [_run-any _env _state _m]
   unknown-command)

 (defn combine-monad-command-configs
@@ -355,11 +355,11 @@
         unknown-command (fn [bind m]
                           (if-let [{line :line column :column statement :statement} (meta bind)]
                             (c/assertion-violation `run-free-reader-state-exception
-                                                   (str "unknown monad command in bind, line " line ", column " column)
+                                                   (str "unknown monad command in bind, line " line ", column " column ": " m)
                                                    bind m
                                                    statement)
                             (c/assertion-violation `run-free-reader-state-exception
-                                                   "unknown monad command in bind"
+                                                   (str "unknown monad command in bind: " m)
                                                    bind m)))]
     (letfn [(run [env state m]
               (cond
@@ -448,14 +448,15 @@
   "
   [^MonadCommandConfig command-config m & [state]]
   (let [res (run-free-reader-state-exception command-config m state)
-        [r state] res]
+        [r _state] res]
     (if (exception-value? r)
-      (throw (exception-value-exception r)))
-    res))
+      (throw (exception-value-exception r))
+      res)))

 (defn run-monadic-swiss-army
   "Run a monadic computation in an almighty monad.  Same as
-  [[`run-free-reader-state-exception`]] with the addition of `call-cc`.
+  [[`run-free-reader-state-exception`]] with the addition of `call-cc`
+  and `pause`.

   - `command-config` is the configuration object for running commands
   - `m` is the computation to run
@@ -473,12 +474,12 @@
                      state)
         unknown-command (fn [bind m]
                           (if-let [{line :line column :column statement :statement} (meta bind)]
-                            (c/assertion-violation `run-free-reader-state-exception
-                                                   (str "unknown monad command in bind, line " line ", column " column)
+                            (c/assertion-violation `run-monadic-swiss-army
+                                                   (str "unknown monad command in bind, line " line ", column " column ": " m)
                                                    bind m
                                                    statement)
-                            (c/assertion-violation `run-free-reader-state-exception
-                                                   "unknown monad command in bind"
+                            (c/assertion-violation `run-monadic-swiss-army
+                                                   (str "unknown monad command in bind: " m)
                                                    bind m)))]
     (letfn [(run [env state m]
               (cond
@@ -579,10 +580,10 @@
   "
   [^MonadCommandConfig command-config m & [state]]
   (let [res (run-monadic-swiss-army command-config m state)
-        [r state] res]
+        [r _state] res]
     (if (exception-value? r)
-      (throw (exception-value-exception r)))
-      res))
+      (throw (exception-value-exception r))
+      res)))

 (defn reify-as
   "Adds `reification` meta data to `m` that helps utilities (like the


Handle ending even if no assigners are being run.

Necessary because of the addition of fades.

--- src/afterglow/effects/fun.clj
+++ src/afterglow/effects/fun.clj
@@ -351,13 +351,6 @@
                            color-cycle)
           f (fn [show snapshot target previous-assignment]
               (pspy :color-cycle-chase-effect
-                    ;; Is it time to grab the next color?
-                    (when (not= (color-index-function snapshot) @current-index)
-                      (reset! current-index (color-index-function snapshot))
-                      (reset! previous-color @current-color)
-                      (reset! current-color
-                              (params/resolve-param (nth (cycle color-cycle) (dec @current-index))
-                                                    show snapshot)))
                     ;; Determine whether this head is covered by the current state of the transition
                     (let [transition-progress (transition-phase-function snapshot)]
                       (cond
@@ -369,6 +362,13 @@
           assigners (fx/build-head-assigners :color heads f)]
       (Effect. effect-name
                (fn [show snapshot]  ;; Continue running until the next color would appear
+                 ;; Is it time to grab the next color?
+                 (when (not= (color-index-function snapshot) @current-index)
+                   (reset! current-index (color-index-function snapshot))
+                   (reset! previous-color @current-color)
+                   (reset! current-color
+                           (params/resolve-param (nth (cycle color-cycle) (dec @current-index))
+                                                 show snapshot)))
                  (or (nil? @ending) (= @current-index @ending)))
                (fn [show snapshot] assigners)
                (fn [snow snapshot]  ;; Arrange to shut down when the next color starts to appear


changed pred from frequentare to attend

changed pred from frequentare to attend

--- src/babel/english/lexicon.clj
+++ src/babel/english/lexicon.clj
@@ -61,7 +61,7 @@
                       :sem {:pred :assure}}}

    "attend" {:synsem {:cat :verb
-                      :sem {:pred :frequentare}}}
+                      :sem {:pred :attend}}}

    "avoid" {:synsem {:cat :verb
                      :sem {:pred :avoid}}}


added empezar

added empezar

--- src/babel/espanol/lexicon.clj
+++ src/babel/espanol/lexicon.clj
@@ -207,6 +207,11 @@
                    :gender :fem
                    :pred :loro}
              :subcat '()}}
+
+    "empezar" {:italiano {:boot-stem1 "empiez"
+                        :boot-stem2 "empez"}
+             :synsem {:cat :verb
+                      :sem {:pred :begin}}}

    "enseñar" [{:synsem {:cat :verb
                         :sem {:pred :show}}}


Remove duplicate `load-shape` snippet.

Remove duplicate `load-shape` snippet.

--- src/cljc/quil/snippets/shape/loading_and_displaying.cljc
+++ src/cljc/quil/snippets/shape/loading_and_displaying.cljc
@@ -5,18 +5,8 @@
   #?(:cljs
      (:use-macros [quil.snippets.macro :only [defsnippet]])))

-(defsnippet load-shape
-  "load-shape"
-  {:renderer :p3d
-   :setup (let [sh #?(:clj (q/load-shape "https://upload.wikimedia.org/wikipedia/en/2/22/Heckert_GNU_white.svg")
-                      :cljs (q/load-shape "octahedron.obj"))]
-            (q/set-state! :shp sh))}
-
-  (let [sh (q/state :shp)]
-    (q/shape sh)))
-
 (defsnippet shape
-  "shape"
+  ["shape" "load-shape"]
   {:renderer :p3d
    :setup (let [sh #?(:clj (q/load-shape "https://upload.wikimedia.org/wikipedia/en/2/22/Heckert_GNU_white.svg")
                       :cljs (q/load-shape "octahedron.obj"))]


clean code

clean code

Signed-off-by: Yen-Chin Lee <082d453d72dce940e12089a4ad48b97cfe1f3ec4@gmail.com>

--- src/clj/brains_brain/core.clj
+++ src/clj/brains_brain/core.clj
@@ -21,63 +21,22 @@
         (* (- cell-size 1)
            (- board-size cell-size)))))

-(println (str "size: " size))
+;; We can use clojure's `make-array' create 2d array, but we do our own here
+;; and convert to array object
+(defn make-array
+  "Create 2d-array object."
+  ([width height] (make-array width height 0))
+  ([width height init-val]
+   (to-array-2d
+    (partition width (repeat (* width height) init-val)))))

-(vec (repeat 9 0))
-
-(def a (vec (replicate 8 (vec (replicate 8 :off)))))
-
-(nth (nth a 1 ) 1)
-
-;; We can use clojure's `make-array' create 2d array, but we do our own here
-(defn make-array
-  [width height init-val]
-  (vec
-   (map vec
-       (partition width (repeat (* width height) init-val)))))
-
-(defn array-get
-  [arr i j]
-  (nth (nth arr i) j))
-
-(def a (make-array 8 4 :off))
-
-(def a (make-array 8 8 :off))
-
-(map vec a)
-(assoc [0 1 2] 1 5)
-
-(assoc (seq (nth a 3)) 2 2)
-
-(var-set '(1 2 3) 1 )
-
-(assoc a 0 (assoc (nth a 1) 0 1))
-
-(array-get a 1 1)
-
-(defn arr-set
-  [arr i j val]
-  (nth arr i)
-  )
-
-(for [y (range 8) x (range 8)] :off );; {:x x :y y})
-;;(partition  8 (for [y (range 8) x (range 8)] {:x x :y y}))
-(nth (partition 5 (repeat 25 0)) 1 )
-
-
-(nth (nth a 0) 1)
-
-(assoc a)
-
-(arr-get a 1 1)
-
-;; TODO: this function need a little modify to run on cljs
 (defn make-board
+  "Create board with random initial value"
   []
-  (let [board (make-array Integer/TYPE board-size board-size)]
+  (let [board (make-array board-size board-size)]
     (doseq [x (range 0 board-size)
             y (range 0 board-size)]
-      (aset-int board x y (if (< (rand-int 100) 50) 0 1)))
+      (aset board x y (if (< (rand-int 100) 50) :off :on)))
     board))

 (def a (make-board))
@@ -91,7 +50,7 @@
     (draw g
           (rect xb yb cell-size)
           (style :background (case cell
-                               1 :red
+                               :on :red
                                :white) ; default (:off)
                  :foreground :black ; broader
                  ))))