Initial draft of robot graphic

Initial draft of robot graphic

--- src/cljs/robot_kata/core.cljs
+++ src/cljs/robot_kata/core.cljs
@@ -40,11 +40,13 @@

     (listen (sel1 :#robot-svg) MOUSEMOVE #(put! channel %))

-    (append! (sel1 :#robot-svg) [:circle {:cx 400 :cy 400 :r 30 :fill "black"}])
+    (append! (sel1 :#robot-svg)
+             [:g#robot {:transform "translate(400, 400)"}
+              [:circle {:cx 0 :cy   0 :r  35 :stroke "black" :stroke-width 2 :fill "silver"}]
+              [:circle {:cx 0 :cy -30 :r 2.5 :stroke "none"                  :fill  "black"}] ] )

     (go
      (while true
        (let [event (<! channel)]
          (js/console.log (get-color-name (get-pixel-color floor-context
                                                           (get-event-offset-position event) ))) ) ) ) ) )
-


Only pass key and ref to react if necessary

--- src/cloact/impl/template.cljs
+++ src/cloact/impl/template.cljs
@@ -132,8 +132,10 @@
         a (js-obj)]
     (set! (.-cljsArgs a) x)
     (when (map? p)
-      (set! (.-key a) (:key p))
-      (set! (.-ref a) (:ref p)))
+      (when-let [key (:key p)]
+        (set! (.-key a) key))
+      (when-let [ref (:ref p)]
+        (set! (.-ref a) ref)))
     (c a)))

 (defn map-into-array [f coll]
@@ -151,7 +153,7 @@
 (def cached-tag (memoize parse-tag))

 (defn render-wrapped [this]
-  (let [inprops (aget this "props") #_(.-props this)
+  (let [inprops (aget this "props")
         args (.-cljsArgs inprops)
         [tag scnd] args
         hasprops (or (nil? scnd) (map? scnd))
@@ -166,7 +168,7 @@
     (.apply f nil (.concat (array jsprops) jsargs))))

 (defn should-update-wrapped [C nextprops nextstate]
-  (let [a1 (-> C (aget "props") #_.-props .-cljsArgs)
+  (let [a1 (-> C (aget "props") .-cljsArgs)
         a2 (-> nextprops .-cljsArgs)]
     (not (equal-args a1 a2))))


Fix bug in IDN handling.

Fix bug in IDN handling.

--- src/clojure/inet/data/dns.clj
+++ src/clojure/inet/data/dns.clj
@@ -76,8 +76,10 @@
 typical order); and (d) every label preceded by a byte indicating the count of
 bytes in the label."
   [name] (->> name str/lower-case (#(str/split % #"\." -1)) reverse
-              (mapcat #(cons (count %) (.getBytes (IDN/toASCII %))))
-              (map sbyte) byte-array))
+              (mapcat (fn [s]
+                        (let [bytes (.getBytes (IDN/toASCII s))]
+                          (cons (sbyte (count bytes)) bytes))))
+              byte-array))

 (defn- wire->bytes
   "Convert a DNS wire form domain name into an internal normalized byte form."


Note to self

Note to self

--- src/clojure/staircase/app.clj
+++ src/clojure/staircase/app.clj
@@ -43,6 +43,7 @@
              :steps [:db]
              :histories [:db]})))))

+;; Todo - should be possible to have multiple instances.
 (def system
   (delay
     (info "Building system with settings: " env)


Force defs in globals.clj that start with prefix global- to correspond to arguments in push-argmap.

--- src/clojush/pushgp/pushgp.clj
+++ src/clojush/pushgp/pushgp.clj
@@ -128,8 +128,9 @@

 (defn reset-globals []
   (doseq [[gname gatom] (filter (fn [[a _]] (.startsWith (name a) "global-")) (ns-publics 'clojush.globals))]
-    (when (contains? @push-argmap (keyword (.substring (name gname) (count "global-"))))
-      (reset! @gatom (get @push-argmap (keyword (.substring (str gname) (count "global-"))))))))
+    (if (contains? @push-argmap (keyword (.substring (name gname) (count "global-"))))
+      (reset! @gatom (get @push-argmap (keyword (.substring (str gname) (count "global-")))))
+      (throw (Exception. (str "globals.clj definition " gname " has no matching argument in push-argmap. Only such definitions should use the prefix 'global-'."))))))

 (defn make-agents-and-rng [{:keys [initial-population use-single-thread population-size
                                    max-points-in-initial-program atom-generators random-seed


Update docstring of defsystem to new protocols. Fixes #4.

--- src/com/palletops/leaven.cljx
+++ src/com/palletops/leaven.cljx
@@ -87,11 +87,10 @@
 (defmacro ^:api defsystem
   "Macro to build a system defrecord out of `components`, a sequence
   of keywords that specify the sub-components.  The record will
-  implement ILifecycle and IStatus by calling the protocol methods on
-  each of the components.  The `start` method calls the sub-components
-  in the specified order.  The `stop` method calls the sub-components
-  in the reverse order.
-
+  implement Startable, Stoppable and Queryable by calling the protocol
+  methods on each of the components.  The `start` method calls the
+  sub-components in the specified order.  The `stop` method calls the
+  sub-components in the reverse order.
   A body can be supplied as used by defrecord, to implement extra
   protocols on the system."
   [record-name components & body]


Use a modular scale for the font sizes

Use a modular scale for the font sizes

See http://www.modularscale.com

--- src/catalog/layout/fop.clj
+++ src/catalog/layout/fop.clj
@@ -18,26 +18,22 @@
 (defn- to-mm [n]
   (format "%smm" n))

+;; 3:4 perfect fourth scale (http://www.modularscale.com/?11&pt&1.333&web&table)
 (def ^:private default-stylesheet
   {:font {:font-family "Verdana" :font-size "11pt"}
    :block {:text-align "start" :hyphenate "false"}
-   :h1 {:font-weight "bold" :keep-with-next "always" :space-after "25pt"
-        :break-before "page" :font-size "25pt" :role "H1"}
-   :h2 {:font-weight "bold" :keep-with-next "always" :space-before "25pt" :space-after "11pt"
-        :font-size "17pt" :role "H2"}
-   :h3 {:font-weight "bold" :keep-with-next "always" :space-before "14pt" :space-after "14pt"
-        :font-size "14pt" :role "H3"}
+   :h1 {:font-size "26.05pt" :font-weight "bold" :space-after "26pt" :keep-with-next "always" :break-before "page" :role "H1"}
+   :h2 {:font-size "19.55pt" :font-weight "bold" :space-after "11pt" :space-before "25pt" :keep-with-next "always" :role "H2"}
+   :h3 {:font-size "14.66pt" :font-weight "bold" :space-after "14pt" :space-before "14pt" :keep-with-next "always" :role "H3"}
    :header {:text-align-last "justify" :font-weight "bold" :border-bottom "thin solid"}})

+;; 3:4 perfect fourth scale (http://www.modularscale.com/?17&pt&1.333&web&table)
 (def ^:private large-print-stylesheet
   {:font {:font-family "Tiresias" :font-size "17pt"}
    :block {:text-align "start" :hyphenate "false"}
-   :h1 {:font-weight "bold" :keep-with-next "always" :space-after "25pt"
-        :break-before "odd-page" :font-size "36pt" :role "H1" :line-height "110%"}
-   :h2 {:font-weight "bold" :keep-with-next "always" :space-after "25pt"
-        :break-before "odd-page" :font-size "36pt" :role "H2" :line-height "110%"}
-   :h3 {:font-weight "bold" :keep-with-next "always" :space-before "30pt" :space-after "25pt"
-        :font-size "25pt" :role "H3"}
+   :h1 {:font-size "40.3pt" :font-weight "bold" :keep-with-next "always" :space-after "30pt" :role "H1" :line-height "110%" :break-before "odd-page" }
+   :h2 {:font-size "30.2pt" :font-weight "bold" :keep-with-next "always" :space-after "30pt" :role "H2" :line-height "110%"}
+   :h3 {:font-size "22.6pt" :font-weight "bold" :keep-with-next "always" :space-after "30pt" :role "H3" :line-height "110%"}
    :header {:text-align-last "justify" :font-weight "bold" :border-bottom "thin solid"}})

 (def ^:private ^:dynamic *stylesheet* default-stylesheet)


changing info all access for auditing

changing info all access for auditing

--- src/celestial/security.clj
+++ src/celestial/security.clj
@@ -34,7 +34,7 @@
   "A tiny middleware to track api access"
   (fn [{:keys [uri request-method] :as req}]
     (set-tid (gen-uuid)
-      (debug request-method " on " uri "by" (current-user))
+      (info request-method " on " uri "by" (current-user))
       (app req))))


Make the comment less ambiguous

Make the comment less ambiguous

--- src/circle/backend/ec2.clj
+++ src/circle/backend/ec2.clj
@@ -60,7 +60,7 @@
        :tries 30
        :catch [AmazonClientException java.lang.RuntimeException]
        :error-hook (fn [e#]
-                     (errorf "caught %s %s" (class e#) e#)
+                     (errorf "with-ec2-client: caught %s %s" (class e#) e#)
                      ;; We don't want to catch (many) ServiceExceptions, because they can often be programming errors.
                      (if (= (class e#) com.amazonaws.AmazonServiceException)
                        false


monkey-patch goog.require before loading core, otherwise stack overflow

--- src/clj/cljs/repl/node.clj
+++ src/clj/cljs/repl/node.clj
@@ -120,18 +120,19 @@
       ;; monkey-patch isProvided_ to avoid useless warnings - David
       (node-eval repl-env
         (str "goog.isProvided_ = function(x) { return false; };"))
-      ;; load cljs.core, setup printing
-      (repl/evaluate-form repl-env env "<cljs repl>"
-        '(do
-           (.require js/goog "cljs.core")
-           (set! *print-fn* (.-print (js/require "util")))))
       ;; monkey-patch goog.require, skip all the loaded checks
       (repl/evaluate-form repl-env env "<cljs repl>"
         '(do
            (set! (.-require js/goog)
              (fn [name]
                (js/CLOSURE_IMPORT_SCRIPT
-                 (aget (.. js/goog -dependencies_ -nameToPath) name))))))
+                 (aget (.. js/goog -dependencies_ -nameToPath) name))))
+           nil))
+      ;; load cljs.core, setup printing
+      (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 proc]


Modified all-installed to recursively search for hosted cards

--- src/clj/game/core-misc.clj
+++ src/clj/game/core-misc.clj
@@ -67,11 +67,15 @@
   but not including 'inactive hosting' like Personal Workshop."
   [state side]
   (if (= side :runner)
-    (let [installed (flatten (for [t [:program :hardware :resource]] (get-in @state [:runner :rig t])))
+    (let [top-level-cards (flatten (for [t [:program :hardware :resource]] (get-in @state [:runner :rig t])))
           hosted-on-ice (->> (:corp @state) :servers seq flatten (mapcat :ices) (mapcat :hosted))]
-      (concat installed
-              (filter :installed (mapcat :hosted installed))
-              (filter #(= (:side %) "Runner") hosted-on-ice)))
+      (concat top-level-cards
+              (filter #(= (:side %) "Runner") hosted-on-ice))
+      (loop [unchecked top-level-cards installed ()]
+        (if (empty? unchecked)
+          (filter :installed installed)
+          (let [[card & remaining] unchecked]
+            (recur (filter identity (into remaining (:hosted card))) (into installed [card]))))))
     (let [servers (->> (:corp @state) :servers seq flatten)
           content (mapcat :content servers)
           ice (mapcat :ices servers)


add timeouts to reading stdout/stderr

add timeouts to reading stdout/stderr

--- src/clj/runbld/process.clj
+++ src/clj/runbld/process.clj
@@ -1,8 +1,9 @@
 (ns runbld.process
   (:require
    [cheshire.core :as json]
-   [clojure.core.async :as async :refer [thread go go-loop chan >! <! >!! <!!
-                                         alts! alts!! close!]]
+   [clojure.core.async
+    :as async
+    :refer [go-loop chan >! <! >!! <!! alts!! close!]]
    [runbld.env :as env]
    [runbld.io :as io]
    [runbld.schema :refer :all]
@@ -53,7 +54,7 @@
     ords      :- Ref
     bytes     :- Ref
     log-extra :- {s/Any s/Any}]
-   (thread
+   (async/thread
      (doseq [line (line-seq (io/reader is))]
        (let [log (dosync
                   (inc-ordinals ords label)
@@ -240,11 +241,13 @@
         listeners [file-ch es-ch stdout-ch stderr-ch]
         result (exec program args scriptfile cwd
                      env listeners log-extra timeout)
-        listeners-done (doall
-                        (map <!! [file-process
-                                  es-process
-                                  stdout-process
-                                  stderr-process]))
+        ;; The process has exited, flush the channels
+        _ (doall (map <!!
+                      [file-process es-process]))
+        ;; stdout and stderr channels might hang on bad input.
+        ;; Waiting indefinitely is a bad idea
+        _ (doall (map #(alts!! [% (async/timeout (* 1000 60 5))])
+                      [stderr-process stdout-process]))
         out-bytes (@(:bytes result) :stdout)
         err-bytes (@(:bytes result) :stderr)
         total-bytes (@(:bytes result) :total)]


cleanup

cleanup

--- src/clj/scrabble/logic.clj
+++ src/clj/scrabble/logic.clj
@@ -1,6 +1,5 @@
 (ns scrabble.logic
   (:require [clojure.core.logic :as l]
-            [clojure.core.unify :as u]
             [clojure.core.logic.arithmetic :as la]
             [clojure.core.logic.fd :as fd]
             [clojure.math.combinatorics :as combo]))


Added new examples: pie charts with titles and subtitles

--- src/clj_flotr/examples.clj
+++ src/clj_flotr/examples.clj
@@ -64,6 +64,21 @@
                                  :legend-position "sw"
                                  :legend-background "#FFFFFF")]
                     ] ; </tr>
+                    [:tr
+                        [:td (generator/pie-chart "chart9" "300px" "300px" data
+                                 :title "Chart title")]
+                        [:td (generator/pie-chart "chart10" "300px" "300px" data
+                                 :subtitle "Chart subtitle")]
+                        [:td (generator/pie-chart "chart11" "300px" "300px" data
+                                 :title "Chart title"
+                                 :subtitle "Chart subtitle")]
+                        [:td (generator/pie-chart "chart12" "300px" "300px" data
+                                 :show-legend true
+                                 :legend-position "sw"
+                                 :legend-background "#FFFFFF"
+                                 :title "Chart title"
+                                 :subtitle "Chart subtitle")]
+                    ] ; </tr>
                 ] ; </table>
                 [:h1 "done"]]))))


Simple but coupled adding of items

Simple but coupled adding of items

--- src/cljs/conedit/main.cljs
+++ src/cljs/conedit/main.cljs
@@ -0,0 +1,66 @@
+(ns conedit.main
+  (:require [goog.dom :as gdom]
+            [om.next :as om :refer-macros [defui]]
+            [om.dom :as dom]))
+
+
+(def app-state
+  (atom {
+         :resources
+         [{:name "pivnet-master"}
+          {:name "pivnet-develop"}
+          ]}))
+
+(declare reconciler)
+
+
+(defui ResourceItem
+  Object
+  (render [this]
+    (dom/li nil (:name (om/props this)))))
+
+(def resource-item (om/factory ResourceItem {:keyfn :name}))
+
+(defui ResourceList
+  Object
+  (render [this]
+    (dom/ul nil
+      (map resource-item (om/props this))
+      (dom/button
+        #js {:onClick #(om/transact! reconciler '[(add-resource)])}
+        "Add"))))
+
+(def resource-list (om/factory ResourceList))
+
+(defui App
+  static om/IQuery
+  (query [this]
+    [:resources])
+  Object
+  (render [this]
+    (dom/div nil (resource-list (:resources (om/props this))))))
+
+; env is more than just the app-atom
+(defn read [{:keys [state] :as env} key params]
+  (let [data @state]
+    (if-let [[_ resources] (find data key)]
+      {:value resources}
+      {:value :not-found})))
+
+(defn mutate [{:keys [state] :as env} key params]
+  {:action #(swap! state update-in [:resources] conj {:name "New!"})}
+  )
+
+(def reconciler
+  (om/reconciler {:state  app-state
+                  :parser (om/parser {:read read :mutate mutate})}))
+
+(om/add-root! reconciler
+  App (gdom/getElement "app"))
+
+
+(comment
+
+  (swap! app-state update-in [:resources] conj {:name "pivnet-lrb"})
+
+  )


fix regression with type members finding parent types (using strings)

--- src/cljs_api_gen/parse.clj
+++ src/cljs_api_gen/parse.clj
@@ -576,7 +576,7 @@
              (= 'set! (first form))
              (list? (second form))
              (= ".-" (subs (name (first (second form))) 0 2))
-             (type-names (second (second form))))
+             (type-names (str (second (second form)))))
     (let [[_set! [attr parent-type :as attr-form] value] form
           name- (str parent-type "." (subs (name attr) 2))
           type- (if (and (list? value) (= 'fn (first value)))
@@ -622,7 +622,7 @@
         lib-parsed (parse-ns* ns- "clojurescript" [:library])
         type-names (->> lib-parsed
                         (filter #(= "type" (:type %)))
-                        (map :name)
+                        (map (comp str :name))
                         set)]
     (concat (parse-extra-macros-from-clj)
             com-parsed


fix sub-options-ns lookup

fix sub-options-ns lookup

--- src/cljs_api_gen/parse.clj
+++ src/cljs_api_gen/parse.clj
@@ -938,7 +938,7 @@
   {:name (name id)
    :ns *cur-ns*
    :type "option"
-   :sub-options-ns (sub-options-ns (name id))})
+   :sub-options-ns (sub-options-ns (str *cur-ns* "/" (name id)))})

 (defn option-present?
   [[id {:keys [added]}]]


Refine filter functions

Refine filter functions

--- src/clojournal/handler.clj
+++ src/clojournal/handler.clj
@@ -24,10 +24,13 @@

 ;; Selmer filters
 (defn remove-all-tags [x]
-  (str/replace x #"<[^>]+?>" ""))
+  (str/replace x #"<[^>]+?>" (fn [[_ tag name]] (if (= name "br") tag ""))))

 (defn shorten-content [x n]
-  (subs x 0 (min (count x) (Long/parseLong n))))
+  (let [n (if (instance? String n)
+            (Long/parseLong n)
+            n)]
+    (subs x 0 (min (count x) n))))

 (defn init
   "init will be called once when


Further refinements for dev usability.

Further refinements for dev usability.

--- src/dragon/data/page.clj
+++ src/dragon/data/page.clj
@@ -51,18 +51,20 @@
   ([]
     (base {}))
   ([opts]
-    {:page-data {
-       :base-path "/blog"
-       :site-title (:site-title opts)
-       :site-description (:site-description opts)
-       :index "index"
-       :about "about"
-       :community "community"
-       :archives "archives"
-       :categories "categories"
-       :tags "tags"
-       :authors "authors"
-       :active (:category-key opts)}}))
+    (merge
+      {:page-data {
+         :base-path "/blog"
+         :site-title (:site-title opts)
+         :site-description (:site-description opts)
+         :index "index"
+         :about "about"
+         :community "community"
+         :archives "archives"
+         :categories "categories"
+         :tags "tags"
+         :authors "authors"
+         :active (:category-key opts)}}
+      opts)))

 (defn default-content-opts
   []
@@ -74,16 +76,28 @@
    :content-fn (constantly nil)})

 (defn default-data-content-opts
-  []
-  (assoc (default-content-opts) :content-fn identity))
+  ([]
+    (default-data-content-opts {}))
+  ([opts]
+    (merge (default-content-opts)
+           {:content-fn identity}
+           opts)))

 (defn default-resource-content-opts
-  []
-  (assoc (default-content-opts) :content-fn resource-content))
+  ([]
+    (default-resource-content-opts {}))
+  ([opts]
+    (merge (default-content-opts)
+           {:content-fn resource-content}
+           opts)))

 (defn default-markdown-content-opts
-  []
-  (assoc (default-content-opts) :content-fn markdown-content))
+  ([]
+    (default-markdown-content-opts {}))
+  ([opts]
+    (merge (default-content-opts)
+           {:content-fn markdown-content}
+           opts)))

 (defn common
   [posts additional-opts]
@@ -95,7 +109,7 @@
         (base-data-fn)
         (assoc-in [:page-data :active] (name (:category-key opts)))
         (dissoc :title :subtitle)
-        (assoc :posts-data posts
+        (assoc :posts-data (or (:posts-data opts) posts)
                :posts-stats (posts-stats posts)
                :content {
                  :title (:title opts)


Fix namespace in grade-school/example.clj

--- grade-school/example.clj
+++ grade-school/example.clj
@@ -1,4 +1,4 @@
-(ns school)
+(ns grade-school)

 (defn grade
   "show the roster for a specific grade"


Update lispychat.clj

Update lispychat.clj

--- src/extras/lispychat.clj
+++ src/extras/lispychat.clj
@@ -47,6 +47,7 @@

 (defn chat-init [ch])
+
 (defn chat-handler [ch room]
   "Relays messages into a chat room. If it doesn't
   exist create a new channel"


Made c.c.gui/gui to return frame

Made c.c.gui/gui to return frame

and deleted debug-gui

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

--- src/conexp/contrib/gui.clj
+++ src/conexp/contrib/gui.clj
@@ -16,28 +16,17 @@

 ;;;

-
 (defn gui
   "Starts the standard gui for conexp-clj. args may be a sequence of
   parameters given by keywords and values."
   [& args]
-  (do-swing
-   (. UIManager (setLookAndFeel (. UIManager (getSystemLookAndFeelClassName))))
-   (let [#^JFrame frame (apply conexp-main-frame args)]
-     (.setVisible frame true))))
-
-(defn debug-gui
-  "Starts the standard gui for conexp-clj. args may be a sequence of
-  parameters given by keywords and values. Returns frame"
-  [& args]
   (let [frm (promise)]
     (do-swing
-      (. UIManager (setLookAndFeel (. UIManager
-                                     (getSystemLookAndFeelClassName))))
-      (let [#^JFrame frame (apply conexp-main-frame args)]
-        (.setVisible frame true)
-        (deliver frm frame)))
-    (deref frm)))
+     (. UIManager (setLookAndFeel (. UIManager (getSystemLookAndFeelClassName))))
+     (let [#^JFrame frame (apply conexp-main-frame args)]
+       (.setVisible frame true)
+       (deliver frm frame)))
+    @frm))

 ;;;


show executed date

show executed date

--- src/deathrow/core.cljs
+++ src/deathrow/core.cljs
@@ -20,6 +20,7 @@
     :lastStmt " Aguilar, Jesus Ledesma\n Last Statement:\n Yes sir.  I would like to say to my family, I am alright. (Spanish) Where are you Leo; are you there Leo? (Spanish) Don't lie man.  Be happy.  Are you happy?  Are you all happy? (Spanish)  "
   })

+
 (defpartial lastQuote
 	[offender]
 	[:blockquote
@@ -27,13 +28,15 @@
 		[:footer
 			[:cite {:title (str (.-firstName offender) " " (.-lastName offender))}
 				[:a {:href (.-profileUrl offender)} (str (.-firstName offender) " " (.-lastName offender))]]
-				", executed 05/24/2006"]])
+				(str ", executed " (.-dateExecuted offender))]])
+

 (defn render-quote
 	[offender]
 	(-> ($ js/document)
 		(jayq/find ".col-md-8.well")
 		(.append (lastQuote offender))))
+

 (defn fetch-random-offender
 	[]
@@ -42,9 +45,9 @@
 	                 :success  (fn [data] (render-quote data))}))

-
 (defn init
 	[]
 	(jayq/document-ready fetch-random-offender))

 (init)
+


Check field has search expression using helper function

--- src/hatti/ona/forms.cljs
+++ src/hatti/ona/forms.cljs
@@ -6,7 +6,8 @@
             [clojure.string :as string]
             [hatti.constants :refer [_submission_time
                                      _submitted_by
-                                     _last_edited]]))
+                                     _last_edited]]
+            [hatti.utils.helpers :refer [uses-search-expression?]]))

 ;; CONSTANTS
 (def currency-regex #"£|$")
@@ -217,13 +218,10 @@
                           (or formatted answer))
     (select-all? field) (let [names (set (string/split answer #" "))
                               appearance-value (-> field :control :appearance)
-                              uses-search-expression?
-                              (and (string? appearance-value)
-                                   (re-matches
-                                    #"^search\(.*\)$"
-                                    appearance-value))
+                              has-search-expression? (uses-search-expression?
+                                                       appearance-value)
                               multiple-select-values
-                              (if uses-search-expression?
+                              (if has-search-expression?
                                 (map #(identity {:name %}) names)
                                 (->> (:children field)
                                      (filter


Simple formatting changes

Simple formatting changes

--- src/hphelper/handler.clj
+++ src/hphelper/handler.clj
@@ -138,8 +138,12 @@
   (GET "/api/player/:gameUuid/:userUuid/updates/:lastUpdated/"
        {{gameUuid :gameUuid userUuid :userUuid lastUpdated :lastUpdated} :params}
        (json/write-str (lapi/get-updated-player gameUuid (parse-long lastUpdated))))
-  (GET "/api/player/:gameUuid/:userUuid/charsheet/" {{gameUuid :gameUuid userUuid :userUuid} :params} (json/write-str (lapi/get-player-character-sheet gameUuid userUuid)))
-  (GET "/api/player/:gameUuid/:userUuid/societymissions/" {{gameUuid :gameUuid userUuid :userUuid} :params} (json/write-str (lapi/get-player-society-missions gameUuid userUuid)))
+  (GET "/api/player/:gameUuid/:userUuid/charsheet/"
+       {{gameUuid :gameUuid userUuid :userUuid} :params}
+       (json/write-str (lapi/get-player-character-sheet gameUuid userUuid)))
+  (GET "/api/player/:gameUuid/:userUuid/societymissions/"
+       {{gameUuid :gameUuid userUuid :userUuid} :params}
+       (json/write-str (lapi/get-player-society-missions gameUuid userUuid)))

   ;; Admin endpoints
   (GET "/api/admin/:gameUuid/:userUuid/debug/"


Player page auto-refreshes each 5 seconds

--- src/hphelper/live/view.clj
+++ src/hphelper/live/view.clj
@@ -61,6 +61,7 @@
     (html [:html
            [:head
             [:title "Sector indicies"]
+            [:meta {:http-equiv "refresh" :content 5}]
             ]
            [:body
             [:div


add frequencies

add frequencies

--- src/ghadi/reducers.clj
+++ src/ghadi/reducers.clj
@@ -160,3 +160,12 @@
   [xfn iterable]
   (XFIterable. xfn iterable))

+(defn frequencies
+  "Like core/frequencies but takes a transducer"
+  [xfn coll]
+  (let [rf (fn
+             ([counts]
+                (persistent! counts))
+             ([counts x]
+                (assoc! counts x (inc (get counts x 0)))))]
+    (transduce xfn rf (transient {}) coll)))


refactor compilation

refactor compilation

--- src/kondolisp/compiler.clj
+++ src/kondolisp/compiler.clj
@@ -32,8 +32,10 @@
        ;; lisp namespace operation
        (:VM_BIND lispval-symbol)	;; bind stack-top value to symbol(operand)
        (:VM_UNBIND integer) ;; unbind symbol(operand)
-       (:VM_VREF lispval-symbol)	  ;; refer value of symbol(operand)
-       (:VM_VSET lispval-symbol)	  ;; overwrite symbol(operand) by %val
+       (:VM_VREF lispval-symbol)	;; refer value of symbol(operand)
+       (:VM_VSET lispval-symbol)	;; overwrite symbol(operand) by %val
+       (:VM_VINC lispval-symbol)	;; increment value of symbol(operand)
+       (:VM_VDEC lispval-symbol)	;; increment value of symbol(operand)

        ;; basic arithmetic operation
        (:VM_LT nil)	;; (< <%val> <stack-top>)
@@ -270,6 +272,54 @@
 	     (map compile-pass1 body))
     (:VM_UNBIND ~(count bindings))))

+(defn compile-cond [clauses]
+  (match clauses
+    ()
+    `((:VM_IVAL ~(make-nil)))
+    ;;
+    (clause & clauses)
+    (let [end-label (gensym),
+          clauses-insts
+          (apply concat
+                 (map (fn [clause]
+                        (let [pred (first clause)
+                              body (rest clause)
+                              next-clause-label (gensym)]
+                          `(~@(compile-pass1 pred)
+                            (:VM_BIFN ~next-clause-label)
+                            ~@(apply concat
+                                     (map compile-pass1 body))
+                            (:VM_JMP ~end-label)
+                            ~next-clause-label)))
+                      (cons clause clauses)))]
+      `(~@clauses-insts
+        ~end-label))))
+
+(defn compile-dotimes [var num body]
+  (let [end-label (gensym),
+        retry-label (gensym)]
+    `((:VM_IVAL ~(make-num 0))
+      (:VM_BIND ~(make-sym var))
+      ~retry-label
+      ~@(apply concat (map compile-pass1 body))
+      (:VM_PUSH)
+      ;; (:VM_VREF ~(make-sym var))
+      ;; (:VM_PUSH)
+      ;; (:VM_IVAL ~(make-num 1))
+      ;; (:VM_PLUS)
+      ;; (:VM_VSET ~(make-sym var))
+      ;; (:VM_VREF ~(make-sym var))
+      (:VM_VINC ~(make-sym var))
+      (:VM_PUSH)
+      (:VM_IVAL ~(make-num num))
+      (:VM_LE)
+      (:VM_BIF ~end-label)
+      (:VM_POP)
+      (:VM_JMP ~retry-label)
+      ~end-label
+      (:VM_POP)
+      (:VM_UNBIND 1))))
+
 (defn builtin-fun-id [fname]
   (index (fn [pair] (= (first pair) fname))
 	 *vm-builtin-funs*))
@@ -334,26 +384,7 @@
 	       ~@(compile-pass1 else-body)
 	       ~end-label))
           ;;
-          ('cond)
-          `((:VM_IVAL ~(make-nil)))
-          ;;
-          ('cond clause & clauses)
-          (let [end-label (gensym),
-                clauses-insts
-                (apply concat
-                       (map (fn [clause]
-                              (let [pred (first clause)
-                                    body (rest clause)
-                                    next-clause-label (gensym)]
-                                `(~@(compile-pass1 pred)
-                                  (:VM_BIFN ~next-clause-label)
-                                  ~@(apply concat
-                                           (map compile-pass1 body))
-                                  (:VM_JMP ~end-label)
-                                  ~next-clause-label)))
-                            (cons clause clauses)))]
-            `(~@clauses-insts
-              ~end-label))
+          ('cond & clauses)	(compile-cond clauses)
 	  ;;
           ('and)
           `((:VM_IVAL ~(make-t)))
@@ -399,28 +430,8 @@
                                     (:VM_POP)))
 	  ;;
 	  ('dotimes (var num) & body)
-	  (let [end-label (gensym),
-		retry-label (gensym)]
-	    `((:VM_IVAL ~(make-num 0))
-	      (:VM_BIND ~(make-sym var))
-	      ~retry-label
-	      ~@(apply concat (map compile-pass1 body))
-              (:VM_PUSH)
-	      (:VM_VREF ~(make-sym var))
-	      (:VM_PUSH)
-	      (:VM_IVAL ~(make-num 1))
-	      (:VM_PLUS)
-	      (:VM_VSET ~(make-sym var))
-	      (:VM_VREF ~(make-sym var))
-	      (:VM_PUSH)
-	      (:VM_IVAL ~(make-num num))
-	      (:VM_LE)
-	      (:VM_BIF ~end-label)
-              (:VM_POP)
-	      (:VM_JMP ~retry-label)
-	      ~end-label
-              (:VM_POP)
-	      (:VM_UNBIND 1)))
+          (compile-dotimes var num body)
+
 	  ;;
 	  _	(compile-funcall (first exp) (rest exp)))
    ;;


Update core.clj

Update core.clj

--- src/iyye/bios/core.clj
+++ src/iyye/bios/core.clj
@@ -20,7 +20,7 @@
             [iyye.bios.persistence :as persistence]
             [iyye.bios.noun-words :as nouns]
             [iyye.bios.task :as task]
-            [iyye.subcon.knowledge.words :as kb]
+            [iyye.subcon.knowledge.builtins :as kb]
             [clojure.tools.logging :as log]
             [clojure.tools.cli :refer [parse-opts]]
             [clojure.string :as str]


:bug: Fixes problem when adding stroke

:bug: Fixes problem when adding stroke

--- frontend/src/app/main/ui/workspace/sidebar/options/stroke.cljs
+++ frontend/src/app/main/ui/workspace/sidebar/options/stroke.cljs
@@ -114,7 +114,8 @@
           (st/emit! (dwc/update-shapes ids #(assoc %
                                                    :stroke-style :solid
                                                    :stroke-color "#000000"
-                                                   :stroke-opacity 1))))
+                                                   :stroke-opacity 1
+                                                   :stroke-width 1))))

         on-del-stroke
         (fn [event]


adding head

adding head

--- src/lights/my_show.clj
+++ src/lights/my_show.clj
@@ -29,8 +29,18 @@
   []
   {:channels [(chan/color 1 :red)
               (chan/color 2 :green)
-              (chan/color 3 :blue)]
+              (chan/color 3 :blue)
+              (chan/color 4 :white)]
    :name "Simple RGB"})
+
+(defn head280
+  "Head PHS 280"
+  []
+  {:channels [(chan/tilt 1 :tilt)
+              (chan/pan 2 :pan)
+              (chan/functions 10 :shutter 0 "shutter-closed" 32 "shutter-open")
+              (chan/dimmer 11)]
+   :name "Head PHS 280"})

 (defn use-my-show
   "Set up the show on the OLA universes it actually needs."
@@ -50,6 +60,7 @@
                     (show/show :universes [1] :description "My Show"))))

   (show/patch-fixture! :rgb-1 (my-rgb) 1 1)
+  (show/patch-fixture! :head-1 (head280) 1 220)

   ;; Return the show's symbol, rather than the actual map, which gets huge with
   ;; all the expanded, patched fixtures in it.


removed visualizers and emac comment

removed visualizers and emac comment

--- src/functional_music/core.clj
+++ src/functional_music/core.clj
@@ -1,32 +1,17 @@
 (ns functional-music.core
-  (:requre [overtone.live :refer :all]
-           [overtone.inst.sampled-piano :refer :all]
-           [overtone.synth.stringed :refer :all]
-
-           [overtone.inst.synth :as synth]
-           [clojure.string :as s]))
-
-;; run M-x cider-jack-in to get started
-;;
-;; once started, move your cursor to the (ns ...) block above and hit
-;; C-M-x to evaluate it and boot the supercollider server.  if your
-;; sampled-piano samples are not cached, overtime will attempt to
-;; download them and cache them now. once you see the prompt update with
-;; the Overtone logo, you are good to go.
-
-
-;; use odoc() to lookup function documentation in overtone outside of
-;; this you should probably use doc() for the same purpose
-
-;; get documentation for prn
-(odoc prn)
-
-;; get documentation for synth/ping
+  (:require [overtone.live :refer :all]
+            ;; using sampled-piano instead of piano to save downloading 500MB
+            [overtone.inst.sampled-piano :refer :all]
+            [overtone.synth.stringed :refer :all]
+
+            [overtone.inst.synth :as synth]
+            [clojure.string :as s]))
+
+;; Clojure's doc func
+;(doc odoc)
+
+;; 'odoc' is from overtone, get documentation for synth/ping
 (odoc synth/ping)
-
-;; get documentation for odoc
-(odoc odoc)
-

 ;; so `synth` contains a bunch of instrument definitions that you can
 ;; use already. you can try them by calling e.g.
@@ -38,12 +23,8 @@
 ;; some of them don't
 (synth/vintage-bass)

-;; in which case, stop(), i.e. overtone.live/stop(), switches off all sounds
+;; switches off all sounds
 (stop)
-
-;; tip: C-M-x evals the expression (to the outermost surrounding
-;; expression!) that your cursor is /inside/, or /before/. To evaluate
-;; the expression that your cursor is /immdiately after/, use C-x-e

 ;; other synths to try
 (comment
@@ -57,8 +38,7 @@
   (synth/grunge-bass)
   (synth/ks1)

-  (stop)
-  )
+  (stop))

 ;; now let's play a little melody
 (let [beat-ms 250
@@ -66,11 +46,11 @@
                  :D3 :F3 :G3 :C4
                  :D4 :A3 :F3 :C3
                  :D3 :F2 :G2 :A#2]
-      num-measures (* 1 (count base-line))
-      ]
+      num-measures (* 1 (count base-line))]
   (stop)
+
+  ;; first, define a recursive note player
   (letfn [(play-it
-            ;; first, define a recursive note player
             ([interval instrument values]
              (play-it (now) interval instrument values 0))
             ([time interval instrument values counter]
@@ -94,31 +74,27 @@

     ;; baseline plays once per 4 notes
     (play-it (* 4 beat-ms)
-             synth/vintage-bass
-             ;; cycle the base line forever (but in reality, just for
-             ;; `num-measures` times)
-             (take num-measures (cycle (map note base-line))))
+      synth/vintage-bass
+      ;; cycle the base line forever (but in reality, just for
+      ;; `num-measures` times)
+      (take num-measures (cycle (map note base-line))))

     (play-it beat-ms
-             piano
-             ;; concat the sets-of-4-note-chords into a single
-             ;; seq of notes to send to play-it
-             (apply concat
-                    (take num-measures
-                          ;; for each root note, use overtone's rand-chord
-                          ;; to construct a 4-note chord that spans up to
-                          ;; 24 degrees
-                          (map (fn [root-note] (rand-chord root-note :major 4 24))
-                               (cycle base-line)))))))
-
-
-
+      sampled-piano
+      ;; concat the sets-of-4-note-chords into a single
+      ;; seq of notes to send to play-it
+      (apply concat
+             (take num-measures
+                   ;; for each root note, use overtone's rand-chord
+                   ;; to construct a 4-note chord that spans up to
+                   ;; 24 degrees
+                   (map (fn [root-note] (rand-chord root-note :major 4 24))
+                        (cycle base-line)))))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; ok, let's get back to more basics and build up to other exciting things.
-;; first, let's add a few imports.

 ;; playing with the guitar synth
-
-;; Mark found this guitar-pick function
 (guitar-pick (guitar) 0 0) ;; String 0 (Low E) Fret 0 (open)

 ;; we need a function that will play a sequence of notes; notes will
@@ -126,15 +102,15 @@
 ;; `string-index` `fret-value`
 (defn guitar-pick-note-sequence
   "play a sequence of notes [string fret] on instrument instrument
-  spaced by interval milliseconds
-
-  interval = milliseconds between each play
-  noteseq = [[string-index-1 fret-index-1
-              string-index-2 fret-index-2 ... ]]
-  "
+   spaced by interval milliseconds
+
+   interval = milliseconds between each play
+   noteseq = [[string-index-1 fret-index-1
+   string-index-2 fret-index-2 ... ]]
+   "
   [interval noteseq]
   (let [playguitar (partial guitar-pick (guitar))
-        timeseq (range (now) (+ (now) (* interval (count noteseq))) interval)]
+        timeseq    (range (now) (+ (now) (* interval (count noteseq))) interval)]
     (doseq [[string-fret-seq timeval] (map vector noteseq timeseq)]
       (doseq [[string fret] (partition 2 string-fret-seq)]
         (playguitar string fret timeval)))))
@@ -300,480 +276,3 @@

 (play-tab fast-car-tab)

-
-
-;; let's now introduce quil and whip up a simple visualizater for the tab
-;; make sure you've added quil to the namespace
-
-;; convenience map for window related config entries
-(def vis-conf {:width 1300
-               :height 360})
-
-;; create an atom for our visualizer's play state
-(def vis-state (atom {:play-list (take 50 (parse-guitar-tab fast-car-tab))
-                      :index 0}))
-;; this is a beat generator. it keeps ticking by the given timing
-(def metro (metronome 72))
-
-;; gets called once, when the vis is created
-(defn setup []
-  (q/smooth) ;; anti aliasing
-  (q/frame-rate 15))
-
-;; the draw function gets called on every frame refresh
-;; we'll do it live! modify and eval draw() and see it update
-(defn draw []
-  ;; set black
-  (q/fill 0)
-  ;; draw a black rect that fills the canvas
-  (q/rect 0 0 (:width vis-conf) (:height vis-conf))
-
-  (let [x0 10 ;; offsets
-        y0 10
-
-        n-block (count (@vis-state :play-list))
-        block-width (/ (- (:width vis-conf) (* 2 x0)) n-block)
-        block-height (/ (:height vis-conf) 2)
-        ]
-
-    ;; iterate through the note list
-    (doseq [ith (range n-block)]
-
-      ;; draw a bunch of boxes
-      (q/stroke 40 40 0)
-      (q/stroke-weight 2)
-      ;; set the box color here using rgb
-      ;; highlight just the box corresponding to the current index
-      (apply q/fill (if (= ith (:index @vis-state))
-                      [230 100 255]
-                      ;; make a gradient
-                      [(+ 20 (* 2 ith))]))
-      (q/rect (+ x0 (* block-width ith)) y0
-              block-width block-height)
-
-      ;; dimmer
-      (q/fill 100)
-      (q/text (str ith)
-              (+ x0 (* block-width ith))
-              (+ y0 20 block-height))
-
-      ;; for the tab text, use a lighter color
-      (q/fill 220)
-      (let [notes (nth (@vis-state :play-list) ith)]
-        (doseq [[string-index fret-index] (partition 2 notes)]
-          (q/text (str fret-index)
-                  (+ x0 (* block-width ith))
-                  (+ y0 40 block-height
-                     (- 120 (* 20 string-index)))))))))
-
-;; this launches the sketch
-(q/defsketch mysketch
-  :title "visualizer"
-  :setup setup
-  :draw draw
-  :size (map vis-conf [:width :height]))
-
-;; now we need a player function
-(let [my-guitar (guitar) ;; want to save it so we can manipulate its gate value
-      play-guitar (partial guitar-pick my-guitar) ;; from earlier
-      ]
-  (letfn [(vis-play []
-            ;; advance the index BEFORE the notes get played.
-            ;; that way it syncs properly with the playhead
-            ;; we also need to modulo the increment
-            ;; so it doesn't out of bounds the list
-            (swap! vis-state assoc :index (mod
-                                           (inc (:index @vis-state))
-                                           (count (:play-list @vis-state))))
-            ;; if you omit this, the guitar won't fade quickly enough
-            ;; and the audio "fills up" and stutters out after a while.
-            ;; (feel free to try)
-            (ctl my-guitar :gate 0)
-            (doseq [[string-index fret-index] (partition 2 (nth (:play-list @vis-state) (:index @vis-state)))]
-              ;; use our own play-guitar function
-              ;; so we get the gate reset
-              (play-guitar string-index fret-index))
-            )
-          ;; now define a function to play by the metronome
-          (play-notes [m beat-num]
-            (let [next-beat (inc beat-num)]
-              (at (m (+ 0 beat-num)) (vis-play))
-              ;; finally the recursive part
-              (apply-at (m next-beat) play-notes [m next-beat]))
-            )
-          ]
-    ;; it will auto-play forever
-    (play-notes metro (metro)))
-  )
-
-;; speed it up
-(metro-bpm metro 180)
-
-(stop)
-
-
-;; let's try something different now
-;; here's a quick demo of shadertone, just for fun
-(require '[shadertone.tone :as t])
-;; added a file in ohack/wave.glsl, which is taken directly from
-;; https://github.com/overtone/shadertone/blob/master/examples
-(t/start "wave.glsl" :width 1000 :height 400)
-
-;; you can then start a window and visualize e.g.
-(guitar-pick (guitar) 0 0)
-
-;; keep it on if you want, or stop it
-(t/stop)
-
-;; you can look into the glsl file to see how it works.  the edits you
-;; make to the glsl file will be updated live.  if you really want to go
-;; down this route, you'll have to understand GLSL... so we'll leave it
-;; at that.  if you want to learn more, https://www.shadertoy.com/ is a
-;; neat place to check out
-
-;; moving along
-
-;; let's define a little melody
-(def t-melody (let [_ nil
-                    motif [:iii _ :vii- :i     :ii _ :i :vii-     :vi- _ :vi- :i      :iii _ :ii :i
-                           :vii- _ :vii- :i     :ii _ :iii _     :i _ :vi- _      :vi- _ _ _
-                           _ :ii _ :iv    :vi _ :v :iv    :iii _ :i :ii     :iii _ :ii :i
-                           :vii- _ :vii- :i :ii _ :iii _ :i _ :vi- _ :vi- _ _ _]
-                    ;; interlude [:iii _ _ _ :i _ _ _ :ii _ _ _ :vii- _ _ _
-                    ;;            :i _ _ _ :vi- _ _ _ :v-# _ _ _ :vii- _ _ _
-                    ;;            :iii _ _ _ :i _ _ _ :ii _ _ _ :vii- _ _ _
-                    ;;            :i _ :iii _ :vi _ _ _ :v# _ _ _ _ _ _ _]
-                    ]
-                (interleave (concat
-                             ;; deliberately shortening it here
-                             motif
-                             ;; motif interlude motif
-                             )
-                            (cycle [_]))))
-(def t-alto (let [_ nil]
-              [:vii _  _ _  :v# _  :vi _  :vii _ :iii+ :ii+ :vi _ :v _
-               :iii _  _ _  :iii _ :vi _  :i+ _ _ _ :vii _ :vi _
-               :v# :v# :iii _  :v# _ :vi _    :vii _ _ _ :i+ _ _ _
-               :vi _ _ _ :iii _ _ _ :iii _ _ _     _ _ _ _
-               _ _ :iv _    _ _ :vi _    :i+ _ :i+ :i+    :vii _ :vi _
-               :v _   _ _ _ _   :iii _  :v _ :vi :v :iv _ :iii _
-               :v# _ :iii _ :v# _ :vi _  :vii _ :v _ :i+ _ :v _
-               :vi _ :iii _ :iii _ _ _   :iii _ _ _  _ _ _ _ _ _ _ _]))
-(def t-bass (let [_ nil]
-              (interleave [:iii-- :iii- :iii-- :iii-  :iii-- :iii- :iii-- :iii-       :vi-- :vi- :vi-- :vi- :vi-- :vi- :vi-- :vi-
-                           :v#-- :v#- :v#-- :v#-  :iii-- :iii- :iii-- :iii-       :vi-- :vi- :vi-- :vi-   :vi-- :vi- :vii-- :i-
-                           :ii- :ii-- _ :ii--   _ :ii-- :vi-- :iv--     :i-- :i- _ :i-          :i-- :v-- :v-- :i--
-                           :vii-- :vii- _ :vii-    :iii- _ :v#- _   :vi-- :iii- :vi-- :iii-    :vi-- _ _ _]
-                          (cycle [_]))))
-
-;; define a melody player
-(defn play [notes & {:keys [start-time speed instrument]
-                     :or {start-time (now)
-                          speed 100
-                          instrument sampled-piano
-                          }}]
-  (when-not (empty? notes)
-    (when-let [note (first notes)]
-      (at start-time (instrument note)))
-    (let [next-time (+ start-time speed)]
-      (apply-at next-time play [(rest notes)
-                                :start-time next-time
-                                :speed speed
-                                :instrument instrument]))))
-
-;; you can try it if you want
-(play (degrees->pitches t-melody :major :C4))
-
-
-;; instead of the default piano, let's use simple waves
-(definst triangle-wave [freq 440 attack 0.0001 sustain 0.1 release 0.3 vol 1.0]
-  (* (env-gen (lin attack sustain release) 1 1 0 1 FREE)
-     (lf-tri freq)
-     vol))
-
-(definst square-wave [freq 440 attack 0.005 sustain 0.15 release 0.3 vol 1.0]
-  (* (env-gen (lin attack sustain release) 1 1 0 1 FREE)
-     (square freq)
-     vol))
-
-;; now we want to try it out
-;;
-;; note: unlike piano and sampled-piano, which take note values,
-;; wave instruments take Hz!
-;; if you pass the wrong value, it will play, but will not be pleasant.
-;; let's define a converter from note values to Hertz using overtone's
-;; midi->hz function
-(def ->hz (partial map #(and % (midi->hz %))))
-
-;; if you still have the shadertone window open, you can check out the
-;; triangular shape of triangle-wave and square shape of square-wave
-(play (->hz (degrees->pitches t-melody :major :C4)) :instrument square-wave)
-
-;; !!! moved the play block to the bottom
-
-;; now we want to spice it up with a beat.
-;; let's make a little track player and use a metronome
-
-;; convenience fn to make a map, storing the track attributes.
-;; currently we just add the :muted state
-;; added instrument info
-(defn gen-track [inst melody]
-  {:melody melody
-   :muted false
-   :instrument inst})
-
-;; here's the track state atom
-;; updated to contain instruments
-(def mystate (atom {:index 0
-                    :track-list (let [_ nil]
-                                  {:tetris-melody   (gen-track square-wave
-                                                     (degrees->pitches
-                                                      t-melody
-                                                      :major :C5))
-                                   :tetris-alto     (gen-track square-wave
-                                                     (degrees->pitches
-                                                      t-alto
-                                                      :major :C4))
-                                   :tetris-bassline (gen-track triangle-wave
-                                                     (degrees->pitches
-                                                      t-bass
-                                                      :major :C3))
-
-                                   ;; define some beat tracks
-
-                                   ;; to fix the beat problem in the most lazy way
-                                   ;; we will just wrap the percussion instruments in
-                                   ;; a function that will throw away the incoming hz
-                                   ;; value. a nicer method... is left as an exercise
-                                   :beat-my-hat    (gen-track (fn [_] (my-hat))    (take 128 (cycle [1 _])))
-                                   :beat-close-hat (gen-track (fn [_] (close-hat)) (take 128 (cycle [_ 1])))
-                                   :beat-fs-kick   (gen-track (fn [_] (fs-kick))   (take 128 (cycle [1 _ _ _  _ _ _ _  _ _ _ _  _ _ _ _])))
-                                   :beat-my-kick   (gen-track (fn [_] (my-kick))   (take 128 (cycle [_ _ _ _  _ _ _ _  1 _ _ _  _ _ _ _])))
-                                   :beat-open-hat  (gen-track (fn [_] (open-hat))  (take 128 (cycle [_ _ 1 _])))
-                                   :beat-snare     (gen-track (fn [_] (snare))     (take 128 (cycle [_ _ _ _  1 _ _ _])))
-
-                                   })
-                    }))
-
-;; define some beat making instruments
-(definst my-kick [freq 140 dur 0.2 width 0.1]
-    (let [freq-env (* freq (env-gen (perc 0 (* 0.99 dur))))
-          env (env-gen (perc 0.01 dur) 1 1 0 1 FREE)
-          sqr (* (env-gen (perc 0 0.01)) (pulse (* 2 freq) width))
-          src (sin-osc freq-env)
-          drum (+ sqr (* env src))]
-      (compander drum drum 0.2 1 0.1 0.01 0.01)))
-(definst my-hat [amp 1.0 t 0.20]
-  (let [env (env-gen (perc 0.001 t) 1 1 0 1 FREE)
-        noise (white-noise)
-        sqr (* (env-gen (perc 0.01 0.04)) (pulse 880 0.2))
-        filt (bpf (+ sqr noise) 9000 0.5)]
-    (* amp env filt)))
-
-;; you can try them out with
-(my-kick) ;; ... etc
-
-;; overtone also has convenience methods to load and cache other sounds
-;; directly from freesound.org. we'll use 4 nice percussion sounds
-(def snare (sample (freesound-path 26903)))
-(def close-hat (sample (freesound-path 802)))
-(def open-hat (sample (freesound-path 26657)))
-(def fs-kick (sample (freesound-path 777)))
-;; it may take a while to download
-
-
-;; start building the melody player
-(let []
-  (stop)
-  ;; it's too slow, let's change the next-tick to be faster
-  ((defn play-track-map [time-tick track-map]
-     (let [next-tick (+ 0.25 time-tick)]
-       ;; cheat a little here, by reading the track state from
-       ;; the original atom
-       (doseq [[track-name track-state] (@mystate :track-list)]
-         (when-let [note (if (:muted track-state)
-                           nil
-                           (first (->hz (:melody (track-map track-name)))))]
-           (at (metro time-tick)
-               ;; now it plays a single note with all the instruments
-               ((:instrument track-state) note))))
-       ;; if there are notes left, we need to schedule play-track-map again
-       (when (some (fn [[k m]] (not (empty? (:melody m)))) track-map)
-         (apply-at (metro next-tick) play-track-map [next-tick
-                                                     ;; we need to send in track-map
-                                                     ;; where rest() is applied to each :melody value
-                                                     (into {}
-                                                           (map
-                                                            (fn [[k m]]
-                                                              [k (update-in m [:melody] rest)])
-                                                            track-map))
-                                                     ])))
-     )
-   (metro)
-   ;; let's make it play forever now, by constructing a copy of mystate
-   ;; where the tracks are infinite
-   (into {}
-         (map (fn [[k m]]
-                [k (update-in m [:melody]
-                              ;; also make sure they are the same length
-                              ;; or else they will loop at different times!
-                              ;; t-alto is (mistakenly) length 132
-                              #(cycle (take 128 %)))])
-              (@mystate :track-list)))
-   ))
-
-;; you can toggle each track on/off by evaluating e.g.
-(swap! mystate update-in [:track-list :tetris-melody :muted] not)
-(swap! mystate update-in [:track-list :tetris-alto :muted] not)
-(swap! mystate update-in [:track-list :tetris-bassline :muted] not)
-(swap! mystate update-in [:track-list :beat-my-hat :muted] not)
-
-(stop)
-
-;; let's try one more thing
-(defn derive-transition-map [el-seq & {:keys [wrap-around] :or {wrap-around false}}]
-  "for a given sequence, get the transition probabilities for one item
-    to the next. the return value is a map looking like
-    {element_1 {element_1_1 count_1_1, element_1_2 count_1_2}
-     element_2 {element_2_8 count_2_8, element_2_1 count_2_1, element_2_3 ...
-   if :wrap-around true is specified, the final element in el-seq
-   is mapped to the first element"
-  (loop [el-seq (concat el-seq [(if wrap-around (first el-seq))])
-         rtn {}]
-    (let [next-el (second el-seq)]
-      (if (nil? next-el)
-        rtn
-        (recur (rest el-seq)
-               (let [cur-el (first el-seq)
-                     el-map (or (rtn cur-el) {})]
-                 ;; each element gets mapped to a map with keys that
-                 ;; are the subsequent element
-                 (assoc rtn cur-el
-                        ;; construct a map where keys are the next element
-                        ;; and values are the times that element has shown up
-                        (assoc el-map next-el (inc (el-map next-el 0))))))))))
-
-(defn get-next-from-xns-map
-  "given a transition map and a current value that is inside that map,
-  probabilistically select a subsequent value. an optional default
-  can be given, else nil is returned"
-  ([xns-map current] (get-next-from-xns-map xns-map current nil))
-  ([xns-map current default]
-   (or (if-let [next-candidate-map (xns-map current)]
-         ;; select the next value with probabilities based on
-         ;; relative counts of the possible outcomes in the map
-         (let [choice-list (seq next-candidate-map)
-               cumsum (reduce + (map second choice-list))
-               choice (rand-int cumsum)
-               ]
-           (loop [start-sum 0
-                  choice-list choice-list
-                  ]
-             (let [[value proportion] (first choice-list)
-                   cur-sum (+ start-sum proportion)]
-               (if (< choice cur-sum)
-                 value
-                 (recur cur-sum
-                        (rest choice-list))
-                 )))
-
-           )
-         )
-       default)))
-
-(defn make-markov-iterator [sample-melody]
-  (let [xns-map (derive-transition-map sample-melody :wrap-around true)]
-    (iterate #(get-next-from-xns-map xns-map %)
-             (first sample-melody))))
-
-;; revisiting this old code...
-(let [tempo 200
-      bass-scale :C4
-      melody-scale :C5
-      majmin :major
-
-      ;; we will iterate over this: melody, root scale, instrument
-      track-list [
-                  [t-bass bass-scale triangle-wave]
-                  [t-alto bass-scale square-wave]
-                  [t-melody melody-scale square-wave]
-                  ]
-
-      ]
-  ;; stop all playback before starting a new one
-  (stop)
-
-  (doseq [[note-seq scale inst] track-list]
-    (play (->hz (degrees->pitches
-                 ;; we can change just this part...
-                 (make-markov-iterator (remove nil? note-seq))
-                 majmin scale))
-          :speed tempo
-          :instrument inst))
-
-  )
-
-;; playing notes using fixed slots for beats and rests is a bit restrictive.
-;; let's make a play function that allows you to specify individual note
-;; attributes (yes, i know we're kind of reinventing midi here)
-;;
-(let [beat-ms 100
-      ;; make nbeat optional, defaulting to 1 beat
-      gen-note (fn [pitch & [nbeat]]
-                 {:pitch pitch
-                  :duration (* (or nbeat 1) beat-ms)})
-      ;; now we want play to take maps created by gen-note
-      ;; instead of single pitch values
-      play (fn play [mnotes & {:keys [start-time duration instrument]
-                              :or {start-time (now)
-                                   duration beat-ms
-                                   instrument sampled-piano
-                                   }}]
-             (when-not (empty? mnotes)
-               (let [{:keys [pitch duration]} (first mnotes)]
-                 (when pitch
-                   (at start-time (instrument pitch)))
-                 (let [next-time (+ start-time duration)]
-                   (apply-at next-time play [(rest mnotes)
-                                             :start-time next-time
-                                             :duration duration
-                                             :instrument instrument])))))
-
-      ;; move over that map code into a separate function
-      convert-to-new-style (fn [old-melody root-key]
-                             (map
-                              (fn [[degree n-nil]]
-                                (gen-note degree (inc n-nil)))
-                              (partition 2
-                                         (map (fn [part]
-                                                (if (nil? (first part))
-                                                  (count part)
-                                                  (first part)))
-                                              (partition-by nil?
-                                                            (degrees->pitches old-melody
-                                                                              :major root-key))))))]
-  ;; test that it works
-  ;; (play (map #(gen-note % (inc (rand-int 4))) (range 60 68)))
-
-  (stop)
-
-  ;; now let's convert the old t-melody to a duration version
-  ;; (play (convert-to-new-style t-melody :C4))
-
-  ;; we're not playing alto. the reason is because alto is on a different
-  ;; time signature, and applying the same partition method to convert it
-  ;; to durations doesn't actually line them up. try it and you'll hear.
-
-  ;; (play (convert-to-new-style t-bass :C3))
-
-  ;; let's do a final manipulation
-  (play
-   (let [num-play 128]
-     (map
-      (fn [p d]
-        {:pitch p :duration d})
-      (take num-play (make-markov-iterator (map :pitch (convert-to-new-style t-melody :C4))))
-      (take num-play (make-markov-iterator (map :duration (convert-to-new-style t-melody :C4)))))))
-
-
-  )


Wrong local name

Wrong local name

--- src/grimoire/api/web/read.clj
+++ src/grimoire/api/web/read.clj
@@ -86,7 +86,7 @@
       versions)))

 (defmethod api/read-notes :web [config thing]
-  {:pre [(isa? :def def-thing)]}
+  {:pre [(isa? :def thing)]}
   (do-data-req thing "notes"))

 (defmethod api/read-examples :web [config def-thing]


localize tense names in French

localize tense names in French

--- src/babel/francais/grammar.cljc
+++ src/babel/francais/grammar.cljc
@@ -26,9 +26,9 @@
                              :aspect :simple}}}
    "conditional" {:synsem {:sem {:tense :conditional}}}
    "future" {:synsem {:sem {:tense :future}}}
-   "imperfect" {:synsem {:sem {:aspect :progressive
+   "imparfait" {:synsem {:sem {:aspect :progressive
                                 :tense :past}}}
-   "past perfect" {:synsem {:sem {:aspect :perfect
+   "passé composé" {:synsem {:sem {:aspect :perfect
                                   :tense :present}}}})

 (def head-imperfect-infl


present-progressive: tree is h-h-h, not h-h.

--- src/babel/italiano/grammar.cljc
+++ src/babel/italiano/grammar.cljc
@@ -897,7 +897,7 @@
                  :present)
               (= (get-in % [:synsem :sem :aspect])
                  :progressive))
-    :then h-h}
+    :then h-h-h}

    ])


Docstrings of the IComponent functions added

--- src/clj/hellhound/component.clj
+++ src/clj/hellhound/component.clj
@@ -84,15 +84,18 @@
 ;; These functions are the actual implementation of IComponent
 ;; Protocol for IPersistentMap.
 (defn- initialize-component
+  "This function is responsible to initialize the given `component` by
+  initializing the input and ouput manifolds of the component."
   [component]
   (let [default-io-buffer-size (core/get-config :components :io-buffer-size)
-          default-stream-fn #(stream/stream default-io-buffer-size)
-          input-stream-fn   (get component
-                                 :input-stream-fn
-                                 default-stream-fn)
-          output-stream-fn  (get component
-                                 :output-stream-fn
-                                 default-stream-fn)]
+          default-stream-fn    #(stream/stream default-io-buffer-size)
+          input-stream-fn      (get component
+                                    :input-stream-fn
+                                    default-stream-fn)
+          output-stream-fn     (get component
+                                    :output-stream-fn
+                                    default-stream-fn)]
+
       (assert default-io-buffer-size)
       (assoc component
              ::started? false
@@ -100,18 +103,30 @@
              ::output   (output-stream-fn))))

 (defn- start-component!
-  [component context]
+  "Fetches and calls the `start-fn` of the given `component`.
+
+  This function assigns the `started?` key to `true` on the return
+  value of `start-fn` which should be a valid component. `started?`
+  key basically demonstrates that the component in question is running."
+  [component]
   (let [start-fn (::start-fn component)]
       (if (not (started? component))
         (do
-          (log/debug "Starting '" (::name component) "' component...")
-          (assoc (start-fn component context) ::started? true))
-
-        (do
-          (log/debug "Component '" (::name component) "' already started. Skipping...")
+          (log/debug (format "Starting component '%s'..."
+                             (::name component)))
+          (assoc (start-fn component) ::started? true))
+
+        (do
+          (log/debug (format "Component '%s' already started. Skipping..."
+                             (::name component)))
           component))))

 (defn- stop-component!
+  "Fetches and calls the `stop-fn` of the given `component`.
+
+  This function assigns the `started?` key to `false` on the return
+  value of `start-fn` which should be a valid component. Falsy value for
+  `started?` demonstrates that the component in question is not running."
   [component]
   (let [stop-fn (::stop-fn component)]
       (if (started? component)
@@ -125,23 +140,35 @@
           component))))

 (defn- component-started?
+  "Returns `true` if the given component is `started?`."
   [component]
   (or (::started? component) false))

 (defn- name-of
+  "Returns the `name` of the given `component`."
   [component]
   (::name component))

 (defn- dependencies-of
+  "Returns a collection of dependencies of the given `component`."
   [component]
   (::depends-on component))

 (defn- input-of
+  "Returns the input manifold of the given `component`.
+
+  The input of the component is a manifold whichis going to receive
+  the incoming dataflow from the output of the component upstream."
   [component]
   (assert (::input component) "::input should not be empty. Please file a bug")
   (::input component))

 (defn- output-of
+  "Returns the output manifold of the given `component`.
+
+  The output of the component is a manifold which should
+  flow the output data of the component to the downstream
+  component."
   [component]
   (assert (::output component)
           "::input should not be empty. Please file a bug")


New function remove-temporary-directory

New function remove-temporary-directory

--- src/clj_fileutils/fileutils.clj
+++ src/clj_fileutils/fileutils.clj
@@ -40,6 +40,16 @@
     ( [path filename]
     (new java.io.File path filename)))

+
+(defn remove-temporary-directory
+    "Remove (delete) temporary directory that resides in /tmp (at least on Linux)."
+    [directory-name]
+    (let [file (new java.io.File directory-name)
+          abs-path (.getAbsolutePath file)]
+        ; make sure we are not going to remove wrong directory!
+        (if (.startsWith abs-path "/tmp")
+            (exec/exec "/bin/rm -rf" abs-path))))
+
 (defn mv-file
     "Move or rename one file. On the same filesystem the rename should be atomic."
     [filename1 filename2]


rough grid

rough grid

--- src/cljs/tumblrsearch/core.cljs
+++ src/cljs/tumblrsearch/core.cljs
@@ -17,22 +17,24 @@
 (enable-console-print!)

+
 ;; state ------------------------------------------
+
+(def IMGSIZE 400)

 (def initial-state
   {:current-state :search
-   :search-options {:photo true :audio true}
    :current-search ""
    :error ""
    :current-items []
    :before 0
+   :window-width (.. js/window -innerWidth)
    })

 (defn reset-state [state]
   (merge state initial-state))

 ;; Search ------------------------------------------------
-

 ; ajax ---

@@ -91,32 +93,6 @@
         ))))

 ; render ---
-
-(defn render-select [data owner]
-  (dom/div nil
-           (dom/input #js {:type "checkbox"
-                           :checked (-> data :search-options :photo)
-                           :onClick (fn [e]
-                                      (.preventDefault e)
-                                      (om/transact!
-                                        data
-                                        #(update-in % [:search-options :photo] not)))}
-                      (str
-                        "Photo ("
-                        (count (filter #(= (:type %) "photo") (:current-items data)))
-                        " items)"))
-           (dom/input #js {:type "checkbox"
-                           :checked (-> data :search-options :audio)
-                           :onClick (fn [e]
-                                      (.preventDefault e)
-                                      (om/transact!
-                                        data
-                                        #(update-in % [:search-options :audio] not)))}
-                      (str
-                        "Audio ("
-                        (count (filter #(= (:type %) "audio") (:current-items data)))
-                        " items)")
-                      )))

 (defn render-search [data owner]
   (reify
@@ -148,7 +124,6 @@
                                  (om/transact! data reset-state)
                                  )}
                  "Clear")
-               (render-select data owner)
                ))
     ))

@@ -156,39 +131,52 @@

 (defn items-view [data owner]
-  (apply dom/div nil
-         (om/build-all item-view
-                       (filter
-                         #(or (= (:type %) "photo") (= (:type %) "audio"))
-                         (:current-items data))
-                       {:state {:visible (:search-options data)}}
-                       )))
+  (let [col-n (quot (:window-width data) IMGSIZE)
+        left-offset (/ (mod (.. js/window -innerWidth) IMGSIZE) 2)]
+    (apply dom/div #js {:className "images"}
+           (om/build-all
+             item-view
+             (->> (:current-items data)
+                  (filter #(= (:type %) "photo"))
+                  ((fn [items]
+                    (loop [is items coll [] idx 0 offsets (vec (repeat col-n 0))]
+                      (if (empty? is) coll
+                        (let [item  (first is)
+                              title (s/replace (:slug item)  #"-"  " ")
+                              photo (-> item :photos first :alt_sizes second)]
+                          (if (or (nil? (:height photo)) (nil? (:width photo)))
+                            ; nil size found
+                            (recur (rest is) coll idx offsets)
+                            ; ok
+                            (let [offset-n    (mod idx col-n)
+                                  offset-x    (+ left-offset (* IMGSIZE offset-n))
+                                  offset-y    (offsets offset-n)
+                                  new-height  (.round js/Math (* (:height photo) (/ IMGSIZE (:width photo))))
+                                  new-offsets (update-in offsets [offset-n] #(+ % new-height))
+                                  new-item {:index idx
+                                            :title title
+                                            :photo photo
+                                            :x offset-x
+                                            :y offset-y}]
+                              (recur
+                                (rest is)
+                                (conj coll new-item)
+                                (inc idx)
+                                new-offsets)))
+                          ))))))))))

 (defn item-view [item owner]
-  (if
-    (= (:type item) "photo")
-    (reify
-      om/IRender
-      (render [_]
-        (dom/div #js {:data-type (:type item)
-                      :className (if (-> owner om/get-state :visible :photo)
-                                   "shown"
-                                   "hidden")}
-                 (dom/h2 nil (s/replace (:slug item)  #"-"  " "))
-                 (dom/a #js {:href (:post_url item) :target "_blank"}
-                        (dom/img #js {:src (-> item :photos first :alt_sizes second :url)})))))
-    (reify
-      om/IRender
-      (render [_]
-        (dom/div #js {:data-type true
-                      :className (if (-> owner om/get-state :visible :audio)
-                                   "shown"
-                                   "hidden")}
-                 (dom/h2 nil (s/replace (:slug item)  #"-"  " "))
-                 (dom/div
-                   #js {:dangerouslySetInnerHTML #js {:__html (:player item)}}
-                   nil))))
-    ))
+  (reify
+    om/IRender
+    (render [_]
+      (dom/a #js {:href (:post_url item) :target "_blank"
+                  :style #js {:position "absolute"
+                              :height (str (:height (:photo item)) "px")
+                              :width (str IMGSIZE "px")
+                              :top (str (:y item) "px")
+                              :left (str (:x item) "px")
+                              }}
+             (dom/img #js {:src (:url (:photo item))})))))

 ;; Loading ------------------------------------------------
@@ -197,22 +185,19 @@
   (om/component
     (dom/div nil
              ; title
-             (dom/h1 nil (str "Current search: "
-                              (:current-search data)))
-             (dom/button
-               #js {:onClick (fn [e]
-                               (.preventDefault e)
-                               (om/transact! data reset-state))}
-               "Reset")
+             (dom/div #js {:className "header"}
+                      (dom/h1 nil (str "Current search: "
+                                       (:current-search data)))
+                      (dom/button
+                        #js {:onClick (fn [e]
+                                        (.preventDefault e)
+                                        (om/transact! data reset-state))}
+                        "Reset")
+                      ; loading
+                      (dom/h2 nil "loading"))
              ; photo list
              (items-view data owner)
-             ; loading
-             (dom/h2 nil "loading")
-             (dom/button
-               #js {:onClick (fn [e]
-                               (.preventDefault e)
-                               (om/transact! data reset-state ))}
-               "Cancel"))))
+             )))

 ;; loaded ------------------------------------------------

@@ -220,17 +205,16 @@
 (defn render-loaded [data owner]
   (om/component
     (dom/div nil
-             ; title
-             (dom/h1 nil (str "Current search: "
-                              (:current-search data)))
-
-             (render-select data owner)
-
-             (dom/button
-               #js {:onClick (fn [e]
-                               (.preventDefault e)
-                               (om/transact! data reset-state))}
-               "Reset")
+             (dom/div #js {:className "header"}
+                      ; title
+                      (dom/h1 nil (str "Current search: "
+                                       (:current-search data)))
+
+                      (dom/button
+                        #js {:onClick (fn [e]
+                                        (.preventDefault e)
+                                        (om/transact! data reset-state))}
+                        "Reset"))
              ; item list
              (items-view data owner)
              )))
@@ -308,6 +292,11 @@
         (om/transact! data #(assoc % :current-state :loading))
         (go (async-search @data ajax-chan))))))

+(defn async-window-resize [data]
+   (.addEventListener
+     js/window "resize"
+     (fn []
+       (om/transact! data #(assoc % :window-width (.. js/window -innerWidth))))))

 (om/root
   (fn [data owner]
@@ -317,6 +306,7 @@
         (let [ajax-chan (chan 1)]
           (async-response-loop data ajax-chan)
           (async-window-scroll data ajax-chan)
+          (async-window-resize data)
           (om/set-state! owner :ajax-chan ajax-chan)))
       om/IRenderState
       (render-state [this local-state]


Add backward compatibility aliases on buddy.core.hmac namespace.

--- src/clojure/buddy/core/hmac.clj
+++ src/clojure/buddy/core/hmac.clj
@@ -16,10 +16,33 @@
   "Hash-based Message Authentication Codes (HMACs)
 This namespace is now deprecated in favour of buddy.core.mac.hmac
 and mantained for backward comaptibility."
-  (:require buddy.core.mac.hmac))
+  (:import clojure.lang.Keyword)
+  (:require buddy.core.mac.hmac
+            buddy.core.mac.shmac))

 (defmacro pullall [ns]
   `(do ~@(for [i (map first (ns-publics ns))]
            `(def ~i ~(symbol (str ns "/" i))))))

 (pullall buddy.core.mac.hmac)
+(pullall buddy.core.mac.shmac)
+
+(def hmac-verify buddy.core.mac.hmac/verify)
+(def shmac-verify buddy.core.mac.shmac/verify)
+
+
+;; Alias for hmac + sha2 hash algorithms
+(def hmac-sha256 #(buddy.core.mac.hmac/hmac %1 %2 :sha256))
+(def hmac-sha384 #(buddy.core.mac.hmac/hmac %1 %2 :sha384))
+(def hmac-sha512 #(buddy.core.mac.hmac/hmac %1 %2 :sha512))
+(def hmac-sha256-verify #(buddy.core.mac.hmac/verify %1 %2 %3 :sha256))
+(def hmac-sha384-verify #(buddy.core.mac.hmac/verify %1 %2 %3 :sha384))
+(def hmac-sha512-verify #(buddy.core.mac.hmac/verify %1 %2 %3 :sha512))
+
+;; Alias for salted hmac + sha2 hash algorithms
+(def shmac-sha256 #(buddy.core.mac.shmac/shmac %1 %2 %3 :sha256))
+(def shmac-sha384 #(buddy.core.mac.shmac/shmac %1 %2 %3 :sha384))
+(def shmac-sha512 #(buddy.core.mac.shmac/shmac %1 %2 %3 :sha512))
+(def shmac-sha256-verify #(buddy.core.mac.shmac/verify %1 %2 %3 %4 :sha256))
+(def shmac-sha384-verify #(buddy.core.mac.shmac/verify %1 %2 %3 %4 :sha384))
+(def shmac-sha512-verify #(buddy.core.mac.shmac/verify %1 %2 %3 %4 :sha512))


use clojure.edn/read-string instead of clojure.core/read-string

--- src/clojure/nightcode/utils.clj
+++ src/clojure/nightcode/utils.clj
@@ -1,7 +1,8 @@
 (ns nightcode.utils
   (:require [clojure.java.io :as java.io]
             [clojure.xml :as xml]
-            [seesaw.core :as s])
+            [seesaw.core :as s]
+            [clojure.edn :as edn])
   (:import [bsh.util JConsole]
            [clojure.lang LineNumberingPushbackReader]
            [com.camick WrapLayout]
@@ -19,7 +20,7 @@
 (defn read-pref
   [k]
   (when-let [string (.get prefs (name k) nil)]
-    (read-string string)))
+    (edn/read-string string)))

 ; language

@@ -93,7 +94,7 @@
   []
   (let [project-clj (-> (java.io/resource "project.clj")
                         (slurp)
-                        (read-string))]
+                        (edn/read-string))]
     (if (= (name (nth project-clj 1)) "nightcode")
       (nth project-clj 2)
       "beta")))


:lipstick: Fix indentation on workspace header.

--- frontend/src/uxbox/main/ui/workspace/header.cljs
+++ frontend/src/uxbox/main/ui/workspace/header.cljs
@@ -45,16 +45,16 @@
        [:& dropdown {:show @show-dropdown?
                      :on-close #(reset! show-dropdown? false)}
         [:ul.zoom-dropdown
-          [:li {:on-click increase}
-            "Zoom in" [:span "+"]]
-          [:li {:on-click decrease}
-            "Zoom out" [:span "-"]]
-          [:li {:on-click zoom-to-50}
-            "Zoom to 50%"]
-          [:li {:on-click zoom-to-100}
-            "Zoom to 100%" [:span "Shift + 0"]]
-          [:li {:on-click zoom-to-200}
-            "Zoom to 200%"]]]]
+         [:li {:on-click increase}
+          "Zoom in" [:span "+"]]
+         [:li {:on-click decrease}
+          "Zoom out" [:span "-"]]
+         [:li {:on-click zoom-to-50}
+          "Zoom to 50%"]
+         [:li {:on-click zoom-to-100}
+          "Zoom to 100%" [:span "Shift + 0"]]
+         [:li {:on-click zoom-to-200}
+          "Zoom to 200%"]]]]
      [:span.remove-zoom {:on-click increase} "+"]]))

 ;; --- Header Users


Improve doc strings

Improve doc strings

--- src/mdr2/abacus/import.clj
+++ src/mdr2/abacus/import.clj
@@ -1,6 +1,9 @@
 (ns mdr2.abacus.import
   "Funtionality for the initial import of the production data from
-  ABACUS to Madras2"
+  ABACUS to Madras2.
+
+  This is meant to be used only once when importing the productions
+  from ABACUS. Use from within a repl."
   (:require [clojure.java.io :as io]
             [clojure.data.csv :as csv]
             [clojure.string :as string]
@@ -11,7 +14,7 @@
 (def ^:private db (env :database-url))

 (defn fix-production
-  "Fix a `production`, i.e. fix some of the fields as they are coing
+  "Fix a `production`, i.e. fix some of the fields as they are coming
   from ABACUS the values as they are expected by Madras2"
   [{:keys [id periodical_number] :as production}]
   (-> production


Fix syntax error

Fix syntax error

--- src/metabase/api/embed.clj
+++ src/metabase/api/embed.clj
@@ -129,7 +129,7 @@
         :when                         (and tag-type
                                            (or widget-type (not= tag-type "dimension")))]
     {:id      (:id tag)
-     :type    widget-type (if (= tag-type "date") "date/single" "category")
+     :type    (or widget-type (if (= tag-type "date") "date/single" "category"))
      :target  ["variable" ["template-tag" (:name tag)]]
      :name    (:display_name tag)
      :slug    (:name tag)


fix moved reference to get-prev-state

fix moved reference to get-prev-state

--- src/parinfer/core.cljs
+++ src/parinfer/core.cljs
@@ -10,9 +10,8 @@
                           render-controls!]]
     [parinfer.editor :refer [create-editor!
                              create-regular-editor!
-                             start-editor-sync!
-                             get-prev-state
-                             ]]
+                             start-editor-sync!]]
+    [parinfer.editor-support :refer [get-prev-state]]
     [parinfer.state :refer [state]]
     [parinfer.format.infer :as infer]
     [parinfer.format.prep :as prep]


add twitterbot to robots.txt

add twitterbot to robots.txt

--- src/pc/http/routes.clj
+++ src/pc/http/routes.clj
@@ -343,4 +343,8 @@
 (defpage health-check "/health-check" [req]
   (lb/health-check-response req))

+(defpage robots-txt "/robots.txt" [req]
+  {:status 200
+   :body "User-agent: Twitterbot\nDisallow:\n"})
+
 (def app (defpage/collect-routes))


Refactor the triggering code a bit.

Refactor the triggering code a bit.

--- src/om_event_bus/core.cljs
+++ src/om_event_bus/core.cljs
@@ -53,12 +53,9 @@
   The arity 4 version lets you specify a channel if you also want to handle events outside of component hierarchy.

   **IMPORTANT:** If you pass a channel to receive events through, you **MUST** consume events."
-  ([f value options]
-    (root<> f value options nil))
-  ([f value options out-event-ch]
-    (root* f value options out-event-ch {:bubbling (impl/event-bus (impl/bubbling-router))
-                                         :trickling (impl/event-bus (impl/trickling-router))})))
-
+  ([f value options & [out-event-ch]]
+    (root* f value options out-event-ch {::bubbling (impl/event-bus (impl/bubbling-router))
+                                         ::trickling (impl/event-bus (impl/trickling-router))})))

 (defn root>
   "Use `root>` instead of om.core/root to add support for sending events from child components to parent components only.
@@ -69,15 +66,17 @@
   ([f value options]
     (root> f value options nil))
   ([f value options out-event-ch]
-    (root* f value options out-event-ch {:bubbling (impl/event-bus (impl/bubbling-router))})))
+    (root* f value options out-event-ch {::bubbling (impl/event-bus (impl/bubbling-router))})))

 (defn root<
   "Use `root>` instead of om.core/root to add support for sending events from parent components to child components only."
   ([f value options]
-    (root* f value options nil {:trickling (impl/event-bus (impl/trickling-router))})))
+    (root* f value options nil {::trickling (impl/event-bus (impl/trickling-router))})))

 ; =============================================================================
 ;; ### Triggering events.
+
+(declare trigger*)

 (defn bubble
   "This function sends an event from the component up through its parent components.
@@ -85,19 +84,11 @@
   Note that `event` can be any data structure, there are no restrictions in this respect though for future compatibility,
   a map is recommended."
   [owner event]
-  (let [event-bus (:bubbling (om/get-state owner ::event-buses))]
-    (impl/trigger event-bus event))
-  nil)  ; Avoid the following React.js warning: "Returning `false` from an event handler is deprecated
-        ; and will be ignored in a future release. Instead, manually call e.stopPropagation() or e.preventDefault(),
-        ; as appropriate."
+  (trigger* owner ::bubbling event))

 (defn trickle
   [owner event]
-  (let [event-bus (:trickling (om/get-state owner ::event-buses))]
-    (impl/trigger event-bus event))
-  nil)  ; Avoid the following React.js warning: "Returning `false` from an event handler is deprecated
-        ; and will be ignored in a future release. Instead, manually call e.stopPropagation() or e.preventDefault(),
-        ; as appropriate."
+  (trigger* owner ::trickling event))

 (defn trigger
   [owner event]
@@ -114,7 +105,7 @@

 ;; ### Implementation of om/root replacements.

-(defn- root*
+(defn root*
   "Here's what the `root*` function does:

   1. It intercepts calls to build (via `:instrument`) to pass on event buses from parent components to their
@@ -138,7 +129,7 @@
                                          (binding [*parent* this]
                                            (super)))})]
     (when out-event-ch
-      (if-let [bubbling-bus (:bubbling event-buses)]
+      (if-let [bubbling-bus (::bubbling event-buses)]
         (impl/tap bubbling-bus out-event-ch)
         (throw (js/Error. "Bubbling event bus not available. Make sure to use root> or root<>."))))
     (om/root f value
@@ -149,6 +140,16 @@
                                              (om/build* f x (-> m
                                                                 (update-in [:init-state] merge {::event-buses parent-buses})
                                                                 (merge {:descriptor descriptor})))))}))))
+
+;; ### Event triggering
+
+(defn trigger*
+  [owner event-bus-key event]
+  (let [event-bus (event-bus-key (om/get-state owner ::event-buses))]
+    (impl/trigger event-bus event))
+  nil)  ; Avoid the following React.js warning: "Returning `false` from an event handler is deprecated
+        ; and will be ignored in a future release. Instead, manually call e.stopPropagation() or e.preventDefault(),
+        ; as appropriate."

 ;; ### Event bus setup


remove pass-through

remove pass-through

--- src/otp_api_proxy/core.clj
+++ src/otp_api_proxy/core.clj
@@ -312,7 +312,6 @@
        (ws-help))
   ;; (ANY "/otp-params/:otp-instance" {params :params}
   (context "/trip-planner/:otp-instance" [otp-instance]
-    ;; (ANY "/pass-through" {route-params :route-params params :params}
      (ANY "/plan" request
        (ws-otp-with-args (:params request)))
      (ANY "/plan-cooked" []


Lisätty sessio serveriin

Lisätty sessio serveriin

--- mtg-pairings-backend/src/mtg_pairings_backend/server.clj
+++ mtg-pairings-backend/src/mtg_pairings_backend/server.clj
@@ -3,6 +3,7 @@
   (:require [org.httpkit.server :as hs]
             [compojure.core :as c]
             [ring.middleware.json :refer [wrap-json-body wrap-json-response]]
+            [ring.middleware.session :refer [wrap-session]]
             [ring.util.response :refer [response]]
             [clojure.java.io :as io]

@@ -34,6 +35,7 @@
         db (create-and-load-db (:db-filename properties))
         stop-fn (hs/run-server
                   (-> (routes db)
+                    wrap-session
                     wrap-json-response
                     (wrap-json-body {:keywords? true}))
                   {:port 8080})]


For /all-normal command, reset mid marker to nil.

--- src/planviz/state.cljs
+++ src/planviz/state.cljs
@@ -262,7 +262,7 @@
               edge-normal-fn (fn [m k v]
                                (assoc m k
                                  (if (keyword-identical? (:plan/plid v) plid)
-                                   (assoc v :edge/state :normal) v)))
+                                   (assoc v :edge/state :normal :edge/marker-mid nil) v)))
               edge-by-plid-id (reduce-kv edge-normal-fn {} edge-by-plid-id)]
           (assoc st
             :edge/edge-by-plid-id edge-by-plid-id


Improve comments around post-event-callback stuff

--- src/re_frame/core.cljc
+++ src/re_frame/core.cljc
@@ -76,19 +76,19 @@
 ;; -- Event Procssing Callbacks

 (defn add-post-event-callback
-  "Registers a callback function 'f'.
-  f will be called after each dispatched event is procecessed
-  f will be called with two arguments:
-    - the event's vector. That which was dispatched orignally.
-    - the further event queue - what is still to be processed. A PersistentQueue.
+  "Registers a callback function `f` to be called after each event is procecessed
+   `f` will be called with two arguments:
+    - `event`: a vector. The event just processed.
+    - `queue`: a PersistentQueue, possibly empty, of events yet to be processed.

-  This is useful in advanced cases like:
-    - you are implementing a complex bootstrap pipeline
-    - you want to create your own handling infrastructure, with perhaps multiple
-      handlers for the one event, etc.  Hook in here.
-    - libraries providing 'isomorphic javascript' rendering on  Nodejs or Nashorn.
+   This is useful in advanced cases like:
+     - you are implementing a complex bootstrap pipeline
+     - you want to create your own handling infrastructure, with perhaps multiple
+       handlers for the one event, etc.  Hook in here.
+     - libraries providing 'isomorphic javascript' rendering on  Nodejs or Nashorn.

-  'id' is typically a keyword.
+  'id' is typically a keyword. It is an identifier, supplied initially
+  at \"add time\", which can be subsequently be used to remove a callback.
   "
   ([f]
     (router/add-post-event-callback re-frame.router/event-queue f f))


Improve reg-sub documentation (#518)

Improve reg-sub documentation (#518)

* Fix indention of reg-sub syntax sugar docs

* Fix formatting of code snippet for syntax sugar of reg-sub

* Clarify documentation of reg-sub syntax sugar

Closes: #516

* Explain the query-vector of reg-sub's computation function

--- src/re_frame/subs.cljc
+++ src/re_frame/subs.cljc
@@ -218,7 +218,9 @@
   a namespaced keyword.

   A computation function is always the last argument and it has this general form:
-    `(input-signals, query-vector) -> a-value`
+    `(input-signals, query-vector) -> a-value`.  The `query-vector` is the
+    `query` passed to `(subscribe query)` (see there for details), which may contain
+    additional arguments to further parametrise the query.

   What goes in between the 1st and last args can vary, but whatever is there will
   define the input signals part of the template, and, as a result, it will control
@@ -271,15 +273,29 @@

   3. Syntax Sugar

+     ```clj
      (reg-sub
        :a-b-sub
        :<- [:a-sub]
        :<- [:b-sub]
        (fn [[a b] [_]] {:a a :b b}))
-
-  This 3rd variation is syntactic sugar for the 2nd. Pairs are supplied instead
-  of an `input signals` functions. Each pair starts with a `:<-` and a subscription
-  vector follows.
+     ```
+
+     This 3rd variation is syntactic sugar for the 2nd.  Instead of providing an
+     `input signals` function, other subscriptions are used as automatic `input
+     signals`: Each pair of `:<-` and a subscription vector is equivalent to a call to
+     `(subscribe [:a-sub])`.
+
+     Beware that in this syntax a single `:<-` pair is *not* wrapped in a vector, hence
+     the same rule as for the 2nd variation applies: If you only provide one `input
+     signal`, the computation function must expect a single value as the 1st argument:
+
+     ```clj
+     (reg-sub
+       :a-sub
+       :<- [:a-sub]
+       (fn [a _] ...))
+     ```

   For further understanding, read `/docs`, and look at the detailed comments in
   /examples/todomvc/src/subs.cljs


Unify the matches-requirement logic.

Unify the matches-requirement logic.

--- src/shale/sessions.clj
+++ src/shale/sessions.clj
@@ -158,26 +158,38 @@
   :new (s/pair s/Any "session" Requirement "requirement"))

 (s/defmethod matches-requirement :old :- s/Bool
-  [session-model :- s/Any
+  [session-model :- {(s/optional-key :id) s/Str
+                     (s/optional-key :reserved) s/Bool
+                     (s/optional-key :tags) [s/Str]
+                     (s/optional-key :browser-name) s/Str
+                     (s/optional-key :current-url) s/Str
+                     (s/optional-key :node) {(s/optional-key :id) s/Str
+                                             (s/optional-key :url) s/Str
+                                             (s/optional-key :tags) [s/Str]}}
    requirements :- OldRequirements]
-  (let [exact-match-keys [:browser-name :reserved]
-        resolved-nodes (map (comp str host-resolved-url)
-                            (filter identity
-                                    (map #(get-in % [:node :url])
-                                         [session-model requirements])))]
-    (info "Checking session requirements..."
-         session-model
-         requirements)
-    (info "Resolved node hosts..." resolved-nodes)
-    (and
-      (every? #(apply clojure.set/subset? %)
-              [(map #(into #{} (% :tags))
-                       [requirements session-model])
-               (map #(into #{} (select-keys % exact-match-keys))
-                    [requirements session-model])])
-      (if (> (count resolved-nodes) 0)
-        (apply = resolved-nodes)
-        true))))
+  (matches-requirement
+    {:session-id (:id session-model)
+     :session (merge
+                (select-keys session-model
+                           [:tags :reserved :browser-name :current-url])
+                (if-let [node-id (get-in session-model [:node :id])]
+                  {:node-id node-id}))
+     :node (select-keys (:node session-model) [:tags :url])}
+    [:and
+     (vec
+       (concat
+         (map #(vec [:session-tag %])
+              (get requirements :tags))
+         (->> [:browser-name :reserved]
+              (map #(vec [% (get requirements %)]))
+              (filter identity)
+              (into []))
+         (if-let [node-id
+                  (get-in requirements [:node :id])]
+           [[:node-id node-id]])
+         (map #(vec [:node-tag %])
+              (get-in requirements [:node :tags]))))]))
+
 (s/defmethod matches-requirement :new :- s/Bool
   [session-model :- {(s/optional-key :session-id) s/Str
                      (s/optional-key :session) SessionInRedis