Button for confirmation of marks added

Button for confirmation of marks added

--- src/tango/cljs/adjudicator/core.cljs
+++ src/tango/cljs/adjudicator/core.cljs
@@ -474,6 +474,19 @@
                     (dom/h1 #js {:className "col-xs-offset-4 col-xs-4 text-center"}
                             (str "Marks " mark-count "/" (:round/recall selected-activity))))

+                  ;(dom/div #js {:className "col-xs-offset-4 col-xs-4"}
+                  ;  (dom/button #js {:className "btn btn-primary btn-block btn-lg"
+                  ;                   :disabled (= current-page last-page)
+                  ;                   :onClick  #(om/transact! this `[(app/heat-page {:page ~(inc current-page)})
+                  ;                                                   :app/heat-page])} "Next"))
+
+                  (dom/div #js {:className "row"}
+                    (dom/div #js {:className "col-xs-offset-4 col-xs-4"}
+                      (dom/button #js {:className "btn btn-primary btn-lg btn-block"
+                                   :disabled  (not= mark-count (:round/recall selected-activity))
+                                   :onClick   #()}
+                              "Confirm Marks")))
+
                   (dom/div #js {:className "col-xs-1 pull-right"}
                     (dom/button #js {:className "btn btn-default"
                                      :onClick   #(om/transact! this `[(app/set-admin-mode


[#2620] Use feature flag on update process

--- backend/src/akvo/lumen/lib/update.clj
+++ backend/src/akvo/lumen/lib/update.clj
@@ -126,55 +126,61 @@

 (defn- import-data-to-table [tenant-conn import-config dataset-id job-execution-id data-source-spec]
   (jdbc/with-db-transaction [conn tenant-conn]
-    (with-open [importer (import/dataset-importer (get data-source-spec "source")
-                                                  (assoc import-config :environment (env/all conn)))]
-     (let [initial-dataset-version  (db.transformation/initial-dataset-version-to-update-by-dataset-id conn {:dataset-id dataset-id})
-           latest-dataset-version (db.transformation/latest-dataset-version-by-dataset-id conn {:dataset-id dataset-id})
-           imported-dataset-columns (vec (:columns initial-dataset-version))
-           importer-columns         (p/columns importer)
-
-           columns-used (columns-used-in-txs
-                         (import/importer-type (get data-source-spec "source"))
-                         initial-dataset-version
-                         latest-dataset-version)
-           imported-dataset-columns-checked (reduce (fn [c co]
-                                                      (if (contains? columns-used (get co "columnName"))
-                                                        (conj c co)
-                                                        c)) [] imported-dataset-columns)]
-       (if-let [compatible-errors (compatible-columns-error? imported-dataset-columns-checked importer-columns)]
-         (do
-           (failed-update conn job-execution-id
-                          (cond-> "Column mismatch"
-                            (seq (:missed-columns compatible-errors))
-                            (str ".\n Following columns are missed in new data version: " (:missed-columns compatible-errors))
-                            (seq (:wrong-types compatible-errors))
-                            (str ".\n Following columns have changed the column type in new data version: " (:wrong-types compatible-errors))))
-           {:success? false})
-         (let [table-name          (util/gen-table-name "ds")
-               imported-table-name (util/gen-table-name "imported")]
-           (postgres/create-dataset-table conn table-name importer-columns)
-           (doseq [record (map (comp postgres/coerce-to-sql import/extract-first-and-merge) (p/records importer))]
-             (jdbc/insert! conn table-name record))
-           (db.job-execution/clone-data-table conn {:from-table table-name
-                                                    :to-table   imported-table-name}
-                                              {}
-                                              {:transaction? false})
-           (let [coerce-column-fn (fn [{:keys [title id type key multipleId multipleType groupName groupId] :as column}]
-                                    (cond-> {"type" type
-                                             "title" title
-                                             "columnName" id
-                                             "groupName" groupName
-                                             "groupId" groupId
-                                             "sort" nil
-                                             "direction" nil
-                                             "hidden" false}
-                                      key           (assoc "key" (boolean key))
-                                      multipleType (assoc "multipleType" multipleType)
-                                      multipleId   (assoc "multipleId" multipleId)))]
-             {:success? true
-              :table-name table-name :imported-table-name imported-table-name
-              :importer-columns (mapv coerce-column-fn importer-columns) :imported-dataset-columns imported-dataset-columns
-              :latest-dataset-version latest-dataset-version})))))))
+    (let [environment (env/all conn)]
+      (with-open [importer (import/dataset-importer (get data-source-spec "source")
+                                                    (assoc import-config :environment environment))]
+        (let [initial-dataset-version  (db.transformation/initial-dataset-version-to-update-by-dataset-id conn {:dataset-id dataset-id})
+              latest-dataset-version (db.transformation/latest-dataset-version-by-dataset-id conn {:dataset-id dataset-id})
+              imported-dataset-columns (vec (:columns initial-dataset-version))
+              importer-columns         (p/columns importer)
+
+              columns-used (columns-used-in-txs
+                            (import/importer-type (get data-source-spec "source"))
+                            initial-dataset-version
+                            latest-dataset-version)
+              imported-dataset-columns-checked (reduce (fn [c co]
+                                                         (if (contains? columns-used (get co "columnName"))
+                                                           (conj c co)
+                                                           c)) [] imported-dataset-columns)]
+          (if-let [compatible-errors (compatible-columns-error? imported-dataset-columns-checked
+                                                                (if (get environment "optionColumnType")
+                                                                  (map #(update % :type (fn [t]
+                                                                                (if (= "option" t) "text" t)))
+                                                                       importer-columns)
+                                                                  importer-columns))]
+            (do
+              (failed-update conn job-execution-id
+                             (cond-> "Column mismatch"
+                               (seq (:missed-columns compatible-errors))
+                               (str ".\n Following columns are missed in new data version: " (:missed-columns compatible-errors))
+                               (seq (:wrong-types compatible-errors))
+                               (str ".\n Following columns have changed the column type in new data version: " (:wrong-types compatible-errors))))
+              {:success? false})
+            (let [table-name          (util/gen-table-name "ds")
+                  imported-table-name (util/gen-table-name "imported")]
+              (postgres/create-dataset-table conn table-name importer-columns)
+              (doseq [record (map (comp postgres/coerce-to-sql import/extract-first-and-merge) (p/records importer))]
+                (jdbc/insert! conn table-name record))
+              (db.job-execution/clone-data-table conn {:from-table table-name
+                                                       :to-table   imported-table-name}
+                                                 {}
+                                                 {:transaction? false})
+              (let [coerce-column-fn (fn [{:keys [title id type key multipleId multipleType groupName groupId] :as column}]
+                                       (cond-> {"type" type
+                                                "title" title
+                                                "columnName" id
+                                                "groupName" groupName
+                                                "groupId" groupId
+                                                "sort" nil
+                                                "direction" nil
+                                                "hidden" false}
+                                         key           (assoc "key" (boolean key))
+                                         multipleType (assoc "multipleType" multipleType)
+                                         multipleId   (assoc "multipleId" multipleId)))]
+                {:success? true
+                 :table-name table-name :imported-table-name imported-table-name
+                 :importer-columns (mapv coerce-column-fn importer-columns) :imported-dataset-columns imported-dataset-columns
+                 :latest-dataset-version latest-dataset-version}))))))))

 (defn update-dataset [tenant-conn caddisfly import-config error-tracker dataset-id data-source-id data-source-spec]
   (if-let [current-tx-job (db.transformation/pending-transformation-job-execution tenant-conn {:dataset-id dataset-id})]


making sure last commit is sent to github

--- test/push/instructions/base/integer_test.clj
+++ test/push/instructions/base/integer_test.clj
@@ -324,7 +324,7 @@

 (tabular
   (fact ":integer-shovedup pops an item from :integer, then MOVES it to an index specified
-    by the second :integer value AND replaces it on the top of the stack;
+    by the second :integer value AFTER replacing it on the top of the stack;
     uses (mod arg (inc (count :integer)))"
     (step-and-check-it ?set-stack ?items ?instruction ?get-stack) => ?expected)


cjl - Unit formatting

cjl - Unit formatting

--- src/icfp2015/problem.clj
+++ src/icfp2015/problem.clj
@@ -32,11 +32,15 @@
   "Returns (count (:sourceSeeds problem)) games given a problem."
   [problem]
   (let [n (:sourceLength problem)
+        coord-to-vec (fn [{ :keys [x y] }] [x y])
+        format-unit (fn [{ :keys [members pivot] }]
+                      { :members (set (map coord-to-vec members))
+                        :pivot (coord-to-vec pivot) })
+        formatted-units (map format-unit (:units problem))
         units (fn [seed] (->> seed
                               (source-sequence)
                               (take n)
-                              (map #(nth (:units problem) (mod % n)))))
-        coord-to-vec (fn [{:keys [x y]}] [x y])
+                              (map #(nth formatted-units (mod % n)))))
         make-game (fn [seed]
                     { :width (:width problem)
                       :height (:height problem)


Simplify memory store, promote it to component

--- src/io/cyanite/store.clj
+++ src/io/cyanite/store.clj
@@ -55,40 +55,38 @@
     (fetch! [this from to paths])
     (insert! [this metric])))

-(defn memory-store
-  "Extremely inefficient memory store for testing/mocking purposes"
-  []
-  (let [state (atom {})]
-    (reify
-      component/Lifecycle
-      (start [this] this)
-      (stop [this] this)
-      clojure.lang.IDeref
-      (deref [this]
-        @state)
-      MetricStore
-      (fetch! [this from to paths]
-        (let [st @state]
-          (mapcat
-           (fn [path]
-             (->> (get st path)
-                  (filter
-                   (fn [[time _]]
-                     (and (>= time from)
-                         (<= time to))))
-                 (map
-                  (fn [[time point]]
-                    {:id    path
-                     :time  time
-                     :point point}))))
-          paths)))
-      (insert! [this metric]
-        (swap! state
-               (fn [old]
-                 (update-in old
-                            [(select-keys metric [:path :resolution])
-                             (:time metric)]
-                            (constantly (select-keys metric [:max :min :sum :mean])))))))))
+(defrecord MemoryStore [state]
+  component/Lifecycle
+  (start [this]
+    (assoc this :state (atom {})))
+  (stop [this]
+    (assoc this :state nil))
+  clojure.lang.IDeref
+  (deref [this]
+    @state)
+  MetricStore
+  (fetch! [this from to paths]
+    (let [st @state]
+      (mapcat
+       (fn [path]
+         (->> (get st path)
+              (filter
+               (fn [[time _]]
+                 (and (>= time from)
+                      (<= time to))))
+              (map
+               (fn [[time point]]
+                 {:id    path
+                  :time  time
+                  :point point}))))
+       paths)))
+  (insert! [this metric]
+    (swap! state
+           (fn [old]
+             (update-in old
+                        [(select-keys metric [:path :resolution])
+                         (:time metric)]
+                        (constantly (select-keys metric [:max :min :sum :mean])))))))

 (defmulti build-store (comp (fnil keyword "cassandra-v2") :type))

@@ -102,7 +100,7 @@

 (defmethod build-store :memory
   [options]
-  (memory-store))
+  (map->MemoryStore options))

 (defn query! [store from to paths]
   (let [raw-series         (fetch! store from to paths)


Add output for tag-revision and push

Add output for tag-revision and push

--- src/lambdacd_git/git.clj
+++ src/lambdacd_git/git.clj
@@ -117,6 +117,7 @@
         (process-commit))))

 (defn tag-revision [workspace hash tag]
+  (println "Tagging " hash " with " tag "...")
   (let [git (git-open workspace)
         commit (get-commit-reference git hash)]
     (-> git
@@ -126,6 +127,7 @@
         (.call))))

 (defn push [workspace remote]
+  (println "Pushing changes...")
   (let [git (git-open workspace)]
     (-> git
         (.push)


fix bikeshed issues

fix bikeshed issues

--- src/leiningen/jshint.clj
+++ src/leiningen/jshint.clj
@@ -87,10 +87,11 @@
                           (generate-exclude-files project)
                           (apply invoke project sources)))
     (catch Throwable t
-      (println (joine (str "Can't execute jshint application: " (.getMessage t))
-                      "Check that JSHint is:"
-                      " - installed correctly: npm install jshint -g"
-                      " - configured correctly: https://github.com/vbauer/lein-jshint.git"))
+      (println
+       (joine (str "Can't execute jshint application: " (.getMessage t))
+              "Something is wrong:"
+              " - installation: npm install jshint -g"
+              " - configuration: https://github.com/vbauer/lein-jshint"))
       (main/abort))))


OMCSS-29: `defui` support for om pre alpha25

--- src/main/om_css/core.clj
+++ src/main/om_css/core.clj
@@ -47,8 +47,9 @@
                        (list sym))]
             (recur (next dt)
               (into ret
-                [(concat pre'
-                   (reshape-render post component-info classes-seen))])))
+                [(cond->> (concat pre'
+                            (reshape-render post component-info classes-seen))
+                   (vector? form) (into []))])))
           (recur (next dt) (into ret [form]))))
       ret)))


more cleanup

more cleanup

--- demo/sitetools/core.cljs
+++ demo/sitetools/core.cljs
@@ -168,17 +168,14 @@
         (.' fs mkdirSync d)))))

 (defn write-file [f content]
-  (let [fs (js/require "fs")]
-    (mkdirs f)
-    (.' fs writeFileSync f content)))
+  (mkdirs f)
+  (.' (js/require "fs") writeFileSync f content))

 (defn read-file [f]
-  (let [fs (js/require "fs")]
-    (.' fs readFileSync f)))
+  (.' (js/require "fs") readFileSync f))

 (defn path-join [& paths]
-  (let [path (js/require "path")]
-    (apply (.' path :join) paths)))
+  (apply (.' (js/require "path") :join) paths))

 (defn read-css []
   (string/join "\n" (map read-file (:css-infiles @config))))


Generate correct ports for figwheel

Generate correct ports for figwheel

Each figwheel dev env runs on a different port

--- src/webapp/framework/server/core.clj
+++ src/webapp/framework/server/core.clj
@@ -187,6 +187,17 @@

+(defn replace-in-file [ file-location     text-to-find   text-to-replace ]
+  (do
+    (println (str "***replace-in-file: "  file-location))
+    (let [aa         (slurp  file-location)
+          bb         (.replace  aa    (str text-to-find)  (str text-to-replace))]
+
+      (spit file-location  bb))))
+
+
+
+

 ; deletes the realtime log every time the file is reloaded, or the server is restarted
 (if (not *hosted-mode*)
@@ -226,20 +237,19 @@
                (let [src-dir           (str *project-root-windows* "coils\\")
                      new-dir           (str *project-root-windows* "figwheel_dev_envs\\app" a)
                      java-new-dir      (io/file new-dir)
+                     figwheel-port     (+ a *base-dev-port*)
                      ]
-                 (println (str "making new fiwheel instance: " a " + " new-dir))
-                 (sql "insert into coils_figwheel_processes (figwheel_port) values (?);" [(+ a *base-dev-port*)])
+                 (println (str "***making new figheel instance: " a " + " new-dir))
+                 (sql "insert into coils_figwheel_processes (figwheel_port) values (?);" [figwheel-port])
                  (.mkdir   java-new-dir)
                  (fs/copy-dir src-dir  new-dir)
-                 )))
-
-      )
-
-
-
-
-
-   ))
-
-
-
+
+                 (replace-in-file (str new-dir "\\coils\\project.clj")  3449 figwheel-port )
+                 (replace-in-file (str new-dir "\\coils\\srcbase\\webapp_config\\settings.clj")  3449 figwheel-port)
+
+                 ))))))
+
+
+
+
+


add "if exists" to drop statement to avoid false failures.

--- test/metabase/test_db.clj
+++ test/metabase/test_db.clj
@@ -11,7 +11,7 @@

 ; create a simple sample table
 (jdbc/execute! testdb-jdbc
-  ["drop table del_test"])
+  ["drop table if exists del_test"])
 (jdbc/execute! testdb-jdbc
   ["create table del_test(id int)"])


Dont provide completions for empty string

--- planck-cljs/src/planck/core.cljs
+++ planck-cljs/src/planck/core.cljs
@@ -89,10 +89,12 @@
                          (completion-candidates-for-ns @current-ns))]
     (let [buffer-match-suffix (re-find #"[a-zA-Z]*$" buffer)
           buffer-prefix (subs buffer 0 (- (count buffer) (count buffer-match-suffix)))]
-      (clj->js (map #(str buffer-prefix %)
-                 (sort
-                   (filter (partial is-completion? buffer-match-suffix)
-                     all-candidates)))))))
+      (clj->js (if (= "" buffer-match-suffix)
+                 []
+                 (map #(str buffer-prefix %)
+                  (sort
+                    (filter (partial is-completion? buffer-match-suffix)
+                      all-candidates))))))))

 (defn extension->lang [extension]
   (if (= ".js" extension)


Resort to code eval

Resort to code eval

* Prints spurious warnings around plack.core namespaces and
  the planck.core/print-error var

* Obscure-for--user result if *e is blank:
    `undefined is not an object (evaluating 'error.cause')`

Former-commit-id: 4ffd7191fcd268f38d68f30ddbba941c9c06b9cb

--- planck-cljs/src/planck/core.cljs
+++ planck-cljs/src/planck/core.cljs
@@ -204,9 +204,10 @@
                   (repl/print-doc
                     (let [sym (second expression-form)]
                           (with-compiler-env st (resolve env sym)))))
-            pst (let [sym (or (-> expression-form second second) '*e)
-                      err (with-compiler-env st (resolve env sym))]
-                  (print-error err)))
+            pst (let [sym (or (second expression-form) '*e)]
+                  (read-eval-print (str "(planck.core/print-error " sym ")")
+                                   expression?
+                                   false)))
           (prn nil))
         (try
           (cljs/eval-str


Add user-agent to planck.http/get docstring

--- planck-cljs/src/planck/http.cljs
+++ planck-cljs/src/planck/http.cljs
@@ -183,6 +183,7 @@
   :accepts, keyword or string. Valid keywords are :json or :xml
   :content-type, keyword or string Valid keywords are :json or :xml
   :headers, map, a map containing headers
+  :user-agent, string, the user agent header to send
   :socket, string, specifying a system path to a socket to use
   :binary-response, boolean, encode response body as vector of unsigned bytes"
   ([url] (get url {}))


Cache macro namespaces under different disk name

--- planck-cljs/src/planck/repl.cljs
+++ planck-cljs/src/planck/repl.cljs
@@ -348,8 +348,8 @@
       clj->js)))

 (defn- cache-prefix-for-path
-  [path]
-  (str (:cache-path @app-env) "/" (munge path)))
+  [path macros]
+  (str (:cache-path @app-env) "/" (munge path) (when macros "$macros")))

 (defn- extract-cache-metadata
   [source]
@@ -373,10 +373,15 @@
   [js-source]
   (second (re-find #"// Compiled by ClojureScript (\S*)" js-source)))

+(defn is-macros?
+  [cache]
+  (s/ends-with? (str (:name cache)) "$macros"))
+
 (defn caching-js-eval
   [{:keys [path name source cache]}]
   (when (and path source cache (:cache-path @app-env))
-    (js/PLANCK_CACHE (cache-prefix-for-path path) (str (compiled-by-string) "\n" source) (cljs->transit-json cache)))
+    (js/PLANCK_CACHE (cache-prefix-for-path path (is-macros? cache))
+      (str (compiled-by-string) "\n" source) (cljs->transit-json cache)))
   (js/eval source))

 (defn extension->lang
@@ -402,7 +407,7 @@
 (defn- cached-callback-data
   [path cache-prefix source source-modified raw-load]
   (let [cache-prefix (if (= :calculate-cache-prefix cache-prefix)
-                       (cache-prefix-for-path (second (extract-cache-metadata-mem source)))
+                       (cache-prefix-for-path (second (extract-cache-metadata-mem source)) false)
                        cache-prefix)
         [js-source js-modified] (or (raw-load (add-suffix path ".js"))
                                     (js/PLANCK_READ_FILE (str cache-prefix ".js")))
@@ -475,7 +480,7 @@
       (when-not (load-and-callback!
                   (str path (first extensions))
                   (extension->lang (first extensions))
-                  (cache-prefix-for-path path)
+                  (cache-prefix-for-path path macros)
                   cb)
         (recur (next extensions)))
       (cb nil))))
@@ -723,7 +728,7 @@
     (when (and (= "File" (:name x)) (:source x))
       (let [source (:source x)
             [file-namespace relpath] (extract-cache-metadata-mem source-text)]
-        (js/PLANCK_CACHE (cache-prefix-for-path relpath) (str (compiled-by-string) "\n" source)
+        (js/PLANCK_CACHE (cache-prefix-for-path relpath false) (str (compiled-by-string) "\n" source)
           (when file-namespace
             (cljs->transit-json (get-namespace file-namespace))))))
     (cb {:value nil})))


Use same url for the json+ld data as for the sender.

--- src/oc/email/content.clj
+++ src/oc/email/content.clj
@@ -380,7 +380,7 @@
       "\"publisher\": {"
         "\"@type\": \"Organization\","
         "\"name\": \"Carrot\","
-        "\"url\": \"https://carrot.io/\","
+        "\"url\": \"" config/web-url "\","
       "}"
     "}"])


Add docstrings for group manipulation protocol

--- src/overtone/sc/node.clj
+++ src/overtone/sc/node.clj
@@ -36,12 +36,26 @@
       (kill* [this] "Kill a synth element (node, or group, or ...)."))

     (defprotocol ISynthGroup
-      (group-prepend-node [group node])
-      (group-append-node  [group node])
-      (group-clear        [group])
-      (group-deep-clear   [group])
-      (group-post-tree    [group with-args?])
-      (group-node-tree    [group]))))
+      (group-prepend-node [group node]
+        "Adds the node to the head (first to be executed) of the group.")
+      (group-append-node  [group node]
+        "Adds the node to the tail (last to be executed) of the group.")
+      (group-clear        [group]
+        "Nukes all nodes in the group. This completely clears out all
+         subgroups and frees all subsynths." )
+      (group-deep-clear   [group]
+        "Traverses all groups below this group and frees all the
+         synths. Group structure is left unaffected." )
+      (group-post-tree    [group with-args?]
+        "Posts a representation of this group's node subtree, i.e. all
+         the groups and synths contained within it, optionally including
+         the current control values for synths." )
+      (group-node-tree    [group]
+        "Request a representation of this group's node subtree, i.e. all
+         the groups and synths contained within it.
+
+         Low-level functionality. See node-tree for something more
+         usable." ))))

 (extend-type java.lang.Long to-synth-id*    (to-synth-id [v] v))
 (extend-type java.lang.Integer to-synth-id* (to-synth-id [v] v))


Handling case where only a single argument was passed when a seq is allowed.

* although append-sequence works, we also handle non-sequence args.
* removing the need for c.c.seq-utils/indexed with a slight refactor

--- src/overtone/sc/ugen.clj
+++ src/overtone/sc/ugen.clj
@@ -8,8 +8,7 @@
     [overtone util]
     [overtone.sc.ugen special-ops common categories]
     [clojure.contrib.types :only (deftype)]
-    [clojure.contrib.generic :only (root-type)]
-    [clojure.contrib.seq-utils :only (indexed)]) ; TODO use keep-indexed or map-indexed
+    [clojure.contrib.generic :only (root-type)])
   (:require
     overtone.sc.core
     [clojure.set :as set]
@@ -162,12 +161,12 @@
         normal-args    (map first (remove pred args-specs))
         to-append      (filter pred args-specs)
         to-append-args (map first to-append)
-        args           (flatten (conj normal-args to-append-args))
+        args           (flatten (concat normal-args to-append-args))
         ugen           (assoc ugen :args args)]
     (if-let [n-outs-arg (first (filter #(= :append-sequence-set-num-outs (second %))
                                        to-append))]
-      (assoc ugen :n-outputs (count (first n-outs-arg)))
-      ugen)))
+        (assoc ugen :n-outputs (count (flatten [(first n-outs-arg)])))
+        ugen)))

 (defn add-default-args [spec ugen]
   (let [args (:args ugen)
@@ -191,8 +190,6 @@
 (defn- with-floated-args [spec ugen]
   (assoc ugen :args (floatify (:args ugen))))

-; TODO: Refactor these init functions so everything just takes a ugen and a spec
-   ; and outputs an updated ugen...  Should have done it like this initially...
 (defn- with-init-fn
   "Creates the final argument initialization function which is applied to arguments
   at runtime to do things like re-ordering and automatic filling in of arguments.
@@ -251,8 +248,6 @@
         derived (derive-ugen-specs specs)]
     (map decorate-ugen-spec derived)))

-; TODO: currently not including pseudo because it causes problems and I
-; don't know what they are...
 (def UGEN-NAMESPACES
   '[basicops buf-io compander delay envgen fft2 fft-unpacking grain
     io machine-listening misc osc beq-suite chaos control demand
@@ -282,7 +277,7 @@
     (println (apply str (interpose " -> " cat)))))

 (def UGEN-RATE-SORT-FN
-  (apply hash-map (flatten (map reverse (indexed UGEN-RATE-PRECEDENCE)))))
+  (zipmap UGEN-RATE-PRECEDENCE (range (count UGEN-RATE-PRECEDENCE)))

 (defn- print-ugen-rates [rates]
   (let [rates (sort-by UGEN-RATE-SORT-FN rates)]
@@ -437,11 +432,6 @@

 (defn control? [obj]
   (isa? (type obj) ::control))
-
-;; TODO:
-;; * Need to write a function that takes a ugen-spec, and generates a set
-;; of ugen functions for that spec.  Each of these functions will automatically
-;; set the rate for the ugen.

 (defn- ugen-docs
   "Create a string representing the documentation for the given ugen-spec."


turn off rasterize, it's connecting to docs!

--- src/pc/views/content.clj
+++ src/pc/views/content.clj
@@ -142,10 +142,11 @@
         [:script {:type "text/javascript"}
          "goog.require(\"frontend.core\");"
          "goog.require(\"frontend.dev\");"])))
-   [:script {:type "text/javascript"}
-    (format "rasterize = {}; rasterize.api_key = '%s';"
-            (pc.profile/rasterize-key))]
-   "<script async src=\"https://rasterize.io/rasterize.js\"></script>"))
+   ;; [:script {:type "text/javascript"}
+   ;;  (format "rasterize = {}; rasterize.api_key = '%s';"
+   ;;          (pc.profile/rasterize-key))]
+   ;; "<script async src=\"https://rasterize.io/rasterize.js\"></script>"
+   ))

 (defn app [view-data]
   (h/html (app* view-data)))


bugfix

bugfix


Rewrite some code to remove printf, which is not supported in cljs

--- src/pinpointer/core.cljc
+++ src/pinpointer/core.cljc
@@ -47,14 +47,15 @@
                                  (colorize-by colorize (subs sval start end))
                                  (when (> (count sval) end)
                                    (subs sval end))))
-       (printf  "        : %s\n" (colorize-by colorize (wavy-line start end)))
+       (print  "        : ")
+       (println (colorize-by colorize (wavy-line start end)))
        (print "Expected: ")
        (doseq [[j {:keys [pred reason]}] (map-indexed vector probs)]
          (when (not= j 0)
            (print "          "))
          (pr pred)
          (when reason
-           (printf " (%s)" reason))
+           (print (str " (" reason ")")))
          (newline))))))

 (defn pinpoint


Remove println

Remove println

--- src/re_com/dropdown.cljs
+++ src/re_com/dropdown.cljs
@@ -197,7 +197,6 @@
   [choices-state choices text regex-filter?]
   (let [id (inc (:id @choices-state))
         callback (fn [{:keys [result error] :as args}]
-                   (println "single-dropdown callback" id args @choices-state)
                    (when (= id (:id @choices-state))
                      (swap! choices-state assoc
                             :loading? false
@@ -360,7 +359,6 @@
            attr)          ;; Prevent user text selection
          [dropdown-top internal-model choices id-fn label-fn tab-index placeholder dropdown-click key-handler filter-box? drop-showing? title?]
          (when (and @drop-showing? (not disabled?))
-           (println "render" choices-fn? @choices-state)
            [:div.chosen-drop
             [filter-text-box filter-box? filter-text key-handler drop-showing? #(set-filter-text % args true)]
             [:ul.chosen-results


Better explanation of router's handling of exceptions.

--- src/re_frame/router.cljs
+++ src/re_frame/router.cljs
@@ -33,8 +33,9 @@
                           (do (flush) (<! (timeout 20)))  ;; wait just over one annimation frame (16ms), to rensure all pending GUI work is flushed to the DOM.
                           (<! (timeout 0)))]              ;; just in case we are handling one dispatch after an other, give the browser back control to do its stuff
            (try
-             (handle event-v)                             ;; XXX There should be a plugable place to write exceptions and wanrs
-             (catch js/Object e  (.error js/console e)))  ;; exceptions are a special kind of rubbish when you are in a goloop. So catch it here and print.
+             (handle event-v)                             ;; XXX There should be a plugable place to write exceptions and warns
+             (catch js/Object e
+               (.error js/console e)))  ;; exceptions are a special kind of rubbish when you are in a goloop. So catch it here and print.
            (recur)))


fix a couple of comment typos

fix a couple of comment typos

--- src/re_frame/router.cljs
+++ src/re_frame/router.cljs
@@ -51,7 +51,8 @@
 ;;     etc. So it is modeled explicitly as a FSM.
 ;;     See "-fsm-trigger" (below) for the states and transitions.
 ;;   - the scheduling is done via "goog.async.nextTick" which is pretty quick
-;;   - when the event has :dom-flush we schedule via "reagent.impl.batching.doLater"
+;;   - when the event has :flush-dom we schedule via
+;;       "reagent.impl.batching.do-later"
 ;;     which will run event processing after the next reagent animation frame.
 ;;

@@ -142,7 +143,7 @@
             [:quiescent :add-event] [:scheduled #(do (-add-event this arg)
                                                      (-run-next-tick this))]

-            ;; processing has been already been scheduled to run in the future
+            ;; processing has already been scheduled to run in the future
             [:scheduled :add-event] [:scheduled #(-add-event this arg)]
             [:scheduled :begin-run] [:running   #(-run-queue this)]


Fix bug introduced by previous commit. Travis failed! https://travis-ci.org/nbeloglazov/hatnik/builds/43799463

--- src/cljs/hatnik/web/client/components.cljs
+++ src/cljs/hatnik/web/client/components.cljs
@@ -102,7 +102,7 @@
              (dom/button
               #js {:className "btn btn-default"
                    :type "button"
-                   :onClick nil #_#(pmenu/show {:project-id id
+                   :onClick nil #(pmenu/show {:project-id id
                                           :name name})}
               (dom/span #js {:className "glyphicon glyphicon-pencil pull-right"})))))


insights: implement asymmetrical top-bottom bars

--- src-cljs/frontend/components/insights.cljs
+++ src-cljs/frontend/components/insights.cljs
@@ -50,7 +50,8 @@
    :legend-info {:square-size 10
                  :item-width 80
                  :item-height 14   ; assume font is 14px
-                 :spacing 4}})
+                 :spacing 4}
+   :positive-y% 0.65})

 (defn add-queued-time [build]
   (let [queued-time (max (build/queued-time build) 0)]
@@ -128,25 +129,29 @@
         (.text #(aget % "text")))))

 (defn visualize-insights-bar! [el builds]
-  (let [y-max (apply max (mapcat #((juxt :queued_time_minutes :build_time_minutes) %)
-                                 builds))
-        y-scale (-> (js/d3.scale.linear)
-                    (.domain #js[(- y-max) y-max])
-                    (.range #js[(:height plot-info) 0]))
+  (let [y-pos-max (apply max (map :build_time_minutes
+                                  builds))
+        y-neg-max (apply max (map :queued_time_millis
+                                  builds))
+        y-zero (* (:height plot-info) (:positive-y% plot-info))
         y-pos-scale (-> (js/d3.scale.linear)
-                        (.domain #js[0 y-max])
-                        (.range #js[(y-scale 0) 0]))
+                        (.domain #js[0 y-pos-max])
+                        (.range #js[y-zero 0]))
         y-neg-scale (-> (js/d3.scale.linear)
-                        (.domain #js[0 y-max])
-                        (.range #js[(y-scale 0) (:height plot-info)]))
-        y-middle (y-scale 0)
-        y-tick-values (map js/Math.round
-                           [y-max (* y-max 0.5) 0 (* -1 y-max 0.5) (- y-max)])
-        y-axis (-> (js/d3.svg.axis)
-                   (.scale y-scale)
-                   (.orient "left")
-                   (.tickValues (clj->js y-tick-values))
-                   (.tickFormat js/Math.abs))
+                        (.domain #js[0 y-neg-max])
+                        (.range #js[y-zero (:height plot-info)]))
+        y-pos-tick-values (map js/Math.round
+                               [y-pos-max (* y-pos-max 0.5) 0])
+        y-neg-tick-values (map js/Math.round
+                               [y-neg-max])
+        y-pos-axis (-> (js/d3.svg.axis)
+                       (.scale y-pos-scale)
+                       (.orient "left")
+                       (.tickValues (clj->js y-pos-tick-values)))
+        y-neg-axis (-> (js/d3.svg.axis)
+                       (.scale y-neg-scale)
+                       (.orient "left")
+                       (.tickValues (clj->js y-neg-tick-values)))
         scale-filler (map (partial str "xx-") (range (- (:max-bars plot-info) (count builds))))
         x-scale (-> (js/d3.scale.ordinal)
                     (.domain (clj->js
@@ -163,11 +168,12 @@
                          (.enter)
                          (.append "g")
                          (.attr "class" "bar-pair"))
-        grid-y-vals (for [tick (remove zero? y-tick-values)] (y-scale tick))
+        grid-y-pos-vals (for [tick (remove zero? y-pos-tick-values)] (y-pos-scale tick))
+        grid-y-neg-vals (for [tick (remove zero? y-neg-tick-values)] (y-neg-scale tick))
         grid-lines-join (-> svg
                             (.select "g.grid-lines")
                             (.selectAll "line.horizontal")
-                            (.data (clj->js grid-y-vals)))]
+                            (.data (clj->js (concat grid-y-pos-vals grid-y-neg-vals))))]

     ;; top bar enter
     (-> bars-enter-g
@@ -188,19 +194,19 @@
                     "y" #(y-pos-scale (aget % "build_time_minutes"))
                     "x" #(x-scale (aget % "build_num"))
                     "width" (.rangeBand x-scale)
-                    "height" #(- y-middle (y-pos-scale (aget % "build_time_minutes")))})
+                    "height" #(- y-zero (y-pos-scale (aget % "build_time_minutes")))})
         (.select "title")
         (.text #(gstring/format "%s in %.1fm" (gstring/toTitleCase (aget % "outcome")) (aget % "build_time_minutes"))))

     ;; bottom bar enter and update
     (-> bars-join
         (.select ".bottom")
-        (.attr #js {"y" y-middle
+        (.attr #js {"y" y-zero
                     "x" #(x-scale (aget % "build_num"))
                     "width" (.rangeBand x-scale)
-                    "height" #(- (y-neg-scale (aget % "queued_time_minutes")) y-middle)})
+                    "height" #(- (y-neg-scale (aget % "queued_time_millis")) y-zero)})
         (.select "title")
-        (.text #(gstring/format "Queue time %.1fm" (aget % "queued_time_minutes"))))
+        (.text #(gstring/format "Queue time %.1fm" (aget % "queued_time_millis"))))

     ;; bars exit
     (-> bars-join
@@ -213,13 +219,16 @@

     ;; y-axis
     (-> svg
-        (.select ".axis-container g.y-axis.axis")
-        (.call y-axis))
+        (.select ".axis-container g.y-axis.positive")
+        (.call y-pos-axis))
+    (-> svg
+        (.select ".axis-container g.y-axis.negative")
+        (.call y-neg-axis))
     ;; x-axis
     (-> svg
         (.select ".axis-container g.axis.x-axis line")
-        (.attr #js {"y1" (int y-middle)
-                    "y2" (int y-middle)
+        (.attr #js {"y1" y-zero
+                    "y2" y-zero
                     "x1" 0
                     "x2" (:width plot-info)}))

@@ -266,7 +275,10 @@
           (.append "line"))
       (-> axis-container
           (.append "g")
-          (.attr "class" "y-axis axis")))))
+          (.attr "class" "y-axis positive axis"))
+      (-> axis-container
+          (.append "g")
+          (.attr "class" "y-axis negative axis")))))

 (defn chartable-builds [builds]
   (->> builds


Don't evaluate spec forms at macro-expansion-time

* "Method too large" for deeply nested specs

--- src/spec_tools/core.cljc
+++ src/spec_tools/core.cljc
@@ -172,51 +172,35 @@
                       (map (comp keyword name) (:opt-un m))))})))

 (defn create-spec [m]
-  (let [info (extract-extra-info (:spec/form m))]
-    (map->Spec (merge m info))))
+  (let [form (or (:spec/form m) (s/form (:pred m)))
+        info (extract-extra-info form)
+        type (if-not (contains? m :spec/type)
+               (types/resolve-type form)
+               (:spec/type m))]
+    (map->Spec (merge m info {:spec/form form, :spec/type type}))))

 #?(:clj
    (defmacro spec
      ([pred]
-      (if (impl/in-cljs? &env)
-        `(let [form# (if (clojure.core/symbol? '~pred)
-                       '~(or (and (clojure.core/symbol? pred) (some->> pred (impl/cljs-resolve &env) impl/->sym)) pred)
-                       (s/form ~pred))]
-           (create-spec
-             {:spec/type (types/resolve-type form#)
-              :pred ~pred
-              :spec/form form#}))
-        `(let [form# (if (clojure.core/symbol? '~pred)
-                       '~(or (and (clojure.core/symbol? pred) (some->> pred resolve impl/->sym)) pred)
-                       (s/form ~pred))]
-           (create-spec
-             {:spec/type (types/resolve-type form#)
-              :pred ~pred
-              :spec/form form#}))))
+      `(spec ~pred {}))
      ([pred info]
       (if (impl/in-cljs? &env)
         `(let [info# ~info
                form# (if (clojure.core/symbol? '~pred)
-                       '~(or (and (clojure.core/symbol? pred) (some->> pred (impl/cljs-resolve &env) impl/->sym)) pred)
-                       (s/form ~pred))]
+                       '~(or (and (clojure.core/symbol? pred) (some->> pred (impl/cljs-resolve &env) impl/->sym)) pred))]
            (assert (clojure.core/map? info#) (str "spec info should be a map, was: " info#))
            (create-spec
              (merge
                ~info
-               (if-not (contains? info# :spec/type)
-                 {:spec/type (types/resolve-type form#)})
                {:spec/form form#
                 :pred ~pred})))
         `(let [info# ~info
                form# (if (clojure.core/symbol? '~pred)
-                       '~(or (and (clojure.core/symbol? pred) (some->> pred resolve impl/->sym)) pred)
-                       (s/form ~pred))]
+                       '~(or (and (clojure.core/symbol? pred) (some->> pred resolve impl/->sym)) pred))]
            (assert (clojure.core/map? info#) (str "spec info should be a map, was: " info#))
            (create-spec
              (merge
                ~info
-               (if-not (contains? info# :spec/type)
-                 {:spec/type (types/resolve-type form#)})
                {:spec/form form#
                 :pred ~pred})))))))


Rename generate-piece to generate-rhythm

--- src/tenor/constructs.clj
+++ src/tenor/constructs.clj
@@ -129,15 +129,15 @@
   and musical notes as values."
   (map #(hash-map :pos %1, :note %2) entity intervals))

-(defn generate-piece [measure-count beat-count
+(defn generate-rhythm [measure-count beat-count
                       & {:keys [note-value sparseness]
                          :or {note-value 16 sparseness 1}}]
-  "Generate a musical piece with measure-count measures,
+  "Generate a rhythm with measure-count measures,
   each of time signature with beat-count and note-value."
   (let [time-sig (generate-meter beat-count)
         segmented (segment-measure time-sig note-value sparseness)
-        piece (repeat measure-count segmented)]
-    (string-measures piece beat-count)))
+        rhythm (repeat measure-count segmented)]
+    (string-measures rhythm beat-count)))

 (defn generate-entity-map [construct-melody measure-count beat-count
                             & {:keys [note-value sparseness scale]
@@ -146,10 +146,10 @@
                                     scale (generate-random-scale)}}]
   "Take a function to construct a melody, measure count, note count and note value,
   and generate a measure map of the melody and rhythm using map-entity."
-  (let [piece (generate-piece measure-count beat-count note-value sparseness)
+  (let [rhythm (generate-rhythm measure-count beat-count note-value sparseness)
         scale-intervals (intervals->notes
-                          (generate-intervals construct-melody scale (count piece)) scale)]
-  (map-entity piece scale-intervals)))
+                          (generate-intervals construct-melody scale (count rhythm)) scale)]
+  (map-entity rhythm scale-intervals)))

 ;; --- Chords --- ;;


add _content index

add _content index

--- src/sledge/db.clj
+++ src/sledge/db.clj
@@ -47,6 +47,12 @@
            :tokenize-query lower-words}
    :title {:tokenize-tags (comp #'lower-words :title)
            :tokenize-query lower-words}
+   :_content {:tokenize-tags (fn [r]
+                               (lower-words
+                                (str/join " "
+                                          ((juxt :artist :album :title :genre)
+                                           r))))
+              :tokenize-query lower-words}
    ;; numeric field support is a bit rudimentary yet, it doesn't
    ;; do anything useful with "like".
    :year {:empty-map (sorted-map)
@@ -113,6 +119,7 @@

 (defmethod where "and" [index [_ & terms]]
   (let [results (map #(into {} (where index %)) terms)
+        _ (println results)
         paths (apply set/intersection (map #(set (keys %)) results))]
     (map (fn [path]
            [path (reduce * (map #(get % path) results))])


[#532] Add correct data to pivot table shares

--- backend/src/akvo/lumen/lib/public_impl.clj
+++ backend/src/akvo/lumen/lib/public_impl.clj
@@ -20,7 +20,7 @@
   (let [dataset-id (:datasetId visualisation)
         {:keys [status body]} (pivot/query tenant-conn dataset-id (:spec visualisation))]
     (when (= status 200)
-      {"visualisations" {(:id visualisation) (assoc visualisation :data visualisation)}})))
+      {"visualisations" {(:id visualisation) (assoc visualisation :data body)}})))

 (defmethod visualisation :default
   [tenant-conn visualisation]


Remove unwanted lines from test file

Remove unwanted lines from test file

I accidentally committed some lines in the test file. Remove them before
someone gets confused.

--- test/clj/theatralia/database/t_txd_gen.clj
+++ test/clj/theatralia/database/t_txd_gen.clj
@@ -98,28 +98,3 @@
       (let [tags-after (qcan/tags-of-user-eid db-after owner-eid)]
         (apply distinct? tags-after)))
     => (quick-check 100)))
-
-(comment
-
-  (require '[theatralia.database.t-txd-gen :as t])
-  (require '[theatralia.database.canned-queries :as qcan])
-  (require '[theatralia.database.txd-gen :as txd-gen])
-
-  (def db-0 (t/fresh-db))
-  (def oeid (qcan/username->eid db-0 "sandbox"))
-  (def res-1 (txd-gen/add-tags-txd db-0 ["a"] oeid))
-
-
-  )
-
-  ; add-material-txd
-  ; Properties:
-  ;  - None should have nil? for a value.
-  ;  - Hm, this one is pretty borinrc/clj/theatralia/routes.clj
-  ;  - What do we want to do if same material transacted twice?
-  ;  - Tags already present shouldn't be modified.
-  ;  - Shouldn't add more tags than we want.
-  ;  - Make sure that when there are some tags already in the database and our
-  ;    list of tags contains some of these, the ones that are contained are left
-  ;    in peace and the extra ones are added.
-  ;  - What about duplicate tags in tags?


Pass compression.

Pass compression.

[ci skip]

--- test/onyx/peer/custom_compression_test.clj
+++ test/onyx/peer/custom_compression_test.clj
@@ -5,105 +5,95 @@
             [onyx.test-helper :refer [load-config]]
             [onyx.api]))

-(def id (java.util.UUID/randomUUID))
+(def n-messages 100)

-(def config (load-config))
+(defn my-inc [{:keys [n] :as segment}]
+  (assoc segment :n (inc n)))

-(def env-config (assoc (:env-config config) :onyx/id id))
+(def in-chan (chan (inc n-messages)))

-(def peer-config
-  (assoc (:peer-config config)
-    :onyx/id id
-    :onyx.messaging/decompress-fn #(read-string (String. % "UTF-8"))
-    :onyx.messaging/compress-fn #(.getBytes (pr-str %))))
+(def out-chan (chan (sliding-buffer (inc n-messages))))

-(def env (onyx.api/start-env env-config))
+(defn inject-in-ch [event lifecycle]
+  {:core.async/chan in-chan})

-(def peer-group (onyx.api/start-peer-group peer-config))
+(defn inject-out-ch [event lifecycle]
+  {:core.async/chan out-chan})

-(try
-  (def n-messages 100)
+(def in-calls
+  {:lifecycle/before-task-start inject-in-ch})

-  (def batch-size 20)
+(def out-calls
+  {:lifecycle/before-task-start inject-out-ch})

-  (defn my-inc [{:keys [n] :as segment}]
-    (assoc segment :n (inc n)))
+(deftest compression
+  (let [id (java.util.UUID/randomUUID)
+        config (load-config)
+        env-config (assoc (:env-config config) :onyx/id id)
+        peer-config (assoc (:peer-config config)
+                      :onyx/id id
+                      :onyx.messaging/decompress-fn #(read-string (String. % "UTF-8"))
+                      :onyx.messaging/compress-fn #(.getBytes (pr-str %)))
+        env (onyx.api/start-env env-config)
+        peer-group (onyx.api/start-peer-group peer-config)
+        batch-size 20

-  (def catalog
-    [{:onyx/name :in
-      :onyx/plugin :onyx.plugin.core-async/input
-      :onyx/type :input
-      :onyx/medium :core.async
-      :onyx/batch-size batch-size
-      :onyx/max-peers 1
-      :onyx/doc "Reads segments from a core.async channel"}
+        catalog
+        [{:onyx/name :in
+          :onyx/plugin :onyx.plugin.core-async/input
+          :onyx/type :input
+          :onyx/medium :core.async
+          :onyx/batch-size batch-size
+          :onyx/max-peers 1
+          :onyx/doc "Reads segments from a core.async channel"}

-     {:onyx/name :inc
-      :onyx/fn :onyx.peer.custom-compression-test/my-inc
-      :onyx/type :function
-      :onyx/batch-size batch-size}
+         {:onyx/name :inc
+          :onyx/fn :onyx.peer.custom-compression-test/my-inc
+          :onyx/type :function
+          :onyx/batch-size batch-size}

-     {:onyx/name :out
-      :onyx/plugin :onyx.plugin.core-async/output
-      :onyx/type :output
-      :onyx/medium :core.async
-      :onyx/batch-size batch-size
-      :onyx/max-peers 1
-      :onyx/doc "Writes segments to a core.async channel"}])
+         {:onyx/name :out
+          :onyx/plugin :onyx.plugin.core-async/output
+          :onyx/type :output
+          :onyx/medium :core.async
+          :onyx/batch-size batch-size
+          :onyx/max-peers 1
+          :onyx/doc "Writes segments to a core.async channel"}]

-  (def workflow [[:in :inc] [:inc :out]])
+        workflow [[:in :inc] [:inc :out]]

-  (def in-chan (chan (inc n-messages)))
+        lifecycles
+        [{:lifecycle/task :in
+          :lifecycle/calls :onyx.peer.custom-compression-test/in-calls}
+         {:lifecycle/task :in
+          :lifecycle/calls :onyx.plugin.core-async/reader-calls}
+         {:lifecycle/task :out
+          :lifecycle/calls :onyx.peer.custom-compression-test/out-calls}
+         {:lifecycle/task :out
+          :lifecycle/calls :onyx.plugin.core-async/writer-calls}]

-  (def out-chan (chan (sliding-buffer (inc n-messages))))
+        v-peers (onyx.api/start-peers 3 peer-group)]
+    (doseq [n (range n-messages)]
+      (>!! in-chan {:n n}))

-  (defn inject-in-ch [event lifecycle]
-    {:core.async/chan in-chan})
+    (>!! in-chan :done)
+    (close! in-chan)

-  (defn inject-out-ch [event lifecycle]
-    {:core.async/chan out-chan})
+    (onyx.api/submit-job
+     peer-config
+     {:catalog catalog
+      :workflow workflow
+      :lifecycles lifecycles
+      :task-scheduler :onyx.task-scheduler/balanced})

-  (def in-calls
-    {:lifecycle/before-task-start inject-in-ch})
+    (let [results (take-segments! out-chan)
+          expected (set (map (fn [x] {:n (inc x)}) (range n-messages)))]
+      (is (= expected (set (butlast results))))
+      (is (= :done (last results)))

-  (def out-calls
-    {:lifecycle/before-task-start inject-out-ch})
+      (doseq [v-peer v-peers]
+        (onyx.api/shutdown-peer v-peer))

-  (def lifecycles
-    [{:lifecycle/task :in
-      :lifecycle/calls :onyx.peer.custom-compression-test/in-calls}
-     {:lifecycle/task :in
-      :lifecycle/calls :onyx.plugin.core-async/reader-calls}
-     {:lifecycle/task :out
-      :lifecycle/calls :onyx.peer.custom-compression-test/out-calls}
-     {:lifecycle/task :out
-      :lifecycle/calls :onyx.plugin.core-async/writer-calls}])
+      (onyx.api/shutdown-peer-group peer-group)

-  (doseq [n (range n-messages)]
-    (>!! in-chan {:n n}))
-
-  (>!! in-chan :done)
-  (close! in-chan)
-
-  (def v-peers (onyx.api/start-peers 3 peer-group))
-
-  (onyx.api/submit-job
-   peer-config
-   {:catalog catalog
-    :workflow workflow
-    :lifecycles lifecycles
-    :task-scheduler :onyx.task-scheduler/balanced})
-
-  (def results (take-segments! out-chan))
-
-  (let [expected (set (map (fn [x] {:n (inc x)}) (range n-messages)))]
-    (fact (set (butlast results)) => expected)
-    (fact (last results) => :done))
-
-  (finally
-   (doseq [v-peer v-peers]
-     (onyx.api/shutdown-peer v-peer))
-
-   (onyx.api/shutdown-peer-group peer-group)
-
-   (onyx.api/shutdown-env env)))
+      (onyx.api/shutdown-env env))))


Rewrite key nest as thread.

Rewrite key nest as thread.

--- test/isla/test/story.clj
+++ test/isla/test/story.clj
@@ -80,7 +80,7 @@
         story (init-story story-str)
         result (run-command story "go into garden")]
     (is (re-find #"You are in the garden" (:out result)))
-    (is (:name (:room (:player (:sto result)))) "garden")))
+    (is (-> result :sto :player :room :name) "garden")))

 (deftest test-trying-to-move-to-unconnected-room
   (let [story-str (str "palace is a room\ngarden is a room\nmy room is palace")


use bash to call deploy app, files copied from the classpath don't preserve execute rights

--- src/devops_101_pipeline/deploy_scripts.clj
+++ src/devops_101_pipeline/deploy_scripts.clj
@@ -31,4 +31,4 @@
 (defn deploy [ctx]
   (let [basedir (prepare-deploy-scripts)]
     (shell/bash ctx basedir
-                "./deploy-app.sh")))+                "bash ./deploy-app.sh")))


Revert "Lets capture the time it takes to get a list endpoint out. (#781)" (#783)

This reverts commit 2defa52462ab2bc7353d8f82044b5183142b1a0f.

--- scheduler/src/cook/mesos/api.clj
+++ scheduler/src/cook/mesos/api.clj
@@ -2159,10 +2159,8 @@
     :handle-malformed ::error
     :handle-forbidden ::error
     :handle-ok (fn [ctx]
-                 (timers/time!
-                   (timers/timer [cook-scheduler handler list-endpoint-duration])
-                   (let [job-uuids (list-jobs db false ctx)]
-                     (doall (mapv (partial fetch-job-map db framework-id) job-uuids)))))))
+                 (let [job-uuids (list-jobs db false ctx)]
+                   (mapv (partial fetch-job-map db framework-id) job-uuids)))))

 ;;
 ;; /unscheduled_jobs


Remove broken import

Remove broken import

--- src/rdf-repository/grafter/rdf/repository/registry.clj
+++ src/rdf-repository/grafter/rdf/repository/registry.clj
@@ -13,8 +13,7 @@
   altering them may have unintended consequences."
   (:require [clojure.string :as str]
             [clojure.tools.logging :as log])
-  (:import [drafter.rdf DrafterSPARQLRepository]
-           [java.nio.charset Charset]
+  (:import [java.nio.charset Charset]
            [org.openrdf.rio RDFParserRegistry RDFFormat]
            [org.openrdf.query.resultio TupleQueryResultFormat BooleanQueryResultFormat
             TupleQueryResultParserRegistry


volumes ns seperated

volumes ns seperated

--- src/aws/provider.clj
+++ src/aws/provider.clj
@@ -11,8 +11,9 @@

 (ns aws.provider
   (:require
-    [aws.common :refer (with-ctx instance-desc creds)]
+    [aws.common :refer (with-ctx instance-desc creds image-id)]
     [aws.networking :refer (update-ip set-hostname pub-dns)]
+    [aws.volumes :refer (delete-volumes handle-volumes)]
     [aws.sdk.ec2 :as ec2]
     [aws.sdk.ebs :as ebs]
     [aws.sdk.eip :as eip]
@@ -28,7 +29,7 @@
     [celestial.core :refer (Vm)]
     [celestial.common :refer (import-logging )]
     [celestial.persistency.systems :as s]
-    [celestial.model :refer (translate vconstruct hypervisor)]))
+    [celestial.model :refer (translate vconstruct)]))

 (import-logging)

@@ -37,21 +38,10 @@
   (wait-for {:timeout timeout} #(= req-stat (.status instance))
     {:type ::aws:status-failed :message "Timed out on waiting for status" :status req-stat :timeout timeout}))

-(defn image-desc [endpoint ami & ks]
-  (-> (ec2/describe-images (assoc (creds) :endpoint endpoint) (ec2/image-id-filter ami))
-      first (apply ks)))
-
-
-
-(defn wait-for-attach [endpoint instance-id timeout]
-  (wait-for {:timeout timeout}
-            #(= "attached" (instance-desc endpoint instance-id :block-device-mappings 0 :ebs :status))
-            {:type ::aws:ebs-attach-failed :message "Failed to wait for ebs root device attach"}))
-
 (defn wait-for-ssh [endpoint instance-id user timeout]
     (wait-for {:timeout timeout}
-              #(ssh-up? {:host (pub-dns endpoint instance-id) :port 22 :user user})
-              {:type ::aws:ssh-failed :message "Timed out while waiting for ssh" :timeout timeout}))
+      #(ssh-up? {:host (pub-dns endpoint instance-id) :port 22 :user user})
+      {:type ::aws:ssh-failed :message "Timed out while waiting for ssh" :timeout timeout}))

 (defn instance-id*
   "grabbing instance id of spec"
@@ -62,33 +52,6 @@
  `(if-let [~'instance-id (instance-id* ~'spec)]
     (do ~@body)
     (throw+ {:type ::aws:missing-id :message "Instance id not found"})))
-
-(defn image-id [machine]
-  (hypervisor :aws :ostemplates (machine :os) :ami))
-
-(defn handle-volumes
-   "attached and waits for ebs volumes"
-   [{:keys [aws machine] :as spec} endpoint instance-id]
-  (when (= (image-desc endpoint (image-id machine) :root-device-type) "ebs")
-    (wait-for-attach endpoint instance-id [10 :minute]))
-  (let [zone (instance-desc endpoint instance-id :placement :availability-zone)]
-    (doseq [{:keys [device size]} (aws :volumes)]
-      (let [{:keys [volumeId]} (with-ctx ebs/create-volume size zone)]
-        (wait-for {:timeout [10 :minute]} #(= "available" (with-ctx ebs/state volumeId))
-           {:type ::aws:ebs-volume-availability :message "Failed to wait for ebs volume to become available"})
-        (with-ctx ebs/attach-volume volumeId instance-id device)
-        (wait-for {:timeout [10 :minute]} #(= "attached" (with-ctx ebs/attachment-status volumeId))
-           {:type ::aws:ebs-volume-attach-failed :message "Failed to wait for ebs volume device attach"})))))
-
-(defn delete-volumes
-   "Clear instance volumes"
-   [endpoint instance-id]
-   (doseq [{:keys [ebs]} (-> (instance-desc endpoint instance-id) :block-device-mappings rest)]
-     (trace "deleting volume" ebs)
-     (with-ctx ebs/detach-volume (ebs :volume-id))
-     (wait-for {:timeout [10 :minute]} #(= "available" (with-ctx ebs/state  (ebs :volume-id)))
-        {:type ::aws:ebs-volume-availability :message "Failed to wait for ebs volume to become available"})
-     (with-ctx ebs/delete-volume (ebs :volume-id))))

 (defn create-instance
    "creates instance from aws"
@@ -130,7 +93,7 @@
   (delete [this]
     (with-instance-id
       (debug "deleting" instance-id)
-      (delete-volumes endpoint instance-id)
+      (delete-volumes endpoint instance-id (spec :system-id))
       (with-ctx ec2/terminate-instances instance-id)
       (wait-for-status this "terminated" [5 :minute])
       ; for reload support
@@ -174,9 +137,6 @@
   (:endpoint m )
   (.status m)
   (.start m)
-  (clojure.pprint/pprint
-    (celestial.model/set-env :dev
-      (instance-desc  "i-cdd59781") ))

   (clojure.pprint/pprint
     (celestial.model/set-env :dev


in (fill-by-spec _count_), check for existing target expressions that match desired spec, and only generate enough expressions so that the new total will be enough to total to_count_.

--- src/babel/writer.clj
+++ src/babel/writer.clj
@@ -203,11 +203,24 @@
     (throw (Exception. "No source language model was supplied.")))
   (if (nil? target-model)
     (throw (Exception. "No target language model was supplied.")))
-
-  (populate count
-            source-model
-            target-model
-            spec table))
+  (let [json-spec (json/write-str spec)
+        current-target-count
+        (:count
+         (first
+          (k/exec-raw ["SELECT count(*) FROM expression
+                         WHERE structure @> ?::jsonb
+                           AND language=?"
+                       [(json/write-str spec) (:language target-model)]]
+                      :results)))]
+    (log/debug (str "current-target-count for spec: " spec "=" current-target-count))
+    (let [count (- count current-target-count)]
+      (if (> current-target-count > 0)
+        (log/warn (str "There are already: " current-target-count " expressions for spec: " spec)))
+      (log/info (str "Generating: " count " target expressions."))
+      (populate count
+                source-model
+                target-model
+                spec table))))

 (defn fill-verb [verb count source-model target-model & [spec table]] ;; spec is for additional constraints on generation.
   (let [spec (if spec spec :top)


more logging

more logging

--- src/babel/writer.clj
+++ src/babel/writer.clj
@@ -469,7 +469,8 @@
                          (->> member-of-unit :fill :target-model))))
                     (if (:fill-one-language member-of-unit)
                       (let [count (or (->> member-of-unit :fill-one-language :count) 10)]
-                        (log/debug (str "doing fill-one-language: " (->> member-of-unit :fill-one-language :spec)
+                        (log/debug (str "doing fill-one-language: "
+                                        (->> member-of-unit :fill-one-language :spec)
                                         "; count=" count))
                         (fill-language-by-spec
                          (->> member-of-unit :fill-one-language :spec)


Fix name function

Fix name function

--- src/beehive/hive.clj
+++ src/beehive/hive.clj
@@ -16,7 +16,7 @@
   (:refer-clojure :exclude [promise future name])
   (:require [beehive.enums :as enums]
             [beehive.future :as f])
-  (:import (clojure.lang APersistentMap ILookup IPending IDeref IBlockingDeref)
+  (:import (clojure.lang APersistentMap ILookup IPending IDeref)
            (beehive.java ToCLJ)
            (net.uncontended.precipice Completable
                                       Failable
@@ -38,7 +38,7 @@

 (extend-protocol Hive
   APersistentMap
-  (beehive-name [this] (:name this))
+  (name [this] (:name this))
   (result-counts [this] (:result-counts this))
   (rejected-counts [this] (:rejected-counts this))
   (result-latency [this] (:result-latency this))


Rename pipe-to-atom to to-atom.

Rename pipe-to-atom to to-atom.

--- src/beicon/core.cljs
+++ src/beicon/core.cljs
@@ -401,14 +401,16 @@
   ([n skip ob]
    (.bufferWithCount ob n skip)))

-(defn pipe-to-atom
+(defn to-atom
   ([ob]
    (let [a (atom nil)]
-     (pipe-to-atom a ob)))
+     (to-atom a ob)))
   ([a ob]
+   {:pre [(observable? ob)]}
    (on-value ob #(reset! a %))
    a)
   ([a ob f]
+   {:pre [(observable? ob)]}
    (on-value ob #(swap! a f %))
    a))


Update handler.clj

Update handler.clj

--- src/blog/handler.clj
+++ src/blog/handler.clj
@@ -27,8 +27,8 @@
   (println "blog is starting")
   ;;u slucaju da ne postji tabela, napravi je
   (if-not (.exists (java.io.File. "./db.sq3"))
-    (db/create-blog-table)
-    (db/create-comment-table)))
+    (do (db/create-blog-table)
+    (db/create-comment-table))))

 (defn destroy []
   (println "blog is shutting down"))


Update public api with new typespecs.

Update public api with new typespecs.

--- src/bytebuf/core.clj
+++ src/bytebuf/core.clj
@@ -1,5 +1,5 @@
 (ns bytebuf.core
-  (:refer-clojure :exclude [read])
+  (:refer-clojure :exclude [read byte float double short long])
   (:require [bytebuf.spec :as spec]
             [bytebuf.buffer :as buffer]
             [bytebuf.proto :as proto]
@@ -12,7 +12,16 @@
   string
   string*
   int32
-  int64]
+  int64
+  short
+  integer
+  long
+  float
+  double
+  real32
+  real64
+  byte
+  bool]
  [bytebuf.buffer
   allocate]
  [bytebuf.proto


replace cell only when necessary

replace cell only when necessary

--- src/clj/neb/cell.clj
+++ src/clj/neb/cell.clj
@@ -330,7 +330,8 @@
     trunk hash
     (when-let [cell-content (read-cell* trunk)]
       (let [replacement  (apply (compiled-cache fn) cell-content params)]
-        (replace-cell* trunk hash replacement)
+        (when-not (= cell-content replacement)
+          (replace-cell* trunk hash replacement))
         replacement))))

 (defn- compile-schema-for-get-in* [schema-fields ks]


[Delete] type-annotation

[Delete] type-annotation

--- src/clj_elm/core.clj
+++ src/clj_elm/core.clj
@@ -5,34 +5,34 @@
             [incanter.core :as c :exclude [update]])
   (:import [clj_elm.data DataSet]))

-(defn ^Number sign
+(defn sign
   "The signum function for a real number x."
-  ([^Number x]
+  ([x]
    {:pre [(number? x)]}
    (cond
      (> x 0) 1
      (= x 0) 0
      :else -1)))

-(defn ^clojure.lang.PersistentVector make-weights
+(defn make-weights
   "Make a d-dimension-random-feature vector. d is number of dimention of
    feature. All elements are in [-1,1]"
-  ([^Integer d]
+  ([d]
    {:pre [(integer? d)]}
    (take d (repeatedly #(dec (rand 2))))))

-(defn ^clojure.lang.PersistentVector make-ass
-  ([^Integer d ^Integer L]
+(defn make-ass
+  ([d L]
    {:pre [(integer? d) (integer? L)]}
    (take L (repeatedly #(make-weights d)))))

-(defn ^clojure.lang.PersistentVector make-bs
-  ([^Integer L]
+(defn make-bs
+  ([L]
    {:pre (integer? L)}
    (take L (repeatedly #(first (make-weights 1))))))

-(defn ^Number standard-sigmoid
-  ([^Number x]
+(defn standard-sigmoid
+  ([x]
    {:pre [(number? x)]
     :post [(number? %)]}
    (/ 1 (+ 1 (Math/exp (- x))))))
@@ -43,29 +43,29 @@
     :post [(number? %)]}
    (dec (/ 2 (+ 1 (Math/exp (- x)))))))

-(defn ^Number g
-  ([^Number x]
+(defn g
+  ([x]
    (standard-sigmoid x)))

-(defn ^Number a-hidden-layer-output
+(defn a-hidden-layer-output
   "Return output of hidden-layer_i with xs. As_i is d-dimension. B_i is number.
    Xs is d-dimension."
-  ([^clojure.lang.PersistentVector as_i ^Number b_i ^clojure.lang.PersistentVector xs]
+  ([as_i b_i xs]
    {:pre [(coll? as_i) (number? b_i) (coll? xs)]}
    (g (+ (c/inner-product as_i xs)
          b_i))))

-(defn ^clojure.lang.PersistentVector hidden-layer-output-matrix
+(defn hidden-layer-output-matrix
   "Ass is d-L-dimension. Xss is d-L-dimesion. Bs is L-dimension."
-  ([^clojure.lang.PersistentVector ass ^Number bs ^clojure.lang.PersistentVector xss]
+  ([ass bs xss]
    {:pre [(coll? ass) (coll? (first ass)) (number? (first (first ass)))
           (coll? bs) (number? (first bs))
           (coll? xss) (coll? (first xss))]
     :post [(= (count (first %)) (count ass)) (= (count %) (count xss))]}
    (pmap (fn [xs_i] (pmap #(a-hidden-layer-output %1 %2 xs_i) ass bs)) xss)))

-(defn ^clojure.lang.PersistentVector pseudo-inverse-matrix
-  ([^clojure.lang.PersistentVector mat]
+(defn pseudo-inverse-matrix
+  ([mat]
    {:pre [(coll? mat) (coll? (first mat))]}
    (let [matrix (c/matrix mat)
          transmat (c/trans matrix)
@@ -84,9 +84,9 @@

 (defrecord Model [ass bs betas])

-(defn ^Model train-model
-  ([^DataSet dataset ^Integer L & {:keys [^Boolean norm] :or {norm false}}]
-   {:pre [(instance? DataSet dataset) (integer? L)]}
+(defn train-model
+  ([dataset L & {:keys [norm] :or {norm false}}]
+   ;; {:pre [(instance? DataSet dataset) (integer? L)]}
    (let [normf (if norm data/normalize identity)
          d (data/num-of-feature dataset)
          ass (make-ass d L)
@@ -97,19 +97,18 @@
          betas (c/to-vect (c/mmult (pseudo-inverse-matrix H) T))]
      (Model. ass bs betas))))

-(defn ^Integer predict
-  ([^Model model ^clojure.lang.PersistentVector xs]
+(defn predict
+  ([model xs]
    {:pre [(instance? Model model) (coll? xs)]}
    (predict (:ass model) (:bs model) (:betas model) xs))
-  ([^clojure.lang.PersistentVector ass ^clojure.lang.PersistentVector bs
-    ^clojure.lang.PersistentVector betas ^clojure.lang.PersistentVector xs]
+  ([ass bs betas xs]
    {:pre [(coll? ass) (coll? (first ass)) (coll? bs) (coll? betas) (coll? xs)]}
    (-> (pmap #(* %1 (a-hidden-layer-output %2 %3 xs)) betas ass bs)
        (c/sum)
        (sign))))

-(defn ^Number evaluation
-  ([^clojure.lang.PersistentVector results ^clojure.lang.PersistentVector facts]
+(defn evaluation
+  ([results facts]
    {:pre [(coll? results) (coll? facts)]}
    (let [numd (count results)]
      (->> (pmap #(= %1 %2) results facts)
@@ -117,8 +116,8 @@
           (count)
           (#(/ % numd))))))

-(defn ^Number _cross-validate
-  ([^DataSet dataset ^Integer a ^Integer b ^Integer L]
+(defn _cross-validate
+  ([dataset a b L]
    {:pre [(instance? DataSet dataset) (integer? a) (integer? b) (> b a)]}
    (let [test (DataSet. (data/extract-list (:classes dataset) a b)
                         (data/extract-list (:features dataset) a b))
@@ -131,8 +130,8 @@
          (as-> eva (do (println eva)
                        eva))))))

-(defn ^Number cross-validate
-  ([^DataSet dataset ^Integer L ^Integer k]
+(defn cross-validate
+  ([dataset L k]
    {:pre [(instance? DataSet dataset) (integer? k) (integer? L)]}
    (let [norm-dataset (DataSet. (:classes dataset) (data/normalize (:features dataset)))
          numd (count (:classes norm-dataset)) ; number of data
@@ -141,4 +140,3 @@
           (pmap #(_cross-validate norm-dataset % (+ % (dec groupn)) L))
           (reduce +)
           (* (/ 1 k))))))
-


Little hack to make datview easier to work with from other projects

--- src/datview/core.clj
+++ src/datview/core.clj
@@ -5,7 +5,7 @@
 (def schema
   (->> "datview-schema.edn"
        ;; Swap out once a lib XXX TODO
-       (str "src/datview/resources/")
+       (str "../catalysis/src/datview/resources/")
        ;io/resource
        slurp
        read-string))


Fix example.

Fix example.

--- src/cljs/main/quil_site/examples/lissajous_table.cljs
+++ src/cljs/main/quil_site/examples/lissajous_table.cljs
@@ -124,6 +124,7 @@
    :host host
    :size [size size]
    :setup setup
-   :draw draw)) ;DELETE
+   :draw draw)
+) ;DELETE

 (quil-site.main/register-example! "lissajous table" "Mochamad Lucky Pradana" run-sketch) ;DELETE


Add using clause to delete query

Add using clause to delete query

--- src/clojure/clojurewerkz/cassaforte/new_query_api.clj
+++ src/clojure/clojurewerkz/cassaforte/new_query_api.clj
@@ -513,9 +513,13 @@
                                    (.column builder (name column))
                                    (column builder)))
                                query-builder
-                               columns)
-
-                       )}]
+                               columns))
+
+       :using         (fn using-query [query-builder m]
+                        (doseq [[key value] m]
+                          (.using query-builder ((get with-values key) value)))
+                        query-builder)
+       }]

   (defn delete
     [table-name & statements]


Doubled max points

Doubled max points

--- src/clojush/problems/integer_regression/factorial.clj
+++ src/clojush/problems/integer_regression/factorial.clj
@@ -72,7 +72,7 @@
                        )
    :population-size 1000
    :max-generations 500
-   :max-points 1000
+   :max-points 2000
    :max-genome-size-in-initial-program 100
    :evalpush-limit 1000
    :genetic-operator-probabilities {[:alternation :uniform-mutation] 0.5


fix non-get ajax requests

fix non-get ajax requests

--- frontend/utils/ajax.cljs
+++ frontend/utils/ajax.cljs
@@ -1,5 +1,5 @@
 (ns frontend.utils.ajax
-  (:require [ajax.core :as ajax]
+  (:require [ajax.core :as clj-ajax]
             [cljs.core.async :as async :refer [>! <! alts! chan sliding-buffer close!]]
             [cljs-time.core :as time]
             [frontend.async :refer [put!]]
@@ -35,24 +35,24 @@
                         (if prefix (str " prefix '" prefix "'"))
                         (if keywords? " keywordize"))}))

-
 ;; XXX only implementing JSON format and not implementing prefixes for now since we don't use either
 (defn ajax [method url message channel & {:keys [params keywords? context]
                                           :or {keywords? true}}]
   (let [uuid frontend.async/*uuid*]
     (put! channel [message :started context])
-    (ajax/ajax-request url method
-                       (ajax/transform-opts
-                        {:format (json-response-format {:keywords? keywords? :url url :method method})
-                         :response-format :json
-                         :keywords? keywords?
-                         :params params
-                         :headers (merge {:Accept "application/json"}
-                                         (when (re-find #"^/" url)
-                                           {:X-CSRFToken (utils/csrf-token)}))
-                         :handler #(binding [frontend.async/*uuid* uuid]
-                                     (put! channel [message :success (assoc % :context context)]))
-                         :error-handler #(binding [frontend.async/*uuid* uuid]
-                                           (put! channel [message :failed (assoc % :context context)]))
-                         :finally #(binding [frontend.async/*uuid* uuid]
-                                     (put! channel [message :finished context]))}))))
+    (clj-ajax/ajax-request url method
+                           (clj-ajax/transform-opts
+                            {:format (merge (clj-ajax/json-request-format)
+                                            (json-response-format {:keywords? keywords? :url url :method method}))
+                             :response-format :json
+                             :keywords? keywords?
+                             :params params
+                             :headers (merge {:Accept "application/json"}
+                                             (when (re-find #"^/" url)
+                                               {:X-CSRFToken (utils/csrf-token)}))
+                             :handler #(binding [frontend.async/*uuid* uuid]
+                                         (put! channel [message :success (assoc % :context context)]))
+                             :error-handler #(binding [frontend.async/*uuid* uuid]
+                                               (put! channel [message :failed (assoc % :context context)]))
+                             :finally #(binding [frontend.async/*uuid* uuid]
+                                         (put! channel [message :finished context]))}))))


link to blog post the approach was taken from

--- src/jsx_fun/core.clj
+++ src/jsx_fun/core.clj
@@ -96,6 +96,7 @@
       "ScrollResponder.js"
       (transform-jsx (slurp (io/file "resources/ScrollResponder.js")))))

+  ;; based on http://slieb.org/blog/parseJavaScriptWithGoogleClosure/
   (let [config       (ParserRunner/createConfig
                        true Config$LanguageMode/ECMASCRIPT5 true nil)
         err-reporter (SimpleErrorReporter.)


reorg

reorg

--- test/caesium/magicnonce/secretbox_test.clj
+++ test/caesium/magicnonce/secretbox_test.clj
@@ -123,6 +123,9 @@
   (let [ctext (ms/secretbox-nmr st/ptext st/secret-key)]
     (is-valid-magicnonce-ctext? ctext))

+  (let [scheme (fn [ptext] (ms/secretbox-nmr ptext st/secret-key))]
+    (is (not (repeated-keystream? scheme))))
+
   (with-redefs [ms/random-nonce! constant-nonce]
     (let [c1 (ms/secretbox-nmr st/ptext st/secret-key)
           c2 (ms/secretbox-nmr st/ptext st/secret-key)
@@ -138,5 +141,3 @@
     (let [scheme (fn [ptext] (ms/secretbox-nmr ptext st/secret-key))]
       (is (not (repeated-keystream? scheme)))))

-  (let [scheme (fn [ptext] (ms/secretbox-nmr ptext st/secret-key))]
-    (is (not (repeated-keystream? example-ptexts)))))


Fix those broken unit tests

Fix those broken unit tests

--- test/com/frereth/common/async_zmq_test.clj
+++ test/com/frereth/common/async_zmq_test.clj
@@ -281,7 +281,7 @@
                        (is (= c ex-right))
                        (is (= msg v)))
                      (let [read (:payload v)
-                           op (first read)
+                           op (-> read first resolve)
                            result (apply op (rest read))
                            [v c] (async/alts!! [[right-chan result] (async/timeout 150)])]
                        (testing "\n\tResponse sent"


Исправления рабты по 3 страницам

Исправления рабты по 3 страницам

--- src/lotsbox/core.clj
+++ src/lotsbox/core.clj
@@ -79,6 +79,9 @@
   "Получение данных лотов по адресу http://tender.sk.kz/index.php/ru/lots"
   (let [res  "tender.sk.kz"
         url  (or url "http://tender.sk.kz/index.php/ru/lots")]
+
+    (println "RUN PARSING FOR: " res " URL: " url)
+
     (-> (h/html-resource (java.net.URL. url))
         (h/select [:.showtab :tr])
         rest ;; Убираем шапку таблицы, берем только тело
@@ -151,11 +154,14 @@
 ;; SHEDULE -----------------------------------------------------------------------------------------

 (defn task-fn-1 []
-  (println (insert-update-rows (concat
-                                (tender-sk-kz-lots "http://tender.sk.kz/index.php/ru/lots")
-                                (tender-sk-kz-lots "http://tender.sk.kz/index.php/ru/lots/10")
-                                (tender-sk-kz-lots "http://tender.sk.kz/index.php/ru/lots/20")
-                                ))))
+  ;; Разделил на 3 для разруливания дубликатов при инсертах в начала страниц"
+  (println (insert-update-rows (tender-sk-kz-lots "http://tender.sk.kz/index.php/ru/lots")))
+  (println (insert-update-rows (tender-sk-kz-lots "http://tender.sk.kz/index.php/ru/lots/10")))
+  (println (insert-update-rows (tender-sk-kz-lots "http://tender.sk.kz/index.php/ru/lots/20")))
+  )
+
+
+

 (def my-pool (at/mk-pool))
@@ -356,13 +362,23 @@

 $(function() {

-        $( \"#accordion\" ).accordion();
-
-        $( \"input[type=submit], input[type=button], button\" ).button();
-
-        $( \"#radioset\" ).buttonset();
-
-        $( \"#tabs\" ).tabs();
+$( \"#accordion\" ).accordion();
+
+$( \"input[type=submit], input[type=button], button\" ).button();
+
+$( \"#radioset\" ).buttonset();
+
+$( \"#tabs\" ).tabs();
+
+$('input:text, input:password')
+  .css({
+          'font' : 'inherit',
+         'color' : 'inherit',
+    'text-align' : 'left',
+       'outline' : 'none',
+        'cursor' : 'text'
+  });
+
 })

 "))


Fix a doc string

Fix a doc string

--- src/mdr2/archive.clj
+++ src/mdr2/archive.clj
@@ -125,7 +125,7 @@
         (jdbc/insert! db :container job)))))

 (defn set-file-permissions
-  "Set file permissions on `root` to g+w recursively"
+  "Set file permissions on `file-tree` to g+w recursively"
   [file-tree]
   (let [permissions (conj (set (nio/posix-file-permissions file-tree))
                           (nio/posix-file-permission :group-write))


backend health checking: first pass

backend health checking: first pass

--- src/merlion/core.clj
+++ src/merlion/core.clj
@@ -5,6 +5,7 @@
             [manifold.deferred :as d]
             [clojure.string :as str]
             [clojure.set :as set]
+            [clojure.instant]
             [clojure.core.async :as async
              :refer [<! go chan >! close! alts!]]
             [aleph.http :as http])
@@ -88,6 +89,18 @@
 (defn print-state [l b]
   (pprint {:listeners l :backends b}))

+(defn s->millepoch-time [s]
+  (.getTimeInMillis (clojure.instant/read-instant-calendar s)))
+
+(defn millepoch-time-now []
+  (.getTime (java.util.Date.)))
+
+(defn healthy-backend?
+  "true if backend seen more recently than time"
+  [time b]
+  (> (s->millepoch-time (:last-seen-at b))
+     time))
+
 (defn run-server [prefix]
   (let [shutdown-ch (chan)
         config-watcher (etcd/watch-prefix prefix)
@@ -115,7 +128,14 @@
                                 shutdown-ch
                                 backends-ch]))]
             (when (= ch backends-ch)
-              (alts! (map (fn [b] [(:channel b) value]) (vals backends))))
+              (let [since (- (millepoch-time-now)
+                             (* 1000 (Integer/parseInt (:upstream-freshness config))))
+                    good-backends (filter (partial healthy-backend? since)
+                                          (vals backends))]
+                (if (seq good-backends)
+                  (alts! (map (fn [b] [(:channel b) value]) good-backends))
+                  (>! (second value) {:status 500 :headers {}
+                                      :body "No healthy downstreams"}))))
             (if (= ch shutdown-ch)
               (.close (first (vals listeners)))
               (recur listeners


Idiomatic tweak

Idiomatic tweak

--- src/omnibus/ohai.clj
+++ src/omnibus/ohai.clj
@@ -25,7 +25,7 @@
 (defn ohai
   "Use Ohai to get our Operating System and Machine Architecture"
   []
-  (let [ohai-data (read-json ((sh "ohai") :out))]
+  (let [ohai-data (read-json (:out (sh "ohai")))]
     {:os (get ohai-data :os),
      :machine (get-in ohai-data [:kernel :machine]),
      :platform (let [ohai-platform (get ohai-data :platform)]


checking to see if operation exists before calling it

--- src/ophion/query.clj
+++ src/ophion/query.clj
@@ -456,7 +456,9 @@
    (fn [g step]
      (let [key (-> step keys first)
            operation (get operations (camelize-key key))]
-       (operation g (get step key))))
+       (try
+         (operation g (get step key))
+         (catch Exception e (log/info "operation" operation "does not exist?")))))
    traversal
    query))


multiple hist planning 2

multiple hist planning 2


Add stack

Add stack

--- src/play_clj/ui.clj
+++ src/play_clj/ui.clj
@@ -6,8 +6,8 @@
            [com.badlogic.gdx.scenes.scene2d Actor Stage]
            [com.badlogic.gdx.scenes.scene2d.ui ButtonGroup CheckBox Dialog
             HorizontalGroup Image ImageButton ImageTextButton Label ScrollPane
-            SelectBox Skin Slider Table TextButton TextField Tree Tree$Node
-            VerticalGroup WidgetGroup Window]
+            SelectBox Skin Slider Stack Table TextButton TextField Tree
+            Tree$Node VerticalGroup WidgetGroup Window]
            [com.badlogic.gdx.scenes.scene2d.utils ActorGestureListener Align
             ChangeListener ClickListener DragListener FocusListener
             NinePatchDrawable SpriteDrawable TextureRegionDrawable
@@ -300,6 +300,20 @@
   [entity k & options]
   `(u/call! ^Slider (:object ~entity) ~k ~@options))

+(defn stack*
+  [children]
+  (create-group (Stack.) children))
+
+(defmacro stack
+  [children & options]
+  `(let [entity# (stack* ~children)]
+     (u/calls! ^Stack (:object entity#) ~@options)
+     entity#))
+
+(defmacro stack!
+  [entity k & options]
+  `(u/call! ^Stack (:object ~entity) ~k ~@options))
+
 (defn table*
   [children]
   (create-group (Table.) children))


Query string: proper camelization on keyword values

--- src/pundit/http.clj
+++ src/pundit/http.clj
@@ -39,17 +39,13 @@
 (defmulti ^:private to-query type)

 (defmethod to-query Sequential [value]
-  (s/join \,
-          (map
-            #(order-camelize
-               (if (keyword? %) (name %) %))
-            value)))
+  (s/join \, (map to-query value)))

 (defmethod to-query Associative [value]
   (to-json value))

 (defmethod to-query Keyword [value]
-  (name value))
+  (order-camelize (name value)))

 (defmethod to-query :default [value]
   value)


Docstring updated

Docstring updated

--- src/ralang/core.clj
+++ src/ralang/core.clj
@@ -21,23 +21,27 @@
     (number? x) x
     :else (look (x 1)))))

-(defn debugMessage [message]
+(defn debugMessage
   "Shows debugging messages."
+  [message]
   (println (string/join message)))

-(defn write [bytecode]
+(defn write
   "Write bytecode to the output file."
+  [bytecode]
   (spit outputFile bytecode :append true))

-(defn tokenReader [token]
+(defn tokenReader
   "Reads a token."
+  [token]
   (def t (parser token))
   (println (apply array-map t))
   (comment (insta/visualize t))
   (println (second t)))

-(defn removeEmptyLineOrComment [source]
+(defn removeEmptyLineOrComment
   "Find and remove empty lines and comments from the source code."
+  [source]
   (def reComment #"\s*#.*")
   (def sourceWithoutComment (clojure.string/replace source reComment ""))
   (def reEmptyLine #"^\s*$")
@@ -46,16 +50,18 @@
     (= (re-find matchEmptyLine) true) source
     :else sourceWithoutComment))

-(defn readSource [file]
+(defn readSource
   "Read source file and remove empty lines."
+  [file]
   (with-open [rdr (reader file)]
     (def source
       (for [line (line-seq rdr)] (removeEmptyLineOrComment line)))
     (doseq [x (remove empty? source)]
       (tokenReader x))))

-(defn checkSource [file]
+(defn checkSource
   "Check if source file exists."
+  [file]
   (debugMessage ["Reading '" file "'"])
   (cond
     (.exists (as-file file)) (readSource file)
@@ -66,9 +72,4 @@
   [& args]
   (cond
     (= (count args) 1) (checkSource (nth args 0))
-    :else (println "Wrong number of arguments."))
-
-  (comment
-    (def f (parser "age = 20 + (3 - 5)"))
-    (insta/visualize f)
-    (walk/postwalk #(do (println %) %) f)))
+    :else (println "Wrong number of arguments.")))


Update project.clj

Update project.clj

--- src/jarkeeper/views/project.clj
+++ src/jarkeeper/views/project.clj
@@ -40,7 +40,6 @@
       [:th {:width "180"} ""]
       [:th {:width "90"} ""]]]
    (render-deps items)])
-

 (defn index [project]
   (html5 {:lang "en"}


Ordered vars, moved private functions to bottom.

--- src/pointer/core.clj
+++ src/pointer/core.clj
@@ -1,19 +1,21 @@
 (ns pointer.core
   "Functions to help in finding the lines you care about."
-  (:require [clojure.string :as str]
+  (:require [clojure.string :as string]
             [clojure.zip :as zip]))
+
+
+(declare basename
+         current-file-name
+         replace-loc-line
+         skip-to-rightmost-leaf)
+
+
+(def ^:private fallback-line-number (atom (Integer. 0)))

 ;; COMPILE-TIME POSITIONS.
 ;; For annotating forms with information retrieved at runtime.
 ;; For reporting syntax errors
-
-(def ^:private fallback-line-number (atom (Integer. 0)))
-
-
-(defn set-fallback-line-number-from [form]
-  (reset! fallback-line-number (or (:line (meta form)) (Integer. 0))))
-

 (defn arrow-line-number
   "Return the best guess for what line an arrow symbol is on."
@@ -43,8 +45,8 @@
   (-> form zip/seq-zip zip/down zip/right arrow-line-number))

-(defn- basename [string]
-  (last (str/split string #"/")))
+(defn compile-time-fallback-position []
+  (list (current-file-name) @fallback-line-number))

 (defn current-file-name []
@@ -61,36 +63,12 @@
   (list (current-file-name)  (:line (meta form))))

-(defn compile-time-fallback-position []
-  (list (current-file-name) @fallback-line-number))
+(defn set-fallback-line-number-from [form]
+  (reset! fallback-line-number (or (:line (meta form)) (Integer. 0))))

 ;; RUNTIME POSITIONS
 ;; These are positions that determine the file or line at runtime.
-
-(defmacro line-number-known
-  "Guess the filename of a file position, but use the given line number."
-  [number]
-  `[(current-file-name) ~number])
-
-
-(defn- skip-to-rightmost-leaf
-  "When positioned at leftmost position of branch, move to the end form.
-   In a tree, that's the rightmost leaf."
-  [loc]
-  (let [end-form (zip/rightmost loc)]
-    (if (zip/branch? end-form)
-      (recur (zip/down end-form))
-      end-form)))
-
-
-(defn- replace-loc-line [loc loc-with-line]
-  (let [m (fn [loc] (meta (zip/node loc)))
-        transferred-meta (if (contains? (m loc-with-line) :line )
-                           (assoc (m loc) :line (:line (m loc-with-line)))
-                           (dissoc (m loc) :line ))]
-    (zip/replace loc (with-meta (zip/node loc) transferred-meta))))
-

 (defn form-with-copied-line-numbers [line-number-source form]
   (loop [loc (zip/seq-zip form)
@@ -113,6 +91,12 @@
                  (zip/next line-loc)))))

+(defmacro line-number-known
+  "Guess the filename of a file position, but use the given line number."
+  [number]
+  `[(current-file-name) ~number])
+
+
 (defn positioned-form
   "Make sure the form is annotated with a line number, either
    its original or the given one. Takes either a number or form
@@ -131,3 +115,26 @@
         :else
         (vary-meta form assoc :line (:line (meta number-source)))))

+
+;; PRIVATE MEMBERS
+
+(defn- basename [string]
+  (last (string/split string #"/")))
+
+
+(defn- replace-loc-line [loc loc-with-line]
+  (let [m (fn [loc] (meta (zip/node loc)))
+        transferred-meta (if (contains? (m loc-with-line) :line )
+                           (assoc (m loc) :line (:line (m loc-with-line)))
+                           (dissoc (m loc) :line ))]
+    (zip/replace loc (with-meta (zip/node loc) transferred-meta))))
+
+
+(defn- skip-to-rightmost-leaf
+  "When positioned at leftmost position of branch, move to the end form.
+   In a tree, that's the rightmost leaf."
+  [loc]
+  (let [end-form (zip/rightmost loc)]
+    (if (zip/branch? end-form)
+      (recur (zip/down end-form))
+      end-form)))


Need to realize lazy result-set before returning

--- src/poky/kv/jdbc.clj
+++ src/poky/kv/jdbc.clj
@@ -20,7 +20,7 @@
                             (string/join "," (repeat (count ks) "?")))
                     b]
                    ks))
-      results)))
+      (doall results))))

 (defn jdbc-set
   [conn b k v]


Allow the home page to be served up by http-kit in development.

--- src/posthere/app.clj
+++ src/posthere/app.clj
@@ -14,7 +14,7 @@
 (defroutes approutes

   ; GET requests
-  (GET "/" [] (str "Egads! How did you get here?")) ; Should be handled by nginx
+  (GET "/" [] (slurp "./resources/public/index.html")) ; This is for development, should be handled by nginx
   (GET "/:uuid" [uuid] (results-view uuid)) ; Show them the results of their requests

   ; POST requests


(PDB-5022) with-coordinated-fn: return result from redefined function


don't deref nil debug-state

don't deref nil debug-state

--- src-cljs/frontend/utils/vcs.cljs
+++ src-cljs/frontend/utils/vcs.cljs
@@ -5,4 +5,5 @@

 (defn bitbucket-enabled? []
   (or (feature/enabled? :bitbucket)
-      (user/bitbucket-authorized? (get-in @state/debug-state state/user-path))))
+      (when state/debug-state
+        (user/bitbucket-authorized? (get-in @state/debug-state state/user-path)))))


bugfix spot-light :to position (was ignored)

--- src/thi/ng/luxor/core.clj
+++ src/thi/ng/luxor/core.clj
@@ -534,15 +534,16 @@

 (defn spot-light
   [scene id {:keys [from to cone-angle cone-delta tx]
-             :or {cone-angle 30 cone-delta 5} :as opts}]
+             :or {cone-angle 30 cone-delta 5 from [0 0 1] to [0 0 0]}
+             :as opts}]
   (append
    scene :lights (name id)
    (merge
     (when tx (transform-common scene tx))
     (light-common scene opts)
     {:__type :spot-light
-     :from [:point-vec [(or from [0 0 1])]]
-     :to [:point-vec [(or from [0 0 0])]]
+     :from [:point-vec [from]]
+     :to [:point-vec [to]]
      :coneangle [:float (->degrees cone-angle)]
      :conedeltaangle [:float (->degrees cone-delta)]})))


[lein] Add lein-yagni

[lein] Add lein-yagni

--- .lein/profiles.clj
+++ .lein/profiles.clj
@@ -4,5 +4,6 @@
                   [lein-pprint                       "1.1.2"]
                   [lein-figwheel                     "0.5.9"]
                   [cider/cider-nrepl                 "0.14.0"]
-                  [venantius/ultra                   "0.5.1"]]
+                  [venantius/ultra                   "0.5.1"]
+                  [venantius/yagni                   "0.1.4"]]
         :signing {:gpg-key "E5B26621"}}}


add longest match

add longest match

--- src/sandbox/lz77.clj
+++ src/sandbox/lz77.clj
@@ -13,5 +13,15 @@
              (into %1 (expand %1 %2)))
           [] xs))

+(defn all-subvecs-from-beginning [xs]
+  (map #(take % xs) (range 1 (inc (count xs)))))
+
 (defn all-subvecs [xs]
-  (mapcat #(partition % 1 xs) (range 1 (count xs))))
+  (for [i (range (inc (count xs))) k (range i)]
+    [(drop k (take i xs)) k]))
+
+(defn longest-match-w-beginning [left-array right-array]
+  (let [all-left-chunks (all-subvecs left-array)
+        all-right-chunks-from-beginning (all-subvecs-from-beginning right-array)]
+    (filter #(some #{(first %)} all-right-chunks-from-beginning) all-left-chunks)))
+


room now initializes on first sign-in

room now initializes on first sign-in

--- src/server/core.cljs
+++ src/server/core.cljs
@@ -36,6 +36,10 @@

   (.on socket "sign-in"
     (fn [room-id username]
+      (rooms/does-room-exist? room-id
+        (fn [reply]
+          (if-not reply
+            (rooms/init-room room-id #(println (str room-id " has been created!"))))))
       (rooms/set-username room-id (.-id socket) username
         (fn []
           (.emit socket "sign-in-success")


doc grammar change

doc grammar change

--- lein-protobuf/src/leiningen/protobuf.clj
+++ lein-protobuf/src/leiningen/protobuf.clj
@@ -49,7 +49,7 @@
       (second (re-matches #".*\"(.*)\".*" line)))))

 (defn extract-dependencies
-  "Extract all files proto is dependent on into dest."
+  "Extract all files proto depends on into dest."
   [proto-path proto dest]
   (loop [deps (proto-dependencies (io/file proto-path proto))]
     (when-let [[dep & deps] (seq deps)]


Update test on github registration (#1550)

--- cimi/test/com/sixsq/slipstream/ssclj/resources/user_github_registration_lifecycle_test.clj
+++ cimi/test/com/sixsq/slipstream/ssclj/resources/user_github_registration_lifecycle_test.clj
@@ -242,7 +242,15 @@
                       (ltu/body->edn)
                       (ltu/is-status 201))

-                  (is (not(nil? (db/find-username-by-authn :githublogin github-login))))
+
+
+                  (let [ss-username (db/find-username-by-authn :githublogin github-login)]
+                    (is (not (nil? ss-username)))
+
+                    (is (= email (->> github-login
+                                     (db/find-username-by-authn :githublogin)
+                                     (db/get-user)
+                                     :emailAddress))))

                   ;; try creating the same user again, should fail
                   (reset-callback! callback)


Simplify cache code a bit.

Simplify cache code a bit.

--- src/soy_clj/core.clj
+++ src/soy_clj/core.clj
@@ -66,14 +66,15 @@
   [file-or-files]
   (let [files (flatten (vector file-or-files))
         k     [:js files]]
-    (if (cache/has? @cache k)
-      (cache/lookup (swap! cache cache/hit k) k)
+    (if-let [v (cache/lookup @cache k)]
       (do
-        (let [js (->> (.compileToJsSrc (build files) js-opts nil)
-                      (cons prelude)
-                      (string/join "\n"))]
-          (swap! cache cache/miss k js)
-          js)))))
+        (swap! cache cache/hit k)
+        v)
+      (let [js (->> (.compileToJsSrc (build files) js-opts nil)
+                    (cons prelude)
+                    (string/join "\n"))]
+        (swap! cache cache/miss k js)
+        js))))

 (defn parse
   "Given the filename (or a sequence of filenames) of a Closure template on the
@@ -81,12 +82,13 @@
   [file-or-files]
   (let [files (vec (flatten (vector file-or-files)))
         k     [:tofu files]]
-    (if (cache/has? @cache k)
-      (cache/lookup (swap! cache cache/hit k) k)
+    (if-let [v (cache/lookup @cache k)]
       (do
-        (let [tofu (.. (build files) (compileToTofu))]
-          (swap! cache cache/miss k tofu)
-          tofu)))))
+        (swap! cache cache/hit k)
+        v)
+      (let [tofu (.. (build files) (compileToTofu))]
+        (swap! cache cache/miss k tofu)
+        tofu))))

 (defn- camel-case
   "Converts a symbol like `:blah-blah` into a string like `blahBlah`."


insights: update side-bar icon

insights: update side-bar icon

--- src-cljs/frontend/components/aside.cljs
+++ src-cljs/frontend/components/aside.cljs
@@ -404,7 +404,7 @@
                           :data-trigger "hover"
                           :title "Insights"
                           :href "/build-insights"}
-           [:i.fa.fa-bar-chart-o]])
+           [:i.fa.fa-bar-chart]])

         (when (:admin user)
           [:a.aside-item {:data-placement "right"


Remove LD flag from team page aside link

--- src-cljs/frontend/components/aside.cljs
+++ src-cljs/frontend/components/aside.cljs
@@ -496,20 +496,12 @@
               [:i.material-icons "library_add"]
               [:div.nav-label "Add Projects"]])

-           (if (feature/enabled? :team-page)
-             [:a.aside-item {:href "/team",
-                             :data-placement "right"
-                             :data-trigger "hover"
-                             :title "Team"}
-              [:i.material-icons "group"]
-              [:div.nav-label "Team"]]
-
-             [:a.aside-item {:href "/invite-teammates",
-                             :data-placement "right"
-                             :data-trigger "hover"
-                             :title "Add Teammates"}
-              [:i.material-icons "group_add"]
-              [:div.nav-label "Team"]])
+           [:a.aside-item {:href "/team",
+                           :data-placement "right"
+                           :data-trigger "hover"
+                           :title "Team"}
+            [:i.material-icons "group"]
+            [:div.nav-label "Team"]]

            (when-not (ld/feature-on? "top-bar-ui-v-1")
              [:a.aside-item {:data-placement "right"