Replace some colors using palette and colors vars

--- src/elfeed_cljsrn/android/core.cljs
+++ src/elfeed_cljsrn/android/core.cljs
@@ -68,7 +68,7 @@
                           :justify-content "flex-end"
                           :align-items "center"
                           :padding-right 14}
-                :icon {:color "#00796b"}}]
+                :icon {:color (:dark-primary palette)}}]
     [rn/view {:style (:wrapper styles)}
      [rn/touchable {:on-press #(dispatch [:mark-entry-as-read entry])}
       [rn/view {}
@@ -84,7 +84,7 @@
                          :padding-top 10
                          :padding-left 10
                          :padding-bottom 10
-                         :border-bottom-color "#CCCCCC"
+                         :border-bottom-color (:divider palette)
                          :border-bottom-width 1}
                 :loading-content {:flex 1
                                   :padding-left 10
@@ -215,7 +215,7 @@

 (defn drawer-component []
   (let [styles {:section {}
-                :header {:background-color "#004d40"
+                :header {:background-color (:primary palette)
                          :height 120
                          :margin-bottom 8 }
                 :item {:flex 1
@@ -225,10 +225,10 @@
                        :padding-left 16}
                 :icon {:padding 1}
                 :value {:font-size 14
-                        :color "#000000"
+                        :color (:primary-text palette)
                         :margin-left 28}}]
     [rn/view {:style {:flex 1
-                      :background-color "#FFFFFF"}}
+                      :background-color (:white colors)}}
      [rn/view {:style (:header styles)}]
      [rn/view {:style {:margin-top 8}}
       [rn/touchable {:on-press (fn []
@@ -255,7 +255,7 @@
   (let [ref-icon (r/atom nil)
         styles {:button {:padding-vertical 16
                          :padding-horizontal 8}
-                :icon {:color "#e0f2f1"}}
+                :icon {:color (:text colors)}}
         actions [{:label "Open in browser"
                   :action (fn [] (dispatch [:open-entry-in-browser]))}]]
     (fn []
@@ -281,7 +281,7 @@

 (defn nav-title [scene-props]
   (let [title (aget scene-props "scene" "route" "title")]
-    [rn/navigation-header-title {:text-style {:color "#e0f2f1"}} title]))
+    [rn/navigation-header-title {:text-style {:color (:text palette)}} title]))

 (defn nav-left-button [scene-props]
   (let [index (aget scene-props "scene" "index")
@@ -289,7 +289,7 @@
                                    :flex-direction "row"
                                    :align-items "center"
                                    :justify-content "center"}
-                :button {:color "#e0f2f1"
+                :button {:color (:text palette)
                          :height 24
                          :width 24
                          :margin 16}}


New function in jenkins-api: read-file-from-artifact

--- src/emender_jenkins/jenkins_api.clj
+++ src/emender_jenkins/jenkins_api.clj
@@ -76,6 +76,16 @@
     [jenkins-url job-name]
     (let [url (str (job-name->url jenkins-url job-name) "/lastSuccessfulBuild/artifact/results.json/")]
         (println "Using the following URL to retrieve job results: " url)
+        (try
+            (slurp url)
+            (catch Exception e
+                 (.printStackTrace e)
+                 nil))))
+
+(defn read-file-from-artifact
+    [jenkins-url job-name file-name]
+    (let [url (str (job-name->url jenkins-url job-name) "/lastSuccessfulBuild/artifact/" file-name)]
+        (println "Using the following URL to retrieve file from artifact: " url)
         (try
             (slurp url)
             (catch Exception e


upgrade lein-ancient, lein-kibit, and eastwood

--- dot/lein/profiles.clj
+++ dot/lein/profiles.clj
@@ -1,8 +1,8 @@
 {:user
  {:plugins [[lein-vanity "0.2.0" :exclusions [org.clojure/clojure]]
-            [lein-ancient "0.6.5"]
-            [lein-kibit "0.1.3"]
-            [jonase/eastwood "0.2.0"]
+            [lein-ancient "0.6.10"]
+            [lein-kibit "0.1.5"]
+            [jonase/eastwood "0.2.4"]
             ;;[com.billpiel/sayid "0.0.10"]
             ]
   :dependencies [[slamhound "1.5.5"]]


Refactor core.clj to use backquote in macros

--- Src/ClojSharp.Core/Src/core.clj
+++ Src/ClojSharp.Core/Src/core.clj
@@ -1,7 +1,7 @@
 (def defmacro (mfn [name & fdecl]
-	(list 'def name (cons 'mfn fdecl))
+	`(def ~name (mfn ~@fdecl))
 ))

 (defmacro defn [name & fdecl]
-	(list 'def name (cons 'fn fdecl))
+	`(def ~name (fn ~@fdecl))
 )


Move some nested call to functions & documentation

--- reports/src/reports/scheduler.clj
+++ reports/src/reports/scheduler.clj
@@ -42,30 +42,38 @@
   "Generates a unique identifier based on the map"
   (format "id%s" (hash (str m))))

+(defn- get-job [jtype id params]
+  "Returns a Job specification for the given parameters"
+  (j/build
+      (j/of-type jtype)
+      (j/using-job-data (conj params {"reportId" id} ))
+      (j/with-identity (j/key id))))
+
+(defn- get-trigger [id]
+  "Returns a Trigger to be executed now"
+  (t/build
+    (t/with-identity (t/key id))
+    (t/start-now)))
+
 (defn- schedule-job [params]
   "Schedule a report for generation. For concurrent requests only schedules the report
    once."
   (let [id (report-id params)
-        jkey (j/key id)
-        job (j/build
-              (j/of-type ExportJob)
-              (j/using-job-data (conj params {"reportId" id} ))
-              (j/with-identity jkey))
-        trigger (t/build
-                  (t/with-identity (t/key id))
-                  (t/start-now))]
+        job (get-job ExportJob id params)
+        trigger (get-trigger id)]
     (qs/maybe-schedule job trigger)
     {"status" "OK"
      "message" "PROCESSING"}))

-(defn- get-report-by-id [rid]
-  (let [found (filter #(= rid (:id %)) (keys @cache))]
+(defn- get-report-by-id [id]
+  "Returns a report from the cache or nil if not found"
+  (let [found (filter #(= id (:id %)) (keys @cache))]
     (if (empty? found)
       nil
       (@cache (nth found 0)))))

 (defn generate-report [params]
-  "Returns the cached report for the given parameters, or schedules the report for execution"
+  "Returns the cached report for the given parameters, or schedules the report for generation"
   (if-let [f (get-report-by-id (report-id params))]
    {"status" "OK"
     "file" f}
@@ -73,10 +81,10 @@

 (defn invalidate-cache [params]
-  "Invalidates (remove) a given file from the cache"
+  "Invalidates (removes) a given file from the cache"
   (let [baseURL (params "baseURL")]
     (doseq [sid (params "surveyIds")]
     (dosync
       (doseq [k (keys @cache) :when (and (= (k :baseURL) baseURL) (= (str sid) (k :surveyId)))]
       (alter cache dissoc k))))
-    {"status" "OK"}))
+    "OK"))


Correcting the output of the go loop in S3

--- src/kixi/datastore/filestore/s3.clj
+++ src/kixi/datastore/filestore/s3.clj
@@ -26,9 +26,9 @@
          (s3/put-object creds
                         bucket id in-stream
                         {:content-length content-length})
+         :done
          (catch Throwable t
-           (error t "S3 put exception")
-           (throw t))))
+           t)))
      out-stream]))

 (defrecord S3


Subscription will be moving to the db component.

--- src/dragon/components/event.clj
+++ src/dragon/components/event.clj
@@ -16,8 +16,6 @@
     (let [dataflow (event/create-dataflow-pubsub)
           component (assoc-in component component-api/dataflow-keys dataflow)]
       (log/info "Adding subscribers ...")
-      (subscription/subscribe-all component)
-      (event/publish component tag/subscribers-added)
       component))

   (stop [component]


Some type hinting, cleanup, use when instead of if, printers only takes strings now (names should not be any old seq)

--- src/main/clojure/clj_print/core.clj
+++ src/main/clojure/clj_print/core.clj
@@ -33,7 +33,6 @@
            (javax.print.event PrintJobListener)))

 ;; TODO: Write 'test' function that prints a test page when invoked on printer.
-;; TODO: What is gen-class good for?

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Util ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

@@ -75,7 +74,7 @@
   "Returns a keyword representative of the document source's
    type."
   {:since "0.0.1"}
-  [source]
+  [^String source]
   (cond (try (.. (File. source) exists) (catch Throwable t)) :file
         (try (URL. source) (catch Throwable t)) :url
         :else nil))
@@ -99,19 +98,19 @@
      :request,
      :service"
   {:since "0.0.1"}
-  [attrs k]
+  [attrs t]
   (if (seq attrs)
     (let [mappings {:doc DocAttribute
                     :job PrintJobAttribute
                     :request PrintRequestAttribute
-                    :service PrintServiceAttribute}]
-      (every? (fn [attr] (instance? (k mappings) attr)) attrs))))
-
+                    :service PrintServiceAttribute}
+          is-attr (fn [attr] (instance? (t mappings) attr))]
+      (every? is-attr attrs))))

 (defn- make-doc
   "Returns a javax.print.Doc object for the print data in this
    job map. SimpleDoc will throw an IllegalArgumentException if
-   the doc-flavor is not representative of the data pointed to
+   the DocFlavor is not representative of the data pointed to
    by doc-source."
   {:since "0.0.1"}
   [doc-spec]
@@ -123,8 +122,8 @@
                          :file (FileInputStream. source)
                          :url (URL. source)
                          nil)]
-    (if (valid-attrs? attrs :doc)
-      (SimpleDoc. resource flavor (-> attrs (make-set :doc))))))
+    (when (valid-attrs? attrs :doc)
+      (SimpleDoc. resource flavor (make-set attrs :doc)))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Printers ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

@@ -141,11 +140,11 @@
   "Returns the printer with the specified name from PrintServiceLookup.
    With no arguments, returns the system default printer."
   {:since "0.0.1"}
-  ([] (printer :default)) ;; TODO: If called with nil or "", should printer return (printer :default) or nil?
+  ([] (printer :default))
   ([name]
      (cond
       (= :default name) (PrintServiceLookup/lookupDefaultPrintService)
-      (seq name) (let [pname-obj (PrinterName. name nil)
+      (string? name) (let [pname-obj (PrinterName. name nil)
                        attrs  (make-set #{pname-obj} :attr)]
                    (some (fn [^PrintService p]
                            (when (= name (.. p getName)) p))
@@ -192,11 +191,14 @@
     (let [{{doc-obj :obj} :doc} this
           {:keys [^DocPrintJob job attrs]} this
           attr-set (make-set attrs :request)]
-      (.. job (print @doc-obj attr-set))))
+      (.. job (print @doc-obj attr-set)))) ;; Still
   (add-listener! [this listener-fn]
     (let [{:keys [^DocPrintJob job listener-fn]} this
           listener (listener-fn)]
       (doto job (.addPrintJobListener listener)))))
+
+;; TODO: Nobody wants to hand type this, create a convencience fn
+;; that takes arguments in order and retuns a JobSpec

 ;;  A JobSpec might look something like this:
 ;; {:doc {:source "/path/to/doc.pdf"
@@ -236,23 +238,29 @@
    3. A basic PrintJobListener that prints any events that occur
    on the DocPrintJob."
   {:since "0.0.1"}
-  (fn [spec] (apply (some-fn #{:doc} #{:docs}) (keys spec))))
+  (fn [spec] (some spec [:doc :docs])))

 (defmethod make-job :doc [spec]
   (let [{:keys [^PrintService printer ^PrintJobListener listener doc attrs]} spec
         {doc-attrs :attrs} doc]
-    (if (and (valid-attrs? doc-attrs :doc)
+    (when (and (valid-attrs? doc-attrs :doc)
              (valid-attrs? attrs :job))
       (letfn [(add-doc [spec]
                 (assoc-in spec [:doc :obj] (delay (make-doc doc))))
               (add-job [spec]
                 (assoc-in spec [:job] (.. printer createPrintJob)))]
-        (-> spec add-doc add-job map->JobSpec)))))
+        (-> spec
+            (add-doc)
+            (add-job)
+            (map->JobSpec))))))

 (defmethod make-job :docs [spec]
   (let [{docs :docs} spec]
     (for [doc docs]
-      (-> spec (dissoc :docs) (assoc :doc doc) make-job))))
+      (-> spec
+          (dissoc :docs)
+          (assoc :doc doc)
+          (make-job)))))

 ;; Old method of encapsulating a 'MultiJobSpec', most
 ;; values in a JobSpec will be singleton instances
@@ -272,7 +280,7 @@
 ;;       (letfn [(add-doc [doc-map]
 ;;                 (assoc-in doc-map [:obj] (delay (make-doc doc-map))))
 ;;               (add-docs [spec]
-;;                 (update-in spec [:docs] (fn [doc-list] (map add-doc  doc-list))))
+;;                 (update-in spec [:docs] (fn [doc-list] (map add-doc doc-list))))
 ;;               (add-jobs [spec]
 ;;                 (assoc-in spec [:jobs] (for [doc docs] (.. printer createPrintJob))))]
 ;;         (-> spec add-docs add-jobs map->MultiJobSpec)))))


New function to check if results for given job exists

--- src/emender_jenkins/results.clj
+++ src/emender_jenkins/results.clj
@@ -124,3 +124,8 @@
     [job-name]
     (some #(if (= job-name (:job-name %)) %) @results))

+(defn job-exists?
+    [job-name]
+    (if job-name
+        (some #(= job-name (:job-name %)) @results)))
+


Improves error handling on startup

Improves error handling on startup

--- scheduler/src/cook/components.clj
+++ scheduler/src/cook/components.clj
@@ -18,6 +18,7 @@
             [clojure.core.cache :as cache]
             [clojure.edn :as edn]
             [clojure.pprint :refer (pprint)]
+            [clojure.stacktrace :as stacktrace]
             [clojure.string :as str]
             [clojure.tools.logging :as log]
             [compojure.core :refer (GET POST routes context)]
@@ -592,7 +593,8 @@
               overrides))
      (catch Throwable t
        (.println System/err "Failed to initialize logging!")
-       (.printCauseTrace t)
+       (stacktrace/print-cause-trace t)
+       (println "Exiting.")
        (System/exit 1)))))

 (def pre-configuration
@@ -628,7 +630,9 @@
     (let [config-format (try
                           (com.google.common.io.Files/getFileExtension config)
                           (catch Throwable t
-                            (.println System/err (str "Failed to start Cook" t))
+                            (.println System/err "Failed to start Cook")
+                            (stacktrace/print-cause-trace t)
+                            (println "Exiting.")
                             (System/exit 1)))
           literal-config (try
                            {:config
@@ -638,7 +642,9 @@
                                 (.println System/err (str "Invalid config file format " config-format))
                                 (System/exit 1)))}
                            (catch Throwable t
-                             (.println System/err (str "Failed to start Cook" t))
+                             (.println System/err "Failed to start Cook")
+                             (stacktrace/print-cause-trace t)
+                             (println "Exiting.")
                              (System/exit 1)))]
       (pre-configuration literal-config)
       (.println System/err "Configured logging")


Wrap comments in a list for styling.

Wrap comments in a list for styling.

--- src-cljs/githubcomments/core.cljs
+++ src-cljs/githubcomments/core.cljs
@@ -7,7 +7,13 @@
                                            render-user-content-markdown]]))

 (defn display-comments [comments element]
-  (go (set! (.-innerHTML element) (<! (async/reduce str "" comments)))))
+  (go (set! (.-innerHTML element)
+            (str "
"
+                 (<! (async/reduce
+                       #(str %1 "
" %2 "
")
+                       ""
+                       comments))
+                 "
"))))

 (defn rendered-comment [repo comment]
   "Render the given comment in the context of the given repository."
@@ -24,6 +30,6 @@
                   (dataset/get element "repositoryName")]
             response (async/<! (repo-comments repo))
             comments (rendered-comments repo (:body response))]
-        (display-comments comments element))))
+        (display-comments (async/take 10 comments) element))))

 (init)


Fixed reduce-kv and reduced weirdness.

Fixed reduce-kv and reduced weirdness.

I'm not sure if it is the map sorting or if it is the keyword equality,
or just something in reduce-kv, but this version works and clears down
the lower parts of the URL hierarchy for the page.

--- src-cljs/kixi/hecuba/history.cljs
+++ src-cljs/kixi/hecuba/history.cljs
@@ -106,12 +106,8 @@

 (defn update-token-ids! [history k v]
   (let [{:keys [ids] :as tmap} (token-as-map history)
-        new-ids (reduce-kv (fn [m k' v']
-                               (if (= k k')
-                                 (reduced (assoc m k v))
-                                 (assoc m k' v')))
-                             (new-historian-map k v)
-                             ids)]
+        keep-keys              (take-while #(not (keyword-identical? % k)) key-order)
+        new-ids                (assoc (select-keys ids keep-keys) k v)]
     (set-token! history (assoc tmap :ids new-ids) historian->token)))

 (defn set-token-search! [history xs]


Doc core/connected.

Doc core/connected.

--- clj_record/core.clj
+++ clj_record/core.clj
@@ -26,7 +26,8 @@

 (defmacro connected
   "Ensures that the body is run with a single DB connection.
-  Doesn't create a new connection if there already is one."
+  Doesn't create a new connection if there already is one.
+  You're probably more interested in the 'transaction' macro."
   [& body]
   `(let [func# (fn [] ~@body)]
     (if (sql.internal/*db* :connection) ; XXX: Bad evil sql.internal dependency.


Pretty-print records

Pretty-print records

--- planck-cljs/src/planck/pprint/data.cljs
+++ planck-cljs/src/planck/pprint/data.cljs
@@ -137,7 +137,9 @@
     [:text (pr-str x)])

   (visit-record [this x]
-    [:text (pr-str x)]))
+    (pretty-coll this (str "#" (string/replace (pr-str (type x)) #"/" ".") "{") x [:span "," :line] "}"
+      (fn [printer [k v]]
+        [:span (visit printer k) " " (visit printer v)]))))

 (defn pprint
   ([x] (pprint x {}))


visual separation for the 'Show Stack Trace' link

--- src/cljs/org/broadinstitute/firecloud_ui/common/components.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/common/components.cljs
@@ -214,7 +214,7 @@
                       (str "at " class "." method " (" file ":" num ")")]))
             (:lines props))
           (style/create-link #(swap! state assoc :expanded? false) "Hide Stack Trace")]
-         (style/create-link #(swap! state assoc :expanded? true) "Show Stack Trace")))})
+         [:div {} (style/create-link #(swap! state assoc :expanded? true) "Show Stack Trace")]))})

 (react/defc CauseViewer
   {:render


Added dummy data and restricted fields.

Added dummy data and restricted fields.

--- src/portal_clj/models/migration.clj
+++ src/portal_clj/models/migration.clj
@@ -27,6 +27,7 @@
                    created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
                    slug VARCHAR(256) NOT NULL,
                    active BOOLEAN NOT NULL DEFAULT 1,
+                   restricted BOOLEAN NOT NULL DEFAULT 0,
                    FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
                  )"]))

@@ -41,6 +42,7 @@
                    created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
                    slug VARCHAR(256) NOT NULL,
                    active BOOLEAN NOT NULL DEFAULT 1,
+                   restricted BOOLEAN NOT NULL DEFAULT 0,
                    FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
                  )"]))

@@ -70,7 +72,8 @@
   (sql/execute! db/spec
                 ["CREATE TABLE IF NOT EXISTS tags (
                    id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
-                   name VARCHAR(256)
+                   name VARCHAR(256),
+                   restricted BOOLEAN NOT NULL DEFAULT 0
                  )"]))

 (defn post-tag-migration []
@@ -95,6 +98,46 @@
     (post-tag-migration)
     (println "Successfully created DB entries.")))

+(defn do-dummy []
+  (do
+    (println "Running dummy inserts.")
+    (sql/insert! db/spec :users {:firstname "Idi"
+                                 :lastname "Admin"
+                                 :username "dummy_admin"
+                                 :email "idi@admin.com"
+                                 :admin 1
+                                 :comments 1
+                                 :active 1})
+    (sql/insert! db/spec :users {:firstname "Some"
+                                 :lastname "Guy"
+                                 :username "dummy_user"
+                                 :email "some@guy.com"
+                                 :admin 0
+                                 :comments 1
+                                 :active 1})
+    (sql/insert! db/spec :pages {:title "Dummy Page"
+                                 :body "This here is some dummy text."
+                                 :user_id 1
+                                 :slug "dummy-page"
+                                 :active 1
+                                 :restricted 0})
+    (sql/insert! db/spec :posts {:title "Dummy Post"
+                                 :body "I'm a dummy update for testing purposes."
+                                 :user_id 2
+                                 :commentable 1
+                                 :slug "dummy-post"
+                                 :active 1
+                                 :restricted 0})
+    (sql/insert! db/spec :comment_authors {:name "Idi Admin" :user_id 1})
+    (sql/insert! db/spec :comments {:title "Heyoo"
+                                    :body "I'm a dummy comment, dummy!"
+                                    :author_id 1
+                                    :post_id 1})
+    (sql/insert! db/spec :tags {:name "dummy" :restricted 0})
+    (sql/insert! db/spec :post_tags {:post_id 1 :tag_id 1})
+    (println "Successfully added dummy content.")))
+
+
 (defn down [table-name]
   (sql/execute! db/spec
                 [(str "DROP TABLE IF EXISTS " table-name)]))
@@ -116,7 +159,11 @@
                                 "where table_name='" table-name "'")]))))

 (defn -main [& args]
-  (if (= (first args) "up")
+  (when (= (first args) "up")
     (do-migrate))
-  (if (= (first args) "down")
-    (nuke-all)))
+  (when (= (first args) "down")
+    (nuke-all))
+  (when (= (first args) "dummy")
+    (do-dummy))
+  (when (= (first args) "clean")
+    (dummy-down)))


Increment lein deps version.

Increment lein deps version.

--- .lein/profiles.clj
+++ .lein/profiles.clj
@@ -8,7 +8,7 @@
                   [lein-pprint "1.1.1"]
                   [slamhound "1.2.0"]
                   [lein-cljsbuild "0.1.9"]
-                  [lein-deps-tree "0.1.1"]
+                  [lein-deps-tree "0.1.2"]
                   ;[lein-autodoc "0.9.0"]
                   [lein-marginalia "0.7.1"]]
         :repl-options {:timeout 120000}


Revert faulty debug change

Revert faulty debug change

--- src-droid/clojure/com/sparrho/supperdemo/main.clj
+++ src-droid/clojure/com/sparrho/supperdemo/main.clj
@@ -1,6 +1,5 @@
 (ns com.sparrho.supperdemo.main
   (:require [neko.activity :refer [defactivity set-content-view!]]
-            [neko.debug :refer [*a]]
             [neko.find-view :refer [find-view]]
             [neko.threading :refer [on-ui]])
   (:import [android.webkit WebViewClient]))
@@ -19,15 +18,15 @@
   :key :main
   :on-create
   (fn [this bundle]
+    (neko.debug/keep-screen-on this)
     (on-ui
-     (set-content-view! (*a)
+     (set-content-view! this
                         [:relative-layout {:layout-width :fill-parent
                                            :layout-height :fill-parent}
                          [:web-view {:id ::webview
                                      :layout-width :fill-parent
-                                     :layout-height :fill-parent}]]))
-    (on-ui
-     (let [web-view (find-view (*a) ::main-web-view)]
+                                     :layout-height :fill-parent}]])
+     (let [web-view (find-view this ::webview)]
        (doto (.getSettings web-view)
          (.setJavaScriptEnabled true))
        (doto web-view


midje qc tests

midje qc tests

--- test/euler/euler001_quickcheck.clj
+++ test/euler/euler001_quickcheck.clj
@@ -2,58 +2,53 @@
   (:require [clojure.test.check :as tc]
             [clojure.test.check.generators :as gen]
             [clojure.test.check.properties :as prop]
-            [clojure.test.check.clojure-test :as ct :refer (defspec)]
             [euler.core-test :refer :all]
             [euler.euler001 :refer :all]))

 (fact-qc "always returns an even result"
         [n gen/nat]
-          (p002 n) => even?)
+        (p002 n) => even?)

-(defspec p002-lazy-quickcheck
-         100
-         (prop/for-all [n gen/nat]
-                       (= (p002 n) (p002-lazy n))))         ; both algorithms return the same results
+(fact-qc "both algorithms return the same results"
+         [n gen/nat]
+         (p002-lazy n) => (p002 n))

-(defspec p003-lazy-quickcheck
-         100
-         (prop/for-all [n (gen/such-that #(> % 1) gen/nat)]
-                       (= (p003 n) (p003-lazy n))))         ; both algorithms return the same results
+(fact-qc "both algorithms return the same results"
+         [n (gen/such-that #(> % 1) gen/nat)]
+         (p003-lazy n) => (p003 n))

-(defspec p004-quickcheck
-         100
-         (prop/for-all [n (gen/such-that #(> % 1) gen/nat)]
-                       (let [res (str (p004 n))]
-                         (= res (apply str (reverse res)))))) ; each returned value is indeed a palindrome
+(fact-qc "each returned value is indeed a palindrome"
+         [n (gen/such-that #(> % 1) gen/nat)]
+         (let [res (str (p004 n))]
+          res => (apply str (reverse res))))

-(defspec p005-quickcheck
-         100
-         (prop/for-all [n (gen/elements (vec (range 23)))]
-                       (let [res (p005 n)
-                             nums (range 2 (+ 1 n))
-                             div-by? (fn [x] (= 0 (rem res x)))]
-                         (every? div-by? nums))))
+; (fact-qc "p005-quickcheck"
+;          [n (gen/elements (vec (range 2 23)))] ; input: numbers
+;           (let [res (p005 n)                  ; result: smallest common multiple
+;           nums (range 2 (+ 1 n))              ; all divisors
+;           not-div-by? (fn [x] (not (= 0 (rem res x))))]
+;           filter not-div-by? nums => '()))

-(defspec p009-quickcheck
-         100
-         (let [triplets                                     ;; all Pythagorean triplets up to 300
-               '((3 4 5) (5 12 13) (8 15 17) (7 24 25) (140 171 221)
-                  (20 21 29) (12 35 37) (9 40 41) (28 45 53)
-                  (11 60 61) (16 63 65) (33 56 65) (48 55 73) (115 276 299)
-                  (13 84 85) (36 77 85) (39 80 89) (39 252 255) (65 72 97)
-                  (20 99 101) (60 91 109) (15 112 113) (44 117 125)
-                  (55 132 143) (17 144 145) (24 143 145) (51 140 149)
-                  (85 132 157) (52 165 173) (19 180 181) (68 285 293)
-                  (57 176 185) (104 153 185) (95 168 193) (28 195 197)
-                  (84 187 205) (84 288 300) (133 156 205) (21 220 221)
-                  (23 264 265) (96 247 265) (69 260 269) (115 252 277)
-                  (60 221 229) (32 255 257) (102 136 170) (95 228 247)
-                  ; (88 105 137) -> duplicate of '(55 132 143)
-                  ; (105 208 233) -> duplicate of '(39 252 255)
-                  ; (119 120 169) -> duplicate of '(102 136 170)
-                  ; (120 209 241) -> duplicate of '(95 228 247)
-                  ; (160 231 281) -> duplicate of '(84 288 300)
-                  ; (161 240 289) -> duplicate of '(115 276 299)
-                  )]
-           (prop/for-all [[a b c] (gen/elements triplets)]
-                         (= (* a b c) (p009 (+ a b c))))))+;(defspec p009-quickcheck
+;         100
+;         (let [triplets                                     ;; all Pythagorean triplets up to 300
+;               '((3 4 5) (5 12 13) (8 15 17) (7 24 25) (140 171 221)
+;                  (20 21 29) (12 35 37) (9 40 41) (28 45 53)
+;                  (11 60 61) (16 63 65) (33 56 65) (48 55 73) (115 276 299)
+;                  (13 84 85) (36 77 85) (39 80 89) (39 252 255) (65 72 97)
+;                  (20 99 101) (60 91 109) (15 112 113) (44 117 125)
+;                  (55 132 143) (17 144 145) (24 143 145) (51 140 149)
+;                  (85 132 157) (52 165 173) (19 180 181) (68 285 293)
+;                  (57 176 185) (104 153 185) (95 168 193) (28 195 197)
+;                  (84 187 205) (84 288 300) (133 156 205) (21 220 221)
+;                  (23 264 265) (96 247 265) (69 260 269) (115 252 277)
+;                  (60 221 229) (32 255 257) (102 136 170) (95 228 247)
+;                  ; (88 105 137) -> duplicate of '(55 132 143)
+;                  ; (105 208 233) -> duplicate of '(39 252 255)
+;                  ; (119 120 169) -> duplicate of '(102 136 170)
+;                  ; (120 209 241) -> duplicate of '(95 228 247)
+;                  ; (160 231 281) -> duplicate of '(84 288 300)
+;                  ; (161 240 289) -> duplicate of '(115 276 299)
+;                  )]
+;           (prop/for-all [[a b c] (gen/elements triplets)]
+;                         (= (* a b c) (p009 (+ a b c))))))


Make everything use match-seq-spec

Make everything use match-seq-spec

--- test/icecap/handlers/core_test.clj
+++ test/icecap/handlers/core_test.clj
@@ -53,12 +53,12 @@
   (testing "execute single step"
     (let [plan (td/success-step 1)
           order (execution-order plan)]
-      (is (= order [1]))))
+      (is (match-seq-spec [[1]] order))))
   (testing "execute some plans consisting of ordered steps"
     (let [names (vec (range 10))
           plan (success-steps names)
           order (execution-order plan)]
-      (is (= order names))))
+      (is (match-seq-spec [names] order))))
   (testing "execute some plans consisting of unordered steps"
     (let [names (set (range 10))
           plan (success-steps names)


Formatting as per @otfrom's comment.

Formatting as per @otfrom's comment.

--- src/kixi/hecuba/api/devices.clj
+++ src/kixi/hecuba/api/devices.clj
@@ -284,8 +284,9 @@
                                        (dissoc :editable :readings))]
             ;; Don't update device if nothing has been changed
             (when (seq edited-device-data)
-              (devices/update session entity_id device_id (assoc edited-device-data :user_id user_id
-                                                                 :device_id device_id))))
+              (devices/update session entity_id device_id (assoc edited-device-data
+                                                            :user_id user_id
+                                                            :device_id device_id))))
           (doseq [new-sensor (:readings body)]
             (let [old-sensor   (first (filter #(= (:type %) (:type new-sensor)) (:readings item)))
                   updated-keys (keys new-sensor)


Move error handling for grimoire ns to more localized fn

--- src/lt/plugins/inc_clojure.cljs
+++ src/lt/plugins/inc_clojure.cljs
@@ -64,10 +64,13 @@
 (defn for-resolved-var
   "Performs given action on a stringified, resolved var e.g. #'clojure.core/cond"
   [action {:keys [result]} info]
-  (let [[_ ns var] (re-find #"^#'(\S+)/(\S+)$" result)]
-    (if (and ns var)
-      (action ns var)
-      (notifos/set-msg! (str "Invalid clojure var: " (:symbol info)) {:class "error"}))))
+  (try
+    (let [[_ ns var] (re-find #"^#'(\S+)/(\S+)$" result)]
+      (if (and ns var)
+        (action ns var)
+        (notifos/set-msg! (str "Invalid clojure var: " (:symbol info)) {:class "error"})))
+    (catch js/Error e
+      (notifos/set-msg! (str e) {:class "error"}))))

 (def open-crossclj-url (partial for-resolved-var (comp tab-open-url ->crossclj-url)))
 (def open-grimoire-url (partial for-resolved-var (comp tab-open-url ->grimoire-url)))
@@ -75,14 +78,10 @@
 (behavior ::clj-result.callback
           :triggers #{:editor.eval.clj.result.callback}
           :reaction (fn [editor result]
-                      (try
-                        (if-let [callback (some->> (get-in result [:meta :callback])
+                      (if-let [callback (some->> (get-in result [:meta :callback])
                                                  (resolve-fn lt.plugins.inc-clojure))]
                         (callback (-> result :results first) (:meta result))
-                        (notifos/set-msg! (str "No callback provided for clj result: " result) {:class "error"}))
-                        ;; Consider only catching invalid grimoire ns error
-                        (catch js/Error e
-                          (notifos/set-msg! (str e) {:class "error"})))))
+                        (notifos/set-msg! (str "No callback provided for clj result: " result) {:class "error"}))))

 (defn eval-code
   "Evals code and returns result with given callback which is a keyword for callback fn.


shorten code a bit by using the threading macro

--- src/brainbot/nozzle/esconnect.clj
+++ src/brainbot/nozzle/esconnect.clj
@@ -60,18 +60,17 @@
 (defn mtime->lastmodified
   "convert unix timestamp to elasticsearch compatible string representation"
   [mtime]
-  (str (tcoerce/from-long (* 1000 (long mtime)))))
+  (-> mtime long (* 1000) tcoerce/from-long str))

 (defn lastmodified->mtime
   "convert elasticsearch date string to unix timestamp"
   [lastmodified]
-  (quot (tcoerce/to-long (tcoerce/from-string lastmodified)) 1000))
-
+  (-> lastmodified tcoerce/from-string tcoerce/to-long (quot 1000)))

 (defn strip-mime-type-parameters
   "strip mime type parameters from mime type string"
   [s]
-  (string/trim (first (string/split s #";" 2))))
+  (-> s (string/split #";" 2) first string/trim))

 (defn ensure-index-and-mappings


don't log error when read-image returns nil

read-image may return nil when it tries to read e.g. a .tiff image.
this did result in an IllegalArgumentException from thumbnail-from-image
and an error being logged. we now just return nil from make-thumbnail in
that case.

--- src/brainbot/nozzle/thumbnail.clj
+++ src/brainbot/nozzle/thumbnail.clj
@@ -36,7 +36,7 @@

 (defmethod make-thumbnail :image
   [content-type get-input-stream]
-  (-> get-input-stream read-image thumbnail-from-image))
+  (some-> get-input-stream read-image thumbnail-from-image))

 ;; (org.jpedal.fonts.FontMappings/setFontReplacements)


fixed test

fixed test

--- test/tango/import_datoms_tests.clj
+++ test/tango/import_datoms_tests.clj
@@ -118,11 +118,8 @@
                                                           :competition/classes class-query
                                                           :competition/panels panel-query}]))))))

-      (is (=
-            (:competition/participants (first (ds/query-competition
-                                                @conn
-                                                ['*])))
-            800)))))
+      (is (= (count (ds/query-participants @conn ['*]))
+             882)))))

 (deftest import-adjudicators
   (testing "Import of adjudicator data"


Catch and log warn when http iostream for putting attachment fails

--- src/cider_ci/storage/put_file.clj
+++ src/cider_ci/storage/put_file.clj
@@ -34,6 +34,10 @@
     [logbug.ring :refer [wrap-handler-with-logging]]
     ))

+(defn body-input-stream [request]
+  (try (io/input-stream (:body request))
+       (catch Exception _
+         (logging/warn "Failed to open body for file put request: " request))))

 (defn save-file-and-presist-row [request store]
   (let [id (java.util.UUID/randomUUID)
@@ -42,7 +46,7 @@
         content-type (-> request :headers (get "content-type"))
         {content-length :content-length} request]
     (jdbc/with-db-transaction [tx (get-ds)]
-      (with-open [in (io/input-stream (:body request))
+      (with-open [in (body-input-stream request)
                   out (io/output-stream file)]
         (clojure.java.io/copy in out))
       (let [[table-name id-name] (get-table-and-id-name request)


Formatting and added :not-distinct

Formatting and added :not-distinct

--- src/clj/game/cards-identities.clj
+++ src/clj/game/cards-identities.clj
@@ -56,23 +56,24 @@
    "Chaos Theory: Wünderkind"
    {:effect (effect (gain :memory 1))}

-   "Chronos Protocol: Selective Mind-mapping"
-   {:events {:pre-resolve-damage {:once :per-turn
-                          :effect (effect (damage-defer :net (last targets))
-                                          (resolve-ability
-                                            { :optional {:prompt "Use Chronos Protocol: Selective Mind-mapping to reveal the Runner's grip to select the first card trashed?"
-                                            :yes-ability {:effect (req (resolve-ability
-                                               state side
-                                               {:prompt (msg "Choose a card to trash")
-                                                :choices (req (:hand runner))
-                                                :effect (effect (system-msg (str "trashes " (:title target) " by using Chronos Protocol: Selective Mind-mapping and does " (- (get-defer-damage state side :net nil) 1) " more net damage"))
-                                                                (trash target)
-                                                                (damage :net (- (get-defer-damage state side :net nil) 1) {:unpreventable true :card card}))} card nil))}
-                                            :no-ability {:effect (effect (damage :net (get-defer-damage state side :net nil) {:unpreventable true :card card}))}
-                                            }} card nil))
-                                    }
-                                }
-                       }
+"Chronos Protocol: Selective Mind-mapping"
+   {:events
+    {:pre-resolve-damage
+     {:once :per-turn
+      :effect (effect (damage-defer :net (last targets))
+                      (resolve-ability
+                        {:optional {:prompt (str "Use Chronos Protocol: Selective Mind-mapping to reveal the Runner's "
+                                                 "grip to select the first card trashed?")
+                                    :yes-ability {:prompt (msg "Choose a card to trash")
+                                                  :choices (req (:hand runner)) :not-distinct true
+                                                  :msg (msg "trash " (:title target) " and deal "
+                                                            (- (get-defer-damage state side :net nil) 1)
+                                                            " more net damage")
+                                                  :effect (effect (trash target)
+                                                                  (damage :net (- (get-defer-damage state side :net nil) 1)
+                                                                          {:unpreventable true :card card}))}
+                                    :no-ability {:effect (effect (damage :net (get-defer-damage state side :net nil)
+                                                                         {:unpreventable true :card card}))}}} card nil))}}}

    "Cybernetics Division: Humanity Upgraded"
    {:effect (effect (lose :max-hand-size 1) (lose :runner :max-hand-size 1))}


Fix validation for event edit page for cloning

--- src/cljs/elevent_client/core.cljs
+++ src/cljs/elevent_client/core.cljs
@@ -959,14 +959,12 @@

 (defn event-edit-page []
   (let [form (atom {})
-        validator (validation-set (presence-of :Name)
-                                  (presence-of :OrganizationId)
-                                  (presence-of :Venue)
-                                  (presence-of :StartDate)
-                                  (presence-of :EndDate)
-                                  (format-of   :TicketPrice :format #"^\d+\.\d{2}$"
-                                               :allow-nil true
-                                               :allow-blank true))
+        validator (validation-set (presence-of     :Name)
+                                  (presence-of     :OrganizationId)
+                                  (presence-of     :Venue)
+                                  (presence-of     :StartDate)
+                                  (presence-of     :EndDate)
+                                  (numericality-of :TicketPrice))
         clone-id (atom 0)]
     (add-watch clone-id :clone
                (fn [_ _ _ id]


renaming move => converted

renaming move => converted

--- src/cljs/triboard/logic/move.cljs
+++ src/cljs/triboard/logic/move.cljs
@@ -11,16 +11,14 @@

 (defn conversion?
   "A move is the result of player a cell at a given coordinate"
-  [m]
+  [c]
   (and
-    (board/coord? (:point m))                                ;; TODO - rename => point
-    (every? board/coord? (:taken m))
-    (cst/player? (:winner m))
-    (cst/cell? (:looser m))))
+    (board/coord? (:point c))
+    (every? board/coord? (:taken c))
+    (cst/player? (:winner c))
+    (cst/cell? (:looser c))))

-(defn conversions?
-  [moves]
-  (every? conversion? moves))
+(defn conversions? [coll] (every? conversion? coll))

 ;; -----------------------------------------


specs

specs

--- src/cljs/triboard/logic/turn.cljs
+++ src/cljs/triboard/logic/turn.cljs
@@ -52,7 +52,8 @@
 ;; -----------------------------------------

 (s/def ::turn
-  (s/keys :req-un [::board/board ::cst/player ::move/available-moves ::scores/scores]))
+  (s/keys :req-un
+    [::board/board ::cst/player ::move/available-moves ::scores/scores]))

 (defn new-init-turn []
   (-> {:board (board/new-board)
@@ -72,6 +73,10 @@
   [turn player]
   (get (get-moves turn) player))

+#_(s/fdef play-move
+  :args (s/tuple ::turn ::cst/player)
+  :ret (s/nilable ::turn))
+
 (defn play-move
   "On player playing the move [x y] - update all the game state accordingly"
   [{:keys [player board] :as turn} point]


icon helper

icon helper

--- src/cljs/western_music/views.cljs
+++ src/cljs/western_music/views.cljs
@@ -4,6 +4,17 @@
   (:require-macros [western-music.util :refer [for']]))

 (def ^:const icons "material-icons")
+
+(defn icon
+  ([on-click type] (icon {} on-click type))
+  ([options on-click type]
+   (let [class (if (:class options)
+                 (str icons " " (:class options))
+                 icons)]
+     [:i (assoc options
+                :on-click on-click
+                :class class)
+      type])))

 (defn composition-list
   []
@@ -17,14 +28,8 @@
                 :on-click (if (empty? @queue)
                             #(dispatch [:play-track id])
                             #(dispatch [:enqueue-track id]))}
-          [:i
-           {:on-click #(dispatch [:play-track id])
-            :class icons}
-           "play_arrow"]
-          [:i
-           {:on-click #(dispatch [:enqueue-track id])
-            :class icons}
-           "queue_music"]
+          (icon #(dispatch [:play-track id]) "play_arrow")
+          (icon #(dispatch [:enqueue-track id]) "queue_music")
           (p/display track)])])))

 (defn composer-list
@@ -68,11 +73,8 @@
               :let [id (p/id track)]]
          [:div {:key id}
           (when-not (= id (p/id @current-track))
-            [:i {:on-click #(dispatch [:play-track id]) :class icons} "play_arrow"])
-          [:i
-           {:on-click #(dispatch [:dequeue-track id])
-            :class icons}
-           "clear"]
+            (icon #(dispatch [:play-track id]) "play_arrow"))
+          (icon #(dispatch [:dequeue-track id]) "clear")
           (p/display track)])])))

 (defn player-controls
@@ -80,11 +82,11 @@
   (let [paused? (subscribe [:paused?])]
     (fn []
       [:div
-       [:i {:on-click #(dispatch [:player-back]) :class icons} "skip_previous"]
+       (icon #(dispatch [:player-back]) "skip_previous")
        (if @paused?
-         [:i {:on-click #(dispatch [:player-play]) :class icons} "play_arrow"]
-         [:i {:on-click #(dispatch [:player-pause]) :class icons} "pause"])
-       [:i {:on-click #(dispatch [:player-forward]) :class icons} "skip_next"]])))
+         (icon #(dispatch [:player-play]) "play_arrow")
+         (icon #(dispatch [:player-pause]) "pause"))
+       (icon #(dispatch [:player-forward]) "skip_next")])))

 (defn track-tabs []
   (let [q (subscribe [:track-queue])]


Reduce hash check to critical keys.

Reduce hash check to critical keys.

--- src/cljx/geschichte/p2p/hash.cljx
+++ src/cljx/geschichte/p2p/hash.cljx
@@ -16,15 +16,16 @@
     (when f
       (doseq [[id val] values]
         ;; HACK to cover commits, TODO introduce distinct fetch types/topics?
-        (when (not= id (uuid (if (and (map? val) (:ts val) (:author val) (:transactions val))
-                               (dissoc val :ts :author) val)))
-          (let [msg (str "CRITICAL: Fetched ID: "  id
-                         " does not match HASH "  (uuid val)
-                         " for value " (pr-str val)
-                         " from " peer)]
-            (error msg)
-            #+clj (throw (IllegalStateException. msg))
-            #+cljs (throw msg))))
+        (let [val (if (and (map? val) (:parents val) (:transactions val))
+                    (select-keys val #{:transactions :parents}) val)]
+          (when (not= id (uuid val))
+            (let [msg (str "CRITICAL: Fetched ID: "  id
+                           " does not match HASH "  (uuid val)
+                           " for value " (pr-str val)
+                           " from " peer)]
+              (error msg)
+              #+clj (throw (IllegalStateException. msg))
+              #+cljs (throw msg)))))
       (>! new-in f)
       (recur (<! fetched-ch)))))


Shape message function by default

Shape message function by default

--- src/clojure/glittering/pregel.clj
+++ src/clojure/glittering/pregel.clj
@@ -1,5 +1,6 @@
 (ns glittering.pregel
   (:require  [glittering.core :as g]
+             [glittering.destructuring :as g-de]
              [t6.from-scala.core :refer [$] :as $])
   (:import [org.apache.spark.graphx EdgeDirection]))

@@ -10,12 +11,13 @@
                     max-iterations Long/MAX_VALUE}}
               g]
   (let [dir (g/edge-directions direction)
+        wrapped-message-fn (g-de/message-fn message-fn)
         g (if initial-message
             (g/map-vertices
              (fn [vid attr] (vertex-fn vid attr initial-message)) g)
             g)]
     (loop [g g
-           messages (g/aggregate-messages message-fn combiner g)
+           messages (g/aggregate-messages wrapped-message-fn combiner g)
            i 0]
       (if (and (> (.count messages) 0)
                (< i max-iterations))
@@ -25,7 +27,7 @@
                                                  (or new-opt old))
                                                new-verts g))
               old-messages messages
-              messages (.cache (g/aggregate-messages message-fn combiner g))]
+              messages (.cache (g/aggregate-messages wrapped-message-fn combiner g))]
           #_(println "Pregel iteration: " i "messages count: " (.count messages))
           (.count messages) ;; We must realise the messages
           (.unpersist old-messages false)


Validate activity request params.

Validate activity request params.

--- src/oc/storage/api/activity.clj
+++ src/oc/storage/api/activity.clj
@@ -4,6 +4,7 @@
             [if-let.core :refer (if-let*)]
             [compojure.core :as compojure :refer (OPTIONS GET)]
             [liberator.core :refer (defresource by-method)]
+            [clj-time.format :as f]
             [oc.lib.slugify :as slugify]
             [oc.lib.db.pool :as pool]
             [oc.lib.db.common :as db-common]
@@ -19,7 +20,14 @@

 ;; ----- Utility functions -----

-(defn activity-sort
+(defn- valid-timestamp? [ts]
+  (try
+    (f/parse db-common/timestamp-format ts)
+    true
+    (catch IllegalArgumentException e
+      false)))
+
+(defn- activity-sort
   "
   Compare function to sort 2 entries and/or activity by their `created-at` or `published-at` order respectively,
   in the order (:asc or :desc) provided.
@@ -103,6 +111,18 @@
     :options true
     :get (fn [ctx] (access/access-level-for conn slug (:user ctx)))})

+  ;; Check the request
+  :malformed? (fn [ctx] (let [ctx-params (keywordize-keys (-> ctx :request :params))
+                              start (:start ctx-params)
+                              valid-start? (if start (valid-timestamp? start) true)
+                              direction (keyword (:direction ctx-params))
+                              ;; no direction is OK, but if specified it's from the allowed enumeration of options
+                              valid-direction? (if direction (#{:before :after :around} direction) true)
+                              ;; a specified start/direction must be together or ommitted
+                              pairing-allowed? (or (and start direction)
+                                                   (and (not start) (not direction)))]
+                          (not (and valid-start? valid-direction? pairing-allowed?))))
+
   ;; Existentialism
   :exists? (fn [ctx] (if-let* [_slug? (slugify/valid-slug? slug)
                                org (or (:existing-org ctx) (org-res/get-org conn slug))]
@@ -118,9 +138,7 @@
                              start? (if (:start ctx-params) true false) ; flag if a start was specified
                              start-params (update ctx-params :start #(or % (db-common/current-timestamp))) ; default is now
                              direction (or (#{:after :around} (keyword (:direction ctx-params))) :before) ; default is before
-                             ;; around is only valid with a specified start
-                             allowed-direction (if (and (not start?) (= direction :around)) :before direction)
-                             params (merge start-params {:direction allowed-direction :start? start?})
+                             params (merge start-params {:direction direction :start? start?})
                              boards (board-res/list-all-boards-by-org conn org-id [:created-at :updated-at :authors :viewers :access])
                              ;allowed-boards (map :uuid (filter #(access/access-level-for org % user) boards))
                              board-uuids (map :uuid boards)


log command and details

log command and details

--- src/org/spootnik/fleet/http.clj
+++ src/org/spootnik/fleet/http.clj
@@ -1,6 +1,6 @@
 (ns org.spootnik.fleet.http
   (:require [compojure.core                 :refer [routes GET POST PUT DELETE]]
-            [clojure.tools.logging          :refer [error]]
+            [clojure.tools.logging          :refer [error infof]]
             [clojure.pprint                 :refer [pprint]]
             [ring.util.response             :refer [response redirect]]
             [cheshire.core                  :refer [generate-string]]
@@ -79,6 +79,9 @@
                   (http/close hchan)
                   (catch Exception e
                     (error e "cannot handle incoming message"))))
+
+              (info "sending request for %s [profile:%s] [matchargs:%s] [args:%s]"
+                    scenario profile matchargs args)
               (engine/request engine
                               (api/prepare scenario profile matchargs args)
                               ch))))


remove ‘verbs’ definition

remove ‘verbs’ definition

--- src/it.clj
+++ src/it.clj
@@ -15,11 +15,6 @@
 (require '[dag-unify.core :refer [get-in unify]])
 (require '[korma.core :refer :all])
 (require '[korma.db :refer :all])
-
-(def verbs
-  (filter (fn [lexeme]
-            (contains? (set (get-in (get @lexicon lexeme) [:synsem :cat])) :verb))
-          (keys @lexicon)))

 ;; subset of the lexicon: only verbs which are infinitives and that can be roots:
 ;; (i.e. those that have a specific (non- :top) value for [:synsem :sem :pred])
@@ -39,7 +34,6 @@
   (let [count (if count (Integer. count) 10)]
     (write-lexicon "it" @it/lexicon)
     (log/info (str "done writing lexicon."))
-
     (log/info (str "generating with this many verbs: " (.size (reduce concat (vals root-verbs)))))
     (.size (map (fn [verb]
                   (let [root-form (get-in verb [:italiano :italiano])]


PUT responds with 204, allow update in cljs

--- app/src/edge/phonebook_app.cljs
+++ app/src/edge/phonebook_app.cljs
@@ -34,7 +34,7 @@
         (.addEventListener
          "load"
          (fn [e]
-           (when (= e.target.status 200)
+           (when (<= 200 e.target.status 299)
              (swap! app-state update :phonebook conj (:current state)))))
         (.send (pr-str entry)))))


support where clauses with partition keys

it's now possible to supply a partition key and additional where
clauses on clustering columns

--- src/er_cassandra/model/select.clj
+++ src/er_cassandra/model/select.clj
@@ -7,7 +7,8 @@
             [qbits.hayt :as h]
             [er-cassandra.key :as k]
             [er-cassandra.record :as r]
-            [er-cassandra.model.types :as t])
+            [er-cassandra.model.types :as t]
+            [er-cassandra.model.util :as util])
   (:import [er_cassandra.model.types Model]))

 (defn if-primary-key-table
@@ -27,42 +28,68 @@
 (defn if-unique-key-table
   [^Model model key]
   (some (fn [t]
-          (when (= (:key t) key)
+          (when (or (t/satisfies-primary-key? (:key t) key)
+                    (t/satisfies-partition-key? (:key t) key))
             t))
         (:unique-key-tables model)))

 (defn if-lookup-key-table
   [^Model model key]
   (some (fn [t]
-          (when (= (:key t) key)
+          (when (or (t/satisfies-primary-key? (:key t) key)
+                    (t/satisfies-partition-key? (:key t) key))
             t))
         (:lookup-key-tables model)))

 (defn select-from-full-table
-  "one fetch - straight from a table"
+  "one fetch - straight from a table. they key must be either
+   a full primary key, or a partition key combined with some
+   clustering key conditions (given as :where options)"

   [session ^Model model table key record-or-key-value opts]
-  (let [kv (k/extract-key-value key record-or-key-value opts)]
-    (r/select session (:name table) key kv (dissoc opts :key-value))))
+  (let [kv (k/extract-key-value key record-or-key-value opts)
+        opts (dissoc opts :key-value)]
+    (r/select session (:name table) key kv opts)))

 (defn select-from-lookup-table
   "two fetches - use the lookup-key to get the uber-key, then
-   get the record from the primary table"
+   get the record from the primary table.
+
+   the lookup query may return multiple records, all of which will be
+   dereferenced against the primary table, with nil results from
+   dangling lookups being filtered out.
+
+   this means that the lookup query may specify a partition-key and
+   some clustering column condition (given as a :where option)"

   [session ^Model model table record-or-key-value opts]
-  (let [lkv (k/extract-key-value (:key table) record-or-key-value opts)]
+  (let [lkv (k/extract-key-value (:key table) record-or-key-value opts)
+        opts (dissoc opts :key-value)
+        lookup-opts (dissoc opts :columns)
+        primary-opts (dissoc opts :where :only-if :order-by :limit)]
     (m/with-monad dm/deferred-monad
-      (m/mlet [lr (r/select-one session (:name table) (:key table) lkv)
-               pkv (m/return
-                    (when lr
-                      (t/extract-uber-key-value model lr)))]
-              (if pkv
-                (r/select session
-                          (get-in model [:primary-table :name])
-                          (get-in model [:primary-table :key])
-                          pkv
-                          (dissoc opts :key-value))
-                (m/return nil))))))
+      (m/mlet [lrs (r/select session
+                             (:name table)
+                             (:key table)
+                             lkv
+                             lookup-opts)
+               pkvs (m/return
+                     (map (fn [lr]
+                            (t/extract-uber-key-value model lr))
+                          lrs))
+               prs (m/return
+                    (map (fn [pkv]
+                           (r/select-one
+                            session
+                            (get-in model [:primary-table :name])
+                            (get-in model [:primary-table :key])
+                            pkv
+                            primary-opts))
+                         pkvs))]
+        (m/return
+         (d/chain
+          (util/combine-responses prs)
+          (fn [rs] (filter identity rs))))))))

 (defn select*
   "select records from primary or lookup tables as required"


prevent exceptions from being hidden

prevent exceptions from being hidden

--- src/core.clj
+++ src/core.clj
@@ -466,32 +466,31 @@

 (defn -main
   []
-  (try
-
-    ;; Retrieve the SHA1 hashes for the checked out repos (for github links)
-    (println "\nUsing repo versions:")
-    (doseq [repo (keys @repo-version)]
-      (let [v (get-repo-version repo)]
-        (swap! repo-version assoc repo v)
-        (println " " repo ":" v)))
-
-    ;; HACK: We need to create this so 'tools.reader' doesn't crash on `::ana/numeric`
-    ;; which is used by cljs.core. (the ana namespace has to exist)
-    (create-ns 'ana)
-
-    ;; create the output directory for the docs
-    (mkdir cljsdoc-dir)
-
-    (println "\nWriting docs to" cljsdoc-dir)
-
-    ;; Build the docs.
-    (doseq [ns- (keys cljs-ns-paths)]
-      (println " " ns-)
-      (dump-api-docs! (parse-ns-api ns-)))
-
-    (println "\nDone.")
-
-    ;; have to do this because `sh` leaves futures hanging,
-    ;; preventing exit, so we must do it manually.
-    (finally (System/exit 0))))
-
+
+  ;; Retrieve the SHA1 hashes for the checked out repos (for github links)
+  (println "\nUsing repo versions:")
+  (doseq [repo (keys @repo-version)]
+    (let [v (get-repo-version repo)]
+      (swap! repo-version assoc repo v)
+      (println " " repo ":" v)))
+
+  ;; HACK: We need to create this so 'tools.reader' doesn't crash on `::ana/numeric`
+  ;; which is used by cljs.core. (the ana namespace has to exist)
+  (create-ns 'ana)
+
+  ;; create the output directory for the docs
+  (mkdir cljsdoc-dir)
+
+  (println "\nWriting docs to" cljsdoc-dir)
+
+  ;; Build the docs.
+  (doseq [ns- (keys cljs-ns-paths)]
+    (println " " ns-)
+    (dump-api-docs! (parse-ns-api ns-)))
+
+  (println "\nDone.")
+
+  ;; have to do this because `sh` leaves futures hanging,
+  ;; preventing exit, so we must do it manually.
+  (System/exit 0))
+


use generate-container-cand-exprs but not defined

--- src/synthesis_crawlers/core.clj
+++ src/synthesis_crawlers/core.clj
@@ -263,7 +263,10 @@
         (let [nodes-in-pages (find-nodes-in-page (:pages (sites site)) new-knowledge)
               reachable-attrs (find-reachable-attrs nodes-in-pages)
               support-nodes (find-support-nodes nodes-in-pages)
-              container-cand-nodes (find-container-node )
+              container-cand-nodes (find-container reachable-attrs
+                                                   (find-best-attr-set reachable-attrs))
+              container-cand-exprs (generate-container-cand-exprs
+                                     container-cand-nodes support-nodes)
               ]
           (println nodes-in-pages)
           ;(println reachable-attrs)


Add repository and service for "update-page-metadata" functionality.

--- src/uxbox/services/projects.clj
+++ src/uxbox/services/projects.clj
@@ -100,6 +100,24 @@
     (some-> (sc/fetch-one conn sqlv)
             (usc/normalize-attrs))))

+;; Update Page Metadata
+
+(def ^:private +update-page-metadata-schema+
+  (dissoc +update-page-schema+ :data))
+
+(defn update-page-metadata
+  [conn {:keys [id user project name width height layout version] :as params}]
+  {:pre [(us/validate! params +update-page-metadata-schema+)]}
+  (let [sql (str "UPDATE pages SET "
+                 " name=?, width=?, height=?, layout=?, version=?"
+                 " WHERE id=? AND \"user\"=? AND project=?"
+                 " RETURNING *")
+        sqlv [sql name width height layout version id user project]]
+    (locks/acquire! conn id)
+    (some-> (sc/fetch-one conn sqlv)
+            (usc/normalize-attrs))))
+
+
 (defn delete-page
   [conn {:keys [id user] :as params}]
   {:pre [(us/validate! params +delete-page-schema+)]}
@@ -181,6 +199,14 @@
     (-> (update-page conn params)
         (decode-page-data))))

+(defmethod usc/-novelty :page/update-metadata
+  [conn {:keys [data] :as params}]
+  (let [data (-> (sz/encode data :transit+msgpack)
+                 (codecs/bytes->base64))
+        params (assoc params :data data)]
+    (-> (update-page-metadata conn params)
+        (decode-page-data))))
+
 (defmethod usc/-novelty :page/delete
   [conn params]
   (delete-page conn params))


format-species-enum handles nil

format-species-enum handles nil

--- src/wb_es/datomic/data/util.clj
+++ src/wb_es/datomic/data/util.clj
@@ -38,7 +38,8 @@
 (defn format-species-enum
   "format a species entity as a elasticsearch term"
   [species-entity]
-  (let [[genus-name species-name] (-> (:species/id species-entity)
-                                      (clojure.string/lower-case)
-                                      (clojure.string/split #"\s+"))]
-    (format "%s_%s" (str (first genus-name)) species-name)))
+  (if species-entity
+    (let [[genus-name species-name] (-> (:species/id species-entity)
+                                        (clojure.string/lower-case)
+                                        (clojure.string/split #"\s+"))]
+      (format "%s_%s" (str (first genus-name)) species-name))))


Support comment as document for field, type, input, enum, argument

--- src/graphql_clj/introspection.clj
+++ src/graphql_clj/introspection.clj
@@ -65,7 +65,7 @@
       (assert inner-type (format "field inner-type is nil for field: %s" field)))
     (assert (or type-name inner-type) (format "field type-name and inner-type are both nil for field: %s" field))
     {:name (:name field)
-     :description (:description field)
+     :description (:doc field)
      :args (:arguments field) ; defer resolving of arguments

      ;; :type nil ; defer resolving of type
@@ -101,7 +101,7 @@
        :inner-type (dissoc type :required)}
       {:kind kind
        :name type-name
-       :description (:description type)
+       :description (:doc type)

        ;; OBJECT and INTERFACE only
        :fields (when (contains? #{:OBJECT :INTERFACE} kind)
@@ -149,7 +149,7 @@
       (assert inner-type (format "inner-type is nil for type: %s" type)))
     (assert (or type-name inner-type) (format "Both type-name and inner-type are nil for input field:%s" field))
     {:name name
-     :description (:description field)
+     :description (:doc field)

      :type-name type-name
      :kind kind
@@ -161,9 +161,10 @@
 (defn enum-resolver [enum]
   (assert (:name enum) (format "enum name is null for:%s" enum))
   {:name (:name enum)
-   :description nil
-   :isDeprecated false
-   :deprecationReason nil})
+   :description (:doc enum)
+   :isDeprecated false ; TODO
+   :deprecationReason nil ; TODO
+   })

 (defn args-resolver [arg]
   (assert (:name arg) (format "argument name is null for:%s" arg))
@@ -179,7 +180,7 @@
       (assert inner-type (format "inner-type is nil for type: %s" arg)))
     (assert (or type-name inner-type) (format "Both type-name and inner-type are nil for arg:%s" arg))
     {:name (:name arg)
-     :description (:description arg)
+     :description (:doc arg)

      ;; defer resolving of type for argument
      :type-name type-name


env: add appengine-api dependency

env: add appengine-api dependency

--- env/project.clj
+++ env/project.clj
@@ -3,8 +3,8 @@
   :url "http://github.com/greynolds/migae"
   :min-lein-version "2.0.0"
   :aot [#".*"]
-  :dependencies [[org.clojure/clojure "1.5.1"]]
+  :dependencies [[org.clojure/clojure "1.5.1"]
+                 [com.google.appengine/appengine-api-1.0-sdk "1.8.3"]]
   :profiles {:test
-             {:dependencies [[com.google.appengine/appengine-api-1.0-sdk "1.8.3"]
-                             [com.google.appengine/appengine-api-stubs "1.8.3"]
+             {:dependencies [[com.google.appengine/appengine-api-stubs "1.8.3"]
                              [com.google.appengine/appengine-testing "1.8.3"]]}})


remove empty test file

remove empty test file

--- test/clj_money/web/reports_test.clj
+++ test/clj_money/web/reports_test.clj
@@ -1,11 +0,0 @@
-(ns clj-money.web.reports-test
-  (:require [clojure.test :refer :all]
-            [environ.core :refer [env]]
-            [clojure.pprint :refer [pprint]]
-            [clojure.data :refer [diff]]
-            [clj-time.core :as t]
-            [clj-factory.core :refer [factory]]
-            [clj-money.serialization :as serialization]
-            [clj-money.factories.user-factory]
-            [clj-money.web.reports :as reports]
-            [clj-money.test-helpers :refer [reset-db]]))


fix border-radius on perfect circles

fix border-radius on perfect circles

--- src-cljs/frontend/layers.cljs
+++ src-cljs/frontend/layers.cljs
@@ -79,9 +79,12 @@
                       1
                       -1)
         end-y (+ (:layer/start-y layer) (* height-sign width))]
-    (assoc layer
-      :layer/current-y end-y
-      :layer/end-y end-y)))
+    (-> layer
+        (assoc :layer/current-y end-y
+               :layer/end-y end-y)
+        (#(if (:layer/rx %)
+            (assoc % :layer/ry (:layer/rx %))
+            %)))))

 (defmethod force-even :layer.type/line
   [layer]


tighten up more routes that include :vcs_type

--- src-cljs/frontend/routes.cljs
+++ src-cljs/frontend/routes.cljs
@@ -109,12 +109,15 @@
     (apply str (v1-org-settings params)
          (when-let [subpage (:subpage params)]
            ["#" subpage])))
-  (defroute v1-org-dashboard-alternative "/:vcs_type/organizations/:org" {:as params}
-    (open-to-inner! nav-ch :dashboard (->short-vcs params)))
+  (defroute v1-org-dashboard-alternative #"/(gh|bb)/organizations/([^/]+)" [short-vcs-type org]
+    (open-to-inner! nav-ch :dashboard (->short-vcs {:vcs_type short-vcs-type
+                                                    :org org})))
   (defroute v1-org-dashboard #"/(gh|bb)/([^/]+)" [short-vcs-type org]
     (open-to-inner! nav-ch :dashboard (->short-vcs {:vcs_type short-vcs-type :org org})))
-  (defroute v1-project-dashboard "/:vcs_type/:org/:repo" {:as params}
-    (open-to-inner! nav-ch :dashboard (->short-vcs params)))
+  (defroute v1-project-dashboard #"/(gh|bb)/([^/]+)/([^/]+)" [short-vcs-type org repo]
+    (open-to-inner! nav-ch :dashboard (->short-vcs {:vcs_type short-vcs-type
+                                                    :org org
+                                                    :repo repo})))
   (defroute v1-project-branch-dashboard #"/([^/]+)/([^/]+)/([^/]+)/tree/(.+)" ; workaround secretary's annoying auto-decode
     [vcs_type org repo branch args]
     (open-to-inner! nav-ch :dashboard (merge args {:vcs_type (->short-vcs vcs_type)
@@ -131,9 +134,8 @@
                                      :org org
                                      :repo repo
                                      :tab (keyword _fragment)})))
-  (defroute v1-project-settings "/:vcs_type/:org/:repo/edit"
-    [vcs_type org repo _fragment]
-    (open-to-inner! nav-ch :project-settings {:vcs_type (->short-vcs vcs_type)
+  (defroute v1-project-settings #"/(gh|bb)/([^/]+)/([^/]+)/edit" [short-vcs-type org repo _fragment]
+    (open-to-inner! nav-ch :project-settings {:vcs_type (->short-vcs short-vcs-type)
                                               :project-name (str org "/" repo)
                                               :subpage (keyword _fragment)
                                               :org org


Hack around event-handlers not getting disposed

--- src-cljs/frontend/scroll.cljs
+++ src-cljs/frontend/scroll.cljs
@@ -11,7 +11,11 @@
         js/window
         "scroll"
         (fn [event]
-          (utils/swallow-errors (cb event))))
+          ;; FIXME: Dispose doesn't actually remove the event listeners
+          ;; so we end up leaking event handlers that survive their components
+          ;; and throw interesting errors when events are triggered against unmounted components
+          (when (om/mounted? owner)
+            (utils/swallow-errors (cb event)))))
       (fn dispose [event-key]
         (goog.events/unlistenByKey event-key)))))


Add code to start a server on port 8192

Add code to start a server on port 8192

--- spec/rook/swagger_spec.clj
+++ spec/rook/swagger_spec.clj
@@ -12,7 +12,9 @@
             [clj-http.client :as client]
             [io.aviso.toolchest.collections :refer [pretty-print]]
             [qbits.jet.server :as jet]
-            [clojure.tools.logging :as l]))
+            [clojure.tools.logging :as l]
+            [io.aviso.rook.server :as server])
+  (:import [org.eclipse.jetty.server Server]))

 (defn- swagger-object
   [rook-options swagger-options & ns-specs]
@@ -51,6 +53,17 @@
                      [[:hotel-id "rooms"] 'rooms]])
     (json/generate-string {:pretty true})
     println)
+
+(defn start-server
+  []
+  (let [creator #(rook/namespace-handler {:swagger-options rs/default-swagger-options}
+                                         ["hotels" 'hotels
+                                          [[:hotel-id "rooms"] 'rooms]])
+        handler (server/construct-handler {:log true :track true :standard true :exceptions true} creator)
+        ^Server server (jet/run-jetty {:ring-handler handler
+                                       :join?        false
+                                       :port         8192})]
+    #(.stop server)))

 #_
 (describe "io.aviso.rook.swagger"


Added assertion for normalization algorithm

that definied-concepts at top-level are not supported.

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

--- src/conexp/contrib/dl/languages/description_graphs.clj
+++ src/conexp/contrib/dl/languages/description_graphs.clj
@@ -110,9 +110,16 @@
 	;; examine arguments
 	(let [next-term (first args)]
 	  (if (atomic? next-term)
-	    ;; atomic term, possibly a tbox-target-pair
-	    (let [[normal-term new-names] (normalize-atomic next-term names)]
-	      (recur (rest args) (conj normalized normal-term) new-names))
+	    (do
+	      ;; this is only a restricted normalization algorithm
+	      (when (and (not (primitive? next-term))
+			 (not (tbox-target-pair? next-term)))
+		(illegal-argument "Sorry, but this normalization algorithm cannot handle your TBox.\n"
+				  "The definition " definition " contains definied concepts at top-level."))
+
+	      ;; atomic term, possibly a tbox-target-pair
+	      (let [[normal-term new-names] (normalize-atomic next-term names)]
+		(recur (rest args) (conj normalized normal-term) new-names)))

 	    ;; next-term is an existential quantification
 	    (let [[r B] (vec (arguments next-term))]


Add better test helper to user ns.

Add better test helper to user ns.

--- src/user.clj
+++ src/user.clj
@@ -6,20 +6,16 @@

 ;; --- Development Stuff

-(defn test-vars
-  [& vars]
-  (repl/refresh)
-  (test/test-vars
-   (map (fn [sym]
-          (require (symbol (namespace sym)))
-          (resolve sym))
-        vars)))
+(defn test
+  ([] (test #"^datoteka.tests.*"))
+  ([o]
+   (repl/refresh)
+   (cond
+     (instance? java.util.regex.Pattern o)
+     (test/run-all-tests o)

-(defn test-ns
-  [ns]
-  (repl/refresh)
-  (test/test-ns ns))
-
-(defn test-all
-  ([] (test/run-all-tests #"^datoteka.tests.*"))
-  ([re] (test/run-all-tests re)))
+     (symbol? o)
+     (if-let [sns (namespace o)]
+       (do (require (symbol sns))
+           (test/test-vars [(resolve o)]))
+       (test/test-ns o)))))


when enterprise, remove useless sidebar tabs

--- src-cljs/frontend/components/aside.cljs
+++ src-cljs/frontend/components/aside.cljs
@@ -272,11 +272,15 @@
     {:type :subpage :href "#users" :title "Users" :subpage :users}]))

 (defn account-settings-nav-items []
-  [{:type :subpage :href (routes/v1-account-subpage {:subpage "notifications"}) :title "Notifications" :subpage :notifications}
-   {:type :subpage :href (routes/v1-account-subpage {:subpage "api"}) :title "API Tokens" :subpage :api}
-   {:type :subpage :href (routes/v1-account-subpage {:subpage "heroku"}) :title "Heroku" :subpage :heroku}
-   {:type :subpage :href (routes/v1-account-subpage {:subpage "plans"}) :title "Plan Pricing" :subpage :plans}
-   {:type :subpage :href (routes/v1-account-subpage {:subpage "beta"}) :title "Beta Program" :subpage :beta}])
+  (remove
+    nil?
+    [{:type :subpage :href (routes/v1-account-subpage {:subpage "notifications"}) :title "Notifications" :subpage :notifications}
+     {:type :subpage :href (routes/v1-account-subpage {:subpage "api"}) :title "API Tokens" :subpage :api}
+     {:type :subpage :href (routes/v1-account-subpage {:subpage "heroku"}) :title "Heroku" :subpage :heroku}
+     (when-not (config/enterprise?)
+       {:type :subpage :href (routes/v1-account-subpage {:subpage "plans"}) :title "Plan Pricing" :subpage :plans})
+     (when-not (config/enterprise?)
+       {:type :subpage :href (routes/v1-account-subpage {:subpage "beta"}) :title "Beta Program" :subpage :beta})]))

 (defn account-settings-menu [app owner]
   (reify


light "Builds" nav when button when on a specific build

--- src-cljs/frontend/components/aside.cljs
+++ src-cljs/frontend/components/aside.cljs
@@ -408,6 +408,8 @@
   ((om/get-shared owner :track-event) {:event-type event-name
                                        :properties {:component "left-nav"}}))

+(def light-builds? #{:dashboard :build})
+
 (defn aside-nav-original [{:keys [user current-route owner]}]
   "Original side-nav, preserved for most users as the top-bar-ui-v-1
    is implemented. Case-by-case feature flags too cumbersome as routes change"
@@ -421,7 +423,7 @@
       [:div.logomark
        (common/ico :logo)]]

-     [:a.aside-item {:class (when (= :dashboard current-route) "current")
+     [:a.aside-item {:class (when (light-builds? current-route) "current")
                      :data-placement "right"
                      :data-trigger "hover"
                      :title "Builds"
@@ -541,7 +543,7 @@
   "New side nav, to be used in conjunction with the top bar"
   (html
     [:nav.aside-left-nav
-     [:a.aside-item {:class (when (dashboard-subpages current-route)
+     [:a.aside-item {:class (when (light-builds? current-route)
                               "current")
                      :data-placement "right"
                      :data-trigger "hover"


hide buttons until their features are built

--- src-cljs/frontend/components/aside.cljs
+++ src-cljs/frontend/components/aside.cljs
@@ -18,36 +18,37 @@
           [:button
            (common/icon :logomark-precursor)
            [:span "Precursor"]]
-          [:button
-           (common/icon :user)
-           [:span "Login"]]
-          [:button
-           (common/icon :download)
-           [:span "Download"]]
-          [:button.collaborators
-           (common/icon :users)
-           [:span "Collaborators"]]
-          [:div.aside-collaborators
-           [:button
-            [:object
-             (common/icon :bullet)
-             [:span "Anonymous"]]]
-           [:button
-            [:object
-             (common/icon :bullet)
-             [:span "Anonymous"]]]
-           [:button
-            [:object
-             (common/icon :bullet)
-             [:span "Anonymous"]]]
-           [:button
-            [:object
-             (common/icon :bullet)
-             [:span "Anonymous"]]]
-           [:button
-            [:object
-             (common/icon :bullet)
-             [:span "Anonymous"]]]]
+          ;; hide extra buttons until there's features to back them up
+          ;; [:button
+          ;;  (common/icon :user)
+          ;;  [:span "Login"]]
+          ;; [:button
+          ;;  (common/icon :download)
+          ;;  [:span "Download"]]
+          ;; [:button.collaborators
+          ;;  (common/icon :users)
+          ;;  [:span "Collaborators"]]
+          ;; [:div.aside-collaborators
+          ;;  [:button
+          ;;   [:object
+          ;;    (common/icon :bullet)
+          ;;    [:span "Anonymous"]]]
+          ;;  [:button
+          ;;   [:object
+          ;;    (common/icon :bullet)
+          ;;    [:span "Anonymous"]]]
+          ;;  [:button
+          ;;   [:object
+          ;;    (common/icon :bullet)
+          ;;    [:span "Anonymous"]]]
+          ;;  [:button
+          ;;   [:object
+          ;;    (common/icon :bullet)
+          ;;    [:span "Anonymous"]]]
+          ;;  [:button
+          ;;   [:object
+          ;;    (common/icon :bullet)
+          ;;    [:span "Anonymous"]]]]
           [:div.aside-settings
            [:button
             (common/icon :settings)


always show cursor for arrow tool, faster custom cursor branching

--- src-cljs/frontend/components/mouse.cljs
+++ src-cljs/frontend/components/mouse.cljs
@@ -36,16 +36,19 @@
                       :style #js {:top (:y mouse)
                                   :left (:x mouse)}}

-          (when (keyboard/pan-shortcut-active? app)
-            (dom/div #js {:className " mouse-cursor holo "}
-              (if (:mouse-down app)
-                grabbing-cursor
-                grab-cursor)))
+          (cond (keyboard/pan-shortcut-active? app)
+                (dom/div #js {:className " mouse-cursor holo "
+                              :key "pan"}
+                  (if (:mouse-down app)
+                    grabbing-cursor
+                    grab-cursor))

-          (when (and (keyboard/arrow-shortcut-active? app)
-                     (not (get-in app [:drawing :relation-in-progress?])))
-            (dom/div #js {:className " mouse-cursor arrow-cursor holo "}
-              (common/icon :cursor)))
+                (keyboard/arrow-shortcut-active? app)
+                (dom/div #js {:className " mouse-cursor arrow-cursor holo "
+                              :key "arrow"}
+                  (common/icon :cursor))
+
+                :else nil)

           (when-not (get-in app state/right-click-learned-path)
             (dom/div (get hints :dial))))))))


Renewables.

Renewables.

--- src-cljs/kixi/hecuba/tabs/profiles.cljs
+++ src-cljs/kixi/hecuba/tabs/profiles.cljs
@@ -806,6 +806,238 @@
                    (text-control item state owner :design_high "Design High")]))]
               [:p "No air flow measurements recorded."]))])]))))

+
+(defn photovoltaic-panels-row [profiles owner]
+  (reify
+    om/IRenderState
+    (render-state [_ state]
+      (html
+       [:div.col-md-12
+        (for [profile profiles]
+          [:div {:class (profile-column-width)}
+           (bs/panel
+            "Photovoltaic-Panels"
+            (if-let [photovoltaic-panels (seq (:photovoltaic-panels profile))]
+              [:div
+               (for [item photovoltaic-panels]
+                 (bs/panel
+                  "Photovoltaic Panel"
+                  [:div
+                   (text-control item state owner :percentage_roof_covered "Percentage Roof Covered")
+                   (text-control item state owner :photovoltaic_type "Photovoltaic Type")
+                   (text-control item state owner :photovoltaic_type_other "Photovoltaic Type Other")
+                   (text-control item state owner :make_model "Make Model")
+                   (text-control item state owner :mcs_no "MCS No")
+                   (text-control item state owner :efficiency "Efficiency")
+                   (text-control item state owner :inverter_type "Inverter Type")
+                   (text-control item state owner :inverter_make_model "Inverter Make Model")
+                   (text-control item state owner :inverter_mcs_no "Inverter MCS No")
+                   (text-control item state owner :installer "Installer")
+                   (text-control item state owner :installer_mcs_no "Installer MCS No")
+                   (text-control item state owner :commissioning_date "Commissioning Date")
+                   (text-control item state owner :capacity "Capacity")
+                   (text-control item state owner :area "Area")
+                   (text-control item state owner :orientation "Orientation")
+                   (text-control item state owner :pitch "Pitch")
+                   (text-control item state owner :est_annual_generation "Est Annual Generation")
+                   (text-control item state owner :est_percentage_requirement_met "Est Percentage Requirement Met")
+                   (text-control item state owner :est_percentage_exported "Est Percentage Exported")
+                   (text-control item state owner :performance "Performance")]))]
+              [:p "No Photovoltaic-Panels recorded."]))])]))))
+
+(defn solar-thermal-panels-row [profiles owner]
+  (reify
+    om/IRenderState
+    (render-state [_ state]
+      (html
+       [:div.col-md-12
+        (for [profile profiles]
+          [:div {:class (profile-column-width)}
+           (bs/panel
+            "Solar Thermal Panels"
+            (if-let [solar-thermal-panels (seq (:solar-thermal-panels profile))]
+              [:div
+               (for [item solar-thermal-panels]
+                 (bs/panel
+                  "Solar Thermal Panel"
+                  [:div
+                   (text-control item state owner :solar_type "Solar Type")
+                   (text-control item state owner :solar_type_other "Solar Type Other")
+                   (text-control item state owner :make_model "Make Model")
+                   (text-control item state owner :mcs_no "MCS No")
+                   (text-control item state owner :installer "Installer")
+                   (text-control item state owner :installer_mcs_no "Installer MCS No")
+                   (text-control item state owner :commissioning_date "Commissioning Date")
+                   (text-control item state owner :capacity "Capacity")
+                   (text-control item state owner :area "Area")
+                   (text-control item state owner :orientation "Orientation")
+                   (text-control item state owner :pitch "Pitch")
+                   (text-control item state owner :est_annual_generation "Est Annual Generation")
+                   (text-control item state owner :est_percentage_requirement_met "Est Percentage Requirement Met")]))]
+              [:p "No solar thermal panels recorded."]))])]))))
+
+(defn wind-turbines-row [profiles owner]
+  (reify
+    om/IRenderState
+    (render-state [_ state]
+      (html
+       [:div.col-md-12
+        (for [profile profiles]
+          [:div {:class (profile-column-width)}
+           (bs/panel
+            "Wind Turbines"
+            (if-let [wind-turbines (seq (:wind-turbines profile))]
+              [:div
+               (for [item wind-turbines]
+                 (bs/panel
+                  "Wind Turbine"
+                  [:div
+                   (text-control item state owner :turbine_type "Turbine Type")
+                   (text-control item state owner :turbine_type_other "Turbine Type Other")
+                   (text-control item state owner :make_model "Make Model")
+                   (text-control item state owner :mcs_no "MCS No")
+                   (text-control item state owner :inverter_type "Inverter Type")
+                   (text-control item state owner :inverter_make_model "Inverter Make Model")
+                   (text-control item state owner :inverter_mcs_no "Inverter MCS No")
+                   (text-control item state owner :installer "Installer")
+                   (text-control item state owner :installer_mcs_no "Installer MCS No")
+                   (text-control item state owner :commissioning_date "Commissioning Date")
+                   (text-control item state owner :capacity "Capacity")
+                   (text-control item state owner :hub_height "Hub Height")
+                   (text-control item state owner :height_above_canpoy "Height Above Canpoy")
+                   (text-control item state owner :wind_speed "Wind Speed")
+                   (text-control item state owner :wind_speed_info_source "Wind Speed Info Source")
+                   (text-control item state owner :wind_speed_info_source_other "Wind Speed Info Source Other")
+                   (text-control item state owner :est_annual_generation "Est Annual Generation")
+                   (text-control item state owner :est_percentage_requirement_met "Est Percentage Requirement Met")
+                   (text-control item state owner :est_percentage_exported "Est Percentage Exported")]))]
+              [:p "No wind turbines recorded."]))])]))))
+
+(defn small-hydro-plants-row [profiles owner]
+  (reify
+    om/IRenderState
+    (render-state [_ state]
+      (html
+       [:div.col-md-12
+        (for [profile profiles]
+          [:div {:class (profile-column-width)}
+           (bs/panel
+            "Small Hydro Plants"
+            (if-let [small-hydro-plants (seq (:small-hydro-plants profile))]
+              [:div
+               (for [item small-hydro-plants]
+                 (bs/panel
+                  "Small Hydro Plant"
+                  [:div
+                   (text-control item state owner :hydro_type "Hydro Type")
+                   (text-control item state owner :make_model "Make Model")
+                   (text-control item state owner :mcs_no "MCS No")
+                   (text-control item state owner :inverter_type "Inverter Type")
+                   (text-control item state owner :inverter_make_model "Inverter Make Model")
+                   (text-control item state owner :inverter_mcs_no "Inverter MCS No")
+                   (text-control item state owner :installer "Installer")
+                   (text-control item state owner :installer_mcs_no "Installer MCS No")
+                   (text-control item state owner :commissioning_date "Commissioning Date")
+                   (text-control item state owner :capacity "Capacity")
+                   (text-control item state owner :head_drop "Head Drop")
+                   (text-control item state owner :design_flow "Design Flow")
+                   (text-control item state owner :est_annual_generation "Est Annual Generation")
+                   (text-control item state owner :est_percentage_requirement_met "Est Percentage Requirement Met")
+                   (text-control item state owner :est_percentage_exported "Est Percentage Exported")]))]
+              [:p "No small hydro plants recorded."]))])]))))
+
+(defn heat-pumps-row [profiles owner]
+  (reify
+    om/IRenderState
+    (render-state [_ state]
+      (html
+       [:div.col-md-12
+        (for [profile profiles]
+          [:div {:class (profile-column-width)}
+           (bs/panel
+            "Heat Pumps"
+            (if-let [heat-pumps (seq (:heat-pumps profile))]
+              [:div
+               (for [item heat-pumps]
+                 (bs/panel
+                  "Heat Pump"
+                  [:div
+                   (text-control item state owner :heat_pump_type "Heat Pump Type")
+                   (text-control item state owner :make_model "Make Model")
+                   (text-control item state owner :cop "CoP")
+                   (text-control item state owner :spf "SPF")
+                   (text-control item state owner :mcs_no "MCS No")
+                   (text-control item state owner :installer "Installer")
+                   (text-control item state owner :installer_mcs_no "Installer MCS No")
+                   (text-control item state owner :commissioning_date "Commissioning Date")
+                   (text-control item state owner :heat_source_type "Heat Source Type")
+                   (text-control item state owner :heat_source_type_other "Heat Source Type Other")
+                   (text-control item state owner :depth "Depth")
+                   (text-control item state owner :geology "Geology")
+                   (text-control item state owner :capacity "Capacity")
+                   (text-control item state owner :est_annual_generation "Est Annual Generation")
+                   (text-control item state owner :est_percentage_requirement_met "Est Percentage Requirement Met")
+                   (text-control item state owner :dhw "DHW")
+                   (text-control item state owner :est_percentage_dhw_requirement_met "Est Percentage Dhw Requirement Met")]))]
+              [:p "No heat pumps recorded."]))])]))))
+
+(defn biomass-boilers-row [profiles owner]
+  (reify
+    om/IRenderState
+    (render-state [_ state]
+      (html
+       [:div.col-md-12
+        (for [profile profiles]
+          [:div {:class (profile-column-width)}
+           (bs/panel
+            "Biomass Boilers"
+            (if-let [biomass-boilers (seq (:biomass-boilers profile))]
+              [:div
+               (for [item biomass-boilers]
+                 (bs/panel
+                  "Biomass Boiler"
+                  [:div
+                   (text-control item state owner :biomass_type "Biomass Type")
+                   (text-control item state owner :model "Model")
+                   (text-control item state owner :mcs_no "MCS No")
+                   (text-control item state owner :installer "Installer")
+                   (text-control item state owner :installer_mcs_no "Installer MCS No")
+                   (text-control item state owner :commissioning_date "Commissioning Date")
+                   (text-control item state owner :capacity "Capacity")
+                   (text-control item state owner :percentage_efficiency_from_spec "Percentage Efficiency From Spec")
+                   (text-control item state owner :est_annual_generation "Est Annual Generation")
+                   (text-control item state owner :est_percentage_requirement_met "Est Percentage Requirement Met")]))]
+              [:p "No biomass boilers recorded."]))])]))))
+
+(defn mCHP-systems-row [profiles owner]
+  (reify
+    om/IRenderState
+    (render-state [_ state]
+      (html
+       [:div.col-md-12
+        (for [profile profiles]
+          [:div {:class (profile-column-width)}
+           (bs/panel
+            "mCHP Systems"
+            (if-let [mCHP-systems (seq (:mCHP-systems profile))]
+              [:div
+               (for [item mCHP-systems]
+                 (bs/panel
+                  "mCHP System"
+                  [:div
+                   (text-control item state owner :chp_type "CHP Type")
+                   (text-control item state owner :model "Model")
+                   (text-control item state owner :mcs_no "MCS No")
+                   (text-control item state owner :installer "Installer")
+                   (text-control item state owner :installer_mcs_no "Installer MCS No")
+                   (text-control item state owner :commissioning_date "Commissioning Date")
+                   (text-control item state owner :capacity_elec "Capacity Elec")
+                   (text-control item state owner :capacity_thermal "Capacity Thermal")
+                   (text-control item state owner :est_annual_generation "Est Annual Generation")
+                   (text-control item state owner :est_percentage_thermal_requirement_met "Est Percentage Thermal Requirement Met")
+                   (text-control item state owner :est_percentage_exported "Est Percentage Exported")]))]
+              [:p "No mCHP systems recorded."]))])]))))
+
 (defn profile-rows [profiles owner]
   (reify
     om/IRenderState
@@ -850,16 +1082,13 @@
          (om/build airflow-measurements-row profiles)

          ;; renewable energy systems
-         ;; (om/build photovoltaic-panels profiles)
-         ;; (om/build solar-thermal-panels profiles)
-         ;; (om/build wind-turbines profiles)
-         ;; (om/build small-hydro-plants profiles)
-         ;; (om/build heat-pumps profiles)
-         ;; (om/build biomass-boilers profiles)
-         ;; (om/build mCHP-systems profiles)
-         ]])))
-
-  )
+         (om/build photovoltaic-panels-row profiles)
+         (om/build solar-thermal-panels-row profiles)
+         (om/build wind-turbines-row profiles)
+         (om/build small-hydro-plants-row profiles)
+         (om/build heat-pumps-row profiles)
+         (om/build biomass-boilers-row profiles)
+         (om/build mCHP-systems-row profiles)]]))))

 (defn profiles-div [data owner]
   (reify


Sync with upstream

Sync with upstream

--- src/clojure/clojurewerkz/cassaforte/cql.clj
+++ src/clojure/clojurewerkz/cassaforte/cql.clj
@@ -18,7 +18,7 @@
 (defn ^:private execute-
   [query-params builder]
   (let [rendered-query (client/render-query (client/compile-query query-params builder))]
-    (client/execute client/*default-session* rendered-query :prepared cql/*prepared-statement*)))
+    (client/execute rendered-query :prepared cql/*prepared-statement*)))

 ;;
 ;; Schema operations
@@ -147,7 +147,7 @@
                    (apply query/queries)
                    query/batch-query
                    client/render-query)]
-    (client/execute client/*default-session* query :prepared cql/*prepared-statement*)))
+    (client/execute query :prepared cql/*prepared-statement*)))

 (defn update
   "Updates one or more columns for a given row in a table. The `where` clause


Extract migration helper functions for dropping constraints

This creates `drop-constraints`, along with `drop-primary-key` and
`drop-foreign-keys` which use it to drop particular kinds of
constraints.

--- src/com/puppetlabs/puppetdb/scf/migrate.clj
+++ src/com/puppetlabs/puppetdb/scf/migrate.clj
@@ -22,6 +22,31 @@
                                                     sql-current-connection-database-name
                                                     sql-current-connection-database-version]]))

+(defn- drop-constraints
+  "Drop all constraints of given `constraint-type` on `table`."
+  [table constraint-type]
+  (let [results     (query-to-vec
+                      (str "SELECT constraint_name FROM information_schema.table_constraints "
+                           "WHERE LOWER(table_name) = LOWER(?) AND LOWER(constraint_type) = LOWER(?)")
+                      table constraint-type)
+        constraints (map :constraint_name results)]
+    (if (seq constraints)
+      (apply sql/do-commands
+             (for [constraint constraints]
+               (format "ALTER TABLE %s DROP CONSTRAINT %s" table constraint)))
+      (throw (IllegalArgumentException. (format "No %s constraint exists on the table '%s'" constraint-type table))))))
+
+(defn- drop-primary-key
+  "Drop the primary key on the given `table`."
+  [table]
+  (drop-constraints table "primary key"))
+
+(defn- drop-foreign-keys
+  "Drop all foreign keys on the given `table`. Does not currently support
+  selecting a single key to drop."
+  [table]
+  (drop-constraints table "foreign key"))
+
 (defn initialize-store
   "Create the initial database schema."
   []
@@ -134,12 +159,7 @@
    [(to-timestamp (now))])

   ;; First we get rid of the existing foreign key to certnames
-  (let [[result & _] (query-to-vec
-                      (str "SELECT constraint_name FROM information_schema.table_constraints "
-                           "WHERE LOWER(table_name) = 'certname_facts' AND LOWER(constraint_type) = 'foreign key'"))
-        constraint   (:constraint_name result)]
-    (sql/do-commands
-     (str "ALTER TABLE certname_facts DROP CONSTRAINT " constraint)))
+  (drop-foreign-keys "certname_facts")

   ;; Then we replace it with a foreign key to certname_facts_metadata
   (sql/do-commands