removed supervisor as it is not being used

--- storm-multicore/src/clj/backtype/storm/daemon/supervisor.clj
+++ storm-multicore/src/clj/backtype/storm/daemon/supervisor.clj
@@ -1,575 +0,0 @@
-;;; Licensed to the Apache Software Foundation (ASF) under one
-;;; or more contributor license agreements.  See the NOTICE file
-;;; distributed with this work for additional information
-;;; regarding copyright ownership.  The ASF licenses this file
-;;; to you under the Apache License, Version 2.0 (the
-;;; "License"); you may not use this file except in compliance
-;;; with the License.  You may obtain a copy of the License at
-;;;
-;;; http://www.apache.org/licenses/LICENSE-2.0
-;;;
-;;; Unless required by applicable law or agreed to in writing, software
-;;; distributed under the License is distributed on an "AS IS" BASIS,
-;;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;;; See the License for the specific language governing permissions and
-;;; limitations under the License.
-;(ns backtype.storm.daemon.supervisor
-;  (:import [backtype.storm.scheduler ISupervisor])
-;  (:use [backtype.storm bootstrap])
-;  (:use [backtype.storm.daemon common])
-;  (:require [backtype.storm.daemon [worker :as worker]])
-;  (:gen-class
-;    :methods [^{:static true} [launch [backtype.storm.scheduler.ISupervisor] void]]))
-;
-;(bootstrap)
-;
-;(defmulti download-storm-code cluster-mode)
-;(defmulti launch-worker (fn [supervisor & _] (cluster-mode (:conf supervisor))))
-;
-;;; used as part of a map from port to this
-;(defrecord LocalAssignment [storm-id executors])
-;
-;(defprotocol SupervisorDaemon
-;  (get-id [this])
-;  (get-conf [this])
-;  (shutdown-all-workers [this])
-;  )
-;
-;(defn- assignments-snapshot [storm-cluster-state callback]
-;  (let [storm-ids (.assignments storm-cluster-state callback)]
-;     (->> (dofor [sid storm-ids] {sid (.assignment-info storm-cluster-state sid callback)})
-;          (apply merge)
-;          (filter-val not-nil?)
-;          )))
-;
-;(defn- read-my-executors [assignments-snapshot storm-id assignment-id]
-;  (let [assignment (get assignments-snapshot storm-id)
-;        my-executors (filter (fn [[_ [node _]]] (= node assignment-id))
-;                           (:executor->node+port assignment))
-;        port-executors (apply merge-with
-;                          concat
-;                          (for [[executor [_ port]] my-executors]
-;                            {port [executor]}
-;                            ))]
-;    (into {} (for [[port executors] port-executors]
-;               ;; need to cast to int b/c it might be a long (due to how yaml parses things)
-;               ;; doall is to avoid serialization/deserialization problems with lazy seqs
-;               [(Integer. port) (LocalAssignment. storm-id (doall executors))]
-;               ))))
-;
-;
-;(defn- read-assignments
-;  "Returns map from port to struct containing :storm-id and :executors"
-;  [assignments-snapshot assignment-id]
-;  (->> (dofor [sid (keys assignments-snapshot)] (read-my-executors assignments-snapshot sid assignment-id))
-;       (apply merge-with (fn [& ignored] (throw-runtime "Should not have multiple topologies assigned to one port")))))
-;
-;(defn- read-storm-code-locations
-;  [assignments-snapshot]
-;  (map-val :master-code-dir assignments-snapshot))
-;
-;(defn- read-downloaded-storm-ids [conf]
-;  (map #(url-decode %) (read-dir-contents (supervisor-stormdist-root conf)))
-;  )
-;
-;(defn read-worker-heartbeat [conf id]
-;  (let [local-state (worker-state conf id)]
-;    (.get local-state LS-WORKER-HEARTBEAT)
-;    ))
-;
-;
-;(defn my-worker-ids [conf]
-;  (read-dir-contents (worker-root conf)))
-;
-;(defn read-worker-heartbeats
-;  "Returns map from worker id to heartbeat"
-;  [conf]
-;  (let [ids (my-worker-ids conf)]
-;    (into {}
-;      (dofor [id ids]
-;        [id (read-worker-heartbeat conf id)]))
-;    ))
-;
-;
-;(defn matches-an-assignment? [worker-heartbeat assigned-executors]
-;  (let [local-assignment (assigned-executors (:port worker-heartbeat))]
-;    (and local-assignment
-;         (= (:storm-id worker-heartbeat) (:storm-id local-assignment))
-;         (= (disj (set (:executors worker-heartbeat)) Constants/SYSTEM_EXECUTOR_ID)
-;            (set (:executors local-assignment))))))
-;
-;(defn read-allocated-workers
-;  "Returns map from worker id to worker heartbeat. if the heartbeat is nil, then the worker is dead (timed out or never wrote heartbeat)"
-;  [supervisor assigned-executors now]
-;  (let [conf (:conf supervisor)
-;        ^LocalState local-state (:local-state supervisor)
-;        id->heartbeat (read-worker-heartbeats conf)
-;        approved-ids (set (keys (.get local-state LS-APPROVED-WORKERS)))]
-;    (into
-;     {}
-;     (dofor [[id hb] id->heartbeat]
-;            (let [state (cond
-;                         (not hb)
-;                           :not-started
-;                         (or (not (contains? approved-ids id))
-;                             (not (matches-an-assignment? hb assigned-executors)))
-;                           :disallowed
-;                         (> (- now (:time-secs hb))
-;                            (conf SUPERVISOR-WORKER-TIMEOUT-SECS))
-;                           :timed-out
-;                         true
-;                           :valid)]
-;              (log-debug "Worker " id " is " state ": " (pr-str hb) " at supervisor time-secs " now)
-;              [id [state hb]]
-;              ))
-;     )))
-;
-;(defn- wait-for-worker-launch [conf id start-time]
-;  (let [state (worker-state conf id)]
-;    (loop []
-;      (let [hb (.get state LS-WORKER-HEARTBEAT)]
-;        (when (and
-;               (not hb)
-;               (<
-;                (- (current-time-secs) start-time)
-;                (conf SUPERVISOR-WORKER-START-TIMEOUT-SECS)
-;                ))
-;          (log-message id " still hasn't started")
-;          (Time/sleep 500)
-;          (recur)
-;          )))
-;    (when-not (.get state LS-WORKER-HEARTBEAT)
-;      (log-message "Worker " id " failed to start")
-;      )))
-;
-;(defn- wait-for-workers-launch [conf ids]
-;  (let [start-time (current-time-secs)]
-;    (doseq [id ids]
-;      (wait-for-worker-launch conf id start-time))
-;    ))
-;
-;(defn generate-supervisor-id []
-;  (uuid))
-;
-;(defn try-cleanup-worker [conf id]
-;  (try
-;    (rmr (worker-heartbeats-root conf id))
-;    ;; this avoids a race condition with worker or subprocess writing pid around same time
-;    (rmpath (worker-pids-root conf id))
-;    (rmpath (worker-root conf id))
-;  (catch RuntimeException e
-;    (log-warn-error e "Failed to cleanup worker " id ". Will retry later")
-;    )
-;  (catch java.io.FileNotFoundException e (log-message (.getMessage e)))
-;  (catch java.io.IOException e (log-message (.getMessage e)))
-;    ))
-;
-;(defn shutdown-worker [supervisor id]
-;  (log-message "Shutting down " (:supervisor-id supervisor) ":" id)
-;  (let [conf (:conf supervisor)
-;        pids (read-dir-contents (worker-pids-root conf id))
-;        thread-pid (@(:worker-thread-pids-atom supervisor) id)]
-;    (when thread-pid
-;      (psim/kill-process thread-pid))
-;    (doseq [pid pids]
-;      (ensure-process-killed! pid)
-;      (try
-;        (rmpath (worker-pid-path conf id pid))
-;        (catch Exception e)) ;; on windows, the supervisor may still holds the lock on the worker directory
-;      )
-;    (try-cleanup-worker conf id))
-;  (log-message "Shut down " (:supervisor-id supervisor) ":" id))
-;
-;(defn supervisor-data [conf shared-context ^ISupervisor isupervisor]
-;  {:conf conf
-;   :shared-context shared-context
-;   :isupervisor isupervisor
-;   :active (atom true)
-;   :uptime (uptime-computer)
-;   :worker-thread-pids-atom (atom {})
-;   :storm-cluster-state (cluster/mk-storm-cluster-state conf)
-;   :local-state (supervisor-state conf)
-;   :supervisor-id (.getSupervisorId isupervisor)
-;   :assignment-id (.getAssignmentId isupervisor)
-;   :my-hostname (if (contains? conf STORM-LOCAL-HOSTNAME)
-;                  (conf STORM-LOCAL-HOSTNAME)
-;                  (local-hostname))
-;   :curr-assignment (atom nil) ;; used for reporting used ports when heartbeating
-;   :timer (mk-timer :kill-fn (fn [t]
-;                               (log-error t "Error when processing event")
-;                               (halt-process! 20 "Error when processing an event")
-;                               ))
-;   })
-;
-;(defn sync-processes [supervisor]
-;  (let [conf (:conf supervisor)
-;        ^LocalState local-state (:local-state supervisor)
-;        assigned-executors (defaulted (.get local-state LS-LOCAL-ASSIGNMENTS) {})
-;        now (current-time-secs)
-;        allocated (read-allocated-workers supervisor assigned-executors now)
-;        keepers (filter-val
-;                 (fn [[state _]] (= state :valid))
-;                 allocated)
-;        keep-ports (set (for [[id [_ hb]] keepers] (:port hb)))
-;        reassign-executors (select-keys-pred (complement keep-ports) assigned-executors)
-;        new-worker-ids (into
-;                        {}
-;                        (for [port (keys reassign-executors)]
-;                          [port (uuid)]))
-;        ]
-;    ;; 1. to kill are those in allocated that are dead or disallowed
-;    ;; 2. kill the ones that should be dead
-;    ;;     - read pids, kill -9 and individually remove file
-;    ;;     - rmr heartbeat dir, rmdir pid dir, rmdir id dir (catch exception and log)
-;    ;; 3. of the rest, figure out what assignments aren't yet satisfied
-;    ;; 4. generate new worker ids, write new "approved workers" to LS
-;    ;; 5. create local dir for worker id
-;    ;; 5. launch new workers (give worker-id, port, and supervisor-id)
-;    ;; 6. wait for workers launch
-;
-;    (log-debug "Syncing processes")
-;    (log-debug "Assigned executors: " assigned-executors)
-;    (log-debug "Allocated: " allocated)
-;    (doseq [[id [state heartbeat]] allocated]
-;      (when (not= :valid state)
-;        (log-message
-;         "Shutting down and clearing state for id " id
-;         ". Current supervisor time: " now
-;         ". State: " state
-;         ", Heartbeat: " (pr-str heartbeat))
-;        (shutdown-worker supervisor id)
-;        ))
-;    (doseq [id (vals new-worker-ids)]
-;      (local-mkdirs (worker-pids-root conf id)))
-;    (.put local-state LS-APPROVED-WORKERS
-;          (merge
-;           (select-keys (.get local-state LS-APPROVED-WORKERS)
-;                        (keys keepers))
-;           (zipmap (vals new-worker-ids) (keys new-worker-ids))
-;           ))
-;    (wait-for-workers-launch
-;     conf
-;     (dofor [[port assignment] reassign-executors]
-;       (let [id (new-worker-ids port)]
-;         (log-message "Launching worker with assignment "
-;                      (pr-str assignment)
-;                      " for this supervisor "
-;                      (:supervisor-id supervisor)
-;                      " on port "
-;                      port
-;                      " with id "
-;                      id
-;                      )
-;         (launch-worker supervisor
-;                        (:storm-id assignment)
-;                        port
-;                        id)
-;         id)))
-;    ))
-;
-;(defn assigned-storm-ids-from-port-assignments [assignment]
-;  (->> assignment
-;       vals
-;       (map :storm-id)
-;       set))
-;
-;(defn shutdown-disallowed-workers [supervisor]
-;  (let [conf (:conf supervisor)
-;        ^LocalState local-state (:local-state supervisor)
-;        assigned-executors (defaulted (.get local-state LS-LOCAL-ASSIGNMENTS) {})
-;        now (current-time-secs)
-;        allocated (read-allocated-workers supervisor assigned-executors now)
-;        disallowed (keys (filter-val
-;                                  (fn [[state _]] (= state :disallowed))
-;                                  allocated))]
-;    (log-debug "Allocated workers " allocated)
-;    (log-debug "Disallowed workers " disallowed)
-;    (doseq [id disallowed]
-;      (shutdown-worker supervisor id))
-;    ))
-;
-;(defn mk-synchronize-supervisor [supervisor sync-processes event-manager processes-event-manager]
-;  (fn this []
-;    (let [conf (:conf supervisor)
-;          storm-cluster-state (:storm-cluster-state supervisor)
-;          ^ISupervisor isupervisor (:isupervisor supervisor)
-;          ^LocalState local-state (:local-state supervisor)
-;          sync-callback (fn [& ignored] (.add event-manager this))
-;          assignments-snapshot (assignments-snapshot storm-cluster-state sync-callback)
-;          storm-code-map (read-storm-code-locations assignments-snapshot)
-;          downloaded-storm-ids (set (read-downloaded-storm-ids conf))
-;          all-assignment (read-assignments
-;                           assignments-snapshot
-;                           (:assignment-id supervisor))
-;          new-assignment (->> all-assignment
-;                              (filter-key #(.confirmAssigned isupervisor %)))
-;          assigned-storm-ids (assigned-storm-ids-from-port-assignments new-assignment)
-;          existing-assignment (.get local-state LS-LOCAL-ASSIGNMENTS)]
-;      (log-debug "Synchronizing supervisor")
-;      (log-debug "Storm code map: " storm-code-map)
-;      (log-debug "Downloaded storm ids: " downloaded-storm-ids)
-;      (log-debug "All assignment: " all-assignment)
-;      (log-debug "New assignment: " new-assignment)
-;
-;      ;; download code first
-;      ;; This might take awhile
-;      ;;   - should this be done separately from usual monitoring?
-;      ;; should we only download when topology is assigned to this supervisor?
-;      (doseq [[storm-id master-code-dir] storm-code-map]
-;        (when (and (not (downloaded-storm-ids storm-id))
-;                   (assigned-storm-ids storm-id))
-;          (log-message "Downloading code for storm id "
-;             storm-id
-;             " from "
-;             master-code-dir)
-;          (download-storm-code conf storm-id master-code-dir)
-;          (log-message "Finished downloading code for storm id "
-;             storm-id
-;             " from "
-;             master-code-dir)
-;          ))
-;
-;      (log-debug "Writing new assignment "
-;                 (pr-str new-assignment))
-;      (doseq [p (set/difference (set (keys existing-assignment))
-;                                (set (keys new-assignment)))]
-;        (.killedWorker isupervisor (int p)))
-;      (.assigned isupervisor (keys new-assignment))
-;      (.put local-state
-;            LS-LOCAL-ASSIGNMENTS
-;            new-assignment)
-;      (reset! (:curr-assignment supervisor) new-assignment)
-;      ;; remove any downloaded code that's no longer assigned or active
-;      ;; important that this happens after setting the local assignment so that
-;      ;; synchronize-supervisor doesn't try to launch workers for which the
-;      ;; resources don't exist
-;      (if on-windows? (shutdown-disallowed-workers supervisor))
-;      (doseq [storm-id downloaded-storm-ids]
-;        (when-not (assigned-storm-ids storm-id)
-;          (log-message "Removing code for storm id "
-;                       storm-id)
-;          (try
-;            (rmr (supervisor-stormdist-root conf storm-id))
-;            (catch Exception e (log-message (.getMessage e))))
-;          ))
-;      (.add processes-event-manager sync-processes)
-;      )))
-;
-;;; in local state, supervisor stores who its current assignments are
-;;; another thread launches events to restart any dead processes if necessary
-;(defserverfn mk-supervisor [conf shared-context ^ISupervisor isupervisor]
-;  (log-message "Starting Supervisor with conf " conf)
-;  (.prepare isupervisor conf (supervisor-isupervisor-dir conf))
-;  (FileUtils/cleanDirectory (File. (supervisor-tmp-dir conf)))
-;  (let [supervisor (supervisor-data conf shared-context isupervisor)
-;        [event-manager processes-event-manager :as managers] [(event/event-manager false) (event/event-manager false)]
-;        sync-processes (partial sync-processes supervisor)
-;        synchronize-supervisor (mk-synchronize-supervisor supervisor sync-processes event-manager processes-event-manager)
-;        heartbeat-fn (fn [] (.supervisor-heartbeat!
-;                               (:storm-cluster-state supervisor)
-;                               (:supervisor-id supervisor)
-;                               (SupervisorInfo. (current-time-secs)
-;                                                (:my-hostname supervisor)
-;                                                (:assignment-id supervisor)
-;                                                (keys @(:curr-assignment supervisor))
-;                                                ;; used ports
-;                                                (.getMetadata isupervisor)
-;                                                (conf SUPERVISOR-SCHEDULER-META)
-;                                                ((:uptime supervisor)))))]
-;    (heartbeat-fn)
-;    ;; should synchronize supervisor so it doesn't launch anything after being down (optimization)
-;    (schedule-recurring (:timer supervisor)
-;                        0
-;                        (conf SUPERVISOR-HEARTBEAT-FREQUENCY-SECS)
-;                        heartbeat-fn)
-;    (when (conf SUPERVISOR-ENABLE)
-;      ;; This isn't strictly necessary, but it doesn't hurt and ensures that the machine stays up
-;      ;; to date even if callbacks don't all work exactly right
-;      (schedule-recurring (:timer supervisor) 0 10 (fn [] (.add event-manager synchronize-supervisor)))
-;      (schedule-recurring (:timer supervisor)
-;                          0
-;                          (conf SUPERVISOR-MONITOR-FREQUENCY-SECS)
-;                          (fn [] (.add processes-event-manager sync-processes))))
-;    (log-message "Starting supervisor with id " (:supervisor-id supervisor) " at host " (:my-hostname supervisor))
-;    (reify
-;     Shutdownable
-;     (shutdown [this]
-;               (log-message "Shutting down supervisor " (:supervisor-id supervisor))
-;               (reset! (:active supervisor) false)
-;               (cancel-timer (:timer supervisor))
-;               (.shutdown event-manager)
-;               (.shutdown processes-event-manager)
-;               (.disconnect (:storm-cluster-state supervisor)))
-;     SupervisorDaemon
-;     (get-conf [this]
-;       conf)
-;     (get-id [this]
-;       (:supervisor-id supervisor))
-;     (shutdown-all-workers [this]
-;       (let [ids (my-worker-ids conf)]
-;         (doseq [id ids]
-;           (shutdown-worker supervisor id)
-;           )))
-;     DaemonCommon
-;     (waiting? [this]
-;       (or (not @(:active supervisor))
-;           (and
-;            (timer-waiting? (:timer supervisor))
-;            (every? (memfn waiting?) managers)))
-;           ))))
-;
-;(defn kill-supervisor [supervisor]
-;  (.shutdown supervisor)
-;  )
-;
-;;; distributed implementation
-;
-;(defmethod download-storm-code
-;    :distributed [conf storm-id master-code-dir]
-;    ;; Downloading to permanent location is atomic
-;    (let [tmproot (str (supervisor-tmp-dir conf) file-path-separator (uuid))
-;          stormroot (supervisor-stormdist-root conf storm-id)]
-;      (FileUtils/forceMkdir (File. tmproot))
-;
-;      (Utils/downloadFromMaster conf (master-stormjar-path master-code-dir) (supervisor-stormjar-path tmproot))
-;      (Utils/downloadFromMaster conf (master-stormcode-path master-code-dir) (supervisor-stormcode-path tmproot))
-;      (Utils/downloadFromMaster conf (master-stormconf-path master-code-dir) (supervisor-stormconf-path tmproot))
-;      (extract-dir-from-jar (supervisor-stormjar-path tmproot) RESOURCES-SUBDIR tmproot)
-;      (FileUtils/moveDirectory (File. tmproot) (File. stormroot))
-;      ))
-;
-;(defn jlp [stormroot conf]
-;  (let [resource-root (str stormroot File/separator RESOURCES-SUBDIR)
-;        os (clojure.string/replace (System/getProperty "os.name") #"\s+" "_")
-;        arch (System/getProperty "os.arch")
-;        arch-resource-root (str resource-root File/separator os "-" arch)]
-;    (str arch-resource-root File/pathSeparator resource-root File/pathSeparator (conf JAVA-LIBRARY-PATH))))
-;
-;(defn- substitute-worker-childopts [value port]
-;  (let [sub-fn (fn [s] (.replaceAll s "%ID%" (str port)))]
-;    (if (list? value)
-;      (map sub-fn value)
-;      (-> value sub-fn (.split " ")))))
-;
-;(defn java-cmd []
-;  (let [java-home (.get (System/getenv) "JAVA_HOME")]
-;    (if (nil? java-home)
-;      "java"
-;      (str java-home file-path-separator "bin" file-path-separator "java")
-;      )))
-;
-;
-;(defmethod launch-worker
-;    :distributed [supervisor storm-id port worker-id]
-;    (let [conf (:conf supervisor)
-;          storm-home (System/getProperty "storm.home")
-;          stormroot (supervisor-stormdist-root conf storm-id)
-;          jlp (jlp stormroot conf)
-;          stormjar (supervisor-stormjar-path stormroot)
-;          storm-conf (read-supervisor-storm-conf conf storm-id)
-;          classpath (add-to-classpath (current-classpath) [stormjar])
-;          worker-childopts (when-let [s (conf WORKER-CHILDOPTS)]
-;                             (substitute-worker-childopts s port))
-;          topo-worker-childopts (when-let [s (storm-conf TOPOLOGY-WORKER-CHILDOPTS)]
-;                                  (substitute-worker-childopts s port))
-;          logfilename (str "worker-" port ".log")
-;          command (concat
-;                    [(java-cmd) "-server"]
-;                    worker-childopts
-;                    topo-worker-childopts
-;                    [(str "-Djava.library.path=" jlp)
-;                     (str "-Dlogfile.name=" logfilename)
-;                     (str "-Dstorm.home=" storm-home)
-;                     (str "-Dlogback.configurationFile=" storm-home "/logback/cluster.xml")
-;                     (str "-Dstorm.id=" storm-id)
-;                     (str "-Dworker.id=" worker-id)
-;                     (str "-Dworker.port=" port)
-;                     "-cp" classpath
-;                     "backtype.storm.daemon.worker"
-;                     storm-id
-;                     (:assignment-id supervisor)
-;                     port
-;                     worker-id])
-;          command (->> command (map str) (filter (complement empty?)))
-;          shell-cmd (->> command
-;                         (map #(str \' (clojure.string/escape % {\' "\\'"}) \'))
-;                         (clojure.string/join " "))]
-;      (log-message "Launching worker with command: " shell-cmd)
-;      (launch-process command :environment {"LD_LIBRARY_PATH" jlp})
-;      ))
-;
-;;; local implementation
-;
-;(defn resources-jar []
-;  (->> (.split (current-classpath) File/pathSeparator)
-;       (filter #(.endsWith  % ".jar"))
-;       (filter #(zip-contains-dir? % RESOURCES-SUBDIR))
-;       first ))
-;
-;(defmethod download-storm-code
-;    :local [conf storm-id master-code-dir]
-;  (let [stormroot (supervisor-stormdist-root conf storm-id)]
-;      (FileUtils/copyDirectory (File. master-code-dir) (File. stormroot))
-;      (let [classloader (.getContextClassLoader (Thread/currentThread))
-;            resources-jar (resources-jar)
-;            url (.getResource classloader RESOURCES-SUBDIR)
-;            target-dir (str stormroot file-path-separator RESOURCES-SUBDIR)]
-;            (cond
-;              resources-jar
-;              (do
-;                (log-message "Extracting resources from jar at " resources-jar " to " target-dir)
-;                (extract-dir-from-jar resources-jar RESOURCES-SUBDIR stormroot))
-;              url
-;              (do
-;                (log-message "Copying resources at " (str url) " to " target-dir)
-;                (FileUtils/copyDirectory (File. (.getFile url)) (File. target-dir))
-;                ))
-;            )))
-;
-;(defmethod launch-worker
-;    :local [supervisor storm-id port worker-id]
-;    (let [conf (:conf supervisor)
-;          pid (uuid)
-;          worker (worker/mk-worker conf
-;                                   (:shared-context supervisor)
-;                                   storm-id
-;                                   (:assignment-id supervisor)
-;                                   port
-;                                   worker-id)]
-;      (psim/register-process pid worker)
-;      (swap! (:worker-thread-pids-atom supervisor) assoc worker-id pid)
-;      ))
-;
-;;(defn -launch [supervisor]
-;;  (let [conf (read-storm-config)]
-;;    (validate-distributed-mode! conf)
-;;    (mk-supervisor conf nil supervisor)))
-;
-;(defn standalone-supervisor []
-;  (let [conf-atom (atom nil)
-;        id-atom (atom nil)]
-;    (reify ISupervisor
-;      (prepare [this conf local-dir]
-;        (reset! conf-atom conf)
-;        (let [state (LocalState. local-dir)
-;              curr-id (if-let [id (.get state LS-ID)]
-;                        id
-;                        (generate-supervisor-id))]
-;          (.put state LS-ID curr-id)
-;          (reset! id-atom curr-id))
-;        )
-;      (confirmAssigned [this port]
-;        true)
-;      (getMetadata [this]
-;        (doall (map int (get @conf-atom SUPERVISOR-SLOTS-PORTS))))
-;      (getSupervisorId [this]
-;        @id-atom)
-;      (getAssignmentId [this]
-;        @id-atom)
-;      (killedWorker [this port]
-;        )
-;      (assigned [this ports]
-;        ))))
-;
-;;(defn -main []
-;;  (-launch (standalone-supervisor)))


Message queue: fix retry, backoff keys cleanup

--- src/taoensso/carmine/message_queue.clj
+++ src/taoensso/carmine/message_queue.clj
@@ -134,6 +134,8 @@
         redis.call('srem', _:qk-recently-done, mid)
         redis.call('hdel', _:qk-messages,      mid)
         redis.call('hdel', _:qk-locks,         mid)
+        redis.call('hdel', _:qk-nretries,      mid)
+        redis.call('hdel', _:qk-backoffs,      mid)
         return nil
       end


returning a 200 status code for the root url, making the first fact pass

--- src/bitfondue/handler.clj
+++ src/bitfondue/handler.clj
@@ -1,4 +1,11 @@
-(ns bitfondue.handler)
+(ns bitfondue.handler
+  (:require (compojure [core :refer :all]
+                       [route :as route])))
+
+(defroutes app-routes
+  (GET "/" [] "Success!"))
+
+(def app app-routes)

 (defn foo
   "I don't do a whole lot."


[STORM-1407] fix authorize issue for daemon log link in UI

--- storm-core/src/clj/backtype/storm/daemon/logviewer.clj
+++ storm-core/src/clj/backtype/storm/daemon/logviewer.clj
@@ -439,49 +439,43 @@
       (unauthorized-user-html user))))

 (defn daemonlog-page [fname start length grep user root-dir]
-  (if (or (blank? (*STORM-CONF* UI-FILTER))
-        (authorized-log-user? user fname *STORM-CONF*))
-    (let [file (.getCanonicalFile (File. root-dir fname))
-          file-length (.length file)
-          path (.getCanonicalPath file)
-          zip-file? (.endsWith path ".gz")]
-      (if (and (= (.getCanonicalFile (File. root-dir))
-                 (.getParentFile file))
-            (.exists file))
-        (let [file-length (if zip-file? (Utils/zipFileSize (clojure.java.io/file path)) (.length (clojure.java.io/file path)))
-              length (if length
-                       (min 10485760 length)
-                       default-bytes-per-page)
-              log-files (into [] (filter #(.isFile %) (.listFiles (File. root-dir)))) ;all types of files included
-              files-str (for [file log-files]
-                          (.getName file))
-              reordered-files-str (conj (filter #(not= fname %) files-str) fname)
-              log-string (escape-html
-                           (if (is-txt-file fname)
-                             (if start
-                               (page-file path start length)
-                               (page-file path length))
-                             "This is a binary file and cannot display! You may download the full file."))
-              start (or start (- file-length length))]
-          (if grep
-            (html [:pre#logContent
-                   (if grep
-                     (->> (.split log-string "\n")
-                       (filter #(.contains % grep))
-                       (string/join "\n"))
-                     log-string)])
-            (let [pager-data (if (is-txt-file fname) (pager-links fname start length file-length) nil)]
-              (html (concat (log-file-selection-form reordered-files-str "daemonlog") ; list all daemon logs
-                      pager-data
-                      (daemon-download-link fname)
-                      [[:pre#logContent log-string]]
-                      pager-data)))))
-        (-> (resp/response "Page not found")
-          (resp/status 404))))
-    (if (nil? (get-log-user-group-whitelist fname))
+  (let [file (.getCanonicalFile (File. root-dir fname))
+        file-length (.length file)
+        path (.getCanonicalPath file)
+        zip-file? (.endsWith path ".gz")]
+    (if (and (= (.getCanonicalFile (File. root-dir))
+                (.getParentFile file))
+             (.exists file))
+      (let [file-length (if zip-file? (Utils/zipFileSize (clojure.java.io/file path)) (.length (clojure.java.io/file path)))
+            length (if length
+                     (min 10485760 length)
+                     default-bytes-per-page)
+            log-files (into [] (filter #(.isFile %) (.listFiles (File. root-dir)))) ;all types of files included
+            files-str (for [file log-files]
+                        (.getName file))
+            reordered-files-str (conj (filter #(not= fname %) files-str) fname)
+            log-string (escape-html
+                         (if (is-txt-file fname)
+                           (if start
+                             (page-file path start length)
+                             (page-file path length))
+                           "This is a binary file and cannot display! You may download the full file."))
+            start (or start (- file-length length))]
+        (if grep
+          (html [:pre#logContent
+                 (if grep
+                   (->> (.split log-string "\n")
+                        (filter #(.contains % grep))
+                        (string/join "\n"))
+                   log-string)])
+          (let [pager-data (if (is-txt-file fname) (pager-links fname start length file-length) nil)]
+            (html (concat (log-file-selection-form reordered-files-str "daemonlog") ; list all daemon logs
+                          pager-data
+                          (daemon-download-link fname)
+                          [[:pre#logContent log-string]]
+                          pager-data)))))
       (-> (resp/response "Page not found")
-        (resp/status 404))
-      (unauthorized-user-html user))))
+          (resp/status 404)))))

 (defn download-log-file [fname req resp user ^String root-dir]
   (let [file (.getCanonicalFile (File. root-dir fname))]


Add backward compatibility alias on crypto ns.

--- src/buddy/core/crypto.clj
+++ src/buddy/core/crypto.clj
@@ -130,6 +130,12 @@
       (process-block! [_ input]
         (stream-cipher-process! engine input)))))

+(defn process-bytes!
+  "Backward compatibility alias for `process-block!`
+  function. This function will be removed in the
+  next stable version."
+  [engine input]
+  (process-block! engine input))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; High level api.


Fix some references in leibniz.cljs

Fix some references in leibniz.cljs

1. Reorder in order of usage instead of top-down.
2. Fix up some variable names that I forgot to change.

It still doesn't work, though! Doesn't even compile yet!

--- src/chapter3/leibniz.cljs
+++ src/chapter3/leibniz.cljs
@@ -1,10 +1,9 @@
 (ns chapter3.leibniz
-  (:refer chapter3.match :only [match atom?]))
+  (:refer chapter3.match :only [match match-state atom?]))
 (defn nested-diff-sum? [d v]
-  (when-let [d2 (and (not (atom? v)) (match '(+ (? e1) (? e2)) v))]
-    (merge d d2)))
+  (and (not (atom? v)) (match '(+ (? e1) (? e2)) v)))
 (defn nested-diff-x1? [d v]
-  (assoc d :e1 v))
+  {:e1 v})
 (defn nested-diff-x2? [d v]
   (= v (d :e1)))
 (def diff-sum-rule
@@ -19,16 +18,34 @@
    "diff-x-rule"])
 ; other rules go here ...

+; TODO: Clojure HAS to have a class/record facility to do this...
+(def rule-goal first)
+(def rule-pattern second)
+(defn rule-action [rule] (nth rule 2))
+(defn rule-name [rule] (nth rule 3))
 (def rules
   [diff-sum-rule diff-x-rule])
 ;;; control scheme ;;;
 ; (I don't know--that's just what the book calls it)
-(defn control []
-  ; TODO: current-formula is unbound
-  (loop [current-formula '()]
-      (if-let [new-formula (try-rules rules current-formula)]
-        (recur new-formula)
-        current-formula)))
+(declare try-rule1)
+(defn try-rule-on-list [rule expressions]
+  (if (empty? expressions)
+    nil
+    (if-let [temp (try-rule1 rule (first expressions))]
+      (cons temp (rest expressions))
+      (when-let [temp (try-rule-on-list rule (rest expressions))]
+        (cons (first expressions) temp)))))
+(defn fire [rule]
+  (println (rule-name rule) " fires.")
+  ((rule-action rule)))
+(defn try-rule1 [rule expression]
+  (cond
+    (atom? expression) nil
+    (match-state (rule-pattern rule) expression) (fire rule)
+    :else (try-rule-on-list rule expression)))
+(defn try-rule [rule expression]
+  (if (= current-goal (rule-goal rule))
+    (try-rule1 rule expression)))
 (defn try-rules [rules formula]
   (loop [rules-left rules]
     (cond
@@ -37,21 +54,9 @@
       :else (if-let [new-formula (try-rule (first rules-left) formula)]
               new-formula
               (recur (rest rules-left) formula)))))
-(defn try-rule [rule expression]
-  (if (= current-goal (rule-goal rule))
-    (try-rule1 rule expression)))
-(defn try-rule1 [rule expression]
-  (cond
-    (atom? expression) nil
-    (match-state (rule-pattern rule) expression) (fire rule)
-    :else (try-rule-on-list rule expression)))
-(defn try-rule-on-list [rule expressions]
-  (if (empty? expression-list)
-    nil
-    (if-let [temp (try-rule1 rule (first expression-list))]
-      (cons temp (rest expression-list))
-      (when-let [temp (try-rule-on-list rule (rest expression-list))]
-        (cons (first expression-list) temp)))))
-(defn fire [rule]
-  (printfn (rule-name rule) " fires.")
-  ((rule-action rule)))
+(defn control []
+  ; TODO: current-formula is unbound
+  (loop [current-formula '()]
+      (if-let [new-formula (try-rules rules current-formula)]
+        (recur new-formula)
+        current-formula)))


add comment for timbre conf

add comment for timbre conf

--- src/chat/client/sync.cljs
+++ src/chat/client/sync.cljs
@@ -5,6 +5,7 @@
             [chat.client.store :as store]
             [goog.string.format]))

+; Change to :debug to get detailed info in dev
 (timbre/set-level! :info)

 (defn make-socket! []


Cleaned up state machine change logging

Cleaned up state machine change logging

--- src/chicken_coop/core.clj
+++ src/chicken_coop/core.clj
@@ -75,7 +75,6 @@

 (defn trans-sm! [sm m]
-  (log "Running trans-sm! on sm:" sm "with msg:" m)
   (assoc sm :state
     (((:trans sm) (:state sm)) m)))


Include all other methods

Include all other methods

--- src/clj/gtfve/handler.clj
+++ src/clj/gtfve/handler.clj
@@ -1,5 +1,5 @@
 (ns gtfve.handler
-  (:require [compojure.core :refer [GET defroutes]]
+  (:require [compojure.core :refer [GET POST PUT ANY defroutes]]
             [compojure.route :refer [not-found resources]]
             [ring.middleware.defaults :refer [site-defaults wrap-defaults]]
             [selmer.parser :refer [render-file]]


try-catch for Long.

try-catch for Long.

--- src/clj/tictag/server.clj
+++ src/clj/tictag/server.clj
@@ -52,14 +52,14 @@
         (twilio/response "<Response></Response>"))

       ;; maybe command is a long-time itself!
-      (db/is-ping? db (Long. cmd))
+      (try (db/is-ping? db (Long. cmd)) (catch Exception e nil))
       (let [long-time (Long. cmd)
             tags      args]
         (db/add-tags db long-time tags (utils/local-time-from-long long-time)))

       :else
-      (let [tags      args
-            last-ping (db/get-pings (:db db) ["select * from pings order by timestamp desc limit 1"])]
+      (let [tags        args
+            [last-ping] (db/get-pings (:db db) ["select * from pings order by timestamp desc limit 1"])]
         (db/update-tags! db [(assoc last-ping :tags args)])
         (twilio/response
          (format


fix mdi css link

fix mdi css link

--- src/clj/tictag/server.clj
+++ src/clj/tictag/server.clj
@@ -33,7 +33,7 @@
              :type "text/css"}]
      [:link {:rel "stylesheet" :href "//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/css/bootstrap.css"}]
      [:link {:rel "stylesheet" :href "/css/re-com.css"}]
-     [:link {:rel "stylesheet" :href "/css/material-design-iconic-font.min"}]
+     [:link {:rel "stylesheet" :href "/css/material-design-iconic-font.min.css"}]
      [:link {:rel "stylesheet" :href "/css/main.css"}]]
     [:body
      [:div#app]


Added store/fetch functions for local storage

--- src/cljs/drawer/util.cljs
+++ src/cljs/drawer/util.cljs
@@ -70,3 +70,34 @@
   (if (= (type element) js/String)
     (set! (.-innerHTML (element-by-id element)) value)
     (set! (.-innerHTML element) value)))
+
+(defn keywordify
+  "Turns the the keys of
+  given data-structure into
+  keywords."
+  [m]
+  (cond
+    (map? m) (into {} (for [[k v] m] [(keyword k) (keywordify v)]))
+    (coll? m) (vec (map keywordify m))
+    :else m))
+
+(defn store-locally
+  "Stores given object in the
+  javascript localStorage.
+  Use fetch to get it again."
+  [k obj]
+  (.setItem js/localStorage k (js/JSON.stringify (clj->js obj))))
+
+(defn fetch-local
+  "Fetches a locally stored object
+  with given key and converts it
+  into a clojure data-structure."
+  [k default]
+  (let [item (.getItem js/localStorage k)]
+    (if item
+      (-> (.getItem js/localStorage k)
+          (or (js-obj))
+          (js/JSON.parse)
+          (js->clj)
+          (keywordify))
+      default)))


fixed issue with html template alignment

--- src/cljs/josefk/core.cljs
+++ src/cljs/josefk/core.cljs
@@ -383,7 +383,7 @@
                        "+"] " "
                       [:button {:href    "#"
                                 :onClick #(do (butt-stuff "divide"))}
-                       "/"] " "
+                       "/"] " " ]
                       ;[:button {:href    "#"
                       ;          :onClick #(do
                       ;                     (but app-state target-register '.)
@@ -746,13 +746,13 @@
                        (q/text (str "...") (get (line 2) :x) (get (line 2) :y))
                        (q/text (str "(put :r2 (target))") (get (line 3) :x) (get (line 3) :y))
                        (q/text (str "(put " (get-in @keyboard-input [:key-id]) " :r2)") (get (line 4) :x) (get (line 4) :y))
-                       (q/text (str "=> 'ok") (get (line 2) :x) (get (line 2) :y))
-                       (= code 3) (do
-                                    (q/text (str "loading instr reg 3...") (get (line 1) :x) (get (line 1) :y))
-                                    (q/text (str "...") (get (line 2) :x) (get (line 2) :y))
-                                    (q/text (str "(eval '(put (key) (target))") (get (line 3) :x) (get (line 3) :y))
-                                    (q/text (str "=> (put " (get-in @keyboard-input [:key-id]) " " (translate-target) ")") (get (line 4) :x) (get (line 4) :y))))))
-  )
+                       (q/text (str "=> 'ok") (get (line 2) :x) (get (line 2) :y)))
+          (= code 3) (do
+                       (q/text (str "loading instr reg 3...") (get (line 1) :x) (get (line 1) :y))
+                       (q/text (str "...") (get (line 2) :x) (get (line 2) :y))
+                       (q/text (str "(eval '(put (key) (target))") (get (line 3) :x) (get (line 3) :y))
+                       (q/text (str "=> (put " (get-in @keyboard-input [:key-id]) " " (translate-target) ")") (get (line 4) :x) (get (line 4) :y))))))
+
                      ;;1 push to empty y register
                      ;(fn [e] (do (divert-route :current-target :y)
                      ;            (put e :current-target)))
@@ -882,3 +882,4 @@
     ;(add-watch result :on-change (fn [_ _ _ _] (render!)))

     (render!)
+


Allow last character of search input to be ignored, so that Korean input doesn't cause flicker while typing

--- src/cljs/kulive/core.cljs
+++ src/cljs/kulive/core.cljs
@@ -61,21 +61,6 @@

 ;; Views -------------------------

-(defn matches-query?
-  [search-input course]
-  (let [matches-input? (fn [key]
-                         (re-find (re-pattern (string/lower-case search-input))
-                                  (string/lower-case (apply str (val course)))))]
-    (if (= "" search-input)
-      true
-      (or (matches-input? :name)
-          (matches-input? :number)
-          (matches-input? :prof)
-          (matches-input? :time)
-          (matches-input? :credits)
-          (matches-input? :type)
-          ))))
-
 (defn search-component
   []
   (let [search-input (re-frame/subscribe [:search-input])]
@@ -90,6 +75,27 @@
            :on-change #(re-frame/dispatch
                         [:search-input-entered (-> % .-target .-value)])
            :placeholder "Course ID, Title, Professor, etc..."}]]]])))
+
+(defn matches-query?
+  [search-input course]
+  (let [matches-input? (fn [key]
+                         (or (re-find
+                              (re-pattern (string/lower-case search-input))
+                              (string/lower-case (apply str (val course))))
+                             (re-find
+                              (re-pattern (string/lower-case
+                                           (apply str (butlast search-input))))
+                              (string/lower-case (apply str (val course))))
+                             ))]
+    (if (= "" search-input)
+      true
+      (or (matches-input? :name)
+          (matches-input? :number)
+          (matches-input? :prof)
+          (matches-input? :time)
+          (matches-input? :credits)
+          (matches-input? :type)
+          ))))

 (defn course-component
   "Individual course in search result list"


some setup

some setup

--- src/cljs/simlab/alfa.cljs
+++ src/cljs/simlab/alfa.cljs
@@ -2,7 +2,7 @@
   (:require
    [quil.core :as q :include-macros true]
    [quil.middleware :as m]))
-
+
 (defn setup []
   ;; Set frame rate to 30 frames per second.
   (q/frame-rate 30)
@@ -41,9 +41,3 @@
   :update update-state
   :draw draw-state
   :middleware [m/fun-mode])
-
-
-
-
-
-


Add more examples

Add more examples

--- src/clojure/cfbt/ch04.clj
+++ src/clojure/cfbt/ch04.clj
@@ -88,4 +88,24 @@
 (take-while #(< (:month %) 4)
             (drop-while #(< (:month %) 2) food-journal)) ;; ({:month 2, :day 1, :human 4.9, :critter 2.1} {:month 2, :day 2, :human 5.0, :critter 2.5} {:month 3, :day 1, :human 4.2, :critter 3.3} {:month 3, :day 2, :human 4.0, :critter 3.8})

-;; Filter and some! (TBC)
+;; Filter and some
+
+(filter #(< (:human %) 5) food-journal) ;; ({:month 2, :day 1, :human 4.9, :critter 2.1} {:month 3, :day 1, :human 4.2, :critter 3.3} {:month 3, :day 2, :human 4.0, :critter 3.8} {:month 4, :day 1, :human 3.7, :critter 3.9} {:month 4, :day 2, :human 3.7, :critter 3.6})
+
+(filter #(< (:month %) 3) food-journal) ;; ({:month 1, :day 1, :human 5.3, :critter 2.3} {:month 1, :day 2, :human 5.1, :critter 2.0} {:month 2, :day 1, :human 4.9, :critter 2.1} {:month 2, :day 2, :human 5.0, :critter 2.5})
+
+(some #(> (:critter %) 5) food-journal) ;; nil
+
+(some #(> (:critter %) 3) food-journal) ;; true
+
+(some #(and (> (:critter %) 3) %) food-journal) ;; {:month 3, :day 1, :human 4.2, :critter 3.3}
+
+;; sort and sort-by
+(sort [3 1 2]) ;; (1 2 3)
+
+(sort-by count ["aaa" "c" "bb"]) ;; ("c" "bb" "aaa")
+
+;; concat
+(concat [1 2] [3 4]) ;;(1 2 3 4)
+
+;; Lazy sequences


Cleanup.  Thanks, #clojure.

Cleanup.  Thanks, #clojure.

--- src/clojurecraft/core.clj
+++ src/clojurecraft/core.clj
@@ -294,29 +294,29 @@
   (doto (:out @conn) (.flush)))

 (defn write-packet [conn packet-type payload]
-  (cond
-    (= packet-type :keepalive)            (write-packet-handshake conn payload)
-    (= packet-type :handshake)            (write-packet-handshake conn payload)
-    (= packet-type :login)                (write-packet-login conn payload)
-    (= packet-type :chat)                 (write-packet-chat conn payload)
-    (= packet-type :respawn)              (write-packet-respawn conn payload)
-    (= packet-type :player)               (write-packet-player conn payload)
-    (= packet-type :playerposition)       (write-packet-playerposition conn payload)
-    (= packet-type :playerlook)           (write-packet-playerlook conn payload)
-    (= packet-type :playerpositionlook)   (write-packet-playerpositionlook conn payload)
-    (= packet-type :playerdigging)        (write-packet-playerdigging conn payload)
-    (= packet-type :playerblockplacement) (write-packet-playerblockplacement conn payload)
-    (= packet-type :holdingchange)        (write-packet-holdingchange conn payload)
-    (= packet-type :usebed)               (write-packet-usebed conn payload)
-    (= packet-type :animation)            (write-packet-animation conn payload)
-    (= packet-type :entityaction)         (write-packet-entityaction conn payload)
-    (= packet-type :pickupspawn)          (write-packet-pickupspawn conn payload)
-    (= packet-type :entitypainting)       (write-packet-entitypainting conn payload)
-    (= packet-type :stanceupdate)         (write-packet-stanceupdate conn payload)
-    (= packet-type :entityvelocity)       (write-packet-entityvelocity conn payload)
-    (= packet-type :attachentity)         (write-packet-attachentity conn payload)
-    (= packet-type :entitymetadata)       (write-packet-entitymetadata conn payload)
-    (= packet-type :multiblockchange)     (write-packet-multiblockchange conn payload)
+  (case packet-type
+    :keepalive            (write-packet-handshake conn payload)
+    :handshake            (write-packet-handshake conn payload)
+    :login                (write-packet-login conn payload)
+    :chat                 (write-packet-chat conn payload)
+    :respawn              (write-packet-respawn conn payload)
+    :player               (write-packet-player conn payload)
+    :playerposition       (write-packet-playerposition conn payload)
+    :playerlook           (write-packet-playerlook conn payload)
+    :playerpositionlook   (write-packet-playerpositionlook conn payload)
+    :playerdigging        (write-packet-playerdigging conn payload)
+    :playerblockplacement (write-packet-playerblockplacement conn payload)
+    :holdingchange        (write-packet-holdingchange conn payload)
+    :usebed               (write-packet-usebed conn payload)
+    :animation            (write-packet-animation conn payload)
+    :entityaction         (write-packet-entityaction conn payload)
+    :pickupspawn          (write-packet-pickupspawn conn payload)
+    :entitypainting       (write-packet-entitypainting conn payload)
+    :stanceupdate         (write-packet-stanceupdate conn payload)
+    :entityvelocity       (write-packet-entityvelocity conn payload)
+    :attachentity         (write-packet-attachentity conn payload)
+    :entitymetadata       (write-packet-entitymetadata conn payload)
+    :multiblockchange     (write-packet-multiblockchange conn payload)

     )
   (flushc conn))
@@ -374,263 +374,263 @@
   nil)

 (defn read-packet-handshake [conn]
-  (-> {}
-    (assoc :hash (-read-string16 conn))))
+  (assoc
+    :hash (-read-string16 conn)))

 (defn read-packet-login [conn]
-  (-> {}
-    (assoc :eid (-read-int conn))
-    (assoc :unknown (-read-string16 conn))
-    (assoc :seed (-read-long conn))
-    (assoc :dimension (-read-byte conn))))
+  (assoc
+    :eid (-read-int conn)
+    :unknown (-read-string16 conn)
+    :seed (-read-long conn)
+    :dimension (-read-byte conn)))

 (defn read-packet-chat [conn]
-  (-> {}
-    (assoc :message (-read-string16 conn))))
+  (assoc
+    :message (-read-string16 conn)))

 (defn read-packet-timeupdate [conn]
-  (-> {}
-    (assoc :time (-read-long conn))))
+  (assoc
+    :time (-read-long conn)))

 (defn read-packet-equipment [conn]
-  (-> {}
-    (assoc :eid (-read-int conn))
-    (assoc :slot (-read-short conn))
-    (assoc :itemid (-read-short conn))
-    (assoc :unknown (-read-short conn))))
+  (assoc
+    :eid (-read-int conn)
+    :slot (-read-short conn)
+    :itemid (-read-short conn)
+    :unknown (-read-short conn)))

 (defn read-packet-spawnposition [conn]
-  (-> {}
-    (assoc :x (-read-int conn))
-    (assoc :y (-read-int conn))
-    (assoc :z (-read-int conn))))
+  (assoc
+    :x (-read-int conn)
+    :y (-read-int conn)
+    :z (-read-int conn)))

 (defn read-packet-useentity [conn]
-  (-> {}
-    (assoc :user (-read-int conn))
-    (assoc :target (-read-int conn))
-    (assoc :leftclick (-read-bool conn))))
+  (assoc
+    :user (-read-int conn)
+    :target (-read-int conn)
+    :leftclick (-read-bool conn)))

 (defn read-packet-updatehealth [conn]
-  (-> {}
-    (assoc :health (-read-short conn))))
+  (assoc
+    :health (-read-short conn)))

 (defn read-packet-respawn [conn]
-  (-> {}
-    (assoc :world (-read-byte conn))))
+  (assoc
+    :world (-read-byte conn)))

 (defn read-packet-playerpositionlook [conn]
-  (-> {}
-    (assoc :x (-read-double conn))
-    (assoc :stance (-read-double conn))
-    (assoc :y (-read-double conn))
-    (assoc :z (-read-double conn))
-    (assoc :yaw (-read-float conn))
-    (assoc :pitch (-read-float conn))
-    (assoc :onground (-read-bool conn))))
+  (assoc
+    :x (-read-double conn)
+    :stance (-read-double conn)
+    :y (-read-double conn)
+    :z (-read-double conn)
+    :yaw (-read-float conn)
+    :pitch (-read-float conn)
+    :onground (-read-bool conn)))

 (defn read-packet-playerdigging [conn]
-  (-> {}
-    (assoc :status (-read-byte conn))
-    (assoc :x (-read-int conn))
-    (assoc :y (-read-byte conn))
-    (assoc :z (-read-int conn))
-    (assoc :face (-read-byte conn))))
+  (assoc
+    :status (-read-byte conn)
+    :x (-read-int conn)
+    :y (-read-byte conn)
+    :z (-read-int conn)
+    :face (-read-byte conn)))

 (defn read-packet-playerblockplacement [conn]
-  (-> {}
-    (assoc :x (-read-int conn))
-    (assoc :y (-read-byte conn))
-    (assoc :z (-read-int conn))
-    (assoc :direction (-read-byte conn))
-    (assoc :id (-read-short conn))
-    (assoc :amount (-read-byte conn))
-    (assoc :damage (-read-short conn))))
+  (assoc
+    :x (-read-int conn)
+    :y (-read-byte conn)
+    :z (-read-int conn)
+    :direction (-read-byte conn)
+    :id (-read-short conn)
+    :amount (-read-byte conn)
+    :damage (-read-short conn)))

 (defn read-packet-holdingchange [conn]
-  (-> {}
-    (assoc :slot (-read-short conn))))
+  (assoc
+    :slot (-read-short conn)))

 (defn read-packet-usebed [conn]
-  (-> {}
-    (assoc :eid (-read-int conn))
-    (assoc :inbed (-read-byte conn))
-    (assoc :x (-read-int conn))
-    (assoc :y (-read-byte conn))
-    (assoc :z (-read-int conn))))
+  (assoc
+    :eid (-read-int conn)
+    :inbed (-read-byte conn)
+    :x (-read-int conn)
+    :y (-read-byte conn)
+    :z (-read-int conn)))

 (defn read-packet-animate [conn]
-  (-> {}
-    (assoc :eid (-read-int conn))
-    (assoc :animate (-read-byte conn))))
+  (assoc
+    :eid (-read-int conn)
+    :animate (-read-byte conn)))

 (defn read-packet-entityaction [conn]
-  (-> {}
-    (assoc :eid (-read-int conn))
-    (assoc :action (-read-byte conn))))
+  (assoc
+    :eid (-read-int conn)
+    :action (-read-byte conn)))

 (defn read-packet-namedentityspawn [conn]
-  (-> {}
-    (assoc :eid (-read-int conn))
-    (assoc :playername (-read-string16 conn))
-    (assoc :x (-read-int conn))
-    (assoc :y (-read-int conn))
-    (assoc :z (-read-int conn))
-    (assoc :rotation (-read-byte conn))
-    (assoc :pitch (-read-byte conn))
-    (assoc :currentitem (-read-short conn))))
+  (assoc
+    :eid (-read-int conn)
+    :playername (-read-string16 conn)
+    :x (-read-int conn)
+    :y (-read-int conn)
+    :z (-read-int conn)
+    :rotation (-read-byte conn)
+    :pitch (-read-byte conn)
+    :currentitem (-read-short conn)))

 (defn read-packet-pickupspawn [conn]
-  (-> {}
-    (assoc :eid (-read-int conn))
-    (assoc :item (-read-short conn))
-    (assoc :count (-read-byte conn))
-    (assoc :damagedata(-read-short conn))
-    (assoc :x (-read-int conn))
-    (assoc :y (-read-int conn))
-    (assoc :z (-read-int conn))
-    (assoc :rotation (-read-byte conn))
-    (assoc :pitch (-read-byte conn))
-    (assoc :roll (-read-byte conn))))
+  (assoc
+    :eid (-read-int conn)
+    :item (-read-short conn)
+    :count (-read-byte conn)
+    :damagedata(-read-short conn)
+    :x (-read-int conn)
+    :y (-read-int conn)
+    :z (-read-int conn)
+    :rotation (-read-byte conn)
+    :pitch (-read-byte conn)
+    :roll (-read-byte conn)))

 (defn read-packet-collectitem [conn]
-  (-> {}
-    (assoc :collectedeid (-read-int conn))
-    (assoc :collectoreid (-read-int conn))))
+  (assoc
+    :collectedeid (-read-int conn)
+    :collectoreid (-read-int conn)))

 (defn read-packet-addobjectvehicle [conn]
-  (let [basepacket (-> {}
-                     (assoc :eid (-read-int conn))
-                     (assoc :type (-read-byte conn))
-                     (assoc :x (-read-int conn))
-                     (assoc :y (-read-int conn))
-                     (assoc :z (-read-int conn))
-                     (assoc :moar (-read-int conn)))]
+  (let [basepacket (assoc
+                     :eid (-read-int conn)
+                     :type (-read-byte conn)
+                     :x (-read-int conn)
+                     :y (-read-int conn)
+                     :z (-read-int conn)
+                     :moar (-read-int conn))]
     (if (< 0 (:moar basepacket))
       basepacket
       (-> basepacket
-        (assoc :unknownx (-read-int conn))
-        (assoc :unknowny (-read-int conn))
-        (assoc :unknownz (-read-int conn))))))
+        :unknownx (-read-int conn)
+        :unknowny (-read-int conn)
+        :unknownz (-read-int conn)))))

 (defn read-packet-mobspawn [conn]
-  (-> {}
-    (assoc :eid (-read-int conn))
-    (assoc :type (-read-byte conn))
-    (assoc :x (-read-int conn))
-    (assoc :y (-read-int conn))
-    (assoc :z (-read-int conn))
-    (assoc :yaw (-read-byte conn))
-    (assoc :pitch (-read-byte conn))
-    (assoc :datastream (-read-metadata conn))))
+  (assoc
+    :eid (-read-int conn)
+    :type (-read-byte conn)
+    :x (-read-int conn)
+    :y (-read-int conn)
+    :z (-read-int conn)
+    :yaw (-read-byte conn)
+    :pitch (-read-byte conn)
+    :datastream (-read-metadata conn)))

 (defn read-packet-entitypainting [conn]
-  (-> {}
-    (assoc :eid (-read-int conn))
-    (assoc :type (-read-string16 conn))
-    (assoc :x (-read-int conn))
-    (assoc :y (-read-int conn))
-    (assoc :z (-read-int conn))
-    (assoc :direction (-read-int conn))))
+  (assoc
+    :eid (-read-int conn)
+    :type (-read-string16 conn)
+    :x (-read-int conn)
+    :y (-read-int conn)
+    :z (-read-int conn)
+    :direction (-read-int conn)))

 (defn read-packet-stanceupdate [conn]
-  (-> {}
-    (assoc :unknown1 (-read-float conn))
-    (assoc :unknown2 (-read-float conn))
-    (assoc :unknown3 (-read-bool conn))
-    (assoc :unknown4 (-read-bool conn))
-    (assoc :unknown5 (-read-float conn))
-    (assoc :unknown6 (-read-float conn))))
+  (assoc
+    :unknown1 (-read-float conn)
+    :unknown2 (-read-float conn)
+    :unknown3 (-read-bool conn)
+    :unknown4 (-read-bool conn)
+    :unknown5 (-read-float conn)
+    :unknown6 (-read-float conn)))

 (defn read-packet-entityvelocity [conn]
-  (-> {}
-    (assoc :eid (-read-int conn))
-    (assoc :velocityx (-read-short conn))
-    (assoc :velocityy (-read-short conn))
-    (assoc :velocityz (-read-short conn))))
+  (assoc
+    :eid (-read-int conn)
+    :velocityx (-read-short conn)
+    :velocityy (-read-short conn)
+    :velocityz (-read-short conn)))

 (defn read-packet-entitydestroy [conn]
-  (-> {}
-    (assoc :eid (-read-int conn))))
+  (assoc
+    :eid (-read-int conn)))

 (defn read-packet-entity [conn]
-  (-> {}
-    (assoc :eid (-read-int conn))))
+  (assoc
+    :eid (-read-int conn)))

 (defn read-packet-entityrelativemove [conn]
-  (-> {}
-    (assoc :eid (-read-int conn))
-    (assoc :dx (-read-byte conn))
-    (assoc :dy (-read-byte conn))
-    (assoc :dz (-read-byte conn))))
+  (assoc
+    :eid (-read-int conn)
+    :dx (-read-byte conn)
+    :dy (-read-byte conn)
+    :dz (-read-byte conn)))

 (defn read-packet-entitylook [conn]
-  (-> {}
-    (assoc :eid (-read-int conn))
-    (assoc :yaw (-read-byte conn))
-    (assoc :pitch (-read-byte conn))))
+  (assoc
+    :eid (-read-int conn)
+    :yaw (-read-byte conn)
+    :pitch (-read-byte conn)))

 (defn read-packet-entitylookandrelativemove [conn]
-  (-> {}
-    (assoc :eid (-read-int conn))
-    (assoc :dx (-read-byte conn))
-    (assoc :dy (-read-byte conn))
-    (assoc :dz (-read-byte conn))
-    (assoc :yaw (-read-byte conn))
-    (assoc :pitch (-read-byte conn))))
+  (assoc
+    :eid (-read-int conn)
+    :dx (-read-byte conn)
+    :dy (-read-byte conn)
+    :dz (-read-byte conn)
+    :yaw (-read-byte conn)
+    :pitch (-read-byte conn)))

 (defn read-packet-entityteleport [conn]
-  (-> {}
-    (assoc :eid (-read-int conn))
-    (assoc :x (-read-int conn))
-    (assoc :y (-read-int conn))
-    (assoc :z (-read-int conn))
-    (assoc :yaw (-read-byte conn))
-    (assoc :pitch (-read-byte conn))))
+  (assoc
+    :eid (-read-int conn)
+    :x (-read-int conn)
+    :y (-read-int conn)
+    :z (-read-int conn)
+    :yaw (-read-byte conn)
+    :pitch (-read-byte conn)))

 (defn read-packet-entitystatus [conn]
-  (-> {}
-    (assoc :eid (-read-int conn))
-    (assoc :entitystatus (-read-byte conn))))
+  (assoc
+    :eid (-read-int conn)
+    :entitystatus (-read-byte conn)))

 (defn read-packet-attachentity [conn]
-  (-> {}
-    (assoc :eid (-read-int conn))
-    (assoc :vehicleid (-read-int conn))))
+  (assoc
+    :eid (-read-int conn)
+    :vehicleid (-read-int conn)))

 (defn read-packet-entitymetadata [conn]
-  (-> {}
-    (assoc :eid (-read-int conn))
-    (assoc :metadata (-read-metadata conn))))
+  (assoc
+    :eid (-read-int conn)
+    :metadata (-read-metadata conn)))

 (defn read-packet-prechunk [conn]
-  (-> {}
-    (assoc :x (-read-int conn))
-    (assoc :z (-read-int conn))
-    (assoc :mode (-read-bool conn))))
+  (assoc
+    :x (-read-int conn)
+    :z (-read-int conn)
+    :mode (-read-bool conn)))

 (defn read-packet-mapchunk [conn]
-  (let [predata (-> {}
-                  (assoc :x (-read-int conn))
-                  (assoc :y (-read-short conn))
-                  (assoc :z (-read-int conn))
-                  (assoc :sizex (-read-byte conn))
-                  (assoc :sizey (-read-byte conn))
-                  (assoc :sizez (-read-byte conn))
-                  (assoc :compressedsize (-read-int conn)))]
+  (let [predata (assoc
+                  :x (-read-int conn)
+                  :y (-read-short conn)
+                  :z (-read-int conn)
+                  :sizex (-read-byte conn)
+                  :sizey (-read-byte conn)
+                  :sizez (-read-byte conn)
+                  :compressedsize (-read-int conn))]
     (assoc predata
            :compresseddata
            (-read-bytearray conn
                             (:compressedsize predata)))))

 (defn read-packet-multiblockchange [conn]
-  (-> {}
-    (assoc :chunkx (-read-int conn))
-    (assoc :chunkz (-read-int conn))
-    (assoc :arraysize (-read-short conn))
-    (assoc :coordinatearray (-read-shortarray conn))
-    (assoc :typearray (-read-bytearray conn))
-    (assoc :metadataarray (-read-bytearray conn))))
+  (assoc
+    :chunkx (-read-int conn)
+    :chunkz (-read-int conn)
+    :arraysize (-read-short conn)
+    :coordinatearray (-read-shortarray conn)
+    :typearray (-read-bytearray conn)
+    :metadataarray (-read-bytearray conn)))

 ; Reading Wrappers -----------------------------------------------------------------
@@ -639,44 +639,44 @@
                   packet-type (packet-types packet-id)]
     (println "\n----->")
     (println
-      (cond
-        (= packet-type :keepalive)                 (read-packet-keepalive conn)
-        (= packet-type :handshake)                 (read-packet-handshake conn)
-        (= packet-type :login)                     (read-packet-login conn)
-        (= packet-type :chat)                      (read-packet-chat conn)
-        (= packet-type :timeupdate)                (read-packet-timeupdate conn)
-        (= packet-type :equipment)                 (read-packet-equipment conn)
-        (= packet-type :spawnposition)             (read-packet-spawnposition conn)
-        (= packet-type :useentity)                 (read-packet-useentity conn)
-        (= packet-type :updatehealth)              (read-packet-updatehealth conn)
-        (= packet-type :respawn)                   (read-packet-respawn conn)
-        (= packet-type :playerpositionlook)        (read-packet-playerpositionlook conn)
-        (= packet-type :playerdigging)             (read-packet-playerdigging conn)
-        (= packet-type :playerblockplacement)      (read-packet-playerblockplacement conn)
-        (= packet-type :holdingchange)             (read-packet-holdingchange conn)
-        (= packet-type :usebed)                    (read-packet-usebed conn)
-        (= packet-type :animate)                   (read-packet-animate conn)
-        (= packet-type :entityaction)              (read-packet-entityaction conn)
-        (= packet-type :namedentityspawn)          (read-packet-namedentityspawn conn)
-        (= packet-type :pickupspawn)               (read-packet-pickupspawn conn)
-        (= packet-type :collectitem)               (read-packet-collectitem conn)
-        (= packet-type :addobjectvehicle)          (read-packet-addobjectvehicle conn)
-        (= packet-type :mobspawn)                  (read-packet-mobspawn conn)
-        (= packet-type :entitypainting)            (read-packet-entitypainting conn)
-        (= packet-type :stanceupdate)              (read-packet-stanceupdate conn)
-        (= packet-type :entityvelocity)            (read-packet-entityvelocity conn)
-        (= packet-type :entitydestroy)             (read-packet-entitydestroy conn)
-        (= packet-type :entity)                    (read-packet-entity conn)
-        (= packet-type :entityrelativemove)        (read-packet-entityrelativemove conn)
-        (= packet-type :entitylook)                (read-packet-entitylook conn)
-        (= packet-type :entitylookandrelativemove) (read-packet-entitylookandrelativemove conn)
-        (= packet-type :entityteleport)            (read-packet-entityteleport conn)
-        (= packet-type :entitystatus)              (read-packet-entitystatus conn)
-        (= packet-type :attachentity)              (read-packet-attachentity conn)
-        (= packet-type :entitymetadata)            (read-packet-entitymetadata conn)
-        (= packet-type :prechunk)                  (read-packet-prechunk conn)
-        (= packet-type :mapchunk)                  (read-packet-mapchunk conn)
-        (= packet-type :multiblockarray)           (read-packet-multiblockchange conn)
+      (case packet-type
+        :keepalive                 (read-packet-keepalive conn)
+        :handshake                 (read-packet-handshake conn)
+        :login                     (read-packet-login conn)
+        :chat                      (read-packet-chat conn)
+        :timeupdate                (read-packet-timeupdate conn)
+        :equipment                 (read-packet-equipment conn)
+        :spawnposition             (read-packet-spawnposition conn)
+        :useentity                 (read-packet-useentity conn)
+        :updatehealth              (read-packet-updatehealth conn)
+        :respawn                   (read-packet-respawn conn)
+        :playerpositionlook        (read-packet-playerpositionlook conn)
+        :playerdigging             (read-packet-playerdigging conn)
+        :playerblockplacement      (read-packet-playerblockplacement conn)
+        :holdingchange             (read-packet-holdingchange conn)
+        :usebed                    (read-packet-usebed conn)
+        :animate                   (read-packet-animate conn)
+        :entityaction              (read-packet-entityaction conn)
+        :namedentityspawn          (read-packet-namedentityspawn conn)
+        :pickupspawn               (read-packet-pickupspawn conn)
+        :collectitem               (read-packet-collectitem conn)
+        :addobjectvehicle          (read-packet-addobjectvehicle conn)
+        :mobspawn                  (read-packet-mobspawn conn)
+        :entitypainting            (read-packet-entitypainting conn)
+        :stanceupdate              (read-packet-stanceupdate conn)
+        :entityvelocity            (read-packet-entityvelocity conn)
+        :entitydestroy             (read-packet-entitydestroy conn)
+        :entity                    (read-packet-entity conn)
+        :entityrelativemove        (read-packet-entityrelativemove conn)
+        :entitylook                (read-packet-entitylook conn)
+        :entitylookandrelativemove (read-packet-entitylookandrelativemove conn)
+        :entityteleport            (read-packet-entityteleport conn)
+        :entitystatus              (read-packet-entitystatus conn)
+        :attachentity              (read-packet-attachentity conn)
+        :entitymetadata            (read-packet-entitymetadata conn)
+        :prechunk                  (read-packet-prechunk conn)
+        :mapchunk                  (read-packet-mapchunk conn)
+        :multiblockarray           (read-packet-multiblockchange conn)

         :else (str "UNKNOWN PACKET TYPE: " packet-id)
         ))


Moar.

Moar.

--- src/clojurecraft/core.clj
+++ src/clojurecraft/core.clj
@@ -39,6 +39,9 @@
   0x1F :entityrelativemove
   0x20 :entitylook
   0x21 :entitylookandrelativemove
+  0x22 :entityteleport
+  0x26 :entitystatus
+  0x27 :attachentity
 })
 (def packet-ids (apply assoc {} (mapcat reverse packet-types)))

@@ -246,6 +249,12 @@
   (-write-short conn velocityx)
   (-write-short conn velocityy)
   (-write-short conn velocityz))
+
+(defn write-packet-attachentity [conn {eid :eid vehicleid :vehicleid}]
+  (-write-byte conn (:attachentity packet-ids))
+
+  (-write-int conn eid)
+  (-write-int conn vehicleid))

 ; Writing Wrappers -----------------------------------------------------------------
@@ -273,6 +282,8 @@
     (= packet-type :entitypainting)       (write-packet-entitypainting conn payload)
     (= packet-type :stanceupdate)         (write-packet-stanceupdate conn payload)
     (= packet-type :entityvelocity)       (write-packet-entityvelocity conn payload)
+    (= packet-type :attachentity)         (write-packet-attachentity conn payload)
+
     )
   (flushc conn))

@@ -525,6 +536,25 @@
     (assoc :dz (-read-byte conn))
     (assoc :yaw (-read-byte conn))
     (assoc :pitch (-read-byte conn))))
+
+(defn read-packet-entityteleport [conn]
+  (-> {}
+    (assoc :eid (-read-int conn))
+    (assoc :x (-read-int conn))
+    (assoc :y (-read-int conn))
+    (assoc :z (-read-int conn))
+    (assoc :yaw (-read-byte conn))
+    (assoc :pitch (-read-byte conn))))
+
+(defn read-packet-entitystatus [conn]
+  (-> {}
+    (assoc :eid (-read-int conn))
+    (assoc :entitystatus (-read-byte conn))))
+
+(defn read-packet-attachentity [conn]
+  (-> {}
+    (assoc :eid (-read-int conn))
+    (assoc :vehicleid (-read-int conn))))

 ; Reading Wrappers -----------------------------------------------------------------
@@ -564,6 +594,9 @@
         (= packet-type :entityrelativemove)        (read-packet-entityrelativemove conn)
         (= packet-type :entitylook)                (read-packet-entitylook conn)
         (= packet-type :entitylookandrelativemove) (read-packet-entitylookandrelativemove conn)
+        (= packet-type :entityteleport)            (read-packet-entityteleport conn)
+        (= packet-type :entitystatus)              (read-packet-entitystatus conn)
+        (= packet-type :attachentity)              (read-packet-attachentity conn)

         :else (str "UNKNOWN PACKET TYPE: " packet-id)
         ))


Fixing when the parser function is run.

Fixing when the parser function is run.

--- src/cmr/common/config.clj
+++ src/cmr/common/config.clj
@@ -31,11 +31,11 @@
   ([config-name default-value]
    (config-value config-name default-value identity))
   ([config-name default-value parser-fn]
-   (or (get @runtime-config-values config-name)
-       (let [env-value (System/getenv (config-name->env-name config-name))]
-         (when env-value
-           (parser-fn env-value)))
-       default-value)))
+   (let [value (or (get @runtime-config-values config-name)
+                   (System/getenv (config-name->env-name config-name))
+                   default-value)]
+     (when value
+       (parser-fn value)))))

 (defn config-value-fn
   "Returns a function that can retrieve a configuration value which can be set as an environment
@@ -47,9 +47,10 @@
   ([config-name default-value parser-fn]

    ;; Environment variables can't change at runtime so we look them up initially.
-   (let [env-value (System/getenv (config-name->env-name config-name))
-         env-value (when env-value (parser-fn env-value))]
+   (let [parser-when #(when % (parser-fn %))
+         parsed-default (parser-when default-value)
+         env-value (parser-when (System/getenv (config-name->env-name config-name)))]
      (fn []
-       (or (get @runtime-config-values config-name)
+       (or (parser-when (get @runtime-config-values config-name))
            env-value
-           default-value)))))
+           parsed-default)))))


Commented out ltest stuff.

Commented out ltest stuff.

--- test/clj/cmr/client/testing/runner.clj
+++ test/clj/cmr/client/testing/runner.clj
@@ -1,9 +1,9 @@
 (ns cmr.client.testing.runner
-  (:require
+  #_(:require
    [ltest.core :as ltest])
-  (:gen-class))
+  #_(:gen-class))

-(defn run-tests
+#_(defn run-tests
   ([]
    (ltest/run-all-tests #"cmr.client.tests.*"))
   ([arg]
@@ -11,7 +11,7 @@
     (coll? arg) (ltest/run-tests arg)
     (var? arg) (ltest/run-test arg))))

-(defn -main
+#_(defn -main
   [& args]
   (println "main args:" args)
   (if (nil? args)


changed similarity call

changed similarity call

--- src/crawler/extractor.clj
+++ src/crawler/extractor.clj
@@ -115,7 +115,7 @@

              pg-signature     (page/page-signature in-host-xpath-hs in-host-map)

-             similarity       (page/signature-similarity2 signature pg-signature)
+             similarity       (page/signature-similarity-cosine signature pg-signature)

              src-xpaths       (filter
                                #(not= % xpath) (map first in-host-xpath-hrefs))


Add subst* tests.

Add subst* tests.

--- test/little_clojurer/chapter5_test.clj
+++ test/little_clojurer/chapter5_test.clj
@@ -31,3 +31,13 @@
     (is (= 3 (occur* :a '((:a (:a)) :a :b))))
     (is (= 3 (occur* :a '(() (:a (:a)) :a :b))))
   ))
+
+(deftest subst*-test
+  (testing
+    (is (= '() (subst* :new :old '())))
+    (is (= '(:new) (subst* :new :old '(:old))))
+    (is (= '((:new)) (subst* :new :old '((:old)))))
+    (is (= '((:new) :new (:new)) (subst* :new :old '((:old) :new (:old)))))
+    (is (= '((:new) :new ( :new)) (subst* :new :old '((:old) :new (:old)))))
+    (is (= '((:new) :new () (:new)) (subst* :new :old '((:old) :new () (:old)))))
+  ))


Fixup the pg tests to run only when the postgres engine is enabled

--- test/metabase/driver/postgres_test.clj
+++ test/metabase/driver/postgres_test.clj
@@ -205,7 +205,7 @@
         (driver/describe-database pg-driver database)))))

 ;; make sure that if a view is dropped and recreated that the original Table object is marked active rather than a new one being created (#3331)
-(expect
+(expect-with-engine :postgres
   [{:name "angry_birds", :active true}]
   (let [details (i/database->connection-details pg-driver :db {:database-name "dropped_views_test"})
         spec    (sql/connection-details->spec pg-driver details)


more design spike

more design spike

--- test/push/design_spikes/dsl_macros.clj
+++ test/push/design_spikes/dsl_macros.clj
@@ -42,8 +42,8 @@
 ; - `remember-stack [stackname :as local]`
 ;    save the entire stack to the `local`
 ;    raise an Exception if it's undefined
-; - `place [stackname args fn]`
-;    push the results of applying `fn` to the named `args` to the named stack
+; - `place [stackname args kwd]`
+;    push the local `kwd` on the named stack
 ;    raise an Exception if it's undefined
 ; - `replace-stack [stackname new-stack]`
 ;    replace the indicated stack with a new list
@@ -64,118 +64,85 @@
 (def six-ints (make-interpreter :stacks {:integer '(6 5 4 3 2 1)}))

+(defn store-local
+  "stores a local kv pair"
+  [[interpreter locals] k v]
+  (into [] (list interpreter (assoc locals k v))))

-(defn store-local
-  "adds a local kv pair to an Interpreter's :local map"
-  [interpreter k v]
-  (if (nil? (:locals interpreter))
-    (assoc interpreter :locals {k v})
-    (assoc-in interpreter [:locals k] v)))
-
-
-(fact "store-local creates a :locals store if needed"
-  (:locals (make-interpreter)) => nil
-  (:locals (store-local (make-interpreter) :foo 8)) => {:foo 8})
-
-
-(fact "store-local amends an existing :locals store"
-  (let [foo (store-local (make-interpreter) :foo 8)]
-  (:locals (store-local foo :bar 9)) => {:foo 8, :bar 9}))
+(fact "store-local saves thing to the locals hashmap"
+  (second (store-local [(make-interpreter) {}] :foo 8)) => {:foo 8}
+  (let [foo (store-local [(make-interpreter) {}] :foo 8)]
+    (second (store-local foo :bar 9)) => {:foo 8, :bar 9}))

 (fact "store-local can overwrite an existing :locals value"
-  (let [foo (store-local (make-interpreter) :foo 8)]
-  (:locals (store-local foo :foo 999)) => {:foo 999}))
-
-
-(defn clear-locals
-  "deletes the :locals key from an Interpreter"
-  [interpreter]
-  (dissoc interpreter :locals))
-
-
-(fact "clear-locals returns a thing that's still an Interpreter"
-  (class (clear-locals (make-interpreter))) => push.interpreter.Interpreter
-  (let [foo (store-local (make-interpreter) :foo 8)]
-    (class (clear-locals foo)) => push.interpreter.Interpreter))
-
-
-(fact "clear-locals also does what it's supposed to do"
-  (let [foo (store-local (make-interpreter) :foo 8)]
-    (:locals (clear-locals foo)) => nil))
-
-
-(defn recall
-  [interpreter k]
-  (get-in interpreter [:locals k]))
-
-
-(fact "recall retrieves a named item from :locals of its interpreter"
-  (let [foo (store-local (make-interpreter) :foo 8)]
-  (recall foo :foo) => 8))
-
-;;
+  (let [foo (store-local [(make-interpreter) {}] :foo 8)]
+    (second (store-local foo :foo 999)) => {:foo 999}))

 (defn consume
-  [interpreter stack & {:keys [as]}]
+  [[interpreter locals] stack & {:keys [as]}]
   (let [old-stack (get-stack interpreter stack)]
-    (if (empty? old-stack)
-      (throw (Exception. (str "Push DSL Error: " stack " is empty")))
-      (store-local
-        (set-stack interpreter stack (pop old-stack))
-          as
-          (first old-stack)))
-      ))
+    (cond (empty? old-stack)
+            (throw (Exception. (str "Push DSL Error: " stack " is empty")))
+          (nil? as)
+            [(set-stack interpreter stack (pop old-stack)) locals]
+          :else
+            (store-local
+              [(set-stack interpreter stack (pop old-stack)) locals]
+              as
+              (first old-stack)))))

-(fact "consume returns an :interpreter with new locals"
-  (:locals (consume six-ints :integer :as :int1)) => {:int1 6}
-  (get-stack (consume six-ints :integer :as :int1) :integer) => '(5 4 3 2 1))
+(defn get-stack-from-dslblob ;; convenience for testing only
+  [[interpreter locals] stackname]
+  (get-stack interpreter stackname))
+
+
+(fact "consume"
+  (second (consume [six-ints {}] :integer :as :int1)) => {:int1 6}
+  (get-stack-from-dslblob
+    (consume [six-ints {}] :integer :as :int1)
+    :integer) => '(5 4 3 2 1))

 (fact "consume throws an exception if the stack is empty"
-  (:locals (consume six-ints :boolean :as :nope)) => (throws #"Push DSL Error:"))
+  (consume [six-ints {}] :boolean :as :nope) => (throws #"Push DSL Error:"))

 (fact "consume can be thread-firsted"
-  (let [two-popped (->  six-ints
+  (let [two-popped (->  [six-ints {}]
                         (consume :integer :as :int1)
                         (consume :integer :as :int2))]
-    (:locals two-popped) => {:int1 6, :int2 5}
-    (get-stack two-popped :integer) => '(4 3 2 1)))
+    (second two-popped) => {:int1 6, :int2 5}
+    (get-stack-from-dslblob two-popped :integer) => '(4 3 2 1)))
+
+
+(fact "consume with no :as argument just throws the thing away"
+  (let [two-popped (->  [six-ints {}]
+                        (consume :integer)
+                        (consume :integer :as :int2))]
+    (second two-popped) => {:int2 5}
+    (get-stack-from-dslblob two-popped :integer) => '(4 3 2 1)))
+

 (defn place
-  [interpreter stack function]
-  (let [result (apply function [interpreter])]
-    (push-item interpreter stack result)))
+  "pushes a named local onto a given stack"
+  [[interpreter locals] stack kwd]
+  (let [item (kwd locals)
+        updated (push-item interpreter stack item)]
+  (into [] (list updated locals))))

-(fact "`place` will apply the specified inline function to the interpreter"
-  (let [integer-added (-> six-ints
+(fact "`place` will push the saved local value to the indicated stack in the interpreter"
+  (let [integer-added (-> [six-ints {}]
                         (consume :integer :as :int1)
                         (consume :integer :as :int2)
-                        (place :integer #(+ (recall % :int1) (recall % :int2))))]
-  (get-stack integer-added :integer) => '(11 4 3 2 1)))
+                        (place :boolean :int1))]
+    (get-stack-from-dslblob integer-added :boolean) => '(6)))

-
-(fact "`place` pays attention the argument order"
-  (let [integer-subtracted (-> six-ints
-                        (consume :integer :as :int1)
-                        (consume :integer :as :int2)
-                        (place :integer #(- (recall % :int1) (recall % :int2))))]
-  (get-stack integer-subtracted :integer) => '(1 4 3 2 1))
-  (let [integer-subtracted (-> six-ints
-                        (consume :integer :as :int1)
-                        (consume :integer :as :int2)
-                        (place :integer #(- (recall % :int2) (recall % :int1))))]
-  (get-stack integer-subtracted :integer) => '(-1 4 3 2 1)))
-
-
-;; this would be nicer if it was
-;; (place :integer #(- (my :int2) (my :int1)))

 ;; counting arguments


load the entrypoint from the tentacle

load the entrypoint from the tentacle

--- src/doctopus/template.clj
+++ src/doctopus/template.clj
@@ -3,6 +3,7 @@
    [net.cgrand.enlive-html :as enlive :refer [deftemplate defsnippet]]
             [doctopus.configuration :refer [server-config]]
             [doctopus.doctopus :refer [list-heads list-tentacles]]
+            [doctopus.doctopus.tentacle :refer [get-html-entrypoint]]
             [ring.util.anti-forgery :as csrf]))

 (def root-url (or (:root-url (server-config)) "/"))
@@ -24,7 +25,7 @@
 (defn- tentacle-li
   [tentacle]
   (let [tentacle-name (:name tentacle)]
-    (enlive/html [:li (linkify (str "/docs/" tentacle-name "/index.html") tentacle-name)])))
+    (enlive/html [:li (linkify (get-html-entrypoint tentacle) tentacle-name)])))

 (deftemplate base-template "templates/base.html"
   [body]


quick fix for auto-generated columns

quick fix for auto-generated columns

--- src/cljs/org/broadinstitute/firecloud_ui/common/table.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/common/table.cljs
@@ -141,7 +141,7 @@
                                (assert false "bad state"))
                              (swap! state assoc :sort-column i :sort-order :asc
                                :key-fn (if (= :value sorter)
-                                         (fn [row] (nth row i))
+                                         (fn [row] (str (nth row i)))
                                          (fn [row] (sorter (nth row i)))))))
             :sortOrder (when (= i (:sort-column @state)) (:sort-order @state))})))
      (filter :showing? (:ordered-columns @state)))


Use 'when' instead 'if' when you don't have an 'else' branch. if-not/when-not is more idiomatic than 'if nil?'/'when nil?'

--- src/engine_server/web.clj
+++ src/engine_server/web.clj
@@ -8,15 +8,13 @@
     [clojure.java.io :as io]
     [environ.core :refer [env]]
     [org.httpkit.timer :refer [schedule-task]]
-    [clojure.data.json :as json]
-  )
-)
+    [clojure.data.json :as json]))

 (def games (atom {}))
 (def clients (atom {}))

 (defn find-or-create-game [id]
-  (if (nil? (@games id))
+  (when-not (@games id)
     (swap! games assoc id (new-game id 0)))
   (@games id))


Make displayed ip the configured ip.

Make displayed ip the configured ip.

Currently the ip displayed when starting gorilla is always localhost.
Displaying the real ip means it is easier to start gorilla over ssh and then launch a browser window.

--- src/gorilla_repl/core.clj
+++ src/gorilla_repl/core.clj
@@ -116,9 +116,9 @@
     (let [s (server/run-server #'app-routes {:port webapp-requested-port :join? false :ip ip})
           webapp-port (:local-port (meta s))]
       (spit (doto (io/file ".gorilla-port") .deleteOnExit) webapp-port)
-      (println (str "Running at http://localhost:" webapp-port "/worksheet.html ."))
+      (println (str "Running at http://" ip ":" webapp-port "/worksheet.html ."))
       (println "Ctrl+C to exit."))))

 (defn -main
   [& args]
-  (run-gorilla-server {:port 8990}))+  (run-gorilla-server {:port 8990}))


remove new auto track ugen as it was already available in core as beat track.

--- src/overtone/sc/machinery/ugen/metadata/extras/bbcut2u.clj
+++ src/overtone/sc/machinery/ugen/metadata/extras/bbcut2u.clj
@@ -3,43 +3,7 @@

 (def specs
   [
-   {:name "AutoTrack"
-    :summary "Autocorrelation beat tracker"
-    :args [{:name "in"
-            :doc "Audio input to track"}
-
-           {:name "lock"
-            :default 0
-            :doc "If this argument is greater than 0.5, the tracker will
-                  lock at its current periodicity and continue from the
-                  current phase. Whilst it updates the model's phase and
-                  period, this is not reflected in the output until lock
-                  goes back below 0.5.  "} ]
-    :rates #{:kr}
-    :doc "Autocorrelation beat tracker by Nick Collins, following:
-
-          M. E. P. Davies and M. D. Plumbley. Beat Tracking With A Two
-          State Model. Proceedings of the IEEE International Conference
-          on Acoustics, Speech and Signal Processing (ICASSP 2005),
-          Philadelphia, USA, March 19-23, 2005
-
-          There are four k-rate outputs, being ticks at quarter, eighth
-          and sixteenth level from the determined beat, and the current
-          detected tempo.
-
-          Note the following restrictions:
-
-          This beat tracker determines the beat, biased to the midtempo
-          range by weighting functions. It does not determine the
-          measure level, only a tactus. It is also slow reacting, using
-          a 6 second temporal window for it's autocorrelation
-          maneouvres. Don't expect human musician level predictive
-          tracking.
-
-          On the other hand, it is tireless, relatively general (though
-          obviously best at transient 4/4 heavy material without much
-          expressive tempo variation), and can form the basis of
-          computer processing that is decidedly faster than human. "}
+   ;;AutoTrack is now BeatTrack (included in the core set of ugens)

    {:name "AnalyseEvents2"
     :summary "On-the-fly event analyser"


Use correct namespace... confused about this one

--- src/io/perun/gravatar.clj
+++ src/io/perun/gravatar.clj
@@ -1,6 +1,6 @@
 (ns io.perun.gravatar
   (:require [io.perun.core :as perun]
-            [gravatar      :as gr]))
+            [gravatar.core :as gr]))

 (defn add-gravatar [file source-prop target-prop]
   (if-let [email (get file source-prop)]


added handling to run_rules.clj for explicit :sparql-string in rules instead of :body

--- kabob-build/src/main/clojure/edu/ucdenver/ccp/kabob/build/run_rules.clj
+++ kabob-build/src/main/clojure/edu/ucdenver/ccp/kabob/build/run_rules.clj
@@ -151,6 +151,41 @@
     (let [new-t (.getTime (java.util.Date.))]
       (add-rule-metadata target-kb (:name rule) new-t @visit-counter (- new-t @t)))))

+
+(defn run-forward-rule-sparql-string [source-kb target-kb rule]
+  "This function is very similar to run-forward-rule, however it takes
+  as input a rule that has an explicitly defined SPARQL string. This
+  can be used for complex SPARQL queryies that are difficult to
+  represent using the DSL defined by the forward rule machinery in
+  this project."
+  (let [{head :head sparql-string :sparql-string reify :reify :as rule} (add-reify-fns rule)
+        visit-counter (atom 0)
+        t (atom (.getTime (java.util.Date.)))]
+    (println "rule query:")
+    (binding [*kb* source-kb]
+      (println sparql-string)
+      (println "running:")
+      (visit-sparql source-kb
+                    (fn [bindings]
+                      (swap! visit-counter inc)
+                      (when (= 0 (mod @visit-counter 10000))
+                        (System/gc))
+                      (when (= 0 (mod @visit-counter 250000))
+                        (let [new-t (.getTime (java.util.Date.))]
+                          (println @visit-counter " in " (- new-t @t) "ms")
+                          (reset! t new-t)))
+                      (dorun
+                       (map (partial add! target-kb)
+                            (doall
+                             (subst-bindings head
+                                             bindings
+                                             (reify-bindings reify
+                                                             bindings))))))
+                    sparql-string)
+      (println "final count: " @visit-counter))))
+
+
+
 ;; This needs to check for duplicates and prefer one, but which?
 ;; This should probably take multiple lists, then defaults and hard-codes can
 ;; also be given in addition to what's in the rule.
@@ -197,7 +232,9 @@
       (prn (str "Processing rule: " (:name rule)))
       (let [source-connection (source-kb args)
             target-connection (rule-output-kb (:output-directory args) rule)]
-        (try (time (run-forward-rule source-connection target-connection rule))
+        (try (time (if (contains? rule :sparql-string)
+                     (run-forward-rule-sparql-string source-connection target-connection rule)
+                     (run-forward-rule source-connection target-connection rule)))
              true
              (finally (close target-connection)
                       (close source-connection)))))))


(TK-316) Add back accidentally deleted test

--- test/com/puppetlabs/http/client/impl/metrics_unit_test.clj
+++ test/com/puppetlabs/http/client/impl/metrics_unit_test.clj
@@ -217,6 +217,9 @@
                     "  as values if no requests have been made yet")
         (let [empty-metrics (Metrics/getClientMetrics (MetricRegistry.))
               empty-metrics-data (Metrics/getClientMetricsData (MetricRegistry.))]
+          (is (= {:url [] :url-and-method [] :metric-id []}
+                 (metrics/get-client-metrics (MetricRegistry.))
+                 (metrics/get-client-metrics-data (MetricRegistry.))))
           (is (empty? (.getUrlTimers empty-metrics)))
           (is (empty? (.getUrlAndMethodTimers empty-metrics)))
           (is (empty? (.getMetricIdTimers empty-metrics)))


fixing grammar error

fixing grammar error

--- src/midje/unprocessed.clj
+++ src/midje/unprocessed.clj
@@ -1,6 +1,6 @@
 ;; -*- indent-tabs-mode: nil -*-

-(ns ^{:doc "Core Midje functions that process expects and reports on their results."}
+(ns ^{:doc "Core Midje functions that process expects and report on their results."}
   midje.unprocessed
   (:use clojure.test
         [midje.internal-ideas.fakes]


CMR-3200: Added comment on filed issues to fix the remaining formats.

--- umm-spec-lib/test/cmr/umm_spec/test/generate_and_parse.clj
+++ umm-spec-lib/test/cmr/umm_spec/test/generate_and_parse.clj
@@ -81,7 +81,7 @@

 (def formats-to-skip
   "A set of formats to skip in the roundtrip example metadata test. These will be fixed as part of
-   separate issues."
+   separate issues. The issues CMR-3252, CMR-3253, CMR-3254, and CMR-3255 are filed to fix this."
   #{:dif :dif10 :iso19115 :iso-smap})

 (deftest roundtrip-example-metadata


spelling

spelling

--- sidecar/src/figwheel_sidecar/core.clj
+++ sidecar/src/figwheel_sidecar/core.clj
@@ -140,7 +140,7 @@
          :access-control-allow-methods [:head :options :get :put :post :delete])
         (run-server {:port server-port}))
     (catch java.net.BindException e
-      (println "Port" server-port "is already being used. Are you running another Figwheel instace? If you want to run two Figwheel instances add a new :server-port (i.e. :server-port 3450) to Figwheel's config options in your project.clj")
+      (println "Port" server-port "is already being used. Are you running another Figwheel instance? If you want to run two Figwheel instances add a new :server-port (i.e. :server-port 3450) to Figwheel's config options in your project.clj")
       (System/exit 0))))

 (defn append-msg [q msg] (conj (take 30 q) msg))


Remove dead arg.

Remove dead arg.

--- src/onyx/plugin/kafka.clj
+++ src/onyx/plugin/kafka.clj
@@ -19,7 +19,6 @@

 (def defaults
   {:kafka/receive-buffer-bytes 65536
-   :kafka/commit-interval 2000
    :kafka/wrap-with-metadata? false
    :kafka/unable-to-find-broker-backoff-ms 8000})


Beef up docstring

Beef up docstring

--- src/overtone/sc/mixer.clj
+++ src/overtone/sc/mixer.clj
@@ -112,8 +112,9 @@
 (defonce recorder-info* (ref nil))

 (defn recording-start
-  "Start recording a wav file to a new file at wav-path. Be careful - may
-  generate very large files."
+  "Start recording a wav file to a new file at wav-path. Be careful -
+  may generate very large files. See buffer-stream for a list of
+  output options."
   [path & args]
   (if-let [info @recorder-info*]
     (throw (Exception. (str "Recording already taking place to: "


Handle error case for *merged* output.

Handle error case for *merged* output.

--- src/plan_schema/utils.clj
+++ src/plan_schema/utils.clj
@@ -54,8 +54,9 @@
   (let [log-fn (get-in @configuration [:loggers level])]
     (if (fn? log-fn)
       (apply log-fn msgs)
-      (println (string/upper-case (name level))
-        (string/join " " msgs)))))
+      (binding [*out* *err*]
+        (println (string/upper-case (name level))
+          (string/join " " msgs))))))

 (defn log-trace [& msgs]
   (apply logger :trace msgs))
@@ -75,7 +76,7 @@
 (defn as-keywords [m]
   (reduce (fn [res [k v]]
             (conj res {(keyword k) v}))
-          {} m))
+    {} m))

 (defn read-json-str [s]
   (reduce (fn [res [k v]]
@@ -95,6 +96,10 @@
   (cond
     (map? output)
     (:error output)
+    (vector? output) ;; it's a merge with two plans.. this is fine
+    false
+    ;(and (string? output) (empty? output))
+    ;false
     (string? output) ;; assume it's JSON as a string
     (:error (read-json-str output))
     (nil? output)


get output for filebeat installation

get output for filebeat installation

--- src/terraboot/cluster.clj
+++ src/terraboot/cluster.clj
@@ -78,11 +78,12 @@
   {:coreos {:units [{:name "filebeat.service" :command "start" :content (snippet "systemd/filebeat.service")}]}
    :write_files [{:path "/etc/filebeat/filebeat.yml"
                   :content (snippet "system-files/filebeat.yml")}]
-   :runcmd ["curl -o /home/core/filebeat-1.2.3-x86_64.tar.gz https://download.elastic.co/beats/filebeat/filebeat-1.2.3-x86_64.tar.gz"
-            "tar xvzf /home/core/filebeat-1.2.3-x86_64.tar.gz"
-            "mkdir -p /opt/bin"
-            "cp /home/core/filebeat-1.2.3-x86_64/filebeat /opt/bin/"
-            "mkdir -p /etc/filebeat"]})
+   :runcmd (mapv #(str % "  >> /var/log/filebeat-install.log 2>&1")
+                 ["curl -o /home/core/filebeat-1.2.3-x86_64.tar.gz https://download.elastic.co/beats/filebeat/filebeat-1.2.3-x86_64.tar.gz"
+                  "tar xvzf /home/core/filebeat-1.2.3-x86_64.tar.gz"
+                  "mkdir -p /opt/bin"
+                  "cp /home/core/filebeat-1.2.3-x86_64/filebeat /opt/bin/"
+                  "mkdir -p /etc/filebeat"])})

 (defn mesos-slave-user-data
   []


ui-v2 remove loaded? check

ui-v2 remove loaded? check

--- src-cljs/frontend/components/app.cljs
+++ src-cljs/frontend/components/app.cljs
@@ -107,10 +107,8 @@
     om/IWillMount
     (will-mount [_]
       (let [logged-in? (boolean (get-in app state/user-path))
-            load-organizations? (nil? (get-in app state/top-nav-orgs-path))
             api-ch (get-in app [:comms :api])]
-        (if (and logged-in? load-organizations?
-                 (feature/enabled? :ui-v2))
+        (if (and logged-in? (feature/enabled? :ui-v2))
           (api/get-orgs api-ch))))
     om/IRender
     (render [_]


[examples] add main so dropout subdir lein run invocation works

--- examples/dropout/src/dropout/autoencoder.clj
+++ examples/dropout/src/dropout/autoencoder.clj
@@ -257,3 +257,7 @@
         network (desc/build-and-create-network (concat (desc/input 28 28 1) tsne-desc))
         samples (net/run network data)]
     (nn-vis/scatter-plot-data samples label-idx "tsne autoencoder")))
+
+(defn -main
+  [& args]
+  (train-networks))


fixing args validation for remoters

fixing args validation for remoters

--- src/celestial/persistency/actions.clj
+++ src/celestial/persistency/actions.clj
@@ -46,8 +46,10 @@
   {:src #{:required :String} :operates-on #{:required :String :type-exists}
    :name #{:required :String}})

-(defn validate-action [{:keys [capistrano ruby name type] :as action}]
-  (when (or capistrano ruby)
-    (validate! capistrano has-args :error ::invalid-cap-action))
+(defn validate-action [{:keys [name type] :as action}]
+  (if-let [r (remoter action)]
+    (validate! r has-args :error ::invalid-remoter)
+    (throw+ {:type ::no-matching-remoter :msg (<< "no matching remoter found for ~{action}")})
+    )
   (validate! action action-base-validation :error ::invalid-action))


fix css include in prod

fix css include in prod

--- src/clj/conference_rating/handler.clj
+++ src/clj/conference_rating/handler.clj
@@ -17,7 +17,7 @@
      [:meta {:charset "utf-8"}]
      [:meta {:name "viewport"
              :content "width=device-width, initial-scale=1"}]
-     (include-css (if (env :dev) "css/site.css" "css/site.min.css"))]
+     (include-css "css/site.css")]
     [:body
      [:div#app
       [:h3 "ClojureScript has not been compiled!"]


Improve mtg-cards so that they include the multiverseIds

--- src/clj/decktouch/mtg_card_master.clj
+++ src/clj/decktouch/mtg_card_master.clj
@@ -23,9 +23,9 @@
             {"name"         (set-card "name")
              "multiverseId" (set-card "multiverseid")}))))))

-(def mtg-sets (json/read-str (slurp "resources/AllSets.json")))
-
-(def mtg-cards (json/read-str (slurp "resources/AllCards.json")))
+(def mtg-cards
+  (let [allcards (json/read-str (slurp "resources/AllCards.json"))]
+    (reduce add-multiverseid-to-card-in-map allcards card-multiverseids)))

 (def card-names (keys mtg-cards))


new entry tag not in pvt-tags

new entry tag not in pvt-tags

--- src/clj/iwaswhere_web/graph/query.clj
+++ src/clj/iwaswhere_web/graph/query.clj
@@ -242,7 +242,7 @@
         g (:graph current-state)
         ltags (map #(-> % :dest :ptag) (uc/find-edges g {:src :pvt-hashtags}))
         tags (map #(:val (uc/attrs g {:ptag %})) ltags)]
-    (set/union (set tags) (:pvt-tags cfg))))
+    (disj (set/union (set tags) (:pvt-tags cfg)) "#new")))

 (defn find-all-mentions
   "Finds all hashtags used in entries by finding the edges that originate from


send correct error status for cljs.repl

send correct error status for cljs.repl

--- src/clj/rksm/cloxp_com/messenger.cljc
+++ src/clj/rksm/cloxp_com/messenger.cljc
@@ -142,13 +142,14 @@

 (defn answer-message-not-understood
   [receiver msg]
-  (answer receiver msg {:error "messageNotUnderstood"} false))
+  (let [err "messageNotUnderstood"]
+    (answer receiver msg {:error err :value err :status :error} false)))

 (defn- handle-target-not-found
   [receiver {:keys [target action] :as msg}]
   (let [err (str "cannot forward message " action " to target " target)]
     (println err)
-    (answer receiver msg {:error err} false)))
+    (answer receiver msg {:error err :value err :status :error} false)))

 (defn- info-service-handler
   [{id :id, :as receiver} msg]
@@ -198,4 +199,4 @@
                   (catch #?(:clj Exception :cljs js/Error) e
                     (do
                       (println "Error handling service request " name ":\n" e)
-                      (answer messenger msg {:error (str e)} false))))))))
+                      (answer messenger msg {:error (str e) :value (str e) :status :error} false))))))))