Some refactoring for TITANIC

Some refactoring for TITANIC

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

--- src/conexp/contrib/algorithms/titanic.clj
+++ src/conexp/contrib/algorithms/titanic.clj
@@ -30,47 +30,42 @@
   "Holds the closures of sets. To be rebound.")
 (defvar- set-weight nil
   "Holds the weights of sets. To be rebound.")
-(defvar- subset-weight nil
-  "Holds the minimum of the weights of the proper subsets of a given
-  set. To be rebound.")
-(defvar- max-weight nil
-  "The maximal weight possible. To be rebound.")
+
+(defn- subset-weight
+  "Returns the minimum of the weights of all proper subsets of X."
+  [max-weight X]
+  (minimum (conj (map #(set-weight (disj X %)) X)
+                 max-weight)))

 (defn- titanic-closure
   "Computes the closure of X by the weights of its subsets."
   [X base-set key-set candidates]
-  (let [Y (apply union X (map #(closure (disj X %)) X))]
-    (loop [Y Y,
-           elements (difference base-set Y)]
-      (if-not (empty? elements)
-        (let [m   (first elements),
-              X+m (conj X m),
-              s   (if (contains? candidates X+m)
-                    (get set-weight X+m max-weight)
-                    (minimum (for [K key-set,
-                                   :when (subset? K X+m)]
-                               (get set-weight K max-weight))))]
-          (recur (if (= s (get set-weight X max-weight))
-                   (conj Y m)
-                   Y)
-                 (rest elements)))
-        Y))))
+  (loop [Y (apply union X (map #(closure (disj X %)) X)),
+         elements (difference base-set Y)]
+    (if-not (empty? elements)
+      (let [m   (first elements),
+            X+m (conj X m),
+            s   (if (contains? candidates X+m)
+                  (set-weight X+m)
+                  (minimum (for [K key-set,
+                                 :when (subset? K X+m)]
+                             (set-weight K))))]
+        (recur (if (= s (set-weight X))
+                 (conj Y m)
+                 Y)
+               (rest elements)))
+      Y)))

 (defn- titanic-generate
   "Generates the next candidate set from the given key-set and sets
   subset-weight accordingly."
   [key-set]
-  (let [C (set-of both [A key-set,
-                        B key-set,
-                        :let [both (union A B)]
-                        :when (and (= (inc (count A)) (count both)) ;one more
-                                   (forall [x both]                 ;both is candidate
-                                     (contains? key-set (disj both x))))])]
-    (doseq [X C]
-      (set-val! subset-weight X
-                (minimum (conj (map #(get set-weight (disj X %) max-weight) X)
-                               max-weight))))
-    C))
+  (set-of both [A key-set,
+                B key-set,
+                :let [both (union A B)]
+                :when (and (= (inc (count A)) (count both)) ;one more
+                           (forall [x both]                 ;both is candidate
+                             (contains? key-set (disj both x))))]))

 (defn titanic
   "Implements the titanic algorithm."
@@ -82,15 +77,10 @@
       (illegal-argument "Given partial order for weights does not have a greatest element."))

     (binding [closure       {},
-              set-weight    {},
-              subset-weight {},
-              max-weight    (first max-weight-values),
+              set-weight    (weigh [#{}]),
+              subset-weight (memoize (partial subset-weight (first max-weight-values))),
               minimum       (partial minimum <=-weight)]

-      (set! set-weight (weigh [#{}]))
-      (let [empty-weight (set-weight #{})]
-        (doseq [m base-set]
-          (set-val! subset-weight #{m} empty-weight)))
       (loop [key-set    #{#{}},
              candidates (set-of #{m} [m base-set]),
              key-sets   [key-set]]
@@ -98,8 +88,8 @@
         (doseq [X key-set]
           (set-val! closure X (titanic-closure X base-set key-set candidates)))
         (let [next-key-set (set-of X [X candidates,
-                                      :when (not= (get subset-weight X max-weight)
-                                            (get set-weight X max-weight))])]
+                                      :when (not= (subset-weight X)
+                                                  (set-weight X))])]
           (if-not (empty? next-key-set)
             (recur next-key-set
                    (titanic-generate next-key-set)


Fix impl

Fix impl

--- src/desdemona/query.clj
+++ src/desdemona/query.clj
@@ -83,9 +83,8 @@
   (comp parsed-infix->dsl infix-parser))

 (def ^:private free-sym
-  "Check if an object is a non-fully-qualified symbol."
-  (every-pred symbol?
-              (comp nil? namespace)))
+  "Check if an object has the free variable metadata annotation."
+  (every-pred symbol? (comp ::free meta)))

 (defn ^:private find-free-vars
   "Finds all the free logic variables in a given logic query.


species.clj edited online with Bitbucket

--- resources/species.clj
+++ resources/species.clj
@@ -1,31 +1,30 @@
 {:cyanobacteria {:size 0.3e20
                  :max-size 1e20
                  :min-size 100
-                 :production-rate 0.02
-                 :influence {:detrit 1e-20
-                             :oxygen 1e-20}
+                 :production-rate 0.03
+                 :influence {:detrit 1e-20}
                  :tolerance {:detrit {:model :limit
-                                      :ideal 40
+                                      :ideal 25
                                       :radius 1.5}}}
-
-:lichens {:size 3e5
-           :max-size 1e6
+:lichens {:size 3e4
+           :max-size 1e5
            :min-size 10
            :production-rate 7e-3
-           :influence {:detrit 4e-6
-                       :oxygen 0.3e-6}
+           :influence {:detrit 1e-5}
          :tolerance {:detrit {:model :limit
-                                :ideal 110
-                                :radius 20}}}
+                                :ideal 75
+                                :radius 40}}}
+
  :soilbacteria {:size 0.3e30
                 :max-size 1e30
                 :min-size 100
-                :production-rate 0.05
+                :production-rate 0.01
                 :tolerance {:detrit {:model :limit
                                      :ideal 1.2e-30
                                      :radius -1.2e-30}}
-                :influence {:detrit -0.9e-30
-                            :soil 1e-30}}
+                :influence {:detrit -0.5e-30
+                            :soil 0.04e-30}}
+
  :fungus {:size 0.3e9
           :max-size 1e10
           :min-size 100


Upgrading deps

Upgrading deps


core.async bump

core.async bump


bump version to 3.5.2

bump version to 3.5.2


bump version number

bump version number


updates server deps

updates server deps


0.2.0


[PDOK-2505] regressiontest timeline-changelog added (again)

--- src/test/clojure/pdok/featured/regression_test.clj
+++ src/test/clojure/pdok/featured/regression_test.clj
@@ -61,10 +61,21 @@
 ;(defn- deleted-versions [extracts dataset collection extract-type versions-to-delete]
 ;  (println "do nothing"))

+(defn- query [table selector]
+  (let [clauses (pg/map->where-clause selector)]
+  (j/query test-db [ (str "SELECT * FROM \"featured_regression_regression-set\"." table " "
+                          "WHERE 1 = 1 "
+                          "AND " clauses )])))
+
+(defn- add-changelog-counts [changelog-counts action]
+  (swap! changelog-counts assoc action (+ (or (action @changelog-counts) 0)
+                                          (count (query "timeline_changelog" {:action (name action)})))))
+

 (defn process-feature-permutation [meta feature-permutation]
   (println "  " (map #(into [] (map :action %1)) feature-permutation))
-  (let [extracts (atom {})]
+  (let [extracts (atom {})
+        changelog-counts (atom{})]
     (with-bindings
       {#'e/*process-insert-extract* (partial inserted-features extracts)
        #'e/*process-delete-extract* (partial deleted-versions extracts)
@@ -75,11 +86,15 @@
                       projectors (conj (config/projectors persistence) (config/timeline persistence))
                       processor (processor/create meta "regression-set" persistence projectors)]
                   (dorun (processor/consume processor features))
+                  (doseq [action [:new :change :close :delete]]
+                    (add-changelog-counts changelog-counts action)
+                    )
                   (e/fill-extract "regression-set" nil)
                   (e/flush-changelog "regression-set")
                   (:statistics (processor/shutdown processor))))
               feature-permutation))
-      :extracts extracts})))
+      :extracts extracts
+      :changelog-counts changelog-counts})))

 (defn replay []
   (println "  Replaying")
@@ -109,8 +124,7 @@
          (doseq [p# permutated#]
            (swap! i# inc)
            (clean-db)
-           (let [~results-var (process-feature-permutation meta# p#)
-                 _# (println "extracts: " @(:extracts ~results-var))]
+           (let [~results-var (process-feature-permutation meta# p#)]
              ~@body
              (when (= @i# n#)
                (replay)
@@ -122,11 +136,6 @@
 (defmacro defregressiontest [name file results-var & body]
   `(defregressiontest* ~name false ~file ~results-var ~@body))

-(defn- query [table selector]
-  (let [clauses (pg/map->where-clause selector)]
-  (j/query test-db [ (str "SELECT * FROM \"featured_regression_regression-set\"." table " "
-                          "WHERE 1 = 1 "
-                          "AND " clauses )])))

 (defn- test-persistence
   ([collection selectors] (test-persistence collection nil selectors))
@@ -137,19 +146,16 @@
      (is (= features (count (query "feature" (cond-> {:collection collection}
                                                feature-id (assoc :feature_id feature-id)))))))))

-
-(defn- test-timeline [collection feature-id {:keys [timeline-current timeline timeline-changelog]}]
+(defn- test-timeline-changelog [expected-counts changelog-counts]
+  (doseq [action [:new :change :close :delete]]
+    (is (= (or ((keyword (str "n-" (name action))) expected-counts) 0)
+           (action @changelog-counts)))))
+
+(defn- test-timeline [collection feature-id {:keys [timeline-current timeline timeline-changelog]} changelog-counts]
   (testing "!>>> Timeline"
     (is (= (:n timeline-current) (count (query "timeline_current" {:collection collection :feature_id feature-id}))))
     (is (= (:n timeline) (count (query "timeline" {:collection collection :feature_id feature-id}))))
-    ;(is (= (or (:n-new timeline-changelog) 0)
-    ;       (count (query "timeline_changelog" {:collection collection :action "new"}))))
-    ;(is (= (or (:n-change timeline-changelog) 0)
-    ;       (count (query "timeline_changelog" {:collection collection :action "change"}))))
-    ;(is (= (or (:n-close timeline-changelog) 0)
-    ;       (count (query "timeline_changelog" {:collection collection :action "close"}))))
-    ;(is (= (or (:n-delete timeline-changelog) 0)
-    ;       (count (query "timeline_changelog" {:collection collection :action "delete"}))))
+    (test-timeline-changelog timeline-changelog changelog-counts)
     ))

 (defn- test-timeline->extract [extracts n-extracts]
@@ -170,18 +176,19 @@
   (test-persistence "col-2" "id-b" {:events 1 :features 1})
   (test-timeline "col-2" "id-b" {:timeline-current {:n 1}
                                  :timeline {:n 0}
-                                 :timeline-changelog {:n-new 1}})
+                                 :timeline-changelog {:n-new 1}}
+                 (:changelog-counts results))
   (test-timeline->extract (:extracts results) 1)
-  (test-geoserver "col-2" 1))
+  (test-geoserver "col-2" 1)
+  )

 (defpermutatedtest new-change-feature "col-2_id-b_new-change" results
   (is (= 2 (:n-processed (:stats results))))
   (is (= 0 (:n-errored (:stats results))))
   (test-persistence "col-2" "id-b" {:events 2 :features 1})
   (test-timeline "col-2" "id-b" {:timeline-current {:n 1}
-                                 :timeline {:n 1}})
-  (println "results: " results)
-  (println "extracts: " @(:extracts results))
+                                 :timeline {:n 1}}
+                 (:changelog-counts results))
   (test-timeline->extract (:extracts results) 2)
   (test-geoserver "col-2" 1))

@@ -191,7 +198,8 @@
   (test-persistence "col-2" "id-b" {:events 3 :features 1})
   (test-timeline "col-2" "id-b" {:timeline-current {:n 1}
                                  :timeline {:n 1}
-                                 :timeline-changelog {:n-new 1 :n-change 1 :n-close 1}})
+                                 :timeline-changelog {:n-new 1 :n-change 1 :n-close 1}}
+                 (:changelog-counts results))
   (test-timeline->extract (:extracts results) 2)
   (test-geoserver "col-2" 0))

@@ -201,7 +209,8 @@
   (test-persistence "col-2" "id-b" {:events 4 :features 1})
   (test-timeline "col-2" "id-b" {:timeline-current {:n 1}
                                  :timeline {:n 2}
-                                 :timeline-changelog {:n-new 1 :n-change 2 :n-close 1}})
+                                 :timeline-changelog {:n-new 1 :n-change 2 :n-close 1}}
+                 (:changelog-counts results))
   (test-timeline->extract (:extracts results) 3)
   (test-geoserver "col-2" 0))

@@ -211,7 +220,8 @@
   (test-persistence "col-1" "id-a" {:events 4 :features 1})
   (test-timeline "col-1" "id-a" {:timeline-current {:n 0}
                                  :timeline {:n 0}
-                                 :timeline-changelog {:n-new 1 :n-change 2 :n-delete 3}})
+                                 :timeline-changelog {:n-new 1 :n-change 2 :n-delete 3}}
+                 (:changelog-counts results))
   (test-timeline->extract (:extracts results) 0)
   (test-geoserver "col-1" 0))

@@ -221,7 +231,8 @@
   (test-persistence "col-1" "id-a" {:events 6 :features 1})
   (test-timeline "col-1" "id-a" {:timeline-current {:n 1}
                                  :timeline {:n 1}
-                                 :timeline-changelog {:n-new 2 :n-change 3 :n-delete 3}})
+                                 :timeline-changelog {:n-new 2 :n-change 3 :n-delete 3}}
+                 (:changelog-counts results))
   (test-timeline->extract (:extracts results) 2)
   (test-geoserver "col-1" 1))

@@ -232,7 +243,8 @@
   (test-persistence "col-2$nested" {:events 1 :features 1})
   (test-timeline "col-2" "id-b" {:timeline-current {:n 1}
                                  :timeline {:n 0}
-                                 :timeline-changelog {:n-new 1 :n-change 1}})
+                                 :timeline-changelog {:n-new 1 :n-change 1}}
+                 (:changelog-counts results))
   (test-timeline->extract (:extracts results) 1)
   (test-geoserver "col-2" 1))

@@ -243,7 +255,8 @@
   (test-persistence "col-2$nested" {:events 1 :features 1})
   (test-timeline "col-2" "id-b" {:timeline-current {:n 1}
                                  :timeline {:n 0}
-                                 :timeline-changelog {:n-new 1 :n-change 1}})
+                                 :timeline-changelog {:n-new 1 :n-change 1}}
+                 (:changelog-counts results))
   (test-timeline->extract (:extracts results) 1)
   (test-geoserver "col-2" 1))

@@ -252,7 +265,9 @@
   (is (= 0 (:n-errored (:stats results))))
   (test-persistence "col-3" "id-c" {:events 2 :features 1})
   (test-timeline "col-3" "id-c" {:timeline-current {:n 0}
-                                 :timeline {:n 0}})
+                                 :timeline {:n 0}
+                                 :timeline-changelog {:n-new 1 :n-delete 1}}
+                 (:changelog-counts results))
   (test-timeline->extract (:extracts results) 0)
   (test-geoserver "col-3" 0))

@@ -262,7 +277,9 @@
   (test-persistence "col-3" "id-c" {:events 3 :features 1})
   (test-persistence "col-3$nested" {:events 5 :features 3})
   (test-timeline "col-3" "id-c" {:timeline-current {:n 1}
-                                 :timeline {:n 2}})
+                                 :timeline {:n 2}
+                                 :timeline-changelog {:n-new 1 :n-change 2}}
+                 (:changelog-counts results))
   (test-timeline->extract (:extracts results) 3)
   (test-geoserver "col-3" 1))

@@ -274,7 +291,8 @@
   (test-persistence "col-2$nestedserie$label" {:events 5 :features 3})
   (test-timeline "col-2" "id-b" {:timeline-current {:n 1}
                                  :timeline {:n 1}
-                                 :timeline-changelog {:n-new 2 :n-change 7 :n-delete 3 :n-close 2}})
+                                 :timeline-changelog {:n-new 2 :n-change 7 :n-delete 3 :n-close 2}}
+                 (:changelog-counts results))
   (test-timeline->extract (:extracts results) 2)
   (test-geoserver "col-2" 1)
   (test-geoserver "col-2$nestedserie$label" 1))
@@ -286,7 +304,8 @@
   (test-persistence "col-2$nested" {:events 0 :features 0})
   (test-timeline "col-2" "id-b" {:timeline-current {:n 0}
                                  :timeline {:n 0}
-                                 :timeline-changelog {}})
+                                 :timeline-changelog {}}
+                 (:changelog-counts results))
   (test-timeline->extract (:extracts results) 0)
   (test-geoserver "col-2" 0)
   (test-geoserver "col-2$nested" 0))
@@ -299,7 +318,8 @@
   (test-persistence "col-2$nestedserie$label" {:events 1 :features 1})
   (test-timeline "col-2" "id-b" {:timeline-current {:n 1}
                                  :timeline {:n 0}
-                                 :timeline-changelog {:n-new 1 :n-change 2}})
+                                 :timeline-changelog {:n-new 1 :n-change 2}}
+                 (:changelog-counts results))
   (test-timeline->extract (:extracts results) 1)
   (test-geoserver "col-2" 1)
   (test-geoserver "col-2$nestedserie" 0)


Add a convenience arity to resolve-column-id so you when you don't supply a not-found value it defaults to nil

--- src/grafter/tabular.clj
+++ src/grafter/tabular.clj
@@ -46,12 +46,14 @@

 (defn resolve-column-id
   "Finds and resolves the column id by converting between symbols and
-  strings.  If column-key is not found in the datsets headers then nil
-  is returned."
-  [dataset column-key not-found]
-
-  (let [headers (column-names dataset)]
-    (resolve-col-id column-key headers not-found)))
+  strings.  If column-key is not found in the datsets headers then
+  not-found is returned."
+
+  ([dataset column-key] (resolve-column-id dataset column-key nil))
+  ([dataset column-key not-found]
+
+     (let [headers (column-names dataset)]
+       (resolve-col-id column-key headers not-found))))

 (defn- invalid-column-keys
   "Takes a sequence of column key names and a dataset and returns a


Remove println in prod

Remove println in prod

--- src/grimoire/things.clj
+++ src/grimoire/things.clj
@@ -395,5 +395,4 @@
                       [(url/url-decode (nth path-elems 5))]
                       (drop 6 path-elems))
                      path-elems)]
-    (println path-elems)
     (path->thing (string/join "/" path-elems))))


bugfix: splitting empty string produces empty string

--- src/harnocode/core.cljs
+++ src/harnocode/core.cljs
@@ -96,12 +96,14 @@
 (defn split-string-literal [token l result]
  (let [[quote & value-rest] (:value token)
        text   (string/join (butlast value-rest))
-       chunks (re-seq #"..?.?.?" text)
+       chunks (re-seq #".?.?.?.?" text)
        plus   {:value "+", :type "Punctuator"}
        quoted-chunks (map #(str quote % quote) chunks)
        quoted-tokens (map (fn [t] {:value t :type "String"}) quoted-chunks)
        interleaved (butlast (interleave quoted-tokens (cycle [plus])))]
-    interleaved))
+    ;[token]   ;  == do nothing
+    interleaved
+    ))

 (defn split-string-literals [tokens l]
   (let [split-token (fn [token]


Bump to clojure version 1.8.0

Bump to clojure version 1.8.0

--- scheduler/project.clj
+++ scheduler/project.clj
@@ -16,7 +16,7 @@
 (defproject cook "1.0.1-SNAPSHOT"
   :description "This launches jobs on a Mesos cluster with fair sharing and preemption"
   :license {:name "Apache License, Version 2.0"}
-  :dependencies [[org.clojure/clojure "1.7.0"]
+  :dependencies [[org.clojure/clojure "1.8.0"]

                  ;;Data marshalling
                  [org.clojure/data.codec "0.1.0"]


Added three tests into irc-bot-test module

--- test/emender_jenkins/irc_bot_test.clj
+++ test/emender_jenkins/irc_bot_test.clj
@@ -47,3 +47,18 @@
     (testing "if the emender-jenkins.irc-bot/prepare-reply-text definition exists."
         (is (callable? 'emender-jenkins.irc-bot/prepare-reply-text))))

+(deftest test-on-incoming-message
+    "Check that the emender-jenkins.irc-bot/on-incoming-message definition exists."
+    (testing "if the emender-jenkins.irc-bot/on-incoming-message definition exists."
+        (is (callable? 'emender-jenkins.irc-bot/on-incoming-message))))
+
+(deftest test-send-message
+    "Check that the emender-jenkins.irc-bot/send-message definition exists."
+    (testing "if the emender-jenkins.irc-bot/send-message definition exists."
+        (is (callable? 'emender-jenkins.irc-bot/send-message))))
+
+(deftest test-start-irc-bot
+    "Check that the emender-jenkins.irc-bot/start-irc-bot definition exists."
+    (testing "if the emender-jenkins.irc-bot/start-irc-bot definition exists."
+        (is (callable? 'emender-jenkins.irc-bot/start-irc-bot))))
+


Add tests for gradient-forward-polar, gradient-aft-polar, theta-switch

--- test/hydrofoil/expectations/model.clj
+++ test/hydrofoil/expectations/model.clj
@@ -2,7 +2,8 @@
   (:require [expectations :refer :all]
             [hydrofoil.model :refer :all]
             [hydrofoil.core :refer :all]
-            [hydrofoil.evolution :refer :all]))
+            [hydrofoil.evolution :refer :all]
+            [hydrofoil.utils :refer :all]))

 ;;; --------- thickness-function tests ------------
 ; thickness 0:
@@ -140,6 +141,30 @@

 (expect 0.5165
         (round-double (lower-surface-x-function (NACA-design 9.5 9 40) 0.5)))
+
+;;----------gradient-forward-polar-function ------------
+(expect 0.0000
+        (round-double (gradient-forward-polar-function (NACA-design 0 0.5 20) 0.5)))
+
+(expect -0.0234
+        (round-double (gradient-forward-polar-function (NACA-design 4.75 4.5 100) 1.5708)))
+
+(expect 0.0938
+        (round-double (gradient-forward-polar-function (NACA-design 9.5 9 40) 4.71239)))
+
+;;----------gradient-aft-polar-function ------------
+(expect 0.000
+        (round-double (gradient-aft-polar-function (NACA-design 0 0.5 20) 0.5)))
+
+(expect -0.0156
+        (round-double (gradient-aft-polar-function (NACA-design 4.75 4.5 100) 1.5708)))
+
+(expect 7.6
+        (round-double (gradient-aft-polar-function (NACA-design 9.5 9 40) 4.71239)))
+
+;;-------- theta-switch ----------
+(expect 1.5708
+        (round-double (theta-switch (NACA-design 5 5 5))))

 ;;;-------- riemann-sum ----------
 (expect 0.0681
@@ -191,3 +216,4 @@
         (round-double (area (NACA-design 3 40 12)))) ;; assymetric -- thin foil
 (expect 0.1367
         (round-double (area (NACA-design 9.5 0 20)))) ;; assymetric -- thick foil
+


Use testrepo for tests

Use testrepo for tests

--- test/lambdacd_git/end_to_end_test.clj
+++ test/lambdacd_git/end_to_end_test.clj
@@ -29,7 +29,7 @@
 (deftest end-to-end-test
   (testing "a complete pipeline"
     (core/init-ssh!)
-    (doseq [repo-uri ["https://github.com/flosell/lambdacd-git.git"]]
+    (doseq [repo-uri ["https://github.com/flosell/testrepo.git"]]
       (testing (str "repo-uri" repo-uri)
         (let [config                 {:home-dir (lambdacd-util/create-temp-dir)
                                       :repo-uri repo-uri}


try combining filtration and transformation

--- src/main/clojure/org/dada/demo/whales.clj
+++ src/main/clojure/org/dada/demo/whales.clj
@@ -105,7 +105,7 @@
 ;; create 10,000 whales and insert them into model
 (insert-n
  whales
- (let [num-whales 100000
+ (let [num-whales 1000
        time (System/currentTimeMillis)
        #^Creator creator (.getCreator whale-metadata)]
    (for [id (range time (+ time num-whales))]
@@ -139,6 +139,25 @@

 (def blue-whales-length (do-transform "length" blue-whales :time :version :length))
 (insert *metamodel* blue-whales-length)
+
+;;----------------------------------------
+;; try a transformation on top of a filtration
+;; e.g. select time, version, length from whales where type="narwhal"
+;;----------------------------------------
+
+(def narwhals-length
+     (do-transform
+      "length"
+      (do-filter
+       "type=narwhal"
+       whales
+       '(:type)
+       #(= "narwhal" %))
+      :time
+      :version
+      :length)
+     )
+(insert *metamodel* narwhals-length)

 ;;----------------------------------------
 ;; select - being refactored into filter, transform, aggregate, group, ...


refactor whale construction

refactor whale construction

--- src/main/clojure/org/dada/demo/whales.clj
+++ src/main/clojure/org/dada/demo/whales.clj
@@ -108,9 +108,25 @@
 (def #^Metadata whale-metadata (metadata Whale [:id] md-attributes))
 (def #^Model whales-model (model "Whales" :version whale-metadata))

-(def num-whales 1000)
-
 (insert *metamodel* whales-model)
+
+(let [#^Creator creator (.getCreator whale-metadata)
+      max-length-x-100 (* max-length 100)
+      max-weight-x-100 (* max-weight 100)]
+
+  (defn whale [id]
+    (.create
+     creator
+     (into-array
+      Object
+      [id
+       0
+       (Date. (rand-int 10)
+	      (rand-int 12)
+	      (+ (rand-int 28) 1))
+       (rnd types)
+       (/ (rand-int max-length-x-100) 100)
+       (/ (rand-int max-weight-x-100) 100)]))))

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

@@ -126,29 +142,12 @@
 ;;--------------------------------------------------------------------------------
 ;; create some whales...

+(def num-whales 1000)
+
 (time
  (doall
-  (let [batcher (Batcher. 999 1000 (list whales-model))
-	#^Creator creator (.getCreator whale-metadata)
-	max-length-x-100 (* max-length 100)
-	max-weight-x-100 (* max-weight 100)]
-    (pmap
-     (fn [id]
-	 (insert
-	  whales-model ;; batcher
-	  (.create
-	   creator
-	   (into-array
-	    Object
-	    [id
-	     0
-	     (Date. (rand-int 10)
-		    (rand-int 12)
-		    (+ (rand-int 28) 1))
-	     (rnd types)
-	     (/ (rand-int max-length-x-100) 100)
-	     (/ (rand-int max-weight-x-100) 100)]))))
-     (range num-whales)))))
+  (let [batcher (Batcher. 999 1000 (list whales-model))]
+    (pmap (fn [id] (insert whales-model (whale id))) (range num-whales)))))

 (println "LOADED: " num-whales)


add go >! instead of blocking thread

add go >! instead of blocking thread

--- clj-tcp/src/clj_tcp/client.clj
+++ clj-tcp/src/clj_tcp/client.clj
@@ -68,8 +68,9 @@
       ;(prn "channel read 0")
       ;(info "channelRead0")
       (let [d (if (instance? ByteBuf in) (buffer->bytes in) in)]
-         (go (>! read-ch d)))
-      )
+         (try
+           (go (>! read-ch d))
+           (catch java.lang.AssertionError e (>!! read-ch d)))))
     (exceptionCaught [^ChannelHandlerContext ctx cause]
       (error "Client-handler exception caught " cause)
       (error cause (>!! internal-error-ch [cause ctx]) )


MSC gets in the way of this hint, dammit.

--- modules/core/src/main/clojure/immutant/utilities.clj
+++ modules/core/src/main/clojure/immutant/utilities.clj
@@ -19,8 +19,7 @@
   "Various utility functions."
   (:require [immutant.registry :as lookup]
             [clojure.string    :as str])
-  (:import org.immutant.core.Closer
-           org.jboss.as.network.NetworkInterfaceBinding))
+  (:import org.immutant.core.Closer))

 (defn app-root
   "Returns a file pointing to the root dir of the application"
@@ -44,7 +43,7 @@
 (defn ^{:private true} lookup-interface-address
   "Looks up the ip address from the proper service for the given name."
   [name]
-  (-> ^NetworkInterfaceBinding (lookup/fetch (str "jboss.network." name))
+  (-> (lookup/fetch (str "jboss.network." name))
       .getAddress
       .getHostAddress))


Fix off-by-one error in Join.up

Fix off-by-one error in Join.up

--- src/aurora/btree.cljs
+++ src/aurora/btree.cljs
@@ -428,6 +428,15 @@

 (deftype Join [seek-key iterators var->iterators ^:mutable end?]
   Object
+  (reset [this]
+         (prn)
+         (prn :reset)
+         (dotimes [i (alength iterators)]
+           (.reset (aget iterators i)))
+         (dotimes [i (alength seek-key)]
+           (aset seek-key i least))
+         (set! end? false)
+         (.down this -1))
   (key [this]
        (when (false? end?)
          seek-key))
@@ -437,7 +446,7 @@
                 num-iterators (alength iterators)]
             (loop [max-key (.key-at (aget iterators (- num-iterators 1)) var)
                    current 0]
-              (prn :search max-key current)
+              (prn :search max-key current seek-key)
               (let [iterator (aget iterators current)
                     min-key (.key-at iterator var)]
                 (aset seek-key var max-key)
@@ -457,13 +466,13 @@
                           (recur min-key (mod (+ current 1) num-iterators)))))))))))
   (up [this old-var]
       ;; assumes prefixes and keys all equal, nothing at end
-      (prn :up old-var)
+      (prn :up old-var seek-key)
       (if (== old-var 0)
         (set! end? true)
         (let [new-var (- old-var 1)
               iterators (aget var->iterators new-var)
               iterator (aget iterators (- (alength iterators) 1))]
-          (when (< old-var (- (alength var->iterators) 1))
+          (when (< old-var (alength var->iterators))
             (aset seek-key old-var least))
           (.next iterator)
           (if (.end? iterator)
@@ -473,7 +482,7 @@
             (.search this new-var)))))
   (down [this old-var old-key]
         ;; assumes prefixes all equal, nothing at end
-        (prn :down old-var old-key)
+        (prn :down old-var old-key seek-key)
         (if (== old-var (- (alength var->iterators) 1))
           (aset seek-key old-var old-key) ;; done
           (let [new-var (+ old-var 1)


Fix noun /get/ to /inspection/ - issue #8

--- src/restaurant_inspections_api/routes.clj
+++ src/restaurant_inspections_api/routes.clj
@@ -5,7 +5,7 @@

 (defroutes all-routes
            (GET "/" [] (srv/home))
-           (GET "/get/:id" [id] (srv/get-details id))
+           (GET "/inspection/:id" [id] (srv/get-details id))
            (GET "/list-counties" [] (srv/get-dist-counties))
            (GET ["/location/:zips" :zips #"[^/]+"]
                 [startDate endDate zips]


Create a new map instead of filtering the raw one

When creating catalog items create new items based on the format of the
raw item. Create the new items from scratch instead of changing the raw
item.

--- src/catalog/vubis.clj
+++ src/catalog/vubis.clj
@@ -20,34 +20,34 @@
    :creator [:datafield (attr= :tag "100") :subfield] ; autor
    :source [:datafield (attr= :tag "020") :subfield] ; isbn
    :description [:datafield (attr= :tag "520") :subfield] ; abstract
-   :volumes-raw [:datafield (attr= :tag "300") :subfield (attr= :code "9")] ; Anzahl Medien
+   :volumes [:datafield (attr= :tag "300") :subfield (attr= :code "9")] ; Anzahl Medien
    :source-publisher [:datafield (attr= :tag "534") :subfield (attr= :code "c")] ; Verlag
-   :source-date-raw [:datafield (attr= :tag "534") :subfield (attr= :code "d")] ; Erscheinungsjahr
+   :source-date [:datafield (attr= :tag "534") :subfield (attr= :code "d")] ; Erscheinungsjahr
    :language [:datafield (attr= :tag "041") :subfield (attr= :code "a")] ; Sprache
    :general-note [:datafield (attr= :tag "500") :subfield (attr= :code "a")] ; Land, Erscheinungsjahr (des Originalfilms)
    :accompanying_material [:datafield (attr= :tag "300") :subfield (attr= :code "e")] ; Begleitmaterial
    :personel-name [:datafield (attr= :tag "700") :subfield (attr= :code "a")] ; Regie oder Darsteller
    :personel-relator-term [:datafield (attr= :tag "700") :subfield (attr= :code "e")]
-   :narrators-raw [:datafield (attr= :tag "709") :subfield (attr= :code "a")] ; Sprecher
+   :narrators [:datafield (attr= :tag "709") :subfield (attr= :code "a")] ; Sprecher
    :duration [:datafield (attr= :tag "391") :subfield (attr= :code "a")] ; Spieldauer
-   :braille-grade-raw [:datafield (attr= :tag "392") :subfield (attr= :code "a")] ; Schriftart Braille
-   :braille-music-grade-raw [:datafield (attr= :tag "393") :subfield (attr= :code "a")] ; Schriftart Braille
-   :producer-long-raw [:datafield (attr= :tag "260") :subfield (attr= :code "b")] ; Produzent
-   :producer-raw [:datafield (attr= :tag "260") :subfield (attr= :code "9")] ; a number that determines Produzent Kürzel und Stadt
-   :producer-place-raw [:datafield (attr= :tag "260") :subfield (attr= :code "a")] ; Produzent Stadt
-   :produced-date-raw [:datafield (attr= :tag "260") :subfield (attr= :code "c")]
-   :produced-commercially-raw? [:datafield (attr= :tag "260") :subfield (attr= :code "d")] ; kommerziell?
-   :series-title-raw [:datafield (attr= :tag "830") :subfield (attr= :code "a")] ; u.a. Rucksackbuch
-   :series-volume-raw [:datafield (attr= :tag "830") :subfield (attr= :code "v")]
-   :format-raw [:datafield (attr= :tag "091") :subfield (attr= :code "c")]
-   :genre-raw [:datafield (attr= :tag "099") :subfield (attr= :code "b")]
+   :braille-grade [:datafield (attr= :tag "392") :subfield (attr= :code "a")] ; Schriftart Braille
+   :braille-music-grade [:datafield (attr= :tag "393") :subfield (attr= :code "a")] ; Schriftart Braille
+   :producer-long [:datafield (attr= :tag "260") :subfield (attr= :code "b")] ; Produzent
+   :producer [:datafield (attr= :tag "260") :subfield (attr= :code "9")] ; a number that determines Produzent Kürzel und Stadt
+   :producer-place [:datafield (attr= :tag "260") :subfield (attr= :code "a")] ; Produzent Stadt
+   :produced-date [:datafield (attr= :tag "260") :subfield (attr= :code "c")]
+   :produced-commercially? [:datafield (attr= :tag "260") :subfield (attr= :code "d")] ; kommerziell?
+   :series-title [:datafield (attr= :tag "830") :subfield (attr= :code "a")] ; u.a. Rucksackbuch
+   :series-volume [:datafield (attr= :tag "830") :subfield (attr= :code "v")]
+   :format [:datafield (attr= :tag "091") :subfield (attr= :code "c")]
+   :genre [:datafield (attr= :tag "099") :subfield (attr= :code "b")]
    :genre-code [:datafield (attr= :tag "099") :subfield (attr= :code "a")] ; used for movie genre i.e. Filmkategorie
    :library-signature [:datafield (attr= :tag "091") :subfield (attr= :code "a")] ; Signaturen
    :product-number [:datafield (attr= :tag "024") :subfield (attr= :code "a")] ; MVL-Bestellnummer
    :price [:datafield (attr= :tag "024") :subfield (attr= :code "c")] ; Preis
-   :game-category-raw [:datafield (attr= :tag "024") :fixme] ; Spiel-Systematikgruppe
-   :game-description-raw [:datafield (attr= :tag "300") :subfield (attr= :code "a")] ; Beschreibung von Spielen
-   :game-materials-raw [:datafield (attr= :tag "024") :fixme] ; Spiel-Materialdetails
+   :game-category [:datafield (attr= :tag "024") :fixme] ; Spiel-Systematikgruppe
+   :game-description [:datafield (attr= :tag "300") :subfield (attr= :code "a")] ; Beschreibung von Spielen
+   :game-materials [:datafield (attr= :tag "024") :fixme] ; Spiel-Materialdetails
    })

 (def iso-639-2-to-iso-639-1
@@ -172,49 +172,66 @@
          remove-nonprintable-chars)))

 (defn clean-raw-item
-  "Return a proper production based on a raw item, i.e.
+  "Return a proper production based on a raw item, e.g.
   translate the language tag into proper ISO 639-1 codes"
-  [{:keys [genre-raw genre-code language format-raw producer-raw
-           produced-commercially-raw? source-date-raw general-note
-           series-title-raw series-volume-raw duration
-           volumes-raw narrators-raw producer-long-raw
-           game-category-raw game-description-raw game-materials-raw
-           braille-grade-raw title] :as item
-    :or {genre-raw "x01"}}]
-  (let [rucksackbuch-number (when (and series-title-raw
-                                       (re-find #"^Rucksackbuch" series-title-raw))
-                              (Integer/parseInt series-volume-raw))
-        fmt (format-raw-to-format format-raw)]
-    (-> item
-        (assoc-some
-         :title (remove-nonprintable-chars title)
-         :language (iso-639-2-to-iso-639-1 language)
-         :genre (or (genre-raw-to-genre (subs genre-raw 0 1))
-                    (genre-code-to-genre (subs genre-code 0 2)))
-         :sub-genre (genre-raw-to-subgenre (subs genre-raw 0 3))
-         :format fmt
-         :producer-brief (producer-raw-to-producer (Integer/parseInt producer-raw))
-         :produced-commercially? (when (= fmt :hörbuch) (some? produced-commercially-raw?))
-         :rucksackbuch-number (when (= fmt :braille) rucksackbuch-number)
-         :rucksackbuch? (when (= fmt :braille) (if rucksackbuch-number true false))
-         :duration (when (= fmt :hörbuch) (get-duration duration))
-         :braille-grade (when (= fmt :braille) (braille-grade-raw-to-braille-grade braille-grade-raw))
-         :source-date (get-year source-date-raw)
-         :narrators (when (and (= fmt :hörbuch) (not-empty narrators-raw))
-                      (map normalize-name narrators-raw))
-         :volumes (when (#{:braille :grossdruck} fmt) volumes-raw)
-         :movie_country (when general-note (second (re-find #"^Originalversion: (.*)$" general-note)))
-         :producer (when (= fmt :hörfilm) producer-long-raw)
-         :game-category (when (= fmt :ludo) game-category-raw)
-         :game-description (when (= fmt :ludo) game-description-raw)
-         :game-materials (when (= fmt :ludo) game-materials-raw))
-        (dissoc :genre-raw :genre-code :format-raw :producer-raw
-                :series-title-raw :series-volume-raw :source-date-raw
-                :produced-commercially-raw? :braille-grade-raw
-                :volumes-raw :producer-long-raw :narrators-raw
-                :produced-date-raw :producer-place-raw
-                :game-category-raw :game-description-raw :game-materials-raw
-                :personel-name :personel-relator-term))))
+  [{:keys [record-id source description source-publisher
+           library-signature title
+           genre genre-code language format producer
+           produced-commercially? source-date general-note
+           series-title series-volume duration
+           volumes narrators producer-long
+           game-category game-description game-materials
+           braille-grade personel-name] :as item
+    :or {genre "x01"}}]
+  (let [fmt (format-raw-to-format format)
+        item (-> {}
+                 (assoc-some
+                  :record-id record-id
+                  :title (remove-nonprintable-chars title)
+                  :description description
+                  :source-publisher source-publisher
+                  :source source
+                  :language (iso-639-2-to-iso-639-1 language)
+                  :genre (or (genre-raw-to-genre (subs genre 0 1))
+                             (genre-code-to-genre (subs genre-code 0 2)))
+                  :sub-genre (genre-raw-to-subgenre (subs genre 0 3))
+                  :format fmt
+                  :producer-brief (producer-raw-to-producer (Integer/parseInt producer))
+                  :source-date (get-year source-date)
+                  :library-signature library-signature))]
+    (case fmt
+      :hörbuch (-> item
+                   (assoc-some
+                    :produced-commercially? (some? produced-commercially?)
+                    :duration (get-duration duration)
+                    :narrators (not-empty (map normalize-name narrators))))
+      :braille (let [rucksackbuch-number (and series-title
+                                              (re-find #"^Rucksackbuch" series-title)
+                                              (Integer/parseInt series-volume))]
+                 (-> item
+                     (assoc-some
+                      :rucksackbuch-number rucksackbuch-number
+                      :rucksackbuch? (boolean rucksackbuch-number)
+                      :braille-grade (braille-grade-raw-to-braille-grade braille-grade)
+                      :volumes volumes)))
+      :grossdruck (-> item
+                      (assoc-some
+                       :volumes volumes))
+      :hörfilm (-> item
+                   (assoc-some
+                    :movie_country (and general-note
+                                        (second (re-find #"^Originalversion: (.*)$" general-note)))
+                    :producer producer-long
+                    :personel-name personel-name))
+      :ludo (-> item
+                (assoc-some
+                 :game-category game-category
+                 :game-description game-description
+                 :game-materials game-materials))
+
+      :e-book item
+      :musiknoten item
+      :taktilesbuch item)))

 (defn select-vals
   "Return a list of the values for the given keys `ks` from `item` if
@@ -281,7 +298,7 @@
     (for [record (xml-> root :record)]
       (->> (for [[key path] param-mapping
                  :let [val (cond
-                             (#{:narrators-raw} key) (get-multi-subfields record path)
+                             (#{:narrators} key) (get-multi-subfields record path)
                              :else (get-subfield record path))]
                  :when (some? val)]
              [key val])


Nope, disable swank.

Nope, disable swank.

--- src/circleci/init.clj
+++ src/circleci/init.clj
@@ -9,7 +9,7 @@
 (defn -main []
   (try
     (circleci.logging/init)
-    (circleci.swank/init)
+    ;;(circleci.swank/init)
     (circleci.db/init)
     (circleci.db.migrations/init)
     (circleci.web/init)


Support timestamps with milliseconds

Support timestamps with milliseconds

Use date-time formatter instead of date-time-no-ms. date-time also handles
timestamps without milliseconds, so we don't lose anything by using it.

--- src/riemann/elastic.clj
+++ src/riemann/elastic.clj
@@ -27,7 +27,7 @@
       (clj-time.format/unparse formatter date))))

 (def ^{:private true} format-iso8601
-  (clj-time.format/with-zone (clj-time.format/formatters :date-time-no-ms)
+  (clj-time.format/with-zone (clj-time.format/formatters :date-time)
     clj-time.core/utc))

 (defn ^{:private true} iso8601 [event-s]


* mention how to do it on windows as well

--- src/riemann/logging.clj
+++ src/riemann/logging.clj
@@ -25,7 +25,8 @@
 (defn init
   "Initialize log4j. You will probably call this from the config file. Options:

-  :file   The file to log to. Use \"/dev/null\" to log to stdout only."
+  :file   The file to log to.
+          Use \"/dev/null\" on *nix or \"NUL:\" on Windows to log to stdout only."
   [& { :keys [file] }]
   (let [filename (or file "riemann.log")
         rolling-policy (doto (TimeBasedRollingPolicy.)


Fix shapes drawing when zoom is activated.

--- src/uxbox/main/ui/workspace/drawarea.cljs
+++ src/uxbox/main/ui/workspace/drawarea.cljs
@@ -150,14 +150,23 @@
           pos
           immanted-zones))

+(defn- translate-to-canvas
+  [point]
+  (let [zoom @wb/zoom-ref
+        ccords (gpt/multiply canvas-coords zoom)]
+    (-> point
+        (gpt/subtract ccords)
+        (gpt/divide zoom))))
+
+(defn- conditional-align
+  [point]
+  (if @wb/alignment-ref
+    (uds/align-point point)
+    (rx/of point)))
+
 (defn- on-init-draw-path
   [shape]
-  (letfn [(conditional-align-point [point]
-            (if @wb/alignment-ref
-              (uds/align-point point)
-              (rx/of point)))
-
-          (stoper-event? [[type opts]]
+  (letfn [(stoper-event? [[type opts]]
             (or (and (= type :key/down)
                      (= (:key opts) 13))
                 (and (= type :mouse/double-click)
@@ -169,9 +178,8 @@
                  (false? (:shift? opts))))]

     (let [mouse (->> (rx/sample 10 wb/mouse-viewport-s)
-                     (rx/mapcat conditional-align-point)
-                     (rx/map #(gpt/subtract % canvas-coords)))
-
+                     (rx/mapcat conditional-align)
+                     (rx/map translate-to-canvas))
           stoper (->> (rx/merge
                        (rx/take 1 drawing-stoper)
                        (rx/filter stoper-event? wb/events-s))
@@ -238,11 +246,8 @@
 (defn- on-init-draw-free-path
   [shape]
   (let [mouse (->> (rx/sample 10 wb/mouse-viewport-s)
-                   (rx/mapcat (fn [point]
-                                (if @wb/alignment-ref
-                                  (uds/align-point point)
-                                  (rx/of point))))
-                   (rx/map #(gpt/subtract % canvas-coords)))
+                   (rx/mapcat conditional-align)
+                   (rx/map translate-to-canvas))
         stoper (->> wb/events-s
                     (rx/map first)
                     (rx/filter #(= % :mouse/up))
@@ -275,12 +280,8 @@
 (defn- on-init-draw-generic
   [shape]
   (let [mouse (->> wb/mouse-viewport-s
-                   (rx/mapcat (fn [point]
-                                (if @wb/alignment-ref
-                                  (uds/align-point point)
-                                  (rx/of point))))
-                   (rx/map #(gpt/subtract % canvas-coords)))
-
+                   (rx/mapcat conditional-align)
+                   (rx/map translate-to-canvas))
         stoper (->> wb/events-s
                     (rx/map first)
                     (rx/filter #(= % :mouse/up))
@@ -295,8 +296,7 @@
                 (reset! drawing-shape shape)))

             (on-draw [[pt ctrl?]]
-              (let [pt (gpt/divide pt @wb/zoom-ref)]
-                (reset! drawing-position (assoc pt :lock ctrl?))))
+              (reset! drawing-position (assoc pt :lock ctrl?)))
             (on-end []
               (let [shape @drawing-shape
                     shpos @drawing-position


Coils trigger admin table for realtime made

Makes a table called coils_triggers if it does not already exist

--- src/webapp/framework/server/systemfns.clj
+++ src/webapp/framework/server/systemfns.clj
@@ -435,6 +435,35 @@

+
+(defn do-real []
+  (let [coils-admin-tables      (korma.core/exec-raw
+                                   [" select * from pg_tables where schemaname='public' and tablename='coils_triggers'" []]
+                                   :results)
+
+        coils-admin-table-exists   (pos? (count coils-admin-tables))
+
+        sql-to-create-admin-table "
+CREATE TABLE coils_triggers
+(
+  id serial NOT NULL,
+  table_name character varying,
+  version character varying
+);
+"
+  ]
+
+      (println "Coils admin table exists: " coils-admin-table-exists)
+      (if (not coils-admin-table-exists )
+                      (korma.core/exec-raw   [sql-to-create-admin-table []]   [])
+                      nil
+        )
+  )
+  )
+
+
+
+
 (defn !get-query-results-v2 [{:keys [
                                      db-table
                           		       where
@@ -497,6 +526,8 @@
               )

            )
+
+          (do-real)

           (println "-------------------------------")
           (println "@cached-queries     " @cached-queries)


Server side knows when a client record should be send to the client

When the client polls the server then the server has something called
:update-reques which is send to the client to say what has changed

--- src/webapp/framework/server/systemfns.clj
+++ src/webapp/framework/server/systemfns.clj
@@ -843,28 +843,28 @@

-(defn inform-clients-about-record  [query   db-table   id]
+(defn inform-clients-about-record  [db-table   id]
   (println "inform-clients-about-record ")
-  (comment let [the-query        (get @server-side-cached-queries   query)
-        clients-atom     (:clients @the-query)
-        ]
-    (swap! the-query assoc  :records       result-id-vector)
-    (swap! the-query assoc  :count         record-count)
-    (swap! the-query assoc  :timestamp     query-time)
-
-    ;(println (str "    clients: " @clients-atom))
+  (let [the-record        (get-record-from-server-cache-for-id  db-table  id )
+        clients-atom      (:clients the-record)
+        ]
+    (println (str "    the-record: " the-record))
+    (println (str "    Record Clients: " @clients-atom))
+
     (doall (for [client @clients-atom]
              (do
-               ;(println (str "    Client: " client))
+               (println (str "    Client: " client))
                (let [the-client       (get @server-side-realtime-clients  client)
                      response-atom    (:update-request @the-client)
-                     ]
-                 (if (not response-atom) (swap! the-query assoc  :update-request (atom {})))
-                 (swap! (:update-request @the-client) assoc-in [:queries query] {:timestamp query-time})
+                             ]
+                 (if (not response-atom) (swap! response-atom assoc  :update-request (atom {})))
+                 (swap! (:update-request @the-client) assoc-in [:records db-table id] {:timestamp (get the-record :timestamp)})
                  ;(println (str "    responses: " (if response-atom @response-atom)))

                  ;                   (swap! (:update-request @the-query) assoc  1 2)
-                 ))))))
+                 ))))
+    nil
+    ))

@@ -1019,7 +1019,9 @@
     ; cache
     ; ----------------------------------------------------------------
     (if (= (get realtime-log-entry :record_operation) "UPDATE")
-        (update-record-in-cache  db-table   id))
+      (do
+        (update-record-in-cache  db-table   id)
+        (inform-clients-about-record   db-table   id)))

@@ -1043,8 +1045,6 @@
                      ;(println (str "    " @(:clients @(get @server-side-cached-queries query))))

                      (update-query-in-cache  query)
-                     (if (= (get realtime-log-entry :record_operation) "UPDATE")
-                        (inform-clients-about-record  query   db-table   id))

                      ;(println (str "    "))
                      ;(println (str "    " "After"))


refactor strip-margin

refactor strip-margin

--- src/sicp/chapter3_2.clj
+++ src/sicp/chapter3_2.clj
@@ -9,20 +9,21 @@
 ;;; 3.2.2  Applying Simple Procedures

 ;; Exercise 3.9
+(def ^:dynamic *newline-char*
+  "\n")
+
 (defn strip-margin
   ([s]
    (strip-margin s "\\|"))
   ([s delimiter]
-   (->> s
-        (str/split-lines)
-        (map #(str/replace-first
-               %
-               (re-pattern (str "^\\s*" delimiter))
-               ""))
-        (str/join "\n"))))
+   (let [p (re-pattern (str "^\\s*" delimiter))]
+     (->> s
+          (str/split-lines)
+          (map #(str/replace-first % p ""))
+          (str/join *newline-char*)))))

 (defn create-node [& xs]
-  {:label (str/join "\n\n" xs)})
+  {:label (str/join (str *newline-char* *newline-char*) xs)})

 ;; recursive version
 ;; cf. resources/public/img/chapter3_2/exercise3-9_recursive.png


Add -entity protocol function to ITransactor.

--- src/continuo/impl.clj
+++ src/continuo/impl.clj
@@ -39,10 +39,10 @@
   (-resolve-eid [this] this))

 (defprotocol ITransactor
-  (-transact [_ fact] "Register a transaction."))
+  (-transact [_ fact] "Register a transaction.")
+  (-entity [_ eid] "Get a entity by eid."))

 ;; (defprotocol ITransactor
-;;   (-entity [_ eid] "Get a dynamic map that represents an entity id.")
 ;;   (-transact [_ data] "Register a transaction.")
 ;;   (-query [_ spec] "Query the database.")
 ;;   (-pull [_ spec entity] "Pull a entity from the database."))


Use a node's previous position instead of 0 when ordering

--- src/fatlip/order.cljs
+++ src/fatlip/order.cljs
@@ -103,7 +103,14 @@
   "Step 2b of ESK - Use nodes' predecessors to calculate a 'measure' for the
   nodes and containers in a layer, which is used for ordering"
   [non-qs preds positions]
-  (into {} (map #(-> [% (get-measure % (get preds %) positions)]) non-qs)))
+  (->> non-qs
+       (map-indexed (fn [idx node]
+              (let [node-edges (get preds node)
+                    measure (if (empty? node-edges)
+                              idx
+                              (get-measure node node-edges positions))]
+                [node measure])))
+       (into {})))

 (defn merge-layer
   "Step 3 of ESK - Considers a layer as two lists, one of nodes and the other


call drivers with channel only

call drivers with channel only

--- cljx/plongeur-cljs/src/kierros/core.cljs
+++ cljx/plongeur-cljs/src/kierros/core.cljs
@@ -19,12 +19,9 @@
   (->> drivers
        (map (fn [[name driver]]
               (let [sink-proxy (sink-proxy-chans name)
-                    ;source     (driver sink-proxy name)
-                    source     (driver sink-proxy)
-                    ]
+                    source     (driver sink-proxy)]
                 [name source])))
        (into {})))
-

 (defn weld-cycle!
   "Closes the cycle between the sinks and sink-proxies."


Hardcoded derive helper function

Hardcoded derive helper function

--- src/icecap/crypto.clj
+++ src/icecap/crypto.clj
@@ -86,6 +86,10 @@
   "
   (derive [kdf cap master-key salt]))

+(defn hardcoded-derive
+  [kdf cap]
+  (derive kdf cap hardcoded-master-key-fixme hardcoded-salt-fixme))
+
 (defn bogus-kdf
   "A totally bogus KDF that consistently returns all-NUL keys.


Add a test to ensure redeploying over existing artifacts is blocked.

--- test/clojars/test/integration/uploads.clj
+++ test/clojars/test/integration/uploads.clj
@@ -107,6 +107,27 @@
          :repository {"test" {:url (str "http://localhost:" test-port "/repo")}}
          :local-repo help/local-repo))))

+(deftest user-cannot-redeploy
+  (-> (session clojars-app)
+      (register-as "dantheman" "test@example.org" "password" valid-ssh-key))
+  (aether/deploy
+   :coordinates '[org.clojars.dantheman/test "0.0.1"]
+   :jar-file (io/file (io/resource "test.jar"))
+   :pom-file (io/file (io/resource "test-0.0.1/test.pom"))
+   :repository {"test" {:url (str "http://localhost:" test-port "/repo")
+                        :username "dantheman"
+                        :password "password"}}
+   :local-repo help/local-repo)
+  (is (thrown-with-msg?
+       org.sonatype.aether.deployment.DeploymentException
+       #"Unauthorized"
+       (aether/deploy
+        :coordinates '[org.clojars.fixture/test "0.0.1"]
+        :jar-file (io/file (io/resource "test.jar"))
+        :pom-file (io/file (io/resource "test-0.0.1/test.pom"))
+        :repository {"test" {:url (str "http://localhost:" test-port "/repo")}}
+        :local-repo help/local-repo))))
+
 (deftest anonymous-cannot-deploy
   (is (thrown-with-msg? org.sonatype.aether.deployment.DeploymentException
         #"Unauthorized"


Playing with APIs, wrote a ping test.

Playing with APIs, wrote a ping test.

--- src/kademlia/core.clj
+++ src/kademlia/core.clj
@@ -1,18 +1,88 @@
 (ns kademlia.core
   (require [aleph.udp :as udp]
            [manifold.stream :as s]
+           [manifold.deferred :as d]
            [taoensso.nippy :as nippy])
   (:gen-class))

-;; (def socket (udp/socket {:port 12312}))
+(def port 1665)
+(def bind-timeout 5000) ;; milliseconds

-;; @(s/put! @socket {:host "localhost", :port 12312, :message (nippy/freeze {:foo :bar})})
+(defn uuid []
+  (java.util.UUID/randomUUID))

-;; (nippy/thaw (:message @(s/take! @socket)))
+(defn send!
+  "Returns a deferred that will eval to true if we successfully sent the message otherwise false."
+  [socket host port msg]
+  (s/put! socket
+          {:host host
+           :port port
+           :message (nippy/freeze msg)}))

-;; (s/close! @socket)
+(defn recv-handler
+  "Handler for all incoming messages.
+  * socket: the socket receiving the message, we can use this to send a message back.
+  * msg: The received message of format {:host [the host that sent the message]
+                                         :port [the port that sent the message]
+                                         :message [the message contents]}"
+  [socket msg]
+  (let [{:keys [host port message]} msg
+        parsed-message (nippy/thaw message)
+        ]
+    (case (:type parsed-message)
+      :ping (send! socket host port {:type :ack})
+      )

-(defn -main
-  "I don't do a whole lot ... yet."
-  [& args]
-  (println "Hello, World!"))
+    )
+  )
+
+(defn bind-socket
+  "Returns a deferred socket, all messages coming into the socket will be consumed by
+   recv-handler. If port is 0 we will bind to an open port."
+  ([] (let [socket (deref (udp/socket {:port 0}) bind-timeout :timeout)]
+        (s/consume (partial #'recv-handler socket) socket)
+        socket) )
+  ([port] (let [socket (deref (udp/socket {:port port}) bind-timeout :timeout)]
+            (s/consume (partial #'recv-handler socket) socket)
+            socket)))
+
+(defonce socket (bind-socket port))
+
+(defn socket->port
+  "Get a port from a socket."
+  [socket]
+  (let [socket (:aleph/channel (meta socket))]
+    (when (nil? socket)
+      (throw (new Exception "socket is not a channel, maybe you need to defer it?")))
+    (.getPort (.localAddress socket))))
+
+;; TESTS
+
+(use 'clojure.test)
+
+(defmacro with-stream
+  "Shamelessly modified with-open only it works on deferred streams instead."
+  [bindings & body]
+  (cond
+    (= (count bindings) 0) `(do ~@body)
+    (symbol? (bindings 0)) `(let ~(subvec bindings 0 2)
+                              (try
+                                (with-stream ~(subvec bindings 2) ~@body)
+                                (finally
+                                  (s/close! ~(bindings 0)))))
+    :else (throw (IllegalArgumentException.
+                   "with-stream only allows Symbols in bindings"))))
+
+(deftest ping-test
+  (testing "when we ping do we get an ack"
+    (with-stream [application-socket (bind-socket)
+                  test-socket        @(udp/socket {:port 0})
+
+                  ]
+      (let [application-port (socket->port application-socket)
+            application-host "localhost"
+            ]
+        (println application-host application-port (socket->port test-socket))
+        @(send! test-socket application-host application-port {:type :ping})
+        (is (= {:type :ack}
+               (nippy/thaw (:message @(s/take! test-socket)))))))))


Add core.matrix and vectorz-clj, and switch to boot-alt-test.

--- project/analyze-data/build.boot
+++ project/analyze-data/build.boot
@@ -5,10 +5,11 @@
   :resource-paths #{"resources"}
   :dependencies '[[org.clojure/clojure "1.8.0"]
                   [org.clojure/data.csv "0.1.3"]
-                  [incanter "1.9.0"]
-                  [adzerk/boot-test "1.2.0" :scope "test"]])
+                  [metosin/boot-alt-test "0.3.1" :scope "test"]
+                  [net.mikera/core.matrix "0.58.0"]
+                  [net.mikera/vectorz-clj "0.46.0"]])

-(require '[adzerk.boot-test :refer [test]])
+(require '[metosin.boot-alt-test :refer [alt-test]])

 (task-options!
     aot {:all true}


Fixed chat log to show most recent lines, not oldest.

--- Turbot/src/turbot/core.clj
+++ Turbot/src/turbot/core.clj
@@ -49,7 +49,7 @@
                                         :topic (channel-obj :topic)))))
                             (if channel
                                 (ref-set state-ref (assoc-in @state-ref [channel :recentlines]
-                                    (vec (take 1000
+                                    (vec (take-last 1000
                                         (concat (:recentlines (@state-ref channel))
                                             [(into {} (filter val {
                                                 :nick nick


fix editing

fix editing

--- labs/architecture-examples/om/src/todomvc/item.cljs
+++ labs/architecture-examples/om/src/todomvc/item.cljs
@@ -27,7 +27,7 @@
   (let [node (om/get-node owner "editField")]
     (put! comm [:edit todo])
     (doto owner
-      (om/set-state! :init-edit true)
+      (om/set-state! :needs-focus true)
       (om/set-state! :edit-text (:title todo)))))

 (defn key-down [e todo owner comm]
@@ -51,11 +51,12 @@
       {:edit-text (:title todo)})
     om/IDidUpdate
     (did-update [_ _ _ _]
-      (when (om/get-state owner :init-edit)
-        (om/set-state! owner :init-edit nil)
+      (when (and (:editing todo)
+                 (om/get-state owner :needs-focus))
         (let [node (om/get-node owner "editField")]
           (.focus node)
-          (.setSelectionRange node 0 (.. node -value -length)))))
+          (.setSelectionRange node (.. node -value -length) (.. node -value -length)))
+        (om/set-state! owner :needs-focus nil)))
     om/IRender
     (render [_]
       (let [class (cond-> ""


remove inspect

remove inspect

--- src/pc/http/sente.clj
+++ src/pc/http/sente.clj
@@ -1022,7 +1022,7 @@

 (defn cleanup-stale [doc-id]
   (let [subs @document-subs
-        now (pc.utils/inspect (time/now))
+        now (time/now)
         doc-uids (keys (get subs doc-id))]
     (doseq [uid doc-uids]
       (fetch-stats uid))


Improve performance of all operator.

Improve performance of all operator.

--- src/promesa/core.cljc
+++ src/promesa/core.cljc
@@ -181,7 +181,7 @@
   that is fulfilled  when all the items in the
   array are fulfilled."
   [promises]
-  #?(:cljs (then (.all Promise (into-array promises)) vec)
+  #?(:cljs (.all Promise (into-array promises))
      :clj (let [promises (clojure.core/map pt/-promise promises)]
             (then (->> (into-array CompletableFuture promises)
                        (CompletableFuture/allOf))


map -> mapv

map -> mapv

--- src/sandbox/stack.clj
+++ src/sandbox/stack.clj
@@ -96,8 +96,8 @@
               (recur result (-> loc z/next)))
             (recur result (-> loc z/next))))))))

-(defn a-call-stack [a-call]
-  (let [zpr (z/vector-zip a-call)]
+(defn call-stack [call]
+  (let [zpr (z/vector-zip call)]
            (loop [result []
                   loc (-> zpr z/down)]
              (if (-> loc z/end?)
@@ -111,9 +111,7 @@
        result)
                         (-> loc z/next)))))))

-(defn program-call-stack
-  [prog]
-  (into []
-        (map a-call-stack
-             (expand-to-primitive-calls prog))))
+(defn program-call-stack [prog]
+  (->> (expand-to-primitive-calls prog)
+       (mapv call-stack)))


friend-list tests: with-fakes-async helper now also should unpatch vars

--- examples/friend-list/test/unit/controller.cljs
+++ examples/friend-list/test/unit/controller.cljs
@@ -52,23 +52,22 @@
 (defn with-fakes-async
   "Helper for defining async tests with fakes.
   f - test body, the function of args [ctx done];
-  ctx - fakes context;
-  done - is a function which performs clj-fakes self-tests and finishes the async test."
+  ctx - clj-fakes context;
+  done - is a function which unpatches all vars, runs clj-fakes self-tests and finishes the async test."
   [f]
   (async done
     (let [ctx (fc/context)
-          done #(try
-                 ; TODO: do not self-test if test has already caught some exceptions
-                 ; TODO: unpatch vars?
-                 (fc/self-test ctx)
+          wrapped-done #(try
+                         (fc/unpatch-all! ctx)
+                         (fc/self-test ctx)

-                 ; hack to "notify" test harness about self-test exception
-                 (catch :default e
-                   (is nil e))
+                         ; hack to "notify" test harness about self-test exception
+                         (catch :default e
+                           (is nil e))

-                 (finally
-                   (done)))]
-      (f ctx done))))
+                         (finally
+                           (done)))]
+      (f ctx wrapped-done))))

 ; sets the timing precision in ms, make it bigger if async tests are flaky
 (def delta 5)


add UI command for triggering :solve

add UI command for triggering :solve

--- src/tile_game/grid.cljs
+++ src/tile_game/grid.cljs
@@ -41,7 +41,7 @@
                :font-family "Verdana" :font-size 0.4 :text-anchor "middle"}
         (str tile)]])))

-(defn tile-grid []
+(defn tile-grid [run-solver]
   (let [{:keys [board size analysis-mode]} @app-state
         dim (b/dimension board)]
     [:center
@@ -60,7 +60,9 @@
       (when analysis-mode
         (if (b/solved? board)
           "Solved!"
-          (str "Suggested Moves: " (b/solve-next board))))]
+          [:div
+           (str "Suggested Moves: " (b/solve-next board))
+           [:div [:button {:on-click run-solver} "Run solver!"]]]))]
      [:p
       "© 2017 Charles L.G. Comstock "
       [:a {:href "https://github.com/dgtized/tile-game"} "(github)"]]]))
@@ -88,7 +90,7 @@
           (slide! key))
         (recur new-cancel)))
     (recur cancel))
-  tile-grid)
+  (fn [] (tile-grid #(async/put! command :solve))))

 (def codename
   {37 :left


minor cleanup

minor cleanup

git-svn-id: 03a8048b5ee8463be5048a3801110fb50f378627@10454 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd

--- plugins/SlideExplorer2/src/slide_explorer/positions.clj
+++ plugins/SlideExplorer2/src/slide_explorer/positions.clj
@@ -15,16 +15,6 @@
           (select-keys [:x :y])
           (assoc :label label)))))

-(defn add-position-to-list [screen-state-atom position-map affine-stage-to-pixel]
-  (let [{:keys [x y]} position-map
-        [x1 y1] (affine/inverse-transform [x y] affine-stage-to-pixel)
-        {:keys [z-origin slice-size-um z]} @screen-state-atom
-        zpos (+ z-origin (* z slice-size-um))
-        label (str "Pos" (int (* 100000 (rand))))
-        labeled-position (assoc position-map :label label)]
-    (mm/add-msp label x1 y1 zpos)
-    (swap! screen-state-atom update-in [:positions] conj labeled-position)))
-
 (defn grid-distances [pos0 pos1]
   (merge-with #(Math/abs (- %1 %2)) pos0 pos1))

@@ -41,6 +31,16 @@
                  (tile-distances w h)
                  (in-tile))
             available-positions)))
+
+(defn add-position-to-list [screen-state-atom position-map affine-stage-to-pixel]
+  (let [{:keys [x y]} position-map
+        [x1 y1] (affine/inverse-transform [x y] affine-stage-to-pixel)
+        {:keys [z-origin slice-size-um z]} @screen-state-atom
+        zpos (+ z-origin (* z slice-size-um))
+        label (str "Pos" (int (* 100000 (rand))))
+        labeled-position (assoc position-map :label label)]
+    (mm/add-msp label x1 y1 zpos)
+    (swap! screen-state-atom update-in [:positions] conj labeled-position)))

 (defn remove-position-from-list [screen-state-atom position-map affine-stage-to-pixel]
   (let [positions (get-position-list-coords affine-stage-to-pixel)
@@ -76,4 +76,4 @@
   (user-controls/handle-shift-click
     panel
     (fn [x y] (toggle-position screen-state-atom x y affine-stage-to-pixel)))
-  (follow-positions! screen-state-atom affine-stage-to-pixel))+  (follow-positions! screen-state-atom affine-stage-to-pixel))


Add tags into full text search

Add tags into full text search

--- src/warehouse/core.cljs
+++ src/warehouse/core.cljs
@@ -95,7 +95,8 @@
 (swap! app-state assoc-in [:filtered-components] (:components @app-state))
 (def index (.lunr js/window (fn []
                      (this-as this
-                              (.field this "name")))))
+                              (.field this "name")
+                              (.field this "tags")))))

 (defn form [item]
   [:div
@@ -172,7 +173,8 @@

 (doseq [[k component] (map vector (iterate inc 0) (:components @app-state))]
   (.add index (clj->js {:id k
-                        :name (:name component)})))
+                        :name (:name component)
+                        :tags (:tags component)})))

 (aset js/window "index" index)


Use 'map' and 'filter' instead of 'for' in problem52.clj

Python habits die hard.

--- euler_clojure/src/euler/problem52.clj
+++ euler_clojure/src/euler/problem52.clj
@@ -8,13 +8,14 @@
   contain the same digits.")

 (defn multiples [x]
-  (for [i (range 2 7)] (* i x)))
+  (map #(* % x) (range 2 7)))

 (defn same-digits? [x y]
-  (= (sort (str x)) (sort (str y))))
+  (= (sort (str x))
+     (sort (str y))))

 (defn all-same-digits? [x]
-  (every? true? (for [y (multiples x)] (same-digits? x y))))
+  (every? true? (map #(same-digits? % x) (multiples x))))

 (defn problem52 []
-  (first (for [x (iterate inc 1) :when (all-same-digits? x)] x)))
+  (first (filter all-same-digits? (iterate inc 1))))


Sending related nodes to the front end

Sending related nodes to the front end

- Standardized so that edge-collection always acts from a map, that way
we can use it both for the main node's relations and for the calculated
ones.
- edge-collection will also optionally receive the color for the links.
- Assigning the edge index in a final pass. Thought about doing a hash
of the linked nodes, but there's no real need to send such long numbers.

--- src/tropefest/api.clj
+++ src/tropefest/api.clj
@@ -1,5 +1,6 @@
 (ns tropefest.api
-  (:require [tropefest.db :as db]))
+  (:require [tropefest.db :as db]
+            [com.numergent.url-tools :as ut]))

 (defn node-size [rel-count]
@@ -21,20 +22,28 @@
         (assoc "x" x "y" y "size" (node-size (stringed "incoming")) "label" (stringed "id")))))

 (defn edge
-  "Returns an edge map"
-  [i from to color]
-  {:id     (str "e" i)
-   :source from
+  "Returns an edge map. Does not return an index, since those are disposable
+  and can be assigned later."
+  [from to color]
+  {:source from
    :target to
    :color  color
    :type   "arrow"})                                        ; Could be line, curve, arrow or curvedArrow

 (defn edge-collection
-  [node links-from links-to]
-  (let [c          (count links-from)
-        edges-from (map-indexed #(edge %1 (:id node) (%2 "id") "#ff3300") links-from)
-        edges-to   (map-indexed #(edge (+ %1 c) (%2 "id") (:id node) "#0066ff") links-to)]
+  [{node       :node
+    links-from :links-from
+    links-to   :links-to
+    color-from :color-from
+    color-to   :color-to}]
+  (let [edges-from (map #(edge (node "id") (%1 "id") (ut/if-nil color-from "#ff3300")) links-from)
+        edges-to   (map #(edge (%1 "id") (node "id") (ut/if-nil color-to "#0066ff")) links-to)]
     (concat edges-from edges-to)))
+
+(defn query-related-from
+  [conn code-from node]
+  {:node       node
+   :links-from (db/query-common-nodes-from conn code-from (node "id"))})

 (defn rand-range [n]
   (- (rand n) (/ n 2)))
@@ -42,15 +51,20 @@
 (defn network-from-node
   [code]
   (let [conn       (db/get-connection)
-        node       (:data (db/query-by-id conn code))
+        node       (-> (:data (db/query-by-id conn code)) (transform-node 0 0))
         links-from (db/query-from conn code :LINKSTO)
         links-to   (db/query-to conn :LINKSTO code)
-        links-set  (set (concat links-from links-to))]
-    {:nodes (concat
-              [(transform-node node 0 0)]
+        links-set  (set (concat links-from links-to))
+        related    (->>
+                     (map #(query-related-from conn code %) links-set)
+                     (map #(assoc % :color-from "#00ffc7")))
+        with-base  (conj related {:node node :links-from links-from :links-to links-to})
+        ]
+    {:nodes (conj
               (map #(transform-node %1 (rand-range 50) (rand-range 50)) links-set)
-              ; (map-indexed #(transform-node %2 %1 1) links-from)
-              ; (map-indexed #(transform-node %2 %1 2) links-to)
-              )
-     :edges (edge-collection node links-from links-to)})
+              node)
+     :edges (->>
+              (map edge-collection with-base)
+              flatten
+              (map-indexed #(assoc %2 :id %1)))})
   )


donwload and exec work

donwload and exec work

--- src/vsphere/guest.clj
+++ src/vsphere/guest.clj
@@ -1,10 +1,12 @@
-(ns vsphere.upload
+(ns vsphere.guest
   (:import
     com.vmware.vim25.NamePasswordAuthentication
+    com.vmware.vim25.GuestProgramSpec
     com.vmware.vim25.GuestFileAttributes)
   (:require
     [clj-http.client :as client])
   (:use
+    [clojure.java.io :only (copy file reader)]
     [vsphere.vijava :only (with-service tools-installed? service find-vm)]))

 (defn- npa
@@ -12,19 +14,48 @@
    [{:keys [user pass] }]
   (doto (NamePasswordAuthentication.) (.setUsername user) (.setPassword pass)))

-(defn manager
-   "file manage of vm"
-   [hostname]
-   (.getFileManager (.getGuestOperationsManager service) (find-vm hostname)))
+(defn- manager
+  "file manage of vm"
+  [hostname t]
+  (let [manager (.getGuestOperationsManager service)]
+    (case t
+      :file (.getFileManager manager (find-vm hostname))
+      :proc  (.getProcessManager manager (find-vm hostname))
+      )))

 (defn upload-file
-   "uploads a file into a guest system"
-   [src dst hostname auth]
+  "uploads a file into a guest system"
+  [src dst hostname auth]
   {:pre [(tools-installed? hostname)]}
   (with-service
     (let [file (slurp src)
-          url (.initiateFileTransferToGuest (manager hostname) (npa auth) dst (GuestFileAttributes.) (.length file) true)]
-      (client/put url {:body file :insecure? true})
-     )))
+          url (.initiateFileTransferToGuest (manager hostname :file) (npa auth) dst (GuestFileAttributes.) (.length file) true)]
+      (client/put url {:body file :insecure? true}))))

-;; (upload-file "project.clj" "/tmp/project.clj" "bar" {:user "ronen" :pass "foobar"})
+(defn download-file
+  "download a file from a guest system"
+  [src dest hostname auth]
+  {:pre [(tools-installed? hostname)]}
+  (with-service
+    (let[{:keys [url]} (bean (.initiateFileTransferFromGuest (manager hostname :file) (npa auth) src))]
+      (copy (:body (client/get url {:as :stream :insecure? true}))  (file dest) ))))
+
+(defn guest-run
+  "Runs a remote command using out of band guest access "
+  [hostname cmd args auth]
+  {:pre [(tools-installed? hostname)]}
+  (with-service
+    (let [m (manager hostname :proc) spec (doto (GuestProgramSpec.) (.setProgramPath cmd) (.setArguments args))]
+      (.startProgramInGuest m  (npa auth) spec))))
+
+(defn set-ip
+   "set guest static ip"
+   [ip hostname auth]
+
+  )
+(comment
+  (download-file "/tmp/project.clj" "/tmp/project.clj" "foo" {:user "ronen" :pass "foobar"})
+  (guest-run "foo" "/usr/bin/touch" "/tmp/foo" {:user "ronen" :pass "foobar"})
+  (upload-file "project.clj" "/tmp/project.clj" "foo" {:user "ronen" :pass "foobar"})
+  (download-file "/tmp/project.clj" "/tmp/project.clj" "foo" {:user "ronen" :pass "foobar"})
+  (tools-installed? "foo"))


add generation tests

add generation tests

--- test/babel/test/en.cljc
+++ test/babel/test/en.cljc
@@ -306,9 +306,20 @@
   (is (not (empty? (parse "I turned on the radio"))))
   (is (not (empty? (parse "I turned the radio on"))))
   (is (not (empty? (parse "I turned off the radio"))))
-  (is (not (empty? (parse "I turned the radio off")))))
-
-
-
-
-
+  (is (not (empty? (parse "I turned the radio off"))))
+  (let [generated (generate {:synsem {:sem {:pred :turn-on
+                                            :tense :present
+                                            :obj {:mod '()
+                                                  :number :sing
+                                                  :spec {:def :def
+                                                         :of {:pred nil}}}
+                                            :subj {:pred :lei}}
+                                      :cat :verb}})]
+    (is (= "she turns the radio on"
+           (morph generated))
+        (= "she turns on the radio"
+           (morph generated)))))
+
+
+
+


add TODO

add TODO

--- test/babel/test/en.cljc
+++ test/babel/test/en.cljc
@@ -5,7 +5,10 @@
             [babel.english.lexicon :refer [lexicon]]
             [babel.english.morphology :refer [fo get-string]]
             [babel.english.workbook :refer [analyze generate parse]]
+
+            ;; TODO: add parsing tests
             [babel.parse :as parse]
+
             [clojure.string :as string]
             #?(:clj [clojure.test :refer [deftest is]])
             #?(:cljs [cljs.test :refer-macros [deftest is]])


fix: clojure version to 1.8.0 in ssclj project.clj

--- ssclj/jar/project.clj
+++ ssclj/jar/project.clj
@@ -8,7 +8,7 @@
   :test-paths     ["src/test/clojure"]
   :resource-paths ["src/main/resources"]

-  :dependencies [[org.clojure/clojure                       "1.7.0"]
+  :dependencies [[org.clojure/clojure                       "1.8.0"]
                  [org.clojure/tools.logging                 "0.3.1"]
                  [org.clojure/tools.namespace               "0.2.10"]
                  [org.clojure/tools.cli                     "0.3.3"]


tweaking create-engine var names

tweaking create-engine var names

--- src/bad_movie_back_end/core/routes/bad_movie_back_end_routes.clj
+++ src/bad_movie_back_end/core/routes/bad_movie_back_end_routes.clj
@@ -13,11 +13,11 @@

 (defn create-engine
   "Creates a new nashorn script engine and loads dependencies into its context."
-  [scripts]
+  [dependencies]
   (let [nashorn (.getEngineByName (ScriptEngineManager.) "nashorn")
-        loads (map #(str "load('" % "');") scripts)]
+        scripts (map #(str "load('" % "');") dependencies)]
     (.eval nashorn "var global = this;")
-    (doseq [load loads] (.eval nashorn load))
+    (doseq [script scripts] (.eval nashorn script))
     nashorn))

 (def react "http://cdnjs.cloudflare.com/ajax/libs/react/0.12.2/react.min.js")


calling play() at track end sends ended event

on android browser.  Though android browser does have other problems,
like sending no events at all when the screen is blanked

--- src-cljs/core.cljs
+++ src-cljs/core.cljs
@@ -375,8 +375,9 @@
     (when (and (.-paused actual) (:playing desired) urls)
       ;; it might have paused because it reached the end of track, or
       ;; because the user previously paused it.  If we have music available,
-      ;; now, resume
-      ; (set! (.-currentTime actual) offset)
+      ;; now, resume.
+      ;; On Android, this appears to trigger the generation of an ended event
+      ;; that might not otherwise get sent, which is nice.  However,
       (.play actual))

     (if-not (:playing desired)


Log websocket requests before they are processed

--- src/alder/core.clj
+++ src/alder/core.clj
@@ -48,12 +48,12 @@
   (with-channel request ws-ch
     (go-loop []
       (when-let [{:keys [message]} (<! ws-ch)]
-        (let [[command args] message
-              response (handle-message command args)]
+        (let [[command args] message]
           (info "MSG"
                 (:remote-addr request)
                 command)
-          (>! ws-ch response))
+          (let [response (handle-message command args)]
+            (>! ws-ch response)))
         (recur)))))

 (defroutes main-routes


make 'morph' param optional

make 'morph' param optional

--- src/babel/over.clj
+++ src/babel/over.clj
@@ -224,6 +224,7 @@
 (defn overc [parent comp]
   "add given child as the comp child of the phrase: parent."

+  ;; disabled for now.
   (throw (Exception. (str "GOT INTO OVERC.")))

   (log/debug (str "set? parent:" (set? parent)))
@@ -267,7 +268,7 @@
      (if (not is-fail?)
        (list result)))))

-(defn overhc [parent head comp morph]
+(defn overhc [parent head comp & [morph]]
   (overc (overh parent head morph) comp))

 ;; TODO: distinguish between when:


latest dependencies

latest dependencies

--- Clojure-Websockets/MainApp/project.clj
+++ Clojure-Websockets/MainApp/project.clj
@@ -4,12 +4,12 @@
   :url "https://github.com/matthiasn/Birdwatch"
   :license {:name "GNU General Public License" :url "http://www.gnu.org/licenses/gpl-3.0.en.html"}
   :dependencies [[org.clojure/clojure "1.8.0-RC4"]
-                 [org.clojure/tools.reader "1.0.0-alpha1"]
+                 [org.clojure/tools.reader "1.0.0-alpha2"]
                  [org.clojure/clojurescript "1.7.170"]
                  [clojurewerkz/elastisch "2.2.0"]
                  [org.clojure/tools.logging "0.3.1"]
-                 [com.taoensso/timbre "4.1.4"]
-                 [com.taoensso/encore "2.31.0"]
+                 [com.taoensso/timbre "4.2.0"]
+                 [com.taoensso/encore "2.31.3"]
                  [com.taoensso/carmine "2.12.1"]
                  [matthiasn/systems-toolbox "0.5.1"]
                  [matthiasn/systems-toolbox-sente "0.5.1"]


Version 2.6.1 [ci skip]

Version 2.6.1 [ci skip]

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject clojush "2.6.0-1-SNAPSHOT"
+(defproject clojush "2.6.1"
   :description "The Push programming language and the PushGP genetic programming
                 system implemented in Clojure.
                 See http://hampshire.edu/lspector/push.html"


v0.1.0

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject ow-app/lein-template "0.1.0-SNAPSHOT"
+(defproject ow-app/lein-template "0.1.0"
   :description "FIXME: write description"
   :url "http://example.com/FIXME"
   :license {:name "Eclipse Public License"


update eastwood

update eastwood

--- project.clj
+++ project.clj
@@ -53,7 +53,7 @@
           {:wb-db-uri "datomic:ddb://us-east-1/WS260/wormbase"
            :swagger-validator-url "http://localhost:8002"}
           :plugins
-          [[jonase/eastwood "0.2.3"
+          [[jonase/eastwood "0.2.4"
             :exclusions [org.clojure/clojure]]
            [lein-ancient "0.6.8"]
            [lein-bikeshed "0.3.0"]


Upgrading cassandra to beta-9 which allows to disconnect custom sessions.

--- project.clj
+++ project.clj
@@ -25,7 +25,7 @@

                  [clj-kafka "0.1.2-0.8" :exclusions [org.slf4j/slf4j-simple]]
                  [camel-snake-kebab "0.1.2"]
-                 [clojurewerkz/cassaforte "1.3.0-beta8" :exclusions [[com.datastax.cassandra/cassandra-driver-core]]]
+                 [clojurewerkz/cassaforte "1.3.0-beta9" :exclusions [[com.datastax.cassandra/cassandra-driver-core]]]
                  [com.datastax.cassandra/cassandra-driver-core "1.0.5" :exclusions [[org.slf4j/slf4j-log4j12]
                                                                                [log4j/log4j]]]


Get rid of build time warning about implicit aot

--- project.clj
+++ project.clj
@@ -40,9 +40,10 @@
           :src-dir-uri "https://github.com/sbsdev/mdr2/blob/master/"
           :src-linenum-anchor-prefix "L"
           :defaults {:doc/format :markdown}}
-  :main mdr2.main
+  :main ^:skip-aot mdr2.main
   :immutant {:war {:context-path "/"}}
-  :profiles {:dev {:source-paths ["dev"]
+  :profiles {:uberjar {:aot :all}
+             :dev {:source-paths ["dev"]
                    :dependencies [[org.xerial/sqlite-jdbc "3.8.7"]
                                   [javax.servlet/servlet-api "2.5"]]}
              :test {:dependencies [[ring-mock "0.1.5"]]


Warn on reflection

Warn on reflection

--- project.clj
+++ project.clj
@@ -93,6 +93,8 @@

      :plugins [[cider/cider-nrepl "0.14.0"]]

+     :global-vars {*warn-on-reflection* true}
+
      :dependencies
      [
       ;; REPL and dev workflow


bump dep

bump dep

--- project.clj
+++ project.clj
@@ -4,7 +4,7 @@

   :dependencies [[org.clojure/clojure "1.6.0"]
                  [org.clojure/clojurescript "0.0-2268"]
-                 [com.cognitect/transit-js "0.8.552"]]
+                 [com.cognitect/transit-js "0.8.554"]]

   :plugins [[lein-cljsbuild "1.0.4-SNAPSHOT"]
             [codox "0.8.9"]]


Version 0.5.13-SNAPSHOT

Version 0.5.13-SNAPSHOT

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject yetibot.core "0.5.12"
+(defproject yetibot.core "0.5.13-SNAPSHOT"
   :description "Core yetibot utilities, extracted for shared use among yetibot
                 and its various plugins"
   :url "https://github.com/yetibot/yetibot.core"


Makes negative retries remaining easier to troubleshoot (#1455)

--- scheduler/src/cook/rest/api.clj
+++ scheduler/src/cook/rest/api.clj
@@ -362,7 +362,7 @@
       (dissoc (s/optional-key :group))
       (dissoc (s/optional-key :status))
       (merge {:framework-id (s/maybe s/Str)
-              :retries-remaining NonNegInt
+              :retries-remaining s/Int
               :status s/Str
               :state s/Str
               :submit-time (s/maybe PosInt)
@@ -1121,10 +1121,13 @@
                         (.getTime (:job/submit-time job)))
           datasets (when (seq (:job/datasets job))
                      (dl/get-dataset-maps job))
+          attempts-consumed (util/job-ent->attempts-consumed db job)
+          retries-remaining (- (:job/max-retries job) attempts-consumed)
+          disable-mea-culpa-retries (:job/disable-mea-culpa-retries job false)
           job-map {:command (:job/command job)
                    :constraints constraints
                    :cpus (:cpus resources)
-                   :disable_mea_culpa_retries (:job/disable-mea-culpa-retries job false)
+                   :disable_mea_culpa_retries disable-mea-culpa-retries
                    :env (util/job-ent->env job)
                    ; TODO(pschorf): Remove field
                    :framework_id (guess-framework-id)
@@ -1137,13 +1140,22 @@
                    :name (:job/name job "cookjob")
                    :ports (:job/ports job 0)
                    :priority (:job/priority job util/default-job-priority)
-                   :retries_remaining (- (:job/max-retries job) (util/job-ent->attempts-consumed db job))
+                   :retries_remaining retries-remaining
                    :state state
                    :status (name (:job/state job))
                    :submit_time submit-time
                    :uris (:uris resources)
                    :user (:job/user job)
                    :uuid (:job/uuid job)}]
+      (when (neg? retries-remaining)
+        ; TODO:
+        ; There's a bug in the retries remaining logic that
+        ; causes this number to sometimes be negative
+        (log/warn "Job" (:job/uuid job) "has negative retries remaining"
+                  {:attempts-consumed attempts-consumed
+                   :disable-mea-culpa-retries disable-mea-culpa-retries
+                   :max-retries (:job/max-retries job)
+                   :retries-remaining retries-remaining}))
       (cond-> job-map
               groups (assoc :groups (map #(str (:group/uuid %)) groups))
               application (assoc :application (util/remove-datomic-namespacing application))


[WM] update deps in generated project.clj

--- resources/leiningen/new/kraken_http_api/project.clj
+++ resources/leiningen/new/kraken_http_api/project.clj
@@ -6,27 +6,24 @@
   :dependencies [[org.clojure/clojure "1.7.0"]
                  [org.clojure/tools.logging "0.3.1"]
                  [turbovote.resource-config "0.2.0"]
-                 [com.novemberain/langohr "3.3.0"]
-                 [prismatic/schema "0.4.4"]
+                 [com.novemberain/langohr "3.4.1"]
+                 [prismatic/schema "1.0.3"]
                  [ch.qos.logback/logback-classic "1.1.3"]

                  ;; core.async has to come before pedestal or kehaar.wire-up will
                  ;; not compile. Something to do with the try-catch in
-                 ;; kehaar.core/go-handler.
-                 [org.clojure/core.async "0.1.346.0-17112a-alpha"]
+                 ;; kehaar.core/go-handler. (This may not be true anymore in
+                 ;; core.async 0.2.x; need to test.)
+                 [org.clojure/core.async "0.2.374"]
                  [democracyworks/kehaar "0.5.0"]
-
-                 [io.pedestal/pedestal.service "0.4.0"]
-                 [io.pedestal/pedestal.service-tools "0.4.0"]
+
+                 [io.pedestal/pedestal.service "0.4.1"]
+                 [io.pedestal/pedestal.service-tools "0.4.1"]
                  [democracyworks/pedestal-toolbox "0.6.2"]
-
-                 ;; this has to go before pedestal.immutant
-                 ;; until this is fixed:
-                 ;; https://github.com/pedestal/pedestal/issues/33
-                 [org.immutant/web "2.0.2"]
-                 [io.pedestal/pedestal.immutant "0.4.0"]
-                 [org.immutant/core "2.0.2"]]
-  :plugins [[lein-immutant "2.0.0"]]
+                 [org.immutant/web "2.1.1"]
+                 [io.pedestal/pedestal.immutant "0.4.1"]
+                 [org.immutant/core "2.1.1"]]
+  :plugins [[lein-immutant "2.1.0"]]
   :main ^:skip-aot {{name}}.server
   :target-path "target/%s"
   :uberjar-name "{{name}}.jar"


Add compatible? to core.

Add compatible? to core.

--- src/clojure/uncomplicate/neanderthal/core.clj
+++ src/clojure/uncomplicate/neanderthal/core.clj
@@ -221,6 +221,12 @@
   "Returns the type of the matrix implementation represented by keyword (:ge, :tr, :sy, etc.)."
   [^MatrixImplementation a]
   (.matrixType a))
+
+(defn compatible?
+  "Checks whether x and y are compatible in the sense that they use compatible
+  data formats (float, double, half) and computation contexts (native host memory, CUDA contexts etc.)."
+  [x y]
+  (api/compatible? x y))

 (defn ge
   "Creates a dense matrix (GE) in the context of `factory`, with `m` rows and `n` columns.


compile fix

compile fix

--- src/clojure/zensols/model/eval_classifier.clj
+++ src/clojure/zensols/model/eval_classifier.clj
@@ -168,6 +168,7 @@
     :class-type (second class-feat)}))

 (declare two-pass-config)
+(declare executing-two-pass?)

 (defn- cross-validate-results
   "Cross validate several models in series.


Fix reference to configure-logging! function

This was broken during the kitchensink move, this patch puts it back
from the com.puppetlabs.utils.logging now. Without this patch users
of the `benchmark` sub-command will receive an exception.

Signed-off-by: Ken Barber <470bc578162732ac7f9d387d34c4af4ca6e1b6f7@bob.sh>

--- src/com/puppetlabs/puppetdb/cli/benchmark.clj
+++ src/com/puppetlabs/puppetdb/cli/benchmark.clj
@@ -41,13 +41,14 @@
   (:require [clojure.tools.logging :as log]
             [com.puppetlabs.puppetdb.catalogs :as cat]
             [com.puppetlabs.puppetdb.catalog.utils :as catutils]
+            [com.puppetlabs.utils.logging :as logutils]
             [com.puppetlabs.puppetdb.command :as command]
             [com.puppetlabs.http :as pl-http]
             [com.puppetlabs.cheshire :as json]
             [clj-http.client :as client]
             [clj-http.util :as util]
             [fs.core :as fs])
-  (:use [puppetlabs.kitchensink.core :only (cli! inis-to-map configure-logging! utf8-string->sha1)]
+  (:use [puppetlabs.kitchensink.core :only (cli! inis-to-map utf8-string->sha1)]
         [com.puppetlabs.puppetdb.scf.migrate :only [migrate!]]
         [com.puppetlabs.puppetdb.command.constants :only [command-names]]))

@@ -185,7 +186,7 @@
   (let [[options _]     (cli! args supported-cli-options required-cli-options)
         config          (-> (:config options)
                             (inis-to-map)
-                            (configure-logging!))
+                            (logutils/configure-logging!))

         catalogs        (if (:catalogs options) (load-sample-data (:catalogs options)))
         reports         (if (:reports options) (load-sample-data (:reports options)))


Clean up deps, move callbacks out to separate source file.

--- src/client/aspire/client.cljs
+++ src/client/aspire/client.cljs
@@ -2,38 +2,22 @@
   (:require [clojure.browser.repl :as repl]
             [clojure.browser.net :as cb-net]
             [clojure.browser.event :as cb-event]
-            [cljs.reader :as edn]
-            [dommy.core :as dommy]
-            [dommy.attrs :as d-attrs]
+            [hickory.core :as hickory]
             [goog.string :as gstring]
             [goog.string.format :as gformat]
             [aspire.model :as a-mdl]
-            )
-  (:use-macros
-   [dommy.macros :only [by-id sel1]]))
+            [aspire.callbacks :as a-cb]
+            ))

 (repl/connect "http://localhost:9000/repl")
 (def api-uri "http://localhost:4001/api")
-
-;; Callbacks
-;; --------------------------------------------------
-;; If possible we'll get by with one err callback and one success
-;; callback for XHR, and use client-side routing and core.async
-;; instead of multiple XHR callbacks.
-(defn srv-callback-err [ev]
-  (.log js/console "Error: " ev))
-
-(defn srv-callback-success [ev]
-  (let [response-text (.getResponseText (.-target ev))]
-    (.log js/console (:now (edn/read-string response-text)))
-    (dommy/replace! (sel1 :#loading) [:p#loading (gstring/format "This is now: %s" (:now (edn/read-string response-text)))])))

 ;; xhr
 ;; --------------------------------------------------
 ;; Create and keep one xhr object that knows about our two XHR callbacks.
 (def xhr (cb-net/xhr-connection.)) ; additional state!
-(cb-event/listen xhr :error srv-callback-err)
-(cb-event/listen xhr :success srv-callback-success)
+(cb-event/listen xhr :error a-cb/err)
+(cb-event/listen xhr :success a-cb/success)

 (defn xhr-fetch!
   "Fetch the specified uri.


Added consolidate and absorb defmains to pail.

--- src/clj/forma/hadoop/pail.clj
+++ src/clj/forma/hadoop/pail.clj
@@ -70,5 +70,8 @@
   (?pail- (split-chunk-tap pail-path)
           query))

-(defn consolidate [pail-path]
+(defmain consolidate [pail-path]
   (.consolidate (Pail. pail-path)))
+
+(defmain absorb [from-pail to-pail]
+  (.absorb (Pail. to-pail) (Pail. from-pail)))


Correct all the UUID usages in Event

Correct all the UUID usages in Event

--- src/clj/herder/web/events.clj
+++ src/clj/herder/web/events.clj
@@ -12,6 +12,12 @@
    [clojure.set :refer [map-invert]])
   (:import
    [java.util UUID]))
+
+(defn- to-uuid [input]
+  (cond
+    (instance? UUID input) input
+    (nil? input) input
+    :else (UUID/fromString input)))

 (defn validate-new-event [params]
   (first
@@ -28,25 +34,20 @@
           persons (get params :persons [])
           persons (if (vector? persons) persons [persons])]
       (d/insert
-       db/events (d/values [{:id (UUID/fromString id)
+       db/events (d/values [{:id (to-uuid id)
                              :name (:name params)
-                             :convention_id (UUID/fromString conv_id)}]))
+                             :convention_id (to-uuid conv_id)}]))
       (doseq [person persons]
         (d/insert
-         db/events-persons (d/values [{:convention_id (UUID/fromString conv_id)
-                                       :event_id (UUID/fromString id)
-                                       :person_id (UUID/fromString person)}])))
+         db/events-persons (d/values [{:convention_id (to-uuid conv_id)
+                                       :event_id (to-uuid id)
+                                       :person_id (to-uuid person)}])))
       (notifications/send-notification [:events conv_id])
       (solve conv_id)
       (status (response {:id id}) 201))))

 (defn- retrieve-event [id]
-  (first (d/select db/events (d/where {:id (UUID/fromString id)}))))
-
-(defn- to-uuid [input]
-  (if (instance? UUID input)
-    input
-    (UUID/fromString input)))
+  (first (d/select db/events (d/where {:id (to-uuid id)}))))

 (defn- get-person-ids [id]
   (sort (map #(-> % :person_id str) (d/select db/events-persons (d/where {:event_id (to-uuid id)})))))
@@ -68,25 +69,25 @@
       (response (set-event-fields event)))))

 (defn get-events [{{:keys [id]} :params}]
-  (let [events (d/select db/events (d/where {:convention_id (UUID/fromString id)}))]
+  (let [events (d/select db/events (d/where {:convention_id (to-uuid id)}))]
     (response events)))

 (defn delete-event [{{:keys [id]} :params}]
-  (let [event (first (d/select db/events (d/where {:id (UUID/fromString id)})))]
+  (let [event (first (d/select db/events (d/where {:id (to-uuid id)})))]
     (if (nil? event)
       (status (response {}) 404)
       (do
-        (d/delete db/events (d/where {:id (UUID/fromString id)}))
+        (d/delete db/events (d/where {:id (to-uuid id)}))
         (notifications/send-notification [:events (str (:convention_id event))])
         (solve (:convention_id event))
         (status (response {}) 200)))))

 (defn delete-event-person [{{:keys [id person_id]} :params}]
-  (let [event-person (first (d/select db/events-persons (d/where {:event_id (UUID/fromString id) :person_id (UUID/fromString person_id)})))]
+  (let [event-person (first (d/select db/events-persons (d/where {:event_id (to-uuid id) :person_id (to-uuid person_id)})))]
     (if (nil? event-person)
       (status (response {}) 404)
       (do
-        (d/delete db/events-persons (d/where {:event_id (UUID/fromString id) :person_id (UUID/fromString person_id)}))
+        (d/delete db/events-persons (d/where {:event_id (to-uuid id) :person_id (to-uuid person_id)}))
         (notifications/send-notification [:event (str (:convention_id event-person)) id])
         (solve (:convention_id event-person))
         (status (response {}) 200)))))
@@ -98,15 +99,15 @@
       (let [conv_id (:convention_id event)
             preferred_slot (if (= "" preferred_slot) nil preferred_slot)]
         (if (contains? params :preferred_slot)
-          (d/update db/events (d/set-fields {:preferred_slot_id preferred_slot}) (d/where {:id (UUID/fromString id)})))
+          (d/update db/events (d/set-fields {:preferred_slot_id (to-uuid preferred_slot)}) (d/where {:id (to-uuid id)})))
         (if (-> event_count nil? not)
-          (d/update db/events (d/set-fields {:event_count event_count}) (d/where {:id (UUID/fromString id)})))
+          (d/update db/events (d/set-fields {:event_count event_count}) (d/where {:id (to-uuid id)})))
         (if (-> name nil? not)
-          (d/update db/events (d/set-fields {:name name}) (d/where {:id (UUID/fromString id)})))
+          (d/update db/events (d/set-fields {:name name}) (d/where {:id (to-uuid id)})))
         (if (-> type nil? not)
           (do
             (println "event type" type (get event-type-map type))
-            (d/update db/events (d/set-fields {:event_type (get event-type-map (keyword type))}) (d/where {:id (UUID/fromString id)}))))
+            (d/update db/events (d/set-fields {:event_type (get event-type-map (keyword type))}) (d/where {:id (to-uuid id)}))))

         (if (-> person nil? not)
           (let [persons (get-person-ids id)]


more clojure-rrific

more clojure-rrific

--- src/clj_beautify/beautify.clj
+++ src/clj_beautify/beautify.clj
@@ -55,9 +55,9 @@

 (defn- unwrap-specials
   [s]
-  (let [comments (unwrap-comments s)
-        metas    (unwrap-meta comments)]
-        metas))
+  (-> s
+    unwrap-comments
+    unwrap-meta))

 (defn- literal-to-str
   "Takes valid formatter clojure literal as input and transforms it to a string