More liberal use of keyword deconstruction

--- src/io/perun.clj
+++ src/io/perun.clj
@@ -46,17 +46,17 @@
   "Returns boot tmpfiles from `fileset`. `options` selects files
   that end with values in the `:extensions` key, filtered by the
   `:filterer` predicate. If `:extensions` is empty, returns all files."
-  [fileset options]
-  (filter (comp (:filterer options) (partial pm/meta-from-file fileset))
-          (tmp-by-ext fileset (:extensions options))))
+  [fileset {:keys [filterer extensions]}]
+  (filter (comp filterer (partial pm/meta-from-file fileset))
+          (tmp-by-ext fileset extensions)))

 (defn filter-meta-by-ext
   "Returns perun metadata from `fileset`. `options` selects files
   that end with values in the `:extensions` key, filtered by the
   `:filterer` predicate. If `:extensions` is empty, returns
   metadata for all files."
-  [fileset options]
-  (filter (:filterer options) (meta-by-ext fileset (:extensions options))))
+  [fileset {:keys [filterer extensions]}]
+  (filter filterer (meta-by-ext fileset extensions)))

 (def ^:private print-meta-deps
   '[[mvxcvi/puget "1.0.0"]])
@@ -190,7 +190,7 @@
   `output-extension` can be used to indicate the type of file the task produces,
   or pass `nil` to overwrite with a file of the same name and extension. Pass
   `pod` if one is needed for parsing"
-  [parse-form-fn extensions output-extension tracer options & [pod]]
+  [{:keys [parse-form-fn extensions output-extension tracer options pod]}]
   (let [tmp  (boot/tmp-dir!)
         prev (atom {})]
     (boot/with-pre-wrap fileset
@@ -258,12 +258,12 @@
   (let [pod     (create-pod markdown-deps)
         options (merge +markdown-defaults+ *opts*)]
     (content-pre-wrap
-     (fn [meta] `(io.perun.markdown/parse-markdown ~meta ~options))
-     [".md" ".markdown"]
-     ".html"
-     :io.perun/markdown
-     options
-     pod)))
+     {:parse-form-fn (fn [meta] `(io.perun.markdown/parse-markdown ~meta ~options))
+      :extensions [".md" ".markdown"]
+      :output-extension ".html"
+      :tracer :io.perun/markdown
+      :options options
+      :pod pod})))

 (deftask global-metadata
   "Read global metadata from `perun.base.edn` or configured file.
@@ -417,8 +417,7 @@
   [s slug-fn    SLUGFN     code  "function to build slug from file metadata"
    _ filterer   FILTER     code  "predicate to use for selecting entries (default: `identity`)"
    e extensions EXTENSIONS [str] "extensions of files to include"]
-  (let [options (merge +slug-defaults+ *opts*)
-        slug-fn (:slug-fn options)
+  (let [{:keys [slug-fn] :as options} (merge +slug-defaults+ *opts*)
         path-fn (fn [global-meta m]
                   (let [{:keys [path filename]} m
                         slug (slug-fn global-meta m)]
@@ -441,8 +440,7 @@
   [p permalink-fn PERMALINKFN code  "function to build permalink from TmpFile metadata"
    _ filterer     FILTER      code  "predicate to use for selecting entries (default: `identity`)"
    e extensions   EXTENSIONS  [str] "extensions of files to include"]
-  (let [options (merge +permalink-defaults+ *opts*)
-        permalink-fn (:permalink-fn options)
+  (let [{:keys [permalink-fn] :as options} (merge +permalink-defaults+ *opts*)
         path-fn (fn [global-meta m]
                   (let [permalink (permalink-fn global-meta m)]
                     (str (:doc-root global-meta)
@@ -580,7 +578,7 @@
   All `:entry`s will be returned, with their `:path`s and `:canonical-url`s
   (if there is a valid `:base-url` in global metadata) set, and `tracer`
   added to `io.perun/trace`."
-  [task-name data renderer tmp tracer global-meta]
+  [{:keys [task-name data renderer tmp tracer global-meta]}]
   (pod/with-call-in @render-pod
     (io.perun.render/update!))
   (doall
@@ -599,12 +597,17 @@
   that are required by `render-paths-fn`.

   Returns a boot `with-pre-wrap` result"
-  [task-name render-paths-fn options tracer]
+  [{:keys [task-name render-paths-fn options tracer]}]
   (let [tmp (boot/tmp-dir!)]
     (boot/with-pre-wrap fileset
       (let [render-paths (render-paths-fn fileset options)
             global-meta (pm/get-global-meta fileset)
-            new-metadata (render-to-paths task-name render-paths (:renderer options) tmp tracer global-meta)
+            new-metadata (render-to-paths {:task-name task-name
+                                           :data render-paths
+                                           :renderer (:renderer options)
+                                           :tmp tmp
+                                           :tracer tracer
+                                           :global-meta global-meta})
             rm-files (keep #(boot/tmp-get fileset (-> % :entry :path)) (vals render-paths))]
         (perun/report-info task-name "rendered %s pages" (count render-paths))
         (perun/report-debug task-name "removing files" rm-files)
@@ -654,14 +657,16 @@
                            {}
                            entries)]
                 paths))]
-      (render-pre-wrap "render" render-paths options :io.perun/render))))
+      (render-pre-wrap {:task-name "render"
+                        :render-paths-fn render-paths
+                        :options options
+                        :tracer :io.perun/render}))))

 (defn- grouped-paths
   "Produces path maps of the shape required by `render-to-paths`, based
   on the provided `fileset` and `options`."
-  [task-name fileset options]
+  [task-name fileset {:keys [grouper sortby comparator out-dir] :as options}]
   (let [global-meta (pm/get-global-meta fileset)
-        {:keys [grouper sortby comparator out-dir]} options
         paths (grouper (filter-meta-by-ext fileset options))]
     (if (seq paths)
       (reduce
@@ -739,7 +744,10 @@
           (u/fail "collection task :sortby option value should implement IFn\n")
           :else
           (let [collection-paths (partial grouped-paths "collection")]
-            (render-pre-wrap "collection" collection-paths options :io.perun/collection)))))
+            (render-pre-wrap {:task-name"collection"
+                              :render-paths-fn collection-paths
+                              :options options
+                              :tracer :io.perun/collection})))))

 (deftask inject-scripts
   "Inject JavaScript scripts into html files.


fix spec cache issue

fix spec cache issue

set/union once again not doing what expected and leaving
everything as a vector. granted that it shouldn't have used a
vector in the first place.

fixes #618

--- src/main/shadow/build/compiler.clj
+++ src/main/shadow/build/compiler.clj
@@ -800,7 +800,7 @@
               ns-spec-vars
               (->> (cljs-spec/speced-vars)
                    (filter spec-filter-fn)
-                   (into []))
+                   (into #{}))

               ana-data
               (get-in @env/*compiler* [::ana/namespaces ns])


CMR-8564 - researched this ticket, found tests to support the current behavior, decided to add a comment here to clearly define the behavior so that future tickets are not created and more time is spent on this (#1786)

--- metadata-db-app/src/cmr/metadata_db/services/concept_service.clj
+++ metadata-db-app/src/cmr/metadata_db/services/concept_service.clj
@@ -936,6 +936,11 @@
             (delete-associations context concept-type concept-id nil :tool-association)
             ;; delete the associated generic associations if applicable
             (delete-associations context concept-type concept-id nil :generic-association)
+
+            ;; Missing from this list is tag association, retain these records in case the
+            ;; concept is brought back to life (un-tombstoned). This is a feature not a bug
+            ;; backed up by tests in tag_association_test.clj
+
             ;; skip publication flag is set for tag association when its associated
             ;; collection revision is force deleted. In this case, the association is no longer
             ;; needed to be indexed, so we don't publish the deletion event.


Remove not needd require.

Remove not needd require.

--- src/oc/storage/resources/label.clj
+++ src/oc/storage/resources/label.clj
@@ -172,7 +172,6 @@

 (comment
   (require '[oc.storage.resources.org :as org])
-  (require '[oc.storage.resources.entry :as entry])
   (require '[clojure.pprint :refer (pprint)])

   (def carrot (org/get-org conn "carrot"))


fix build

fix build

--- src/open_company/api/companies.clj
+++ src/open_company/api/companies.clj
@@ -93,8 +93,7 @@
     (not (company/slug-available? slug)) [false {:reason :slug-taken}]))

 (defn company-processable [company]
-  (->> (add-slug slug company)
-       (s/check {:slug common-res/Slug, :name s/Str, s/Keyword s/Any})
+  (->> (s/check {:slug common-res/Slug, :name s/Str, s/Keyword s/Any})
        (common/check->liberator true)))

 ;; ----- Resources - see: http://clojure-liberator.github.io/liberator/assets/img/decision-graph.svg
@@ -118,7 +117,7 @@
   :processable? (by-method {
     :options true
     :get true
-    :put (fn [ctx] (company-processable (:data ctx)))
+    :put (fn [ctx] (company-processable (add-slug slug (:data ctx))))
     :patch (fn [ctx] true)}) ;; TODO validate for subset of company properties

   ;; Handlers


use sayid 0.0.17 and eastwood 0.3.3

use sayid 0.0.17 and eastwood 0.3.3

--- dot/lein/profiles.clj
+++ dot/lein/profiles.clj
@@ -4,8 +4,8 @@
             [lein-hiera "1.0.0"]
             [lein-kibit "0.1.6"]
             [lein-pprint "1.2.0"]
-            [jonase/eastwood "0.3.1"]
-            [com.billpiel/sayid "0.0.16"]
+            [jonase/eastwood "0.3.3"]
+            [com.billpiel/sayid "0.0.17"]
             [lein-cljfmt "0.6.1"]]
   :dependencies [[slamhound "1.5.5"]]
   :aliases {"slamhound" ["run" "-m" "slam.hound"]}}}


adds metric group for the services created in the grpc integration tests (#1094)

--- waiter/integration/waiter/grpc_test.clj
+++ waiter/integration/waiter/grpc_test.clj
@@ -67,6 +67,7 @@
        "max-instances" 1
        "min-instances" 1
        "mem" 512
+       "metric-group" "waiter_test"
        "name" (rand-name)
        "ports" 2
        "version" "version-does-not-matter"})))


update boot-cljs dependency -> 2.0.0

update boot-cljs dependency -> 2.0.0

--- resources/leiningen/new/tenzing/build.boot
+++ resources/leiningen/new/tenzing/build.boot
@@ -1,7 +1,7 @@
 (set-env!
  :source-paths    {{{source-paths}}}
  :resource-paths  #{"resources"}
- :dependencies '[[adzerk/boot-cljs          "1.7.228-2"  :scope "test"]
+ :dependencies '[[adzerk/boot-cljs          "2.0.0"      :scope "test"]
                  [adzerk/boot-cljs-repl     "0.3.3"      :scope "test"]
                  [adzerk/boot-reload        "0.4.13"      :scope "test"]
                  [pandeiro/boot-http        "0.7.6"      :scope "test"]


Changed date saving logic

Changed date saving logic

This might actually fix date being stored incorrectly and consequently
showing incorrectly. Verification needs to be done in production again.

--- src/ktra_indexer/db.clj
+++ src/ktra_indexer/db.clj
@@ -129,7 +129,6 @@
           -1))
       -1)))

-
 (defn insert-episode
   "Inserts a KTRA episode into the episodes table. Returns a map containing the
   status of the insert operation."
@@ -141,16 +140,18 @@
        (if-not (= (count ep-name-parts) 2)
          {:status "error"
           :cause "invalid-name"}
-         (let [insert-res (kc/insert episodes
+         (let [date-str-to-sql-date (fn [date] (c/to-sql-date
+                                                (t/from-time-zone
+                                                 (f/parse date-formatter date)
+                                                 (t/time-zone-for-id
+                                                  (cfg/get-conf-value
+                                                   :time-zone)))))
+               insert-res (kc/insert episodes
                                      (kc/values [{:number (Integer/parseInt
                                                            (ep-name-parts 1))
                                                   :name ep-name
-                                                  :date (t/to-time-zone
-                                                         (f/parse date-formatter
-                                                                  date)
-                                                         (t/time-zone-for-id
-                                                          (cfg/get-conf-value
-                                                           :time-zone)))}]))
+                                                  :date (date-str-to-sql-date
+                                                         date)}]))
                episode-id (:ep_id insert-res)]
            (if (every? pos? (for [track-json tracklist-json]
                               (insert-episode-track episode-id track-json)))


staging without https

staging without https

--- src/terraboot/infra.clj
+++ src/terraboot/infra.clj
@@ -32,7 +32,7 @@
                                          :min-number-of-public-slaves 1
                                          :max-number-of-public-slaves 1
                                          :public-slave-instance-type "t2.medium"
-                                         :public-slave-elb-listeners [{:lb-port 443 :lb-protocol "https" :port 80 :protocol "http" :cert-name "c512707d-bbec-4859-ab22-0f5fbad62a22"}
+                                         :public-slave-elb-listeners [{:port 80 :protocol "http"}
                                                                       {:port 9501 :protocol "http"}]
                                          :public-slave-elb-health "HTTP:9501/"
                                          :azs azs
@@ -53,7 +53,7 @@
                                                      :max-number-of-public-slaves 1
                                                      :public-slave-instance-type "m4.xlarge"
                                                      :public-slave-disk-allocation 20
-                                                     :public-slave-elb-listeners [{:lb_port 443 :lb_protocol "https" :port 80 :protocol "http"}
+                                                     :public-slave-elb-listeners [{:lb_port 443 :lb_protocol "https" :port 80 :protocol "http" :cert-name "TBD"}
                                                                                {:port 9501}]
                                                      :mesos-ami mesos-ami
                                                      :azs azs


test flatten-ast

test flatten-ast

--- src/logic/transform.clj
+++ src/logic/transform.clj
@@ -50,4 +50,18 @@
 (defn create-ast
   "Parses a formula and transforms it to an ast."
   [formula]
-  (-> formula logic-parse transform-ast))+  (-> formula logic-parse transform-ast))
+
+; test flatten-ast
+(def fml1 '(equiv (equiv a b) c))
+(def fml2 (flatten-ast fml1))
+(tt (list 'equiv fml1 fml2))
+
+(def fml3 '(nand (nand a b) c))
+(def fml4 (flatten-ast fml3))
+(tt (list 'equiv fml3 fml4))
+
+(def fml5 '(nor (nor a b) c))
+(def fml6 (flatten-ast fml5))
+(tt (list 'equiv fml5 fml6))
+; Fazit: nur and und or sind "flat"


STORM-130: Supervisor getting killed due to java.io.FileNotFoundException: File '../stormconf.ser' does not exist.

--- storm-core/src/clj/backtype/storm/daemon/supervisor.clj
+++ storm-core/src/clj/backtype/storm/daemon/supervisor.clj
@@ -54,10 +54,10 @@
                       {sid nil})))
            (apply merge)
            (filter-val not-nil?))]
-
+
       {:assignments (into {} (for [[k v] new-assignments] [k (:data v)]))
        :versions new-assignments})))
-
+
 (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))
@@ -163,7 +163,7 @@
      )))

 (defn- wait-for-worker-launch [conf id start-time]
-  (let [state (worker-state conf id)]
+  (let [state (worker-state conf id)]
     (loop []
       (let [hb (.get state LS-WORKER-HEARTBEAT)]
         (when (and
@@ -305,6 +305,7 @@
 (defn sync-processes [supervisor]
   (let [conf (:conf supervisor)
         ^LocalState local-state (:local-state supervisor)
+        storm-cluster-state (:storm-cluster-state supervisor)
         assigned-executors (defaulted (.get local-state LS-LOCAL-ASSIGNMENTS) {})
         now (current-time-secs)
         allocated (read-allocated-workers supervisor assigned-executors now)
@@ -327,7 +328,7 @@
     ;; 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)
@@ -349,6 +350,20 @@
                         (keys keepers))
            (zipmap (vals new-worker-ids) (keys new-worker-ids))
            ))
+
+    ;; check storm topology code dir exists before launching workers
+    (doseq [[port assignment] reassign-executors]
+      (let [storm-cluster-state (:storm-cluster-state supervisor)
+            downloaded-storm-ids (set (read-downloaded-storm-ids conf))
+            storm-id (:storm-id assignment)
+            assignment-info (.assignment-info-with-version storm-cluster-state storm-id nil)
+            storm-code-map (read-storm-code-locations assignment-info)
+            master-code-dir (if (contains? storm-code-map :data) (storm-code-map :data))
+            stormroot (supervisor-stormdist-root conf storm-id)]
+        (if-not (or (downloaded-storm-ids storm-id) (.exists (File. stormroot)))
+          (download-storm-code conf storm-id master-code-dir))
+        ))
+
     (wait-for-workers-launch
      conf
      (dofor [[port assignment] reassign-executors]
@@ -399,7 +414,7 @@
           sync-callback (fn [& ignored] (.add event-manager this))
           assignment-versions @(:assignment-versions supervisor)
           {assignments-snapshot :assignments versions :versions}  (assignments-snapshot
-                                                                   storm-cluster-state sync-callback
+                                                                   storm-cluster-state sync-callback
                                                                    assignment-versions)
           storm-code-map (read-storm-code-locations assignments-snapshot)
           downloaded-storm-ids (set (read-downloaded-storm-ids conf))
@@ -417,7 +432,7 @@
       (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?
@@ -425,16 +440,7 @@
       (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)
-          ))
+          (download-storm-code conf storm-id master-code-dir)))

       (log-debug "Writing new assignment "
                  (pr-str new-assignment))
@@ -470,7 +476,7 @@
   (.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)]
+        [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!
@@ -542,14 +548,24 @@
     ;; Downloading to permanent location is atomic
     (let [tmproot (str (supervisor-tmp-dir conf) file-path-separator (uuid))
           stormroot (supervisor-stormdist-root conf storm-id)]
+      (log-message "Downloading code for storm id "
+                   storm-id
+                   " from "
+                   master-code-dir)
       (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))
-      (setup-storm-code-dir conf (read-supervisor-storm-conf conf storm-id) stormroot)
+      (if-not (.exists (File. stormroot))
+        (FileUtils/moveDirectory (File. tmproot) (File. stormroot))
+        (FileUtils/deleteDirectory (File. tmproot)))
+      (setup-storm-code-dir conf (read-supervisor-storm-conf conf storm-id) stormroot)
+      (log-message "Finished downloading code for storm id "
+                   storm-id
+                   " from "
+                   master-code-dir)
     ))

 (defn write-log-metadata-to-yaml-file! [storm-id port data conf]
@@ -595,7 +611,7 @@
                          "%WORKER-PORT%" (str port)}
         sub-fn #(reduce (fn [string entry]
                           (apply clojure.string/replace string entry))
-                        %
+                        %
                         replacement-map)]
     (cond
       (nil? value) nil


improved end of run handling when remote servers are removed

--- src/node/game/core.cljs
+++ src/node/game/core.cljs
@@ -21,6 +21,7 @@
 (declare prompt!)
 (declare forfeit)
 (declare trigger-event)
+(declare handle-end-run)

 (defn pay [state side card & args]
   (let [costs (merge-costs (remove #(or (nil? %) (= % [:forfeit])) args))
@@ -99,7 +100,7 @@
                    (empty? (get-in @state (conj z :ices))))
           (when-let [run (:run @state)]
             (when (= (last (:server run)) n)
-              (swap! state assoc :run nil)))
+              (handle-end-run state side)))
           (swap! state update-in [:corp :servers :remote] vdissoc n)
           (swap! state assoc-in [:corp :servers :remote]
                  (vec (map-indexed
@@ -242,8 +243,9 @@
     (swap! state assoc-in [:run :ended] true)
     (do (let [server (get-in @state [:run :server])]
           (trigger-event state side :run-ends (first server))
-          (if (get-in @state [:run :successful])
-            (trigger-event state side :successful-run-ends (first server))
+          (when (get-in @state [:run :successful])
+            (trigger-event state side :successful-run-ends (first server)))
+          (when (get-in @state [:run :unsuccessful])
             (trigger-event state side :unsuccessful-run-ends (first server)))
           (swap! state assoc-in [:runner :rig :program]
                  (for [p (get-in @state [:runner :rig :program])]


Complete

Complete

--- src/toggler/handler.clj
+++ src/toggler/handler.clj
@@ -21,15 +21,22 @@
 (defn setoggle [component setting newval]
   (swap! cfg assoc-in [(keyword component) (keyword setting)] newval))

-(defn createtoggle [component setting newval]
+(defn createtoggle
+  ([component-name component-toggles]
+   (swap! cfg assoc component-name component-toggles))
+  ([component setting newval]
   (let [toggle-map (get @cfg (keyword component))]
-       (swap! cfg assoc-in [(keyword component)] (assoc toggle-map (keyword setting) newval))))
+    (swap! cfg assoc-in [(keyword component)] (assoc toggle-map (keyword setting) newval))))
+  )

 (defn reload-config [config]
   (reset! cfg config))

 (defn reset-cfg []
   (reload-config (read-default-config)))
+
+(defn modify-keys [f m]
+  (zipmap (map f (keys m)) (vals m)))

 (defresource status
   :allowed-methods [:get]
@@ -73,6 +80,12 @@
   :post! (fn [_] (createtoggle component setting newval))
   :handle-ok (encode {:component component :setting setting :newval newval}))

+(defresource create-toggles-component [component-name component-toggles]
+  :allowed-methods [:post]
+  :available-media-types ["application/json"]
+  :post! (fn [_] (createtoggle component-name component-toggles))
+  :handle-ok (encode {:component-name component-name :component-toggles component-toggles}))
+
 (defresource reconfigure [config]
   :allowed-methods [:put]
   :available-media-types ["application/json"]
@@ -104,7 +117,9 @@
   (PUT "/toggle" {body :body} (let [bodydecoded (decode (slurp body) true)]
                                 (set-toggle (get bodydecoded :component) (get bodydecoded :setting) (get bodydecoded :newval))))
   (POST "/toggle" {body :body} (let [bodydecoded (decode (slurp body) true)]
-                                 (create-toggle (get bodydecoded :component) (get bodydecoded :setting) (get bodydecoded :newval))))
+                                 (if (= (count bodydecoded) 3)
+                                   (create-toggle (get bodydecoded :component) (get bodydecoded :setting) (get bodydecoded :newval))
+                                   (create-toggles-component (keyword (get bodydecoded :component-name)) (get bodydecoded :component-toggles)))))
   (route/not-found "Not Found")
   (route/resources "/"))


Fix app environment

Fix app environment

--- src/tourbillon/main.clj
+++ src/tourbillon/main.clj
@@ -12,7 +12,6 @@
   "Start application with a given number of worker processes and optionally
   a webserver for a sample client application."
   [& args]
-  (let [env (or (first args) "dev")]
-    (log/info (str "Starting system in " env))
-    (component/start
-     (system {:app-env (get env :app-env)}))))
+  (log/info (str "Starting system in " (get env :app-env)))
+  (component/start
+    (system {:app-env (get env :app-env)})))


add docstring for free-bus

add docstring for free-bus

--- src/overtone/sc/bus.clj
+++ src/overtone/sc/bus.clj
@@ -23,7 +23,7 @@
 (defonce ^{:private true} __PROTOCOLS__
   (do
     (defprotocol IBus
-      (free-bus [this]))))
+      (free-bus [bus] "Free this control or audio bus - enabling the resource to be re-allocated"))))

 (defrecord AudioBus [id n-channels rate name]
   to-sc-id*


update liliruca message

update liliruca message

--- src/panpan/liliruca.clj
+++ src/panpan/liliruca.clj
@@ -25,12 +25,12 @@
   "
   [{:keys [user] :as arg}]
   (jh/regexp arg
-    #"リリ.+jubot.+テスト"
-    (fn [& _] (out "@" user " 了解です\n"
-                   " * document: " (get-jubot-document-version)
-                   "\n"
-                   " * core    : " (get-jubot-core-version)
-                   "\n"))
+    #"リリ.*jubot.+テスト"
+    (fn [& _]
+      (out "@" user " 了解です")
+      (out "```\n"
+           "document: " (get-jubot-document-version) "\n"
+           "core    : " (get-jubot-core-version) "\n```"))
     #"リリ.*ありがと"
     (fn [& _] (->> MESSAGES :response rand-nth (out "@" user " ")))))


[#12898] Fix endless loading in pubchats

--- src/status_im/mailserver/core.cljs
+++ src/status_im/mailserver/core.cljs
@@ -184,8 +184,9 @@

 (fx/defn handle-successful-request
   {:events [::request-success]}
-  [{:keys [db]} response-js]
-  {:db (dissoc db :mailserver/current-request)})
+  [{:keys [db] :as cofx} response-js]
+  {:db       (dissoc db :mailserver/current-request)
+   :dispatch [:sanitize-messages-and-process-response response-js]})

 (fx/defn process-next-messages-request
   {:events [::request-messages]}


Fixed picture alignment and aspect ratios.

--- site_generator/src/site_generator/core.clj
+++ site_generator/src/site_generator/core.clj
@@ -24,11 +24,11 @@
       [:div.col-md-5 {:id barchart-id}]
       [:div.col-md-2
         [:div.row {:id image-id}
-            [:img.img-responsive {:src picture-link
-                                  :style (str/join ";" ["width: 180px"
-                                                        "height: 180px"
-                                                        "border:2px solid black"
-                                                        "margin: 0 auto"])}]]
+            [:img {:src picture-link
+                   :style (str/join ";" ["width: 180px"
+                                         "height: 180px"
+                                         "border:2px solid black"
+                                         "margin: 1em auto 0"])}]]
         [:div.row.text-center
          [:h5 (escape-html subj-name)]]]
       [:div.col-md-5 {:id sparkline-id}]]))


Refactoring: code to insert new words refactored into the function insert-new-word-into-dictionary

--- src/zg/db_interface.clj
+++ src/zg/db_interface.clj
@@ -18,28 +18,6 @@
 (require '[zg.db-spec     :as db-spec])
 (require '[zg.format-date :as format-date])

-(defn add-new-word-into-dictionary
-    ([word user-name dictionary-type]
-    (let [datetime (format-date/format-current-date)]
-        (println "storing" datetime word)
-        (try
-            (jdbc/insert! db-spec/zg-db
-                          :dictionary {:word word :dictionary dictionary-type :user user-name :datetime datetime :deleted 0})
-            (catch Exception e
-                (println e)))))
-    ([word description user-name dictionary-type]
-    (let [datetime (format-date/format-current-date)]
-        (println "storing" datetime word)
-        (try
-            (jdbc/insert! db-spec/zg-db
-                          :dictionary {:word word :dictionary dictionary-type :user user-name :datetime datetime :deleted 0 :description description})
-            (catch Exception e
-                (try
-                    (jdbc/update! db-spec/zg-db
-                          :dictionary {:description description} ["word=?" word])
-                    (catch Exception e
-                        (println e))))))))
-
 (defn status->int
     [status]
     (if (= status :deleted)
@@ -51,6 +29,38 @@
     (condp = dictionary-type
         :whitelist "w"
         :blacklist "b"))
+
+(defn insert-word-into-dictionary
+    "Try to insert new word into the dictionary. If insert fails, exception
+     is thrown and needs to be caught outside this function."
+    [word description user-name dictionary-type datetime]
+    (jdbc/insert! db-spec/zg-db
+        :dictionary {:word       word
+                     :dictionary (dictionary-type->char dictionary-type)
+                     :user       user-name
+                     :datetime   datetime
+                     :deleted     0
+                     :description description}))
+
+(defn add-new-word-into-dictionary
+    ([word user-name dictionary-type]
+    (let [datetime (format-date/format-current-date)]
+        (println "storing" datetime word)
+        (try
+            (insert-word-into-dictionary word nil user-name dictionary-type datetime)
+            (catch Exception e
+                (println e)))))
+    ([word description user-name dictionary-type]
+    (let [datetime (format-date/format-current-date)]
+        (println "storing" datetime word)
+        (try
+            (insert-word-into-dictionary word description user-name dictionary-type datetime)
+            (catch Exception e
+                (try
+                    (jdbc/update! db-spec/zg-db
+                          :dictionary {:description description} ["word=?" word])
+                    (catch Exception e
+                        (println e))))))))

 (defn set-word-status
     [word dictionary-type status]


loads files on startup

loads files on startup

--- src/server/watcher.cljs
+++ src/server/watcher.cljs
@@ -3,6 +3,7 @@
             [moomoo.file-hash :as file-hash]))

 (defonce watchr (nodejs/require "watchr"))
+(defonce fs (nodejs/require "fs"))

 (defn new-file [file-path]
   (println "New file: " file-path)
@@ -20,5 +21,9 @@

 (defn watch-directories! [directories]
   (println "Starting watcher on the following directories:" directories)
+  (doseq [directory directories]
+    (.readdir fs directory
+      (fn [err files]
+        (doseq [file files] (new-file (str directory "/" file))))))
   (.watch watchr #js {:paths (clj->js directories)
                       :listener listener}))


Add cursors and temproarily remove schema validation

--- src/singularity/db.cljs
+++ src/singularity/db.cljs
@@ -1,23 +1,10 @@
-(ns singularity.db
+(ns ^{:doc "Contains central persistent db atom and helper get/set functions."}
+  singularity.db
   (:refer-clojure :exclude [get get-in update-in assoc-in])
   (:require [reagent.core :refer [atom]]
-            [schema.core :as s :include-macros true]))
+            [reagent.ratom :refer [cursor]]))

-(def schema
-  "Defines the expected shape (i.e. data model) for `state`."
-  (let [piece-colors (s/enum :white :black)
-        piece-types (s/enum :rook :knight :bishop :pawn :queen :king)]
-    {:board-width s/Num
-     :selected-space (s/maybe [s/Num])
-     :me piece-colors
-     :them (s/enum :ai :player :me)
-     :turn piece-colors
-     :board (s/both
-       (s/pred #(= 64 (count %)))
-       {[s/Num] {:piece (s/maybe {
-        :color piece-colors
-        :type piece-types})}})}))

 ; Use schema as validator for state atom. Ensures that an exception
@@ -25,8 +12,17 @@
 (def state
   "Central application state atom. Automatically validated to match
    the `schema`. Easily get/set data in here using the `singularity.db`
-   versions of `get-in`, `update-in`, and `assoc-in`."
-  (atom {} {:validator #(s/validate schema %)}))
+   versions of `get-in`, `update-in`, `assoc-in`, etc."
+  (atom {} {:validator (constantly true)}))
+
+(defn me [] (cursor state [:me]))
+(defn them [] (cursor state [:them]))
+(defn turn [] (cursor state [:turn]))
+(defn selected-space [] (cursor state [:selected-space]))
+(defn board-width [] (cursor state [:board-width]))
+(defn board [] (cursor state [:board]))
+(defn square [coords] (cursor (board) [coords]))
+(defn piece [coords] (cursor (square coords) [:piece]))

 ; These functions wrap the `clojure.core` versions, preventing the user
 ; from having to think about derefs, swap!, etc.
@@ -34,4 +30,7 @@
 (defn get-in [path] (clojure.core/get-in @state path))
 (defn update-in [path fn] (swap! state clojure.core/update-in path fn))
 (defn assoc-in [path fn] (swap! state clojure.core/assoc-in path fn))
-(defn define [& args] (swap! state conj (->> args (partition 2) (map vec))))+
+(defn define
+  "Helper function for merging into state. Usage: (define k1 v1, k2 v2, ...)"
+  [& args] (swap! state conj (->> args (partition 2) (map vec))))


removed invalid prop from core template

removed invalid prop from core template

--- resources/core.cljs
+++ resources/core.cljs
@@ -9,7 +9,6 @@

 ;; Setup some methods to help create React Native elements
-
 (defn view [opts & children]
   (apply js/React.createElement js/React.View (clj->js opts) children))

@@ -18,14 +17,13 @@

 ;; Set up our Om UI
-
 (defonce app-state (atom {:text "Welcome to $PROJECT_NAME$"}))

 (defn widget [data owner]
   (reify
     om/IRender
     (render [this]
-      (view {:style {:flexDirection "row" :margin 40 :fontSize 20}}
+      (view {:style {:flexDirection "column" :margin 40}}
         (text nil (:text data))))))

 (om/root widget app-state {:target 1})


shuffle fn order

shuffle fn order

--- cljs/sledge/core.cljs
+++ cljs/sledge/core.cljs
@@ -217,20 +217,6 @@
         ))
     ))

-
-(defn queue-track-view [track owner]
-  (reify
-    om/IRenderState
-    (render-state [this {:keys [index current?]}]
-      (let [command-chan (om/get-shared owner :command-channel)]
-        (html
-         [:div {:className (if current? "current-track track" "track")}
-          [:span {:className "artist"} (get track "artist")]
-          [:span {:className "album"} (get track "album" )]
-          [:span {:className "title"} (get track "title")]
-          [:span {:className "duration"} (mmss (get track "length"))]
-          [:button {:onClick #(put! command-chan [:dequeue index])}
-           "-"]])))))

 (defn audio-el [state owner]
   (reify
@@ -352,6 +338,20 @@
             (mmss (get track "length" 0))]]
           ])))))

+(defn queue-track-view [track owner]
+  (reify
+    om/IRenderState
+    (render-state [this {:keys [index current?]}]
+      (let [command-chan (om/get-shared owner :command-channel)]
+        (html
+         [:div {:className (if current? "current-track track" "track")}
+          [:span {:className "artist"} (get track "artist")]
+          [:span {:className "album"} (get track "album" )]
+          [:span {:className "title"} (get track "title")]
+          [:span {:className "duration"} (mmss (get track "length"))]
+          [:button {:onClick #(put! command-chan [:dequeue index])}
+           "-"]])))))
+
 (defn queue-view [app owner]
   (reify
     om/IRender


Removed component-preference feature from modular.bidi

--- modules/bidi/src/modular/bidi.clj
+++ modules/bidi/src/modular/bidi.clj
@@ -93,39 +93,6 @@
      {::routes joined-routes
       ::handlers handlers})))

-;; Production of a Ring handler from multiple WebService components
-
-;; The ComponentPreference record modifies a bidi route structure to
-;; preference a given component when forming a URI from a
-;; keyword. Without ComponentPreference, components using identical
-;; keywords in their request-handlers map could inadvertantly get in the
-;; way of path-for calls from another component.
-
-(defrecord ComponentPreference [matched component]
-  bidi/Matched
-  (resolve-handler [this m]
-    (bidi/resolve-handler matched m))
-  (unresolve-handler [this m]
-    (if (keyword? (:handler m))
-      (or
-       ;; In case there's another component using the same key in a handler-map,
-       ;; preference a path to an 'internal' handler first.
-       (bidi/unresolve-handler matched (assoc m :handler [component (:handler m)]))
-       (bidi/unresolve-handler matched m))
-      (bidi/unresolve-handler matched m))))
-
-(defn wrap-component-preference
-  "Augment the routes entry bound to a request with data indicating the
-  component owner of the handler. This information is used to modify the
-  behaviour of the path-for function on those routes, such that the
-  component owner is preferenced in the case where multiple handlers
-  use identical keywords."
-  [h component]
-  (if (fn? h)
-    (fn [req]
-      (h (update-in req [::routes] (fn [r] ["" (->ComponentPreference [r] component)]))))
-    h))
-
 ;; We use ComponentAddressable to allow the formation of URIs using
 ;; korks in addition to direct reference to handlers, which may be
 ;; difficult to obtain in modular applications.
@@ -160,7 +127,6 @@
     (when-let [{:keys [handler] :as res} (bidi/resolve-handler matched m)]
       (if (keyword? handler)
         (assoc res :handler (-> (get-in handlers [ckey handler])
-                                (wrap-component-preference ckey)
                                 (wrap-capture-component-on-error :component ckey :handler handler)))
         res)))


formatting

formatting

--- test/babel/test/fr.cljc
+++ test/babel/test/fr.cljc
@@ -662,8 +662,11 @@
          "plains")))

 (deftest nous-acheterons
-  (let [spec {:synsem {:sem {:tense :future}, :subcat ()},
-              :root {:français {:français "acheter"}}, :comp {:synsem {:agr {:person :1st, :number :plur}}}}
+  (let [spec {:synsem {:sem {:tense :future},
+                       :subcat []}
+              :root {:français {:français "acheter"}}
+              :comp {:synsem {:agr {:person :1st
+                                    :number :plur}}}}
         generated (babel.generate/generate spec model)]
     (is (= (not (nil? generated))))
     (is (= "nous acheterons" (fo generated)))))


add more conjugate tests

add more conjugate tests

--- test/babel/test/fr.cljc
+++ test/babel/test/fr.cljc
@@ -5,7 +5,7 @@
             [babel.forest :as forest]
             [babel.francais.grammar :refer [small medium]]
             [babel.francais.lexicon :refer [lexicon]]
-            [babel.francais.morphology :refer [analyze conjugate fo
+            [babel.francais.morphology :refer [analyze conjugate fo get-string
                                                possible-lexemes replace-patterns]]
             [babel.francais.workbook :refer [generate lookup parse tokenize]]
             [babel.over :as over]
@@ -265,11 +265,48 @@

 (deftest conjugate2
   (is (= "amusé" (conjugate "s'amuser"
-                            {:synsem {:infl :past-p :subcat {:1 {:agr {:number :sing}}}}}))))
+                            {:synsem {:infl :past-p
+                                      :subcat {:1 {:agr {:number :sing}}}}}))))
 (deftest conjugate3
   (is (= (conjugate "s'amuser"
-                    {:synsem {:infl :past-p :subcat {:1 {:agr {:number :plur}}}}})
+                    {:synsem {:infl :past-p
+                              :subcat {:1 {:agr {:number :plur}}}}})
          "amusés")))
+
+(deftest conjugate4
+  (is (= (conjugate "s'amuser"
+                    {:synsem {:infl :past-p
+                              :subcat {:1 {:agr {:gender :masc
+                                                 :number :plur}}}}})
+         "amusés")))
+
+(deftest conjugate5
+  (is (= (conjugate "s'amuser"
+                    {:synsem {:infl :past-p
+                              :subcat {:1 {:agr {:gender :fem
+                                                 :number :plur}}}}})
+         "amusées")))
+
+(deftest conjugate6
+  (is (= (conjugate "se blesser"
+                    {:synsem {:infl :past-p
+                              :subcat {:1 {:agr {:gender :masc
+                                                 :number :sing}}}}})
+         "blessé")))
+
+(deftest conjugate7
+  (is (= (conjugate "se blesser"
+                    {:synsem {:infl :past-p
+                              :subcat {:1 {:agr {:gender :fem
+                                                 :number :plur}}}}})
+         "blessées")))
+
+(deftest conjugate7
+  (is (= (conjugate "se blesser"
+                    {:synsem {:infl :present
+                              :subcat {:1 {:agr {:person :2nd
+                                                 :number :sing}}}}})
+         "blesses")))

 (defn get-lex [exp]
   (filter #(not (nil? (:lookup %)))


Close #64: add instant to zoned date time unit test

--- test/java_time_test.clj
+++ test/java_time_test.clj
@@ -1094,3 +1094,9 @@
              (j/instant 100)
              ;; Then you'll get a LocalDateTime by providing the instant and the time zone to the local-date-time constructor:
              (j/local-date-time "UTC")))))
+
+;; https://github.com/dm3/clojure.java-time/issues/64
+(deftest instant-to-zoned-date-time-test
+  (is (= (j/zoned-date-time #inst "1970-01-01T00:00:00.100" "UTC")
+         (-> (j/instant 100)
+             (j/zoned-date-time "UTC")))))


Use 100 for the number of warm up runs before recording time

--- test/transit/verify.clj
+++ test/transit/verify.clj
@@ -124,7 +124,7 @@

 (defn test-timing [transits proc encoding]
   (println "collecting timing information...")
-  (dotimes [x 10000]
+  (dotimes [x 100]
     (mapv #(roundtrip-transit proc % encoding) transits))
   (let [start (System/currentTimeMillis)]
     (mapv #(roundtrip-transit proc % encoding) transits)


Fix failed test: add locale to content options

--- test/uruk/core_test.clj
+++ test/uruk/core_test.clj
@@ -2,6 +2,7 @@
   (:require [clojure.test :refer :all]
             [uruk.core :refer :all])
   (:import [java.util.logging Logger]
+           [java.util Locale]
            [com.marklogic.xcc RequestOptions]))

 ;; FIXME You'll have to fill in database credentials that work for
@@ -115,7 +116,7 @@
                     :format :text
                     :graph "my-graph"
                     :language "fr"
-                    ;; :locale
+                    :locale (Locale. "ru")
                     :namespace "my-ns"
                     :permissions [{"such-and-such-role" :insert}
                                   {"such-and-such-role" :update}]


add link to PR

add link to PR

--- src/hu/ssh/github_changelog/formatters/markdown.clj
+++ src/hu/ssh/github_changelog/formatters/markdown.clj
@@ -21,7 +21,9 @@
        (:subject change)
        (let [issues (:issues change)]
          (if (not (empty? issues))
-           (str ", closes " (str-map (partial apply markdown/link) issues)))))
+           (str ", closes " (str-map (partial apply markdown/link) issues))))
+       (let [pr (:pull-request change)]
+         (str " " (markdown/link (str "#" (:number pr)) (:html_url pr))))))

 (s/defn format-changes :- s/Str
   [[type changes :- [Change]]]


Removed unneccessary dependencies

Removed unneccessary dependencies

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

--- src/conexp/contrib/gui/editors/context_editor/context_editor.clj
+++ src/conexp/contrib/gui/editors/context_editor/context_editor.clj
@@ -17,8 +17,7 @@
         conexp.contrib.gui.editors.context-editor.editable-contexts
         conexp.contrib.gui.editors.context-editor.context-editor-control)
   (:use seesaw.core)
-  (:import [javax.swing JRootPane KeyStroke Box JFrame JTable JComponent]
-           [java.awt BorderLayout]
+  (:import [javax.swing KeyStroke Box JTable]
            [java.awt.event KeyEvent ActionEvent])
   (:import conexp.contrib.gui.editors.context_editor.context_editor_control.context-editor-widget))


type hint inst. fixes #132

type hint inst. fixes #132

--- src/tick/alpha/api.cljc
+++ src/tick/alpha/api.cljc
@@ -62,8 +62,8 @@
   ([v] (p/date v)))

 (defn inst
-  ([] (p/inst (now)))
-  ([v] (p/inst v)))
+  (^java.util.Date [] (p/inst (now)))
+  (^java.util.Date [v] (p/inst v)))

 (defn instant
   ([] (p/instant (now)))


extract common slide! event handler

extract common slide! event handler

--- src/tile_game/grid.cljs
+++ src/tile_game/grid.cljs
@@ -17,6 +17,9 @@
 (defn new-board! [& args]
   #(swap! app-state assoc :board (apply b/create-board args)))

+(defn slide! [arg]
+  (swap! app-state update-in [:board] b/slide arg))
+
 (defn board-size-slider [size]
   [:div
    [:button {:on-click (new-board! size)} "New Game"]
@@ -29,8 +32,7 @@
 (defn render-tile [[x y] tile]
   (if-not (zero? tile)
     (let [fill-color (nth colors tile)]
-      [:g {:key (str "tile-" tile)
-           :on-click #(swap! app-state update-in [:board] b/slide-tile tile)}
+      [:g {:key (str "tile-" tile) :on-click #(slide! tile)}
        [:rect {:x (+ x 0.05) :y (+ y 0.05) :width 0.9 :height 0.9 :fill fill-color}]
        [:text {:x (+ 0.5 x) :y (+ 0.65 y)
                :font-family "Verdana" :font-size 0.4 :text-anchor "middle"}
@@ -59,7 +61,7 @@
 (defn handle-keydown [e]
   (when-let [direction (codename (.-keyCode e))]
     (.preventDefault e)
-    (swap! app-state update-in [:board] b/slide direction)))
+    (slide! direction)))

 (defn init []
   (.addEventListener js/document "keydown" handle-keydown)


Handle less than 0 seconds.

Handle less than 0 seconds.

--- src/cljs/wombats_web_client/components/countdown_timer.cljs
+++ src/cljs/wombats_web_client/components/countdown_timer.cljs
@@ -12,8 +12,10 @@
   (let [total-seconds (seconds-until time)
         seconds (mod total-seconds 60)
         minutes (/ (- total-seconds seconds) 60)
-        seconds-display (if (< seconds 10) (str "0" seconds) seconds)]
-    (str minutes ":" seconds-display)))
+        seconds-formatted (if (< seconds 10) (str "0" seconds) seconds)]
+    (if (< seconds 0)
+      "0:00"
+      (str minutes ":" seconds-formatted))))

 (defn countdown-timer
   [start-time]


filetype suffices removed

filetype suffices removed

--- src/toggler/handler.clj
+++ src/toggler/handler.clj
@@ -5,7 +5,8 @@
             [liberator.core :refer [resource defresource]]
             [cheshire.core :refer :all]
             [ring.adapter.jetty :refer (run-jetty)]
-            [clojure.java.io :as io])
+            [clojure.java.io :as io]
+            [clojure.string :as str])
   (:gen-class))

 (def backup-counter (atom 0))
@@ -70,11 +71,17 @@
   [file-s]
   (map #(.getName %) file-s))

+(defn remove-suffix
+  "return a filelist without the file suffices"
+  [file-s]
+  (map #(str/join "." (drop-last (str/split (str %) #"\."))) file-s))
+
 (defn getconfigs
   ([]
    (->> (file-seq (clojure.java.io/file @filepath))
         (only-files)
         (file-names)
+        (remove-suffix)
         (vec))))

 (defresource status


Client sending messages

Client sending messages

--- src/kushana/core.cljc
+++ src/kushana/core.cljc
@@ -81,7 +81,17 @@
       (let [in         (<! event-ch)
             next-state (act state in)]
         (reset! scene-atom next-state)
-        #_(when send! (send! [:client/data in]))
+        #?(:cljs
+           (when send!
+             (let [input   (:input in)
+                   cleaned (dissoc input
+                                   :debug/input
+                                   :debug/ping
+                                   :debug/overview
+                                   :reload/logic
+                                   :reload/merge
+                                   :reload/scene)]
+               (send! [:client/data cleaned]))))
         (>! out next-state)
         (recur next-state)))
     out))


Refactor new task.

Refactor new task.

--- src/leiningen/new.clj
+++ src/leiningen/new.clj
@@ -6,6 +6,38 @@
   (:use [leiningen.core :only [ns->path]]
         [clojure.java.io :only [file]]
         [clojure.contrib.string :only [join]]))
+
+(defn write-project [project-dir project-name]
+  (.mkdirs (file project-dir))
+  (spit (file project-dir "project.clj")
+        (str "(defproject " project-name " \"1.0.0-SNAPSHOT\"\n"
+             "  :description \"FIXME: write\"\n"
+             "  :dependencies [[org.clojure/clojure \"1.2.0-beta1\"]\n  "
+             "               [org.clojure/clojure-contrib \"1.2.0-beta1\"]])")))
+
+(defn write-implementation [project-dir project-clj project-ns]
+  (.mkdirs (.getParentFile (file project-dir "src" project-clj)))
+  (spit (file project-dir "src" project-clj)
+        (str "(ns " project-ns ")\n")))
+
+(defn write-test [project-dir test-ns project-ns]
+  (.mkdirs (.getParentFile (file project-dir "test" (ns->path test-ns))))
+  (spit (file project-dir "test" (ns->path test-ns))
+        (str "(ns " (str test-ns)
+             "\n  (:use [" project-ns "] :reload-all)"
+             "\n  (:use [clojure.test]))\n\n"
+             "(deftest replace-me ;; FIXME: write\n  (is false "
+             "\"No tests have been written.\"))\n")))
+
+(defn write-readme [project-dir artifact-id]
+  (spit (file project-dir "README")
+        (join "\n\n" [(str "# " artifact-id)
+                      "FIXME: write description"
+                      "## Usage" "FIXME: write"
+                      "## Installation" "FIXME: write"
+                      "## License" "Copyright (C) 2010 FIXME"
+                      (str "Distributed under the Eclipse Public"
+                           " License, the same as Clojure.\n")])))

 (defn new
   "Create a new project skeleton.
@@ -18,38 +50,16 @@
      (let [project-name (symbol project-name)
            group-id (namespace project-name)
            artifact-id (name project-name)]
-       (.mkdirs (file project-dir))
-       (spit (file project-dir "project.clj")
-             (str "(defproject " project-name " \"1.0.0-SNAPSHOT\"\n"
-                  "  :description \"FIXME: write\"\n"
-                  "  :dependencies [[org.clojure/clojure \"1.2.0-beta1\"]\n"
-                  "                 [org.clojure/clojure-contrib \"1.2.0-beta1\"]])"))
+       (write-project project-dir project-name)
        (let [prefix (.replace (str project-name) "/" ".")
              project-ns (str prefix ".core")
              test-ns (str prefix ".test.core")
-             project-clj (ns->path project-ns)
-             test-clj (ns->path test-ns)]
-         (.mkdirs (file project-dir "test"))
-         (.mkdirs (.getParentFile (file project-dir "src" project-clj)))
-         (spit (file project-dir "src" project-clj)
-               (str "(ns " project-ns ")\n"))
-         (.mkdirs (.getParentFile (file project-dir "test" test-clj)))
-         (spit (file project-dir "test" test-clj)
-               (str "(ns " (str test-ns)
-                    "\n  (:use [" project-ns "] :reload-all)"
-                    "\n  (:use [clojure.test]))\n\n"
-                    "(deftest replace-me ;; FIXME: write\n  (is false "
-                    "\"No tests have been written.\"))\n"))
+             project-clj (ns->path project-ns)]
          (spit (file project-dir ".gitignore")
                (join "\n" ["pom.xml" "*jar" "lib" "classes"]))
-         (spit (file project-dir "README")
-               (join "\n\n" [(str "# " artifact-id)
-                                 "FIXME: write description"
-                                 "## Usage" "FIXME: write"
-                                 "## Installation" "FIXME: write"
-                                 "## License" "Copyright (C) 2010 FIXME"
-                                 (str "Distributed under the Eclipse Public"
-                                      " License, the same as Clojure.\n")]))
+         (write-implementation project-dir project-clj project-ns)
+         (write-test project-dir test-ns project-ns)
+         (write-readme project-dir artifact-id)
          (println "Created new project in:" project-dir))))
   ([project-name] (leiningen.new/new project-name
                                      (name (symbol project-name)))))


Add dummy loop to start the first worker as well

- Will figure out how this works eventually

--- worker/src/clinicico/worker/consumer.clj
+++ worker/src/clinicico/worker/consumer.clj
@@ -15,7 +15,6 @@

 (defprotocol Protocol
   (send! [this socket messages]))
-

 (defrecord MessageProtocol [method]
   Protocol
@@ -46,14 +45,15 @@
         ping #(do (send! (@consumer :protocol) (@consumer :socket) [q/MSG-PING]))
         heartbeat (fn []
                     (when (contains? @consumer :socket)
-                      (let [next-liveness (dec (get @consumer :liveness (inc heartbeat-liveness)))]
+                      (let [next-liveness (dec (get @consumer :liveness heartbeat-liveness))]
                         (swap! consumer assoc :liveness next-liveness)
                         (if (> next-liveness 0)
                           (ping)
                           (@reconnecter)))))]
     (swap! consumer assoc :handlers (merge (@consumer :handlers) {q/MSG-PONG pong}))
     (.addTimer (@consumer :zloop) heartbeat-interval 0
-               (q/zloop-handler #(do (heartbeat) 0)) (Object.))))
+               (q/zloop-handler #(do (heartbeat) 0)) {})))
+

 (defn- handle-request
   [consumer handler]
@@ -83,7 +83,6 @@
         consumer (atom {:handlers  {}
                         :protocol protocol
                         :zloop zloop
-                        :consumer (agent 0)
                         :socket nil})
         initialize #(let [poller (zmq/poller context 1)
                           socket (q/create-connected-socket
@@ -93,14 +92,17 @@
                       (.addPoller (@consumer :zloop)
                                   (.getItem poller 0)
                                   (q/zloop-handler (fn [] ((handle-incoming consumer)) (int 0)))
-                                  (Object.))
+                                  {})
                       (send! protocol socket [q/MSG-READY]))]
     (log/info "[consumer] started consumer for" method)
     (swap! consumer assoc
            :handlers {q/MSG-REQ (handle-request consumer handler)}
            :initialize initialize)
     ((@consumer :initialize))
-    (send (@consumer :consumer) (fn [_] (.start zloop)))
+    ; mysterious hack required to start the zloop
+    (.addTimer zloop 1000 0 (q/zloop-handler #(do (Thread/sleep 1) 0)) {})
+
+    (.start (Thread. #(.start zloop)))
     consumer))

 (defn start


s|log/info|log/debug|

s|log/info|log/debug|

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -150,7 +150,7 @@
       tree)))

 (defn comp-paths-to-complements [bolt model depth max-depth]
-  (log/info (str "comp-paths-to-complements: bolt:" ((:morph-ps model) bolt)))
+  (log/debug (str "comp-paths-to-complements: bolt:" ((:morph-ps model) bolt)))
   (into {}
         (map (fn [path]
                [path (lazy-seq (comp-path-to-complements bolt path model depth max-depth))])


cleanup

cleanup

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -88,35 +88,24 @@
   "Returns a lazy-sequence of all possible bolts given a spec, where a bolt is a tree
 such that only the head children are generated. This sequence is used by (generate (above))
 to generate expressions by adding complements using (add-all-comps)."
-  (log/trace (str "lightning-bolts(depth=" depth
-                  "; total-depth=" total-depth
-                  "; max-total-depth=" max-total-depth
-                  "; spec info:" (spec-info spec) ")"))
-  (let [morph (:morph language-model)
-        grammar (:grammar language-model)
+  (let [grammar (:grammar language-model)
         index (:index language-model)
-        morph (if morph morph (fn [input] (get-in input [:rule] :default-morph-no-rule)))
         depth (if depth depth 0)
         ;; this is the relative depth; that is, the depth from the top of the current lightning bolt.
         ;; total-depth, on the other hand, is the depth all the way to the top of the entire
         ;; expression, which might involve several parent lightning bolts.
         parents (shuffle (candidate-parents grammar spec))]
-    (log/debug (str "lightning-bolt: candidate-parents: [" (string/join "," (map :rule parents)) "] for spec:" (strip-refs spec)))
     (let [lexical ;; 1. generate list of all phrases where the head child of each parent is a lexeme.
           (when (= false (get-in spec [:head :phrasal] false))
             (mapfn (fn [parent]
-                     (log/debug (str "looking for lexical heads of parent: " (:rule parent)))
                      (let [pred (get-in spec [:synsem :sem :pred])
                            cat (get-in spec [:synsem :cat])
                            pred-set (if (:pred2lex language-model) (get (:pred2lex language-model) pred))
                            cat-set (if (:cat2lex language-model) (get (:cat2lex language-model) cat))
                            subset
                            (cond
-                             (and
-                              (not (= :top pred))
-                              (not (empty? pred-set))
-                              (not (= :top cat))
-                              (not (empty? cat-set)))
+                             (and (not (= :top pred)) (not (empty? pred-set))
+                                  (not (= :top cat)) (not (empty? cat-set)))
                              (intersection-with-identity pred-set cat-set)
                              true (get-lex parent :head index))]
                        (over/overh parent (shuffle subset))))
@@ -125,15 +114,11 @@
           (if (and (< total-depth max-total-depth)
                    (= true (get-in spec [:head :phrasal] true)))
             (mapfn (fn [parent]
-                     (log/debug (str "looking for phrasal heads of parent: " (:rule parent)))
                      (over/overh parent
                                  (lightning-bolts language-model (get-in parent [:head])
                                                   (+ 1 depth) (+ 1 total-depth)
                                                   :max-total-depth max-total-depth)))
-                   parents)
-            (do
-              (log/trace (str "hit max-total-depth: " max-total-depth ": will not generate phrasal head children."))
-              nil))]
+                   parents))]
       (if (lexemes-before-phrases total-depth max-total-depth)
         (lazy-cat lexical phrasal)
         (lazy-cat phrasal lexical)))))


if (defn comp-paths-to-complements) finds no possible complements for a given path, return (as before, without merging rest of paths) but return the path with the value being [], so this bolt can be filtered out by (generate-all)

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -51,12 +51,11 @@
      (map (fn [bolt]
             (let [comp-paths-to-complements
                   (comp-paths-to-complements bolt (find-comp-paths bolt) model depth max-depth)]
-              (if (not (nil? comp-paths-to-complements))
+              (if (not (some empty? comp-paths-to-complements))
                 (merge
                  {[]
                   (filter not-fail? [bolt])}
                  comp-paths-to-complements)))))
-     (remove nil?)
      (map (fn [each-bolt-and-comps]
             (map (fn [each-path-through-trellis]
                    (zipmap (keys each-bolt-and-comps)
@@ -185,7 +184,8 @@
       (if (not (empty? comps))
         (merge
          {path comps}
-         (comp-paths-to-complements bolt (rest comp-paths) model depth max-depth))))))
+         (comp-paths-to-complements bolt (rest comp-paths) model depth max-depth))
+        {path []}))))

 ;; TODO: lightning-bolts should use this.
 (defn get-lexemes [model spec]


cleanup and simplify

cleanup and simplify

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -19,16 +19,20 @@
 (def ^:const handle-unify-fail #(log/debug %))
 (def ^:const throw-exception-on-unify-fail false)

-;; deterministic generation:
-;;(def ^:const shufflefn (fn [x] x))
-
-;; nondeterministic generation
-(def ^:const shufflefn (fn [x] (shuffle x)))
+
+(def ^:const shufflefn
+  (fn [x]
+    ;; deterministic generation:
+;;    x
+    ;; nondeterministic generation
+    (lazy-seq (shuffle x))
+
+    ))

 (def ^:const randomize-lexemes-before-phrases
-;;  false)
-;;(def ^:const randomize-lexemes-before-phrases
-  true)
+;;  false
+  true
+  )

 ;; whether to remove [:head] and [:comp] paths from generated trees after generation:
 ;; for performance.
@@ -126,7 +130,7 @@
              (dag_unify.core/strip-refs (dissoc-paths % [[:head][:comp]]))
              %))

-     ;; 11. Remove fails.
+     ;; 9. Remove fails.
      (remove #(= :fail %))
      )))

@@ -265,14 +269,12 @@
   which makes returning true (i.e. lexemes first) increasingly likely
   as depth increases."
   [depth max-total-depth]
-  (if (not randomize-lexemes-before-phrases)
-    false
-    (if (> max-total-depth 0)
-      (let [prob (- 1.0 (/ (- max-total-depth depth)
-                           max-total-depth))]
-        (log/trace (str "P(c," depth ") = " prob " (c: probability of choosing lexemes rather than phrases given depth " depth ")"))
-        (> (* 10 prob) (rand-int 10)))
-      false)))
+  (and (not randomize-lexemes-before-phrases)
+       (> max-total-depth 0)
+       (let [prob (- 1.0 (/ (- max-total-depth depth)
+                            max-total-depth))]
+         (log/trace (str "P(c," depth ") = " prob " (c: probability of choosing lexemes rather than phrases given depth " depth ")"))
+         (> (* 10 prob) (rand-int 10)))))

 (defn not-fail? [arg]
   (not (= :fail arg)))
@@ -301,21 +303,11 @@
   (filter not-fail?
           (mapfn (fn [rule]
                    (log/trace (str "candidate-parents: testing rule: " (:rule rule)))
-                   (if (not-fail? (unify (get-in rule [:synsem :cat] :top)
-                                         (get-in spec [:synsem :cat] :top)))
-                     ;; TODO: add checks for [:synsem :subcat] valence as well as [:synsem :cat].
-                     (do
-                       (log/trace (str "candidate-parents: " (:rule rule) " is a cat-wise candidate for spec:"
-                                       (strip-refs spec)))
-                       (let [unified (unify spec rule)]
-                         (if (= :fail unified)
-                           (log/trace (str "candidate parent: " (:rule rule) " failed at:" (fail-path spec rule)))
-                           (log/debug (str "candidate parent: " (:rule rule) " unified successfully with spec:" (strip-refs spec))))
-                         unified))
-                     (do
-                       (log/debug (str "candidate-parents: " (:rule rule) " is *not* a head candidate for spec:"
-                                       (strip-refs spec)))
-                       :fail)))
+                   (let [unified (unify spec rule)]
+                     (if (= :fail unified)
+                       (log/debug (str "candidate parent: " (:rule rule) " failed at:" (fail-path spec rule)))
+                       (log/debug (str "candidate parent: " (:rule rule) " unified successfully with spec:" (strip-refs spec))))
+                     unified))
                  rules)))

 (defn show-bolt [bolt language-model]


+(defn find-comp-paths,find-end-of-bolt)

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -327,6 +327,23 @@
     (+ 1 (bolt-depth head))
     0))

+(defn find-end-of-bolt [bolt]
+  (cond (= true (get-in bolt [:phrasal]))
+        (cons :head
+              (find-end-of-bolt (get-in bolt [:head])))
+        true
+        []))
+
+(defn find-comp-paths [bolt & [path]]
+  (let [path (if (nil? path)
+               (rest (find-end-of-bolt bolt))
+               path)]
+    (if (not (empty? path))
+      (concat
+       [(vec (concat path [:comp]))]
+       (find-comp-paths bolt (rest path)))
+      [[:comp]])))
+
 (defn find-comp-paths-in [depth]
   (cond
     ;; most-frequent cases done statically:


~(defn generate): remove use of generation-implications since the latter has been removed; +TODO comment to remove of babel.italiano/generate as well

--- src/babel/italiano.cljc
+++ src/babel/italiano.cljc
@@ -64,20 +64,15 @@
   ([surface-form model]
    (morph/analyze surface-form (:lexicon model))))

+;; TODO: remove this (defn generate): use babel.generate/generate instead.
 (defn generate
   ([spec]
    (generate spec model))
   ([spec model & {:keys [do-enrich truncate]
-            :or {do-enrich true
-                 truncate true}}]
+                  :or {do-enrich true
+                       truncate true}}]
    (log/debug (str "generating with spec: " (strip-refs spec)))
    (let [spec (unify spec {:modified false})
-         spec (let [result (grammar/generation-implications spec model)]
-                (cond (= :fail result)
-                      (do (log/warn (str "spec failed when generation-implications applied:" spec ";"
-                                         "using original-spec."))
-                          spec)
-                      true result))
          result (generate/generate spec model)]
      (if result
        (conj {:surface (get-string (get-in result [:italiano]))}


+(defn an-example): how to use either a lexicon loaded from db or from source .edn file.

--- src/babel/italiano.cljc
+++ src/babel/italiano.cljc
@@ -13,6 +13,25 @@
    [clojure.repl :refer [doc]]
    [clojure.string :as string]
    [dag_unify.core :refer [fail-path-between get-in strip-refs unifyc]]))
+
+(defn an-example []
+  (let [med (babel.italiano.grammar/medium)
+        med-reload (babel.italiano.grammar/medium-reloaded)]
+    (do
+      (take 5
+            (repeatedly
+             #(println
+               (morph (time (generate {:synsem {:cat :verb
+                                                :subcat []
+                                              :sem {:pred :know-s}}}
+                                      med-reload))))))
+      (take 5
+            (repeatedly
+             #(println
+               (morph (time (generate {:synsem {:cat :verb
+                                                :subcat []
+                                                :sem {:pred :know-s}}}
+                                      med)))))))))

 ;; can't decide between 'morph' or 'fo' or something other better name.
 (defn morph [expr & {:keys [from-language show-notes]


[base] Make optional spec allow nil

[base] Make optional spec allow nil

Otherwise optional just means that the key can be missing, but doesn't
allow for the key to be there with a nil value

--- src/braid/base/api.cljc
+++ src/braid/base/api.cljc
@@ -158,7 +158,9 @@
                :required? (case required-or-optional
                             :required true
                             :optional false)
-               :schema schema}))
+               :schema (if (= :optional required-or-optional)
+                         [:or schema nil?]
+                         schema)}))

      (defn register-server-message-handlers!
        "Add a map of websocket-event-name -> event-handler-fn to handle events from the client"


Fix db connection issue caused by parinfer

--- src/braid/server/db.clj
+++ src/braid/server/db.clj
@@ -8,12 +8,12 @@

 (defn install-schema! [db-url]
  (d/transact (d/connect db-url)
-                 (concat
-                   ; partition for our data
-                   [{:db/ident :entities
-                     :db/id #db/id [:db.part/db]
-                     :db.install/_partition :db.part/db}]
-                   schema)))
+             (concat
+               ; partition for our data
+               [{:db/ident :entities
+                 :db/id #db/id [:db.part/db]
+                 :db.install/_partition :db.part/db}]
+               schema)))

 (defn init!
   "set up schema"


fix nrepl middleware related to clone

fix nrepl middleware related to clone

upgrading a clone'd session would end up upgrading all clones

--- src/main/shadow/cljs/devtools/server/nrepl_impl.clj
+++ src/main/shadow/cljs/devtools/server/nrepl_impl.clj
@@ -32,12 +32,12 @@
     (transport/send transport res)))

 (defn do-repl-quit [state-ref session]
-  (let [{:keys [clj-ns watch-chan]} @state-ref]
-
-    (reset! state-ref {})
+  (let [session-id (-> session meta :id)
+        {:keys [clj-ns watch-chan]} (get @state-ref session-id)]
+
+    (swap! state-ref dissoc session-id)
     (async/close! watch-chan)

-    (swap! session dissoc #'repl-state-ref)
     (swap! session assoc
       #'*ns* clj-ns
       #'cider.piggieback/*cljs-compiler-env* nil)))
@@ -184,10 +184,13 @@
         (-> (async/sliding-buffer 100)
             (async/chan))

+        session-id
+        (-> session meta :id)
+
         state-ref
         (get @session #'repl-state-ref)]

-    (reset! state-ref
+    (swap! state-ref assoc session-id
       {:init-msg msg
        :last-msg msg
        :session session
@@ -249,7 +252,8 @@
     (swap! session assoc #'repl-state-ref (atom {})))

   (let [state-ref (get @session #'repl-state-ref)
-        {:keys [build-id worker]} @state-ref]
+        session-id (-> session meta :id)
+        {:keys [build-id worker]} (get @state-ref session-id)]
     (if-not build-id
       msg
       (assoc msg ::state-ref state-ref ::worker worker ::build-id build-id))))


Add new initial log message :page_facing_up:

--- src/metabase/util.clj
+++ src/metabase/util.clj
@@ -20,6 +20,11 @@
            (java.util Calendar TimeZone)
            javax.xml.bind.DatatypeConverter
            org.joda.time.format.DateTimeFormatter))
+
+;; This is the very first log message that will get printed.
+;; It's here because this is one of the very first namespaces that gets loaded, and the first that has access to the logger
+;; It shows up a solid 10-15 seconds before the "Starting Metabase in STANDALONE mode" message because so many other namespaces need to get loaded
+(log/info "Loading Metabase...")

 ;; Set the default width for pprinting to 200 instead of 72. The default width is too narrow and wastes a lot of space for pprinting huge things like expanded queries
 (intern 'clojure.pprint '*print-right-margin* 200)


add a function which makes it easy to get the current time formatted as iso8601 string.

--- src/metabase/util.clj
+++ src/metabase/util.clj
@@ -94,4 +94,9 @@
     (->> datetime
       (time/parse (time/formatters :date-time-no-ms))
       (coerce/to-long)
-      (java.sql.Date.))))+      (java.sql.Date.))))
+
+(defn now-iso8601
+  "format the current time as iso8601 date/time string."
+  []
+  (time/unparse (time/formatters :date-time-no-ms) (coerce/from-long (System/currentTimeMillis))))


Slightly update kick synthdef explanation

--- docs/kick.clj
+++ docs/kick.clj
@@ -1,33 +1,53 @@
-; This is an annotated version of this synth definition to help in understanding
-; some basics about synths and the synthdef data structure used in Overtone.
+(ns doc.kick
+  (:use [overtone.live]))

-; Here is a basic kick drum.  An envelope generator is multiplied by a low frequency
-; sin wave, which is like turning the volume knob up and down really quick while playing
-; a low tone.
+;;This is an annotated version of this synth definition to help in understanding
+;; some basics about synths and the synthdef data structure used in Overtone.
+
+;; Here is a basic kick drum.  An envelope generator is multiplied by a low frequency
+;; sin wave, which is like turning the volume knob up and down really quick while playing
+;; a low tone.
 (defsynth kick [amp 0.5 decay 0.6 freq 65]
   (let [env (env-gen (perc 0 decay) 1 1 0 1 :free)
         snd (sin-osc freq (* Math/PI 0.5) amp)]
     (out 0 (pan2 (* snd env) 0))))

-; A shorter variation leaving out the out and pan ugens, which get added by default
-; to synths that are rooted by an audio rate ugen that isn't out.
-(defsynth kick [amp 0.5 decay 0.6 freq 65]
+;; This can be triggered using the name as a function call:
+(kick)
+
+;; A shorter variation using definst which allows you to leave out the out and pan ugens,
+;; which get added by default to synths that are rooted by an audio rate ugen that isn't out.
+(definst kick [amp 0.5 decay 0.6 freq 65]
   (* (sin-osc freq (* Math/PI 0.5) amp)
      (env-gen (perc 0 decay) 1 1 0 1 :free)))

-; The defsynth function will create a synthesizer definition structure that mimics the
-; binary format sent to the SuperCollider server.  These could also be created in other
-; ways, for example if you have in idea for a synthesizer DSL...
+;; Similarly this is also triggered using the name as a function call:
+(kick)
+
+;; The defsynth function will create a synthesizer definition structure that mimics the
+;; binary format sent to the SuperCollider server.  These could also be created in other
+;; ways, for example if you have in idea for a synthesizer DSL...
+
+;; The structure is stored in each synth you create in a key called :sdef. So to retrieve
+;; the structure of our kick synth we need to issue:
+(:sdef kick)
+
+;; This might be improved by pretty printing the result:
+(synthdef-print (:sdef kick))
+
+;; Here is the annotated output of (:sdef kick)
+(pprint (:sdef kick))
+
 {
  :name "kick",
  :n-params 3,             ; The number of controllable parameters
  :params [0.5 0.6 65.0],  ; default parameter values

- ; The name of each parameter with the index of it's default value in the :params vector.
+ ;; The name of each parameter with the index of its default value in the :params vector.
  :n-pnames 3,
  :pnames [{:index 0, :name "amp"} {:index 1, :name "decay"} {:index 2, :name "freq"}],

- ; All constant values used in the synth definition
+ ;; All constant values used in the synth definition
  :n-constants 7,
  :constants [1.0 0.0 2.0 -99.0 5.0 -4.0 1.5707964]

@@ -38,7 +58,7 @@
  [
   ; One control ugen is created for each rate of input parameters.  In this case all of
   ; the inputs are standard control rate (:kr) so we just have a single control.  A control
-  ; is always the first ugen executed, and it's named parameters can be modified at
+  ; is always the first ugen executed, and its named parameters can be modified at
   ; runtime.
   {:outputs [{:rate 1} {:rate 1} {:rate 1}],
    :inputs [],


Release 0.4.16

Release 0.4.16


latest deps

latest deps


version bump

version bump


lein-release plugin: bumped version from 0.19 to 0.20-SNAPSHOT for next development cycle


Upgrade Midje

Upgrade Midje

--- project.clj
+++ project.clj
@@ -7,7 +7,7 @@
                  [quiescent "0.1.3"]
                  [jarohen/chord "0.4.1"]
                  [compojure "1.1.8" :exclusions [joda-time]]]
-  :profiles {:dev {:dependencies [[midje "1.5.0" :exclusions [org.codehaus.plexus/plexus-utils org.clojure/tools.macro]]]
+  :profiles {:dev {:dependencies [[midje "1.6.3" :exclusions [org.codehaus.plexus/plexus-utils org.clojure/tools.macro]]]
                    :plugins [[lein-cljsbuild "1.0.3"]]
                    :cljsbuild {:builds [{:source-paths ["src"]
                                          :compiler {:output-to "target/classes/public/app.js"


disable dev-tools for a moment since it was causing troubles


sources also in src/cljs

sources also in src/cljs


bump up clj-http version

bump up clj-http version


Adding http url

Adding http url

--- project.clj
+++ project.clj
@@ -1,6 +1,6 @@
 (defproject fortress-ring-adapter "0.1.0-SNAPSHOT"
   :description "Ring adapter for netty 4 (part of the fortress distribution)"
-  :url "http://example.com/FIXME"
+  :url "https://github.com/iamedu/fortress-ring-adapter"
   :license {:name "Eclipse Public License"
             :url "http://www.eclipse.org/legal/epl-v10.html"}
   :java-source-paths  ["src/java"]


Version 2.2.5

Version 2.2.5

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject puppetlabs/lein-ezbake "2.2.5-SNAPSHOT"
+(defproject puppetlabs/lein-ezbake "2.2.5"
   :description "A system for building packages for trapperkeeper-based applications"
   :url "https://github.com/puppetlabs/ezbake"
   :license {:name "Apache License 2.0"


Version 0.4.40-SNAPSHOT

Version 0.4.40-SNAPSHOT


multiple ripple

multiple ripple

--- src/mojo_ui/core.cljs
+++ src/mojo_ui/core.cljs
@@ -31,20 +31,22 @@
 (defn ripple
   ""
   [& children]
-  (let [state (atom {:visible false})
-        hide-ripple (fn []
-                      (reset! state {:visible false}))
-        show-ripple (fn [evt]
-                      (let [target (.-currentTarget evt)
-                            rect (.getBoundingClientRect target)
-                            x (- (.-clientX evt) (.-left rect))
-                            y (- (.-clientY evt) (.-top rect))]
-                        (reset! state {:visible true
-                                       :pos {:left x :top y}}))
-                      (js/setTimeout hide-ripple 1000))]
-    (fn [] (-> [:div.ui-ripple {:on-click show-ripple}]
-               (into (if (:visible @state) [[:div.ui-ripple-fx {:style (:pos @state)}]] []))
-               (into children)))))
+  (let [ripples (atom (list))
+        remove-ripple (fn []
+                        (swap! ripples rest))
+        add-ripple (fn [evt]
+                     (let [target (.-currentTarget evt)
+                           rect (.getBoundingClientRect target)
+                           x (- (.-clientX evt) (.-left rect))
+                           y (- (.-clientY evt) (.-top rect))]
+                       (swap! ripples concat (list {:timestamp (. (new js/Date) getTime)
+                                                    :pos {:left x :top y}})))
+                     (js/setTimeout remove-ripple 1000))]
+    (fn []
+      [:div.ui-ripple {:on-click add-ripple}
+       (map #(vector :div.ui-ripple-fx {:key (:timestamp %)
+                                        :style (:pos %)}) @ripples)
+       children])))

 (defn tabs
   "If tab-index is string, convert it to number first using tab keys."
@@ -78,12 +80,12 @@

 (defn tab
   ""
-  [& children]
-  (into [:div] children))
+  [& rest]
+  (into [:div] rest))

 (defn button
-  [& props]
-  [:div.ui-button.ui-widget (into [ripple] props)])
+  [& rest]
+  [:div.ui-button.ui-widget (into [ripple] rest)])

 (defn button-demo
   ""


poking around with calculating total and monthly payments, don't think this is correct yet though

--- src/mortgage/core.clj
+++ src/mortgage/core.clj
@@ -21,8 +21,7 @@
 ; cmd-alt-l: reformat code
 ;
 ; navigation
-; cmd-alt-f7: show usages
-; alt-f7: find usages
+; cmd-f7: show usages
 ; cmd-e: recent files - cursive docs say you can use this instead of tabs, we'll see about that
 ; cmd-shift-o: search for file
 ; cmd-f12: display list of symbols defined in current file, begin typing to search
@@ -33,27 +32,31 @@
 ; cmd-f3: view all bookmarks
 ; cmd-up: open navigation bar, interact w/ it with arrow keys; consider using instead of project browser
 ;
+; testing
+; cmd-t: run tests in current ns
+; cmd-shift-t: run test under caret
+;
 ; debugging
 ; alt-f8: toggle breakpoint
 ; ctrl-d: run program in debug mode
 ; f8: step over
 ; f7: step into
 ; shif-f8:  step out
-;
-; testing
-; cmd-t: run tests in current ns
-; cmd-shift-t: run test under caret
+
+(def e 2.718)

 (s/defschema Mortgage
   {:house-price             s/Int
    :apr                     s/Num
-   :down-payment-percentage s/Num})
+   :down-payment-percentage s/Num
+   :num-years               s/Int})

 (s/defn make-mortgage :- Mortgage
-  [house-price apr down-payment-percentage]
+  [house-price apr down-payment-percentage num-years]
   {:house-price             house-price
    :apr                     apr
-   :down-payment-percentage down-payment-percentage})
+   :down-payment-percentage down-payment-percentage
+   :num-years               num-years})

 (s/defn get-down-payment :- s/Num
   [m :- Mortgage]
@@ -72,7 +75,24 @@
   (> (get-loan-amount m)
      417000))

-(def foo (make-mortgage 500000 0.035 0.15))
+(s/defn total-mortgage-price :- s/Num
+  [m :- Mortgage]
+  (* (get-loan-amount m)
+     (Math/pow e
+               (* (:apr m)
+                  (:num-years m)))))
+
+(s/defn base-monthly-payment :- s/Num
+  [m :- Mortgage]
+  (/ (total-mortgage-price m)
+     (* (:num-years m)
+        12)))
+
+; ok so the math should look something like
+; amount = P * e^rt
+; so is that eg 500,000 * e ^ (0.035 * 30) ?
+
+(def foo (make-mortgage 500000 0.0325 0.2 30))

 (comment
   (get-loan-amount foo)
@@ -80,4 +100,8 @@

   (s/fn-schema get-loan-amount)
   (s/fn-schema make-mortgage)
+
+  (total-mortgage-price foo)
+  (base-monthly-payment foo)
+
   )


Implement collisions

Implement collisions

Now only printing out a message when a collision occurs

--- src/mrunner/core.cljs
+++ src/mrunner/core.cljs
@@ -47,6 +47,7 @@
    :cur-time nil
    :down false
    :obstacles []
+   :pause false
    })

 (def obstacle-types
@@ -59,17 +60,24 @@
   (println x)
   x)

+(defn dbg- [x msg]
+  (println msg x)
+  x)
+
+(def runner {:width 112 :height 72})
+(def floor-y 85)
 (def game-width 800)
 (def jump-speed 1)
-(def gravity -0.003)
+(def gravity -0.0038)
 (def runner-offset 215)

-;; 37 left, 38 up, 39 right, 40 down
+;; 38 up, 40 down, 80 p
 (defn handle-key [state key]
   (case (.-keyCode key)
     38 (when (= (:pos-y @state) 0)
          (swap! state assoc :speed-y jump-speed))
     40 (swap! state assoc :down true)
+    80 (swap! state update :pause not)
     nil))

 (defn handle-key-up [state key]
@@ -77,23 +85,49 @@
     40 (swap! state assoc :down false)
     nil))

-
 (defn update-obstacles [{:keys [obstacles pos-x] :as state}]
   (if (< (count obstacles) 1)
-    (update state :obstacles conj (assoc (rand-nth obstacle-types) :pos (+ pos-x game-width)))
+    (update state :obstacles conj (assoc (rand-nth obstacle-types) :pos-x (+ pos-x game-width)))
     (update state :obstacles
             (fn [obstacles]
-              (filter #(> (:pos %) (- pos-x (:width %))) obstacles)))))
+              (filter #(> (:pos-x %) (- pos-x (:width %))) obstacles)))))
+
+(defn in-segment? [x p0 p1]
+  (and (<= x p1) (<= p0 x)))
+
+(defn in-square? [x0 y0 x y w h]
+  (and (in-segment? x0 x (+ x w))
+       (in-segment? y0 y (+ y h))))
+
+(defn square-intersect?-bad [x0 y0 w0 h0
+                         x1 y1 w1 h1]
+  (or (in-square? x0 y0 x1 y1 w1 h1)
+      (in-square? x1 y1 x0 y0 w0 h0)))
+
+(defn square-intersect? [x0 y0 w0 h0
+                         x1 y1 w1 h1]
+  (and (< x0 (+ x1 w1))
+       (> (+ x0 w0) x1)
+       (< y0 (+ y1 h1))
+       (> (+ y0 h0) y1)))
+
+(defn detect-collision [{:keys [obstacles pos-x pos-y down] :as state}]
+  (let [obstacle (first obstacles)]
+    (square-intersect? (+ pos-x runner-offset) (+ pos-y floor-y)
+                       (:width runner) (if down 47 (:height runner))
+                       (:pos-x obstacle) (:pos-y obstacle)
+                       (:width obstacle) (:height obstacle))))

 (defn game-loop [state end]
   (let [{:keys [cur-time]} @state
         next-time (js/performance.now)
         delta (- next-time cur-time)]
-    (when-not (nil? cur-time)
+    (when-not (or (nil? cur-time) (:pause @state))
       (swap! state update :pos-x + (* (:speed-x @state) delta))
       (swap! state update :pos-y #(max 0 (+ % (* (:speed-y @state) delta))))
       (swap! state update :speed-y + (* gravity delta))
-      (swap! state update-obstacles))
+      (swap! state update-obstacles)
+      (when (detect-collision @state) (println "ooooops")))
     (swap! state assoc :cur-time next-time))
   (when-not @end
     (js/requestAnimationFrame #(game-loop state end))))


Handle touch events

Handle touch events

--- src-cljs/visibility_2d/core.cljs
+++ src-cljs/visibility_2d/core.cljs
@@ -143,6 +143,7 @@
 (defn handle-mouseout! [event]
   (let [canvas (.-currentTarget event)
         ctx (dali/context-2d canvas)]
+    (.preventDefault event)
     (draw-scene! ctx @polygons)))

 (defn handle-resize! [event]
@@ -152,6 +153,9 @@
 (events/listen (dom/ViewportSizeMonitor.) EventType/RESIZE handle-resize!)
 (events/listen canvas EventType/MOUSEMOVE (benchmark! handle-mousemove!))
 (events/listen canvas EventType/MOUSEOUT handle-mouseout!)
+(events/listen canvas EventType/TOUCHSTART handle-mousemove!)
+(events/listen canvas EventType/TOUCHMOVE handle-mousemove!)
+(events/listen canvas EventType/TOUCHEND handle-mouseout!)

 ; Initial drawing
 (draw-scene! (resize-canvas! canvas) @polygons)


add test for "hoping" as well as "participating"

--- test/babel/test/en.cljc
+++ test/babel/test/en.cljc
@@ -525,14 +525,22 @@
     (is (= "I am getting dressed" (morph (generate spec))))))

 (deftest present-progressive-ends-with-e
-  (let [spec {:modified false
+  (let [spec1 {:modified false
               :root {:english {:english "participate"}}
               :synsem {:cat :verb
                        :subcat ()
                        :sem {:tense :present
                              :aspect :progressive
-                             :subj {:pred :I}}}}]
-    (is (= "I am participating" (morph (generate spec))))))
+                             :subj {:pred :I}}}}
+        spec2 {:modified false
+               :root {:english {:english "hope"}}
+               :synsem {:cat :verb
+                        :subcat ()
+                        :sem {:tense :present
+                              :aspect :progressive
+                              :subj {:pred :I}}}}]
+    (is (= "I am participating" (morph (generate spec1))))
+    (is (= "I am hoping" (morph (generate spec2))))))

 (deftest present-progressive-vs-present-simple
   (let [base-spec {:modified false


move {:slash false} into {:synsem}

move {:slash false} into {:synsem}

--- test/babel/test/la.cljc
+++ test/babel/test/la.cljc
@@ -52,8 +52,7 @@
                         :sem {:tense :future}}})))))
 (deftest reader1
   (let [spec (let [agreement (atom {:person :3rd :number :sing :gender :masc})]
-               {:slash false ;; TODO: {:slash false, :synsem {:subcat '()}} should be part of default spec.
-                :synsem {:subcat '()
+               {:synsem {:slash false
                          :agr agreement
                          :sem {:obj :unspec
                                :tense :past


Make sure the branch is a string.

Make sure the branch is a string.

--- src/clj/runbld/main.clj
+++ src/clj/runbld/main.clj
@@ -59,7 +59,7 @@
          depth (-> raw-opts :scm :depth)]
      (when clone?
        (let [clone-args (->> [(when reference ["--reference" reference])
-                              (when branch ["--branch" branch])
+                              (when branch ["--branch" (str branch)])
                               (when depth ["--depth" (str depth)])]
                              (filter identity)
                              (apply concat))]


Delete associated sessions when deleting the node

--- src/clj/shale/nodes.clj
+++ src/clj/shale/nodes.clj
@@ -142,6 +142,8 @@
         (if (some #{url} (node-providers/get-nodes (:node-provider pool)))
           (node-providers/remove-node (:node-provider pool) url)))
       (finally
+        (doseq [session (raw-sessions-with-node pool id)]
+          (redis/delete-model! (:redis-conn pool) redis/SessionInRedis (:id session)))
         (redis/delete-model! (:redis-conn pool) redis/NodeInRedis id)
         (car/del (redis/node-tags-key id)))))
   true)


Added `shared` to the Redis proxy schema

--- src/clj/shale/redis.clj
+++ src/clj/shale/redis.clj
@@ -124,7 +124,8 @@
    :public-ip             (s/maybe IPAddress)
    :type                  (s/enum "socks5" "http")
    :private-host-and-port s/Str
-   :active                s/Bool})
+   :active                s/Bool
+   :shared                s/Bool})

 ;; model fetching


Added initial versions of get-connection, release-connection, and bind-connection.

--- src/clj_ldap/client.clj
+++ src/clj_ldap/client.clj
@@ -322,6 +322,21 @@
       (connect-to-hosts options)
       (connect-to-host options))))

+(defn get-connection
+  "Retrieves an LDAP connection from the pool."
+  [connection-pool]
+  (.getConnection connection-pool))
+
+(defn release-connection
+  "Releases the provided connection back to this pool."
+  [connection-pool connection]
+  (.releaseConnection connection-pool connection))
+
+(defn bind-connection
+  "Change the identity of an existing connection."
+  [connection bind-dn password]
+  (.bind connection (bind-request {:bind-dn bind-dn :password password})))
+
 (defn get
   "If successful, returns a map containing the entry for the given DN.
    Returns nil if the entry doesn't exist or cannot be read. Takes an


Adapt `end-shape` for use with p5js. Issue #255.

--- src/cljc/quil/core.cljc
+++ src/cljc/quil/core.cljc
@@ -1596,7 +1596,7 @@
         :cljs nil))
    (.endShape (current-graphics)
               #?(:clj PApplet/CLOSE
-                 :cljs 2))))
+                 :cljs (aget js/p5.prototype "CLOSE")))))

 (defn
   ^{:requires-bindings true


Adapt lerp-color for use with p5js

Adapt lerp-color for use with p5js

--- src/cljc/quil/core.cljc
+++ src/cljc/quil/core.cljc
@@ -2096,7 +2096,7 @@
   the two values where 0.0 equal to the first point, 0.1 is very near
   the first point, 0.5 is half-way in between, etc."
   [c1 c2 amt]
-  (.lerpColor (current-graphics) (unchecked-int c1) (unchecked-int c2) (float amt)))
+  (.lerpColor (current-graphics) c1 c2 (float amt)))

 (defn
   ^{:requires-bindings false


set PHM conversion thresholds to 8

set PHM conversion thresholds to 8

--- src/cljs/cljs/core.cljs
+++ src/cljs/cljs/core.cljs
@@ -3786,7 +3786,7 @@

 (set! cljs.core.ObjMap/EMPTY (ObjMap. nil (array) (js-obj) 0 0))

-(set! cljs.core.ObjMap/HASHMAP_THRESHOLD 32)
+(set! cljs.core.ObjMap/HASHMAP_THRESHOLD 8)

 (set! cljs.core.ObjMap/fromObject (fn [ks obj] (ObjMap. nil ks obj 0 nil)))

@@ -4057,7 +4057,7 @@

 (set! cljs.core.PersistentArrayMap/EMPTY (PersistentArrayMap. nil 0 (array) nil))

-(set! cljs.core.PersistentArrayMap/HASHMAP_THRESHOLD 16)
+(set! cljs.core.PersistentArrayMap/HASHMAP_THRESHOLD 8)

 (set! cljs.core.PersistentArrayMap/fromArrays
       (fn [ks vs]


[ref] Simplify validation rule creation.

--- src/ombs/validate.clj
+++ src/ombs/validate.clj
@@ -56,8 +56,8 @@

 (defn errors? [] (vld/errors?))

-(defmacro create-rule [tag data]
-  `(vld/rule ~@(list (first data)) [~tag ~(last data)] )
+(defmacro create-rule [tag [validator msg]]
+  `(vld/rule ~@(list validator) [~tag ~msg] )
   )

 (defmacro create-validator


CLJS-793: fix memoize (non-truthy values don't get cached)

ClojureScript's memoize fn currently uses `(get @mem args)` to
check for the existence of a cache entry, preventing falsey
values from being cached correctly.

Clojure's `memoize` uses `find` rather than `get` to avoid this
issue. Here we'll use a `get` lookup sentinel since it's faster.

--- src/cljs/cljs/core.cljs
+++ src/cljs/cljs/core.cljs
@@ -7393,11 +7393,12 @@
   [f]
   (let [mem (atom {})]
     (fn [& args]
-      (if-let [v (get @mem args)]
-        v
-        (let [ret (apply f args)]
-          (swap! mem assoc args ret)
-          ret)))))
+      (let [v (get @mem args lookup-sentinel)]
+        (if (identical? v lookup-sentinel)
+          (let [ret (apply f args)]
+            (swap! mem assoc args ret)
+            ret)
+          v)))))

 (defn trampoline
   "trampoline can be used to convert algorithms requiring mutual


* src/cljs/cljs/core.cljs: add boolean type-hint to lazy-seq-value

--- src/cljs/cljs/core.cljs
+++ src/cljs/cljs/core.cljs
@@ -1595,7 +1595,7 @@

 (defn- lazy-seq-value [lazy-seq]
   (let [x (.-x lazy-seq)]
-    (if (.-realized lazy-seq)
+    (if ^boolean (.-realized lazy-seq)
       x
       (do
         (set! (.-x lazy-seq) (x))


beefed up intro

beefed up intro

--- src/tutorial/untangled_tutorial/A_Introduction.cljs
+++ src/tutorial/untangled_tutorial/A_Introduction.cljs
@@ -7,13 +7,28 @@
 (defcard-doc
   "# Introduction

-  This tutorial will walk you through the various parts of Untangled (alpha).
+  Welcome to Untangled!
+
+  This tutorial will walk you through the various parts of Untangled in a way that should then allow you to easily develop
+  your own full-stack web applications!

   Note that you can navigate to the table of contents any time using the `devcards` link at the top of the page.

-  **WORK IN PROGRESS**: We are working hard to round out documentation, code samples, and many
-  other things while also developing production software. Please be patient with us and feel
-  free to suggest (or make) contributions.
+  ## What is Untangled?
+
+  Untangled is a set of libraries that together comprise a full-stack, feature-complete web development toolkit.
+
+  ## How is Untangled related to Om (Next)?
+
+  The Untangled Client and Server libraries serve as an implementation of the network layer, plumbing, and default
+  application database format. This means that the vast majority of the important and ground-breaking features of
+  Om Next are simply augmented to make them much simpler and easier to get started with.
+
+  Think of the base Untangled libraries as the glue that ties the overall full-stack story together *for* Om Next.
+
+  Other features (such as the i18n integration, support viewer, datomic helpers, websockets, etc.) are additional
+  libraries that further leverage the Untangled additions to give you an even more complete stack on which to develop
+  your next killer app!

   ## About this tutorial


printing stack trace

printing stack trace

--- src/ophion/search.clj
+++ src/ophion/search.clj
@@ -20,7 +20,7 @@
   (try
     (document/create connection index mapping data)
     (catch Exception e
-      (log/info e))))
+      (.printStackTrace e))))

 (defn index-message
   [connection {:keys [id data graph]}]


fixed incorrect or in prefers

fixed incorrect or in prefers

--- src/cljs/cljs/core.cljs
+++ src/cljs/cljs/core.cljs
@@ -3412,7 +3412,7 @@
   (let [xprefs (@prefer-table x)]
     (or
      (when (and xprefs (xprefs y))
-      true)
+       true)
      (loop [ps (parents y)]
        (when (pos? (count ps))
 	 (when (prefers x (first ps) prefer-table)
@@ -3422,8 +3422,8 @@
        (when (pos? (count ps))
 	 (when (prefers (first ps) y prefer-table)
 	   true)
-	 (recur (rest ps)))))
-    false))
+	 (recur (rest ps))))
+     false)))

 (defn- dominates
   [x y prefer-table]


Add regex anchors to time format regex

Add regex anchors to time format regex

So we will only match full strings, not substrings.


refactoring login form

refactoring login form

--- src/cljs/ohds/core.cljs
+++ src/cljs/ohds/core.cljs
@@ -16,19 +16,37 @@
                                       {:form-params {:username username
                                                      :password password}}))]))))

+(defn text-input
+  [labelname ref]
+  (dom/div nil
+   (dom/label nil labelname)
+   (dom/input #js {:type "text" :ref ref})))
+
+(defn password-input
+  [labelname ref]
+  (dom/div nil
+   (dom/label nil labelname)
+   (dom/input #js {:type "password" :ref ref})))
+
+(defn submit-button [label onclick]
+  (dom/div nil
+   (dom/button #js {:onClick onclick} "Login")))
+
+(defn login-form [app owner]
+  (reify
+      om/IRender
+    (render [_]
+      (dom/div nil
+               (text-input "Username: " "username")
+               (password-input "Password: " "password")
+               (submit-button "Login"
+                              (fn [] (do-login app owner)))))))
+
+
+
 (defn main []
   (om/root
-    (fn [app owner]
-      (reify
-        om/IRender
-        (render [_]
-          (dom/div
-           nil
-           "Username: "
-           (dom/input #js {:type "text" :ref "username"})
-           "Password: "
-           (dom/input #js {:type "password" :ref "password"})
-           (dom/button #js {:onClick (fn []
-                                       (do-login app owner))} "Login")))))
+   (fn [app owner]
+     (login-form app owner))
     app-state
     {:target (. js/document (getElementById "app"))}))


Add function for searching sketch from JS by id.

--- src/cljs/quil/core.cljs
+++ src/cljs/quil/core.cljs
@@ -9,7 +9,7 @@

 (defn get-sketch-by-id [id]
-  id)
+  (.getInstanceById js/Processing id))

 (defn width []


Added the values inside of spec-refs when returning them from frontend to backend.

--- src/clj_formal_specifications_app/core.clj
+++ src/clj_formal_specifications_app/core.clj
@@ -52,7 +52,9 @@

 (defn assoc-spec-ref-to-spec
   [spec spec-ref-entry]
-  (assoc-in spec [:spec-refs (key spec-ref-entry)] {}))
+  (assoc-in spec
+            [:spec-refs (key spec-ref-entry)]
+            {:data @(var-get (val spec-ref-entry))}))

 (defn assoc-to-spec
  [spec map-entry]


quieten

quieten

--- src/cljs/infinitelives/pixi/resources.cljs
+++ src/cljs/infinitelives/pixi/resources.cljs
@@ -168,9 +168,7 @@
         b (add-prog-bar s options)]
     (go
       ;; fade in
-      (log "fade in")
       (<! (fadein b :duration fade-in))
-      (log "done")

       ;; show load progress
       (<! (apply (partial load-urls urls b) options))