Filter for product, version, and book name regexp

--- src/emender_jenkins/metadata_reader.clj
+++ src/emender_jenkins/metadata_reader.clj
@@ -79,9 +79,15 @@
     []
     (count @metadata))

+(defn metadata-filter
+    [product version book-regexp item]
+    (and (or (nil? product) (= product (:product item)))
+         (or (nil? version) (= version (:version item)))
+         (or (nil? book-regexp) (re-matches book-regexp (:book item)))))
+
 (defn get-metadata
     ([]
-     (get-metadata nil nil nil))
+     @metadata)
     ([product version book-regexp]
-     @metadata))
+     (filter #(metadata-filter product version book-regexp %) @metadata)))


formatting

formatting

--- src/chat/client/views/new_message.cljs
+++ src/chat/client/views/new_message.cljs
@@ -173,7 +173,7 @@
     om/IWillUpdate
     (will-update [_ next-props next-state]
       (let [next-text (next-state :text)
-              prev-text (om/get-render-state owner :text)]
+            prev-text (om/get-render-state owner :text)]
           (when (not= next-text prev-text)
             (put! (next-state :autocomplete-chan) next-text))))


change api in base64-vlq. encode-val is for a single number - encode now takes a vector values.

--- src/clj/cljs/source_map/base64_vlq.clj
+++ src/clj/cljs/source_map/base64_vlq.clj
@@ -22,9 +22,9 @@
       (- shifted)
       shifted)))

-(defn encode [v]
+(defn encode-val [n]
   (let [sb (StringBuilder.)
-        vlq (to-vlq-signed v)]
+        vlq (to-vlq-signed n)]
     (loop [digit (bit-and vlq vlq-base-mask)
            vlq   (bit-shift-right-zero-fill vlq vlq-base-shift)]
       (if (pos? vlq)
@@ -34,6 +34,9 @@
                  (bit-shift-right-zero-fill vlq vlq-base-shift)))
         (.append sb (base64/encode digit))))
     (str sb)))
+
+(defn encode [v]
+  (apply str (map encode-val v)))

 (defn decode [^String s]
   (let [l (.length s)]
@@ -67,7 +70,7 @@

   ;; Base64 VLQ can only represent 32bit values

-  (encode 32) ; "gC"
+  (encode-val 32) ; "gC"
   (decode "gC") ; {:value 32 :rest ""}

   (decode "AAgBC") ; (0 0 16 1)
@@ -78,7 +81,7 @@
   (decode "AAggBC") ; very clever way to encode large values
   (decode "AAggBCA") ; 5 values instead of 4

-  (apply str (map encode [0 0 16 1])) ; "AAgBC"
+  (encode [0 0 16 1]) ; "AAgBC"

   (decode "IAWdD") ; (4 0 11 -14 -1) this is correct
   ;; gline N, gcol +4, file +0, line +11, col -14, name -1


revert everything back

revert everything back

--- src/clj/rumahsewa141/routes/member.clj
+++ src/clj/rumahsewa141/routes/member.clj
@@ -37,8 +37,7 @@
                             :description "Password changed."}))))

 (defn user-bills [{{id :id} :identity}]
-  #(when-let [bills (db/get-user-bills {:user_id id})]
-     bills))
+  #(db/get-user-bills {:user_id id}))

 (defn user-info [{{username :username} :identity}]
   #(db/get-user {:username username}))


Fix reordering lanes breaking links to them in the board

Om needs a vector of lanes idents, not a list.

--- src/kanban/components/board_dialog.cljs
+++ src/kanban/components/board_dialog.cljs
@@ -47,7 +47,7 @@
                  :element-fn #(dom/span #js {:className "lane-name"} (:name %))
                  :change-fn (fn [lanes]
                               (->> lanes
-                                   (map #(-> [:lane/by-id (:id %)]))
+                                   (mapv #(-> [:lane/by-id (:id %)]))
                                    (.update this :lanes)))})))
           (dom/p #js {:className "dialog-buttons"}
             (dom/button #js {:onClick close-fn} "Close"))


fix: multiple files cli reader

fix: multiple files cli reader

Feature stream starts with meta data. We now drop the meta data after the first file, if you select --single-processor mode. Default behaviour for multiple files is creating a new processor for every file

--- src/main/clojure/pdok/featured/core.clj
+++ src/main/clojure/pdok/featured/core.clj
@@ -30,17 +30,23 @@
         processor (processor/create meta dataset persistence projectors)]
     processor))

-(defn process [{:keys [json-files dataset] :as options}]
-  (log/info "Processing mode")
-  (let [[meta features] (features-from-files json-files :dataset dataset)
-        processor (setup-processor (merge meta options))]
+(defn process-features [features options]
+  (log/info "Start processing")
+  (let [processor (setup-processor options)]
     (dorun (consume processor features))
     (do (log/info "Shutting down.")
         (shutdown processor)))
-  (log/info "Done processing")
-  )
+  (log/info "Done processing"))

-(defn int? [^java.lang.String s]
+(defn process [{:keys [json-files dataset single-processor] :as options}]
+  (if single-processor
+    (let [[meta features] (features-from-files json-files :dataset dataset)]
+      (process-features features (merge meta options)))
+    (doseq [file json-files]
+      (let [[meta features] (features-from-files [file] :dataset dataset)]
+        (process-features features (merge meta options))))))
+
+  (defn int? [^java.lang.String s]
   (try
     (Integer/parseInt s)
     true
@@ -97,6 +103,7 @@
    [nil "--projection PROJ" "RD / ETRS89 / SOURCE"]
    ["-r" "--replay [N/root-collection]" "Replay last N events or all events from root-collection tree from persistence to projectors"]
    [nil "--clear-timeline-changelog" "Clear timeline changelog for dataset"]
+   [nil "--single-processor" "One processor for all files, reads meta data of first file only."]
    ["-h" "--help"]
    ["-v" "--version"]])

@@ -132,10 +139,15 @@
   java.io.Closeable
     (close [this] (close-fn)))

-(defn features-from-files [files & args]
+(defn features-from-files [files & {:keys [drop-meta?] :as args}]
+  (println "OPTS" drop-meta?)
   (when (seq files)
     (let [f (first files)
-          fs (clojure.java.io/reader f)]
-      (log/info "Processing " f)
-      (concat (CloseableSeq. (apply features-from-stream f args) #(.close fs))
-              (lazy-seq (apply features-from-files (rest files) args))))))
+          fs (clojure.java.io/reader f)
+          [meta features] (apply features-from-stream fs args)
+          closeable-seq (concat (CloseableSeq. features #(.close fs))
+                                (lazy-seq (apply features-from-files (rest files) (mapcat identity (assoc args :drop-meta? true)))))]
+      (log/info "Reading " f)
+      (if drop-meta?
+        closeable-seq
+        [meta closeable-seq]))))


Don't generate URLs with query parameters set to their default

--- src-cljs/tamarack/routes.cljs
+++ src-cljs/tamarack/routes.cljs
@@ -41,9 +41,30 @@
       {:last (:window-size timeslice) :tracking-now true}
       {:from (.toISOString from) :to (.toISOString to) :tracking-now false})))

+(defn remove-default-query-params [params]
+  (letfn [(remove-tracking-now [params]
+            (if (:tracking-now params)
+              (dissoc params :tracking-now)
+              params))
+          (remove-window-size [params]
+            (if (= state/default-tracking-now-window-size (:last params))
+              (dissoc params :last)
+              params))
+          (remove-conflicting [params]
+            (tamarack.util/log params)
+            (if (nil? (:tracking-now params))
+              (dissoc params :from :to)
+              (dissoc params :last)))]
+    ((comp remove-conflicting remove-tracking-now remove-window-size)
+     params)))
+
+(defn remove-route-defaults [route]
+  (update-in route [:query-params] remove-default-query-params))
+
 (defn navigate-to
   ([route arg]
-     (let [url (route (merge {:query-params (timeslice-query-params)} arg))]
+     (let [url (route (remove-route-defaults
+                       (merge {:query-params (timeslice-query-params)} arg)))]
        (.setToken history/history (subs url 1))))
   ([route]
      (navigate-to route {})))
@@ -55,7 +76,8 @@
                               [token ""]
                               [(subs token 0 qpos) (subs token (+ qpos 1))])
         query-params (secretary/decode-query-params query-string)
-        new-query-params (merge query-params (timeslice-query-params))
+        new-query-params (remove-default-query-params
+                          (merge query-params (timeslice-query-params)))
         new-query-string (secretary/encode-query-params new-query-params)
         token (string/join "?" [path new-query-string])]
     (.setToken history/history token)))


test fix?

test fix?

--- src/metabase/driver/query_processor.clj
+++ src/metabase/driver/query_processor.clj
@@ -318,7 +318,8 @@
                                                                  (:id %))
                                                       (contains? (set field-field-ids)
                                                                  (:id %)))))
-                                    (sort-by :position))]
+                                    (sort-by (fn [{:keys [position id]}]
+                                               [position (when id (- id))])))]
     (->> (concat breakout-fields field-fields other-fields)
          (map :castified)
          (filter identity))))


Lint fix :shirt:

Lint fix :shirt:

--- src/metabase/query_processor/macros.clj
+++ src/metabase/query_processor/macros.clj
@@ -21,7 +21,7 @@
       subclause                                subclause
       form                                     (throw (java.lang.Exception. (format "segment-parse-filter-subclause failed: invalid clause: %s" form))))))

-(defn segment-parse-filter [form]
+(defn- segment-parse-filter [form]
   (when (non-empty-clause? form)
     (match form
       ["AND" & subclauses] (into ["AND"] (mapv segment-parse-filter subclauses))


lein-release plugin: preparing 0.4.2 release

--- re_view/project.clj
+++ re_view/project.clj
@@ -1,4 +1,4 @@
-(defproject re-view "0.4.2-SNAPSHOT"
+(defproject re-view "0.4.2"
   :description "ClojureScript React Library"
   :url "https://www.github.com/braintripping/re-view/tree/master/re_view"
   :license {:name "Eclipse Public License"


(PDB-4895) storage: add a few new type annotations

These aren't likely performance critical, but were noticed when
examining the input hashing performance and won't hurt.  Though this
doesn't fix all the reflection warnings.  I left some date operations
alone for now.

--- src/puppetlabs/puppetdb/scf/storage.clj
+++ src/puppetlabs/puppetdb/scf/storage.clj
@@ -1093,7 +1093,7 @@
 ;; Chunk size for path insertion to avoid blowing prepared statement size limit
 (def path-insertion-chunk-size 6000)

-(defn pathmap-digestor [digest]
+(defn pathmap-digestor [^MessageDigest digest]
   (fn [{:keys [path value_type_id] :as pathmap}]
     (.update digest (-> (str path value_type_id)
                         (.getBytes "UTF-8")))
@@ -1165,7 +1165,8 @@
   [{:keys [certname values environment timestamp producer_timestamp producer package_inventory] :as fact-data}
    :- facts-schema]
   (jdbc/with-db-transaction []
-    (let [{:keys [package_hash certname_id factset_id stable_hash volatile_fact_names]}
+    (let [{:keys [package_hash certname_id factset_id
+                  ^bytes stable_hash volatile_fact_names]}
           (certname-factset-metadata certname)

           ;; split facts into stable and volatile maps. Everything that was
@@ -1175,7 +1176,7 @@
           current-volatile-fact-keys (volatile-fact-keys-for-factset factset_id)
           incoming-volatile-facts (select-keys values current-volatile-fact-keys)
           incoming-stable-facts (apply dissoc values current-volatile-fact-keys)
-          incoming-stable-fact-hash (shash/generic-identity-sha1-bytes incoming-stable-facts)
+          ^bytes incoming-stable-fact-hash (shash/generic-identity-sha1-bytes incoming-stable-facts)
           fact-json-updates (if-not (Arrays/equals stable_hash incoming-stable-fact-hash)
                               ;; stable facts are different; load the json and move the ones that
                               ;; changed into volatile
@@ -1202,8 +1203,8 @@

       ;; Only update the paths if any existing paths_hash doesn't
       ;; match the incoming paths.
-      (let [paths-hash (if-let [existing-hash (factset-paths-hash factset_id)]
-                         (let [incoming-hash (-> (facts/facts->pathmaps values)
+      (let [paths-hash (if-let [^bytes existing-hash (factset-paths-hash factset_id)]
+                         (let [^bytes incoming-hash (-> (facts/facts->pathmaps values)
                                                  hash-pathmaps-paths)]
                            (if (Arrays/equals existing-hash incoming-hash)
                              existing-hash


added gone

added gone

--- src/babel/english/lexicon-verbcoach.clj
+++ src/babel/english/lexicon-verbcoach.clj
@@ -899,7 +899,8 @@
                     :discrete false
                     :pred :go}
              :subcat {:2 {:cat :prep}}}
-    :english {:past "went"}}
+    :english {:past "went"
+              :past-participle "gone"}}

    ;; TODO: move all "go X"s to "go" with a subcat argument, a la phrasal verbs e.g. "putting on"
    "go around"
@@ -909,6 +910,7 @@
                    :pred :go-around}
              :subcat {:2 '()}}
     :english {:past "went around"
+
               :participle "going around"
               :present {:3sing "goes around"}}}


Fixed a bug in indexing start-date and end-date.

--- src/cmr/indexer/services/collection.clj
+++ src/cmr/indexer/services/collection.clj
@@ -27,5 +27,5 @@
      :short-name.lowercase (s/lower-case short-name)
      :version-id version-id
      :version-id.lowercase (s/lower-case version-id)
-     :start-date (f/unparse (f/formatters :date-time) start-date)
-     :end-date (f/unparse (f/formatters :date-time) end-date)}))
+     :start-date (when-not (nil? start-date) (f/unparse (f/formatters :date-time) start-date))
+     :end-date (when-not (nil? end-date) (f/unparse (f/formatters :date-time) end-date))}))


Tune query generators

Tune query generators

--- src/com/wsscode/pathom/specs/query.cljc
+++ src/com/wsscode/pathom/specs/query.cljc
@@ -32,9 +32,9 @@

    ::gen-join-key
    (fn gen-join-key [{::keys [gen-property gen-ident gen-join-key-param-expr] :as env}]
-     (gen/one-of [(gen-property env)
-                  (gen-ident env)
-                  (gen-join-key-param-expr env)]))
+     (gen/frequency [[10 (gen-property env)]
+                     [3 (gen-ident env)]
+                     [1 (gen-join-key-param-expr env)]]))

    ::gen-join-key-param-key
    (fn gen-join-key-param-key [{::keys [gen-property gen-ident] :as env}]
@@ -52,9 +52,9 @@

    ::gen-join-query
    (fn gen-join-query [{::keys [gen-query gen-union gen-recursion] :as env}]
-     (gen/frequency [[10 (gen-query env)
-                      2 (gen-union env)
-                      1 (gen-recursion env)]]))
+     (gen/frequency [[10 (gen-query env)]
+                     [2 (gen-union env)]
+                     [1 (gen-recursion env)]]))

    ::gen-union-key
    (fn gen-union-key [_] gen/keyword)
@@ -85,11 +85,11 @@
    ::gen-query-expr
    (fn gen-query-expr [{::keys [gen-property gen-join gen-ident gen-param-expr gen-special-property]
                         :as    env}]
-     (gen/one-of [(gen-property env)
-                  (gen-join env)
-                  (gen-ident env)
-                  (gen-param-expr env)
-                  (gen-special-property env)]))
+     (gen/frequency [[20 (gen-property env)]
+                     [6 (gen-join env)]
+                     [1 (gen-ident env)]
+                     [2 (gen-param-expr env)]
+                     [1 (gen-special-property env)]]))

    ::gen-query
    (fn gen-query [{::keys [gen-query-expr gen-max-depth] :as env}]
@@ -128,6 +128,10 @@

 (defn default-gen [name]
   #((get generators name) generators))
+
+(defn make-gen [env name]
+  (let [env (merge generators env)]
+    ((get env name) env)))

 (s/def ::property keyword?)
 (s/def ::special-property #{'*})
@@ -223,8 +227,28 @@
           :mutation ::mutation-tx)
     (default-gen ::gen-transaction)))

+
 (comment
-  (gen/sample (s/gen ::query))
+  (time
+    (clojure.test.check/quick-check 30
+      (clojure.test.check.properties/for-all [query (make-gen {::gen-params
+                                                               (fn [_] (gen/map gen/keyword gen/string-ascii))}
+                                                      ::gen-transaction)]
+        (fp/query->ast query))))
+
+  (gen/sample (make-gen {::gen-params
+                         (fn [_] (gen/map (gen/return :param) gen/string-ascii))
+
+                         ::gen-property
+                         (fn [_] (gen/return :prop))
+
+                         ::gen-union-key
+                         (fn [_] (gen/elements [:a :b :c]))
+
+                         ::gen-ident
+                         (fn [_] (gen/return [:by-id 42]))}
+                ::gen-query)
+    10)

   (let [system (assoc generators
                  ::gen-params


CMR-1936: Fix test description

CMR-1936: Fix test description

--- system-int-test/test/cmr/system_int_test/search/collection_platform_instrument_sensor_search_test.clj
+++ system-int-test/test/cmr/system_int_test/search/collection_platform_instrument_sensor_search_test.clj
@@ -71,7 +71,7 @@
            [coll4 coll5] "platform_Sn_" {:pattern true}
            [coll2] ["platform_Sn B" "platform_Sn A"] {:and true}))

-    (testing "Search collections by platform short-name using JSON query"
+    (testing "Search collections by platform using JSON query"
       (are [items search]
            (d/refs-match? items (search/find-refs-with-json-query :collection {} search))


fix typo in ns

fix typo in ns

Former-commit-id: 547ececac372fafe71a643b72d04dae008187ad7

--- src/status_im/components/main_tabs.cljs
+++ src/status_im/components/main_tabs.cljs
@@ -1,4 +1,4 @@
-(ns status-im.components.main_tabs
+(ns status-im.components.main-tabs
   (:require-macros [status-im.utils.views :refer [defview]])
   (:require [re-frame.core :refer [subscribe dispatch dispatch-sync]]
             [status-im.components.react :refer [view


Remove balances for deleted watch account

Signed-off-by: Churikova Tetiana <df59d4ef10565572befc1f25db27f19bd387b29a@gmail.com>

--- src/status_im/wallet/accounts/core.cljs
+++ src/status_im/wallet/accounts/core.cljs
@@ -102,12 +102,15 @@
   {:events [:wallet.accounts/delete-account]}
   [{:keys [db] :as cofx} account]
   (let [accounts (:multiaccount/accounts db)
-        new-accounts (vec (remove #(= account %) accounts))]
+        new-accounts (vec (remove #(= account %) accounts))
+        deleted-address (get-in account [:address])]
     (fx/merge cofx
               {::json-rpc/call [{:method     "accounts_deleteAccount"
                                  :params     [(:address account)]
                                  :on-success #()}]
-               :db (assoc db :multiaccount/accounts new-accounts)}
+               :db (-> db
+                       (assoc :multiaccount/accounts new-accounts)
+                       (assoc-in [:wallet :accounts deleted-address] nil))}
               (navigation/navigate-to-cofx :wallet nil))))

 (fx/defn save-generated-account


s/map/pmap/

s/map/pmap/

--- src/babel/italiano/writer.clj
+++ src/babel/italiano/writer.clj
@@ -48,11 +48,11 @@
                    (log/trace (str "verb: " (strip-refs verb)))
                    (let [root-form (get-in verb [:italiano :italiano])]
                      (log/info (str "generating with verb: '" root-form "'"))
-                     (.size (map (fn [tense]
+                     (.size (pmap (fn [tense]
                                    (let [spec (unify {:root {:italiano {:italiano root-form}}}
                                                      tense)]
                                      (.size
-                                      (map (fn [gender]
+                                      (pmap (fn [gender]
                                              (let [spec (unify spec
                                                                {:comp {:synsem {:agr gender}}})]
                                                (log/trace (str "generating from gender: " gender))


Teensy hole and holder

Teensy hole and holder

--- src/dactyl_keyboard/dactyl-manuform.clj
+++ src/dactyl_keyboard/dactyl-manuform.clj
@@ -5,15 +5,16 @@
             [unicode-math.core :refer :all]))

-(def nrows 4)
-(def ncols 6)
+(def nrows 6)
+(def ncols 6)                           ; it's not set up to change this
 (def lastrow (dec nrows))
 (def cornerrow (dec lastrow))
 (def α (/ π 12))                        ; curvature of the columns
 (def β (/ π (if (= nrows 4) 26 36)))    ; curvature of the rows
 (def centerrow (- cornerrow 1))         ; controls front-back tilt
 (def centercol 3)                       ; controls left-right tilt / tenting
-
+(def orthographic-x (> nrows 5))        ; for larger number of rows don't curve them in as much
+; (def orthographic-x true)

 ;;;;;;;;;;;;;;;;;
 ;; Switch Hole ;;
@@ -107,6 +108,7 @@
 (def column-radius (+ (/ (/ (+ mount-width 2.0) 2)
                          (Math/sin (/ β 2)))
                       cap-top-height))
+(def column-x-delta (+ -1 (- (* column-radius (Math/sin β)))))

 (defn key-place [column row shape]
   (let [row-placed-shape (->> shape
@@ -116,14 +118,21 @@
         column-offset (cond
                         (= column 2) [0 2.82 -4.5]
                         (>= column 4) [0 -5.8 5.64]
+                        ; (= column 22) [0 2.82 -4.5]
+                        ; (>= column 24) [0 -5.8 5.64]
                         :else [0 0 0])
         column-angle (* β (- centercol column))
         placed-shape (->> row-placed-shape
                           (translate [0 0 (- column-radius)])
                           (rotate column-angle [0 1 0])
                           (translate [0 0 column-radius])
-                          (translate column-offset))]
-    (->> placed-shape
+                          (translate column-offset))
+        column-z-delta (* column-radius (- 1 (Math/cos column-angle)))
+        placed-shape-ortho (->> row-placed-shape
+                                (rotate column-angle [0 1 0])
+                                (translate [(- (* (- column centercol) column-x-delta)) 0 column-z-delta])
+                                (translate column-offset))]
+    (->> (if orthographic-x placed-shape-ortho placed-shape)
          (rotate (/ π 12) [0 1 0])
          (translate [0 0 24]))))

@@ -465,47 +474,51 @@
 (def teensy-pcb-thickness 1.6)
 (def teensy-offset-height 5)

-; (def teensy-holder
-;   (on-wall-place 0 20
-;     (union
-;       (->> (cube 5 (* 1.2 teensy2-length) (+ 6 teensy-width))
-;            (translate [-5 -30 0]))
-;       (->> (cube 5 (* 1.2 teensy2-length) 3)
-;            (translate [-3 -30 (- -1.5 (/ teensy-width 2))]))
-;       (->> (cube 5 (* 1.2 teensy2-length) 5)
-;            (translate [2 -30 (- -0.5 (/ teensy-width 2))]))
-;            )))
-
 (def teensy-holder
-  (on-wall-place 0 20
-    (union
-      (->> (cube 5 (* 1.2 teensy2-length) (+ 6 teensy-width))
-           (translate [-2.5 -30 0]))
-      (->> (cube teensy-pcb-thickness (* 1.2 teensy2-length) 3)
-           (translate [(/ teensy-pcb-thickness 2) -30 (- -1.5 (/ teensy-width 2))]))
-      (->> (cube 4 (* 1.2 teensy2-length) 4)
-           (translate [(+ 2 teensy-pcb-thickness) -30 (-  -1 (/ teensy-width 2))]))
-      (->> (cube teensy-pcb-thickness (* 0.2 teensy2-length) 3)
-           (translate [(/ teensy-pcb-thickness 2) (+ (* 0.5 teensy2-length) -30) (+ 1.5 (/ teensy-width 2))]))
-      (->> (cube 4 (* 0.2 teensy2-length) 4)
-           (translate [(+ 2 teensy-pcb-thickness) (+ (* 0.5 teensy2-length) -30) (+  1 (/ teensy-width 2))]))
-           )))
-
+    (on-wall-place 0 20
+      (translate [-5 0 0]
+        (union
+          (->> (cube 3 (* 1.2 teensy2-length) (+ 6 teensy-width))
+               (translate [-1.5 -30 0]))
+          (->> (cube teensy-pcb-thickness (* 1.2 teensy2-length) 3)
+               (translate [(/ teensy-pcb-thickness 2) -30 (- -1.5 (/ teensy-width 2))]))
+          (->> (cube 4 (* 1.2 teensy2-length) 4)
+               (translate [(+ 2 teensy-pcb-thickness) -30 (-  -1 (/ teensy-width 2))]))
+          (->> (cube teensy-pcb-thickness (* 0.2 teensy2-length) 3)
+               (translate [(/ teensy-pcb-thickness 2) (+ (* 0.5 teensy2-length) -30) (+ 1.5 (/ teensy-width 2))]))
+          (->> (cube 4 (* 0.2 teensy2-length) 4)
+               (translate [(+ 2 teensy-pcb-thickness) (+ (* 0.5 teensy2-length) -30) (+  1 (/ teensy-width 2))]))
+           ))))
+
+(def usb-cutout
+  (let [hole-height 6.2
+        side-radius (/ hole-height 2)
+        hole-width 10.75
+        side-cylinder (->> (cylinder side-radius teensy-length)
+                           (with-fn 20)
+                           (translate [(/ (- hole-width hole-height) 2) 0 0]))]
+    (->> (hull side-cylinder
+               (mirror [-1 0 0] side-cylinder))
+         (rotate (/ π 2) [1 0 0])
+         (rotate (/ π 2) [0 1 0])
+        ;  (translate [0 (/ teensy-length 2) (- side-radius)])
+        ;  (translate [0 0 (- 1)])
+         (on-wall-place 0 20))))

 ;; teensy info
 ; base width - 18
 ; height - 1.45
 ;

-(spit "repl.scad"
+(spit "things/right.scad"
       (write-scad (union
                    key-holes
                    connectors
                    thumb
                    thumb-connectors
-                   (difference case-walls rj9-space)
+                   (difference case-walls rj9-space usb-cutout)
                    rj9-holder
-                   teensy-holder
+                   (if (= nrows 4) teensy-holder)
                   ;  thumbcaps
                   ;  caps
                    )))


Add target-audience keys to genres and to translations

--- src/catalog/layout/common.clj
+++ src/catalog/layout/common.clj
@@ -27,8 +27,13 @@
                 :lebensgestaltung-gesundheit-erziehung :philosophie-religion-esoterik
                 :reisen-natur-tiere :sprache :wissenschaft-technik
                 ;; Kinder und Jugendbücher
-                :kinderbücher-ab-6 :kinderbücher-ab-10 :jugendbücher
+                :kinderbücher-ab-3
+                :kinderbücher-ab-6
+                :kinderbücher-ab-10
+                :kinderbücher-ab-14
+                :jugendbücher
                 :kinder-und-jugendsachbücher
+                :bücher-für-erwachsene
                 ;; Bücher in Fremdsprachen
                 :englisch :weitere-fremdsprachen])

@@ -53,7 +58,6 @@
                              ;; Names for genres
                              :belletristik "Belletristik"
                              :sachbücher "Sachbücher"
-                             :kinder-und-jugendbücher "Kinder- und Jugendbücher"
                              :bücher-in-fremdsprachen "Bücher in Fremdsprachen"
                              :action-und-thriller "Action und Thriller"
                              :beziehungsromane "Beziehungsromane"
@@ -76,16 +80,21 @@
                              :sprache "Sprache"
                              :wissenschaft-technik "Wissenschaft, Technik"
                              :kinder-und-jugendsachbücher "Kinder- und Jugendsachbücher"
+                             :kinderbücher-ab-3 "Kinderbücher (ab 3)"
                              :kinderbücher-ab-6 "Kinderbücher (ab 6)"
                              :kinderbücher-ab-10 "Kinderbücher (ab 10)"
+                             :kinderbücher-ab-14 "Kinderbücher (ab 14)"
+                             :bücher-für-erwachsene "Bücher für Erwachsene"
+                             :kinder-und-jugendbücher "Kinder- und Jugendbücher"
+                             :jugendbücher "Jugendbücher (ab 14)"
                              :englisch "Englisch"
                              :weitere-fremdsprachen "Weitere Fremdsprachen"
                              :spielfilm "Spielfilme"
                              :mundartfilm "Mundartfilme"
                              :dokumentarfilm "Dokumentarfilme"
-                             :jugendbücher "Jugendbücher (ab 14)"
                              :musiknoten "Braille-Musiknoten"
                              :taktilesbuch "Taktile Bücher"
+                             :print-and-braille "Print & Braille Bücher"
                              :spiel "Spiele"
                              :lernspiel "Lernspiele"
                              :solitairspiel "Solitairspiele"


Handle honeysql sql call type.

Handle honeysql sql call type.

--- src/cavm/query/expression.clj
+++ src/cavm/query/expression.clj
@@ -1,6 +1,7 @@
 (ns cavm.query.expression
   (:require [clojure.edn :as edn])
   (:require [honeysql.types :as hsqltypes])
+  (:require [taoensso.timbre :as timbre :refer [info]])
   (:refer-clojure :exclude [eval letfn]))

 (def eval)
@@ -38,17 +39,19 @@
       (contains? specialfns func) (func node scope)
       :else (apply func (map #(eval % scope) (rest node))))))

+(def as-is #{keyword? string? #(instance? honeysql.types.SqlCall %)})
+
 (defn eval [node scope]
   (cond
     (symbol? node) ((first (filter #(contains? % node) scope)) node)
     (seq? node) (fn-node node scope)
     (instance? Number node) (double node)
-    (keyword? node) node
-    (string? node) node
+    (some #(% node) as-is) node
     ; due to weird (empty <clojure.lang.MapEntry>) behavior, we have
     ; to handle map? separate from coll?
     (map? node) (into {} (mapv #(eval (vec %) scope) node))
-    (coll? node) (into (empty node) (mapv #(eval % scope) node))))
+    (coll? node) (into (empty node) (mapv #(eval % scope) node))
+    :else (info "Unknown node type " (type node))))

 (defn expression [exp & globals]
   (eval (edn/read-string {:readers {'sql/call hsqltypes/read-sql-call}} exp) (cons specials globals)))


Check for a sequence of bytes.

Check for a sequence of bytes.

--- proxy-protocol/proxy-protocol-deserialisation/src/main/clojure/proxy/protocol/v1/proxy_information_deserialiser.clj
+++ proxy-protocol/proxy-protocol-deserialisation/src/main/clojure/proxy/protocol/v1/proxy_information_deserialiser.clj
@@ -7,12 +7,15 @@
     :name com.mattunderscore.proxy.protocol.v1.ProxyInformationDeserialiser
     :extends com.mattunderscore.tcproxy.io.serialisation.AbstractByteBufferDeserialiser))

-(defmacro if-has-byte [desired-byte seq & body]
-  (list 'if-let (vector 'byte (list 'first seq))
-        (list 'if (list '= (list 'char 'byte) desired-byte)
-              body
-              (list 'fn (vector) (list 'NotDeserialisableResult/create 1)))
-        (list 'fn (vector) (list 'NeedsMoreDataResult/INSTANCE))))
+(defn- if-has-bytes [seq & forms]
+  (if-let [next-byte (first seq)]
+    (if (= 1 (count forms))
+      (first forms)
+      (let [res (apply if-has-bytes (rest seq) (rest forms))]
+        (if (= (char next-byte) (first forms))
+          res
+          (NotDeserialisableResult/create 1))))
+    (NeedsMoreDataResult/INSTANCE)))

 (defn- has-info [context]
   (and (:header context)
@@ -25,7 +28,7 @@
               (:target-port context)))))

 (defn- process-next-byte [seq context]
-  (if-has-byte \P seq (if-has-byte \R (rest seq) (fn [] (NeedsMoreDataResult/INSTANCE)))))
+  (if-has-bytes seq \P \R \O \X \Y (NeedsMoreDataResult/INSTANCE)))

 (defn- read-info-from-sequence [seq]
   (process-next-byte seq {:processed 0 :header false :pending []}))


fix trash effect on other 3 executives

fix trash effect on other 3 executives

--- src/clj/game/cards-assets.clj
+++ src/clj/game/cards-assets.clj
@@ -53,7 +53,7 @@
    {:effect (effect (lose :runner :max-hand-size 2))
     :leave-play (effect (gain :runner :max-hand-size 2))
     :trash-effect {:req (req (:access @state))
-                   :effect (effect (move :runner card :scored) (gain-agenda-point :runner :agenda-point 2))}}
+                   :effect (effect (move :runner card :scored) (gain-agenda-point :runner 2))}}

    "City Surveillance"
    {:events {:runner-turn-begins
@@ -132,7 +132,7 @@
    "Director Haas"
    {:effect (effect (gain :click 1 :click-per-turn 1)) :leave-play (effect (lose :click-per-turn 1))
     :trash-effect {:req (req (:access @state))
-                   :effect (effect (move :runner card :scored) (gain-agenda-point :runner :agenda-point 2))}}
+                   :effect (effect (move :runner card :scored) (gain-agenda-point :runner 2))}}

    "Docklands Crackdown"
    {:abilities [{:cost [:click 2] :msg "add 1 power counter" :effect (effect (add-prop card :counter 1))}]}
@@ -535,7 +535,7 @@
     :leave-play (effect (gain :runner :agenda-point
                               (count (filter #(> (:agendapoints %) 0) (:scored runner)))))
     :trash-effect {:req (req (:access @state))
-                   :effect (effect (move :runner card :scored) (gain-agenda-point :runner :agenda-point 2))}
+                   :effect (effect (move :runner card :scored) (gain-agenda-point :runner 2))}
     :events {:agenda-stolen {:req (req (> (:agendapoints target) 0))
                              :effect (effect (lose :runner :agenda-point 1))}}}


remove some reflection warnings from the zookeeper consumer code

--- src/clj_kafka/consumer/zk.clj
+++ src/clj_kafka/consumer/zk.clj
@@ -1,5 +1,6 @@
 (ns clj-kafka.consumer.zk
-  (:import [kafka.consumer ConsumerConfig Consumer])
+  (:import [kafka.consumer ConsumerConfig Consumer KafkaStream]
+           [kafka.javaapi.consumer ConsumerConnector])
   (:use [clj-kafka.core :only (as-properties to-clojure with-resource pipe)])
   (:require [zookeeper :as zk]))

@@ -24,12 +25,12 @@

 (defn shutdown
   "Closes the connection to Zookeeper and stops consuming messages."
-  [consumer]
+  [^ConsumerConnector consumer]
   (.shutdown consumer))

 (defn messages
   "Creates a sequence of messages from the given topics."
-  [consumer topic]
+  [^ConsumerConnector consumer topic]
   (let [[topic streams] (first (.createMessageStreams consumer {topic (Integer/valueOf 1)}))]
-    (iterator-seq (.iterator (first streams)))))
+    (iterator-seq (.iterator ^KafkaStream (first streams)))))


clean up cljs.source-map port, update comments, docstrings and provide a proper `cljs.source-map/decode` for client side use

--- src/cljs/cljs/source_map.cljs
+++ src/cljs/cljs/source_map.cljs
@@ -12,34 +12,27 @@
             [cljs.source-map.base64-vlq :as base64-vlq]))

 ;; =============================================================================
-;; All source map code in the file assumes the following in memory
+;; Source map code in the file assumes the following in memory
+;; representation of source map data.
+;;
+;; { gline[Integer]
+;;   { gcol[Integer]
+;;    [{ :line ..., :col ..., :name ..., :source ... }] } }
+;;
+;; Reverse source map code in the file assumes the following in memory
 ;; representation of source map data.
 ;;
 ;; { file-name[String]
 ;;   { line[Integer]
 ;;     { col[Integer]
-;;       [{ :gline ..., :gcol ..., :name ...}] } }
-;;
-;; The outer level is a sorted map where the entries are file name and
-;; sorted map of line information, the keys are strings. The line
-;; information is represented as a sorted map of of column
-;; information, the keys are integers. The column information is a
-;; sorted map where the keys are integers and values are a vector of
-;; maps - these maps have the keys :gline and :gcol for the generated
-;; line and column.  A :name key may be present if available.
-;;
-;; This representation simplifies merging ClojureScript source map
-;; information with source map information generated by Google Closure
-;; Compiler optimization. We can now trivially create the merged map
-;; by using :gline and :gcol in the ClojureScript source map data to
-;; extract final :gline and :gcol from the Google Closure source map.
+;;       [{ :gline ..., :gcol ..., :name ... }] } }

 ;; -----------------------------------------------------------------------------
 ;; Utilities

 (defn indexed-sources
   "Take a seq of source file names and return a map from
-   file number to integer index."
+   file number to integer index. For reverse source maps."
   [sources]
   (->> sources
     (map-indexed (fn [a b] [a b]))
@@ -47,7 +40,8 @@

 (defn source-compare
   "Take a seq of source file names and return a comparator
-   that can be used to construct a sorted map."
+   that can be used to construct a sorted map. For reverse
+   source maps."
   [sources]
   (let [sources (indexed-sources sources)]
     (fn [a b] (compare (sources a) (sources b)))))
@@ -83,10 +77,9 @@
       (with-meta nseg {:name (+ name rname)})
       nseg)))

-(defn update-result
-  "Helper for decode. Take an internal source map representation
-   organized as nested sorted maps mapping file, line, and column
-   and update it based on a segment map and generated line number."
+(defn update-reverse-result
+  "Helper for decode-reverse. Take a reverse source map and
+  update it with a segment map."
   [result segmap gline]
   (let [{:keys [gcol source line col name]} segmap
         d {:gline gline
@@ -103,11 +96,11 @@
             (sorted-map)))))

 (defn decode-reverse
-  "Convert a v3 source map JSON object into a nested sorted map
-   organized as file, line, and column that maps ClojureScript
-   source locations to the generated JavaScript."
+  "Convert a v3 source map JSON object into a reverse source map
+  mapping original ClojureScript source locations to the generated
+  JavaScript."
   ([source-map]
-     (decode (aget source-map "mappings") source-map))
+     (decode-reverse (aget source-map "mappings") source-map))
   ([mappings source-map]
      (let [sources (aget source-map "sources")
            relseg-init [0 0 0 0 0]
@@ -127,6 +120,48 @@
                          (let [seg (first segs)
                                nrelseg (seg-combine (base64-vlq/decode seg) relseg)]
                            (recur (next segs) nrelseg
+                             (update-reverse-result result (seg->map nrelseg source-map) gline)))
+                         [result relseg]))))]
+             (recur (inc gline) (next lines) (assoc relseg 0 0) result))
+           result)))))
+
+(defn update-result
+  "Helper for decode. Take a source map and update it based on a
+  segment map."
+  [result segmap gline]
+  (let [{:keys [gcol source line col name]} segmap
+        d {:line col
+           :col  line
+           :source source}
+        d (if name (assoc d :name name) d)]
+    (update-in result [gline]
+      (fnil (fn [m]
+              (update-in m [gcol]
+                (fnil #(conj % d) [])))
+            (sorted-map)))))
+
+(defn decode
+  "Convert a v3 source map JSON object into a source map mapping
+  generated JavaScript source locations to the original
+  ClojureScript."
+  ([source-map]
+     (decode (aget source-map "mappings") source-map))
+  ([mappings source-map]
+     (let [sources (aget source-map "sources")
+           relseg-init [0 0 0 0 0]
+           lines (seq (string/split mappings #";"))]
+       (loop [gline 0 lines lines relseg relseg-init result {}]
+         (if lines
+           (let [line (first lines)
+                 [result relseg]
+                 (if (string/blank? line)
+                   [result relseg]
+                   (let [segs (seq (string/split line #","))]
+                     (loop [segs segs relseg relseg result result]
+                       (if segs
+                         (let [seg (first segs)
+                               nrelseg (seg-combine (base64-vlq/decode seg) relseg)]
+                           (recur (next segs) nrelseg
                              (update-result result (seg->map nrelseg source-map) gline)))
                          [result relseg]))))]
              (recur (inc gline) (next lines) (assoc relseg 0 0) result))


remove source timestamp from `cljs.source-map/seg->map`. rename `cljs.source-map/decode` to `cljs.source-map/decode-reverse` clarifying what it does.

--- src/cljs/cljs/source_map.cljs
+++ src/cljs/cljs/source_map.cljs
@@ -61,7 +61,7 @@
   [seg source-map]
   (let [[gcol source line col name] seg]
    {:gcol   gcol
-    :source (aget source-map "sources" source)
+    :source (aget (.split (aget source-map "sources" source) "?") 0)
     :line   line
     :col    col
     :name   (when-let [name (-> seg meta :name)]
@@ -102,9 +102,10 @@
                       (sorted-map))))
             (sorted-map)))))

-(defn decode
+(defn decode-reverse
   "Convert a v3 source map JSON object into a nested sorted map
-   organized as file, line, and column."
+   organized as file, line, and column that maps ClojureScript
+   source locations to the generated JavaScript."
   ([source-map]
      (decode (aget source-map "mappings") source-map))
   ([mappings source-map]


Fixed typo.

Fixed typo.

--- src/cmr/http/kit/response.clj
+++ src/cmr/http/kit/response.clj
@@ -34,7 +34,7 @@
 (defn parse-xml-body
   [body]
   (let [str-data (if (string? body) body (slurp body))
-        zml-data (xml/parse-str str-data)]
+        xml-data (xml/parse-str str-data)]
     (log/trace "str-data:" str-data)
     (log/trace "xml-data:" xml-data)
     xml-data))


Rename function name.

Rename function name.

--- src/cmr/search/api/routes.clj
+++ src/cmr/search/api/routes.clj
@@ -30,7 +30,7 @@
      :headers {"Content-Type" (sr/format->mime-type result-format)}
      :body (sr/search-results->response results result-format pretty?)}))

-(defn- find-by-cmr-concept-id
+(defn- find-concept-by-cmr-concept-id
   "Invokes query service to find concept metadata by cmr concept id and returns the response"
   [context concept-id headers]
   ;; TODO headers argument is reserved for ACL validation
@@ -50,7 +50,7 @@
         (find-references context :granule params headers)))
     (context "/concepts/:cmr-concept-id" [cmr-concept-id]
       (GET "/" {headers :headers context :request-context}
-        (find-by-cmr-concept-id context cmr-concept-id headers)))
+        (find-concept-by-cmr-concept-id context cmr-concept-id headers)))
     (route/not-found "Not Found")))

 (defn make-api [system]


rename scene-graph -> datum

rename scene-graph -> datum

--- src/com/kaicode/infamous.cljs
+++ src/com/kaicode/infamous.cljs
@@ -65,8 +65,8 @@
                                :db/valueType   :db.type/ref}})
 (def conn (d/create-conn schema))

-(defn save [scene-graph]
-      (d/transact! conn [scene-graph]))
+(defn save [datum]
+      (d/transact! conn [datum]))

 (defn get-node-by-id [id]
       (ffirst (d/q '[:find (pull ?node [*]) :in $ ?id :where [?node :node/id ?id]] @conn id)))


only instrument api calls to circle

only instrument api calls to circle

--- frontend/instrumentation.cljs
+++ frontend/instrumentation.cljs
@@ -6,7 +6,7 @@
   (fn [state]
     (let [state (handler state)]
       (try
-        (if-not (:response-headers api-data)
+        (if-not (and (:response-headers api-data) (= \/ (first (:url api-data))))
           state
           (let [{:keys [url method request-time response-headers]} api-data]
             (update-in state state/instrumentation-path conj {:url url


add functionality to implement "simple" message handlers

--- src/fscrawler_tika_convert/mqhelper.clj
+++ src/fscrawler_tika_convert/mqhelper.clj
@@ -4,6 +4,8 @@
   (:import [java.util.concurrent Executors])
   (:require [clojure.tools.logging :as logging]
             [clj-logging-config.log4j :as log-config])
+  (:require [clojure.data.json :as json])
+  (:require [fscrawler-tika-convert.routing-key :as rk])

   (:require [langohr.basic :as lb]
             [langohr.shutdown :as lshutdown]
@@ -72,3 +74,24 @@
     (connect-loop
      connect
      handle-connection)))
+
+
+(defn make-handler
+  "create a langohr message handler from a somewhat simpler message
+  handler function
+  simple-fn will be called with two arguments like
+
+  (simple-fn body {:publish publish})
+
+  where body is the decoded message body and publish is a function
+
+  (fn [command publish-body] ...)"
+  [simple-fn]
+  (fn [ch {:keys [delivery-tag exchange routing-key] :as meta} ^bytes payload]
+    (let [body (json/read-json (String. payload "UTF-8"))
+          publish (fn [command publish-body]
+                    (lb/publish ch exchange
+                                (rk/routing-key-string-with-command routing-key command)
+                                (json/write-str publish-body)))]
+      (simple-fn body {:publish publish})
+      (lb/ack ch delivery-tag))))


Added fns for loading vowels, cons, & alphabets.

--- src/hxgm30/language/syntagmata/util.clj
+++ src/hxgm30/language/syntagmata/util.clj
@@ -1,6 +1,7 @@
 (ns hxgm30.language.syntagmata.util
   (:require
     [clojure.java.io :as io]
+    [clojure.set :as set]
     [clojure.string :as string]))

 (defn load-corpora
@@ -13,3 +14,23 @@
        line-seq
        (mapcat #(string/split % #" "))
        sort))
+
+(defn load-oneline-file
+  [type language]
+  (->> language
+       (load-corpora type)
+       first
+       (map str)
+       set))
+
+(defn load-consonants
+  [language]
+  (load-oneline-file :consonants language))
+
+(defn load-vowels
+  [language]
+  (load-oneline-file :vowels language))
+
+(defn load-alphabet
+  [language]
+  (set/union (load-consonants language) (load-vowels language)))


Fix int->scalar bytes tag

Fix int->scalar bytes tag

--- test/caesium/crypto/scalarmult_test.clj
+++ test/caesium/crypto/scalarmult_test.clj
@@ -13,7 +13,7 @@
 (def basepoint
   (byte-array (into [9] (repeat (dec s/bytes) 0))))

-(def ^bytes ^:private int->scalar
+(def ^{:tag 'bytes} ^:private int->scalar
   "**DANGER** This fn is typically only used for demos, not secure
   cryptosystems; see rest of docstring for details. Turns an integral
   type (int, bigint, biginteger) into a byte array suitable for use as


reuse factors from the previous exercise.

--- clojure/raindrops/raindrops.clj
+++ clojure/raindrops/raindrops.clj
@@ -2,22 +2,13 @@
   (require [clojure.set :as set :only [intersection]]
            [clojure.string :as s :only [join]]))

-(let [divisible? (comp zero? rem)]
-  (defn- factors
-    "returns the prime factors of n"
-    [n]
-    (loop [n n
-           candidate 2
-           acc []]
-      (if (<= n 1) acc
-          (if (divisible? n candidate)
-            (recur (bigint (/ n candidate)) candidate (conj acc candidate))
-            (recur n (inc candidate) acc))))))
+;;; from the previous exercise: http://git.io/3ziOAQ
+(load-file "../prime-factors/prime_factors.clj")

 (let [lang {3 "Pling" 5 "Plang" 7 "Plong"}]
   (defn convert
     [n]
-    (let [ns (set (factors n))]
-      (if-let [found-ns (seq (set/intersection ns (set (keys lang))))]
+    (let [factors (set (prime-factors/of n))]
+      (if-let [found-ns (seq (set/intersection factors (set (keys lang))))]
         (s/join (map lang found-ns))
         (str n)))))


Minor indentation change in reports.scheduler.

--- reports/src/reports/scheduler.clj
+++ reports/src/reports/scheduler.clj
@@ -77,7 +77,7 @@
   "Invalidates (removes) a given file from the cache"
   (let [baseURL (params "baseURL")]
     (doseq [sid (params "surveyIds")]
-    (dosync
-      (doseq [k (keys @cache) :when (and (= (k :baseURL) baseURL) (= (str sid) (k :surveyId)))]
-      (alter cache dissoc k))))
+      (dosync
+        (doseq [k (keys @cache) :when (and (= (k :baseURL) baseURL) (= (str sid) (k :surveyId)))]
+        (alter cache dissoc k))))
     "OK"))


Botch mapv further for our particular requirements

--- src/eulalie/util/functor.cljc
+++ src/eulalie/util/functor.cljc
@@ -3,7 +3,8 @@

 (defn fmap [f x]
   (cond
-    (map?  x) (into {}  (for [[k v] x] [k (f v)]))
-    (coll? x) (into (empty x) (map f x))
+    (map?  x) (into (empty x) (for [[k v] x] [k (f v)]))
+    (set?  x) (into (empty x) (map f x))
+    (coll? x) (mapv f x)
     (nil?  x) x
     :else     (f x)))


Document grimoire.api.web.read/do-data-req

--- src/grimoire/api/web/read.clj
+++ src/grimoire/api/web/read.clj
@@ -52,7 +52,13 @@
        baseurl (:uri thing)
        "?op=" op "&type=edn"))

-(defn do-data-req [config thing op]
+(defn do-data-req
+  "λ [Cfg → Thing → Op] → Either[Success[t], Failure[String]]
+
+  Forges and executes a data request agains the Grimoire web API as specified by
+  the various arguments. Returns the entire result of the Grimoire request
+  unaltered and wrapped in Either."
+  [config thing op]
   {:post [either?]}
   (let [?res (-> (make-request config thing op)
                 slurp


-- make async request result and status handlers secure (#83)

--- waiter/src/waiter/core.clj
+++ waiter/src/waiter/core.clj
@@ -848,12 +848,20 @@
                                     (fn inner-async-complete-handler-fn [src-router-id request]
                                       (handler/complete-async-handler async-request-terminate-fn src-router-id request))
                                     request)))
-   :async-result-handler-fn (pc/fnk [[:routines async-trigger-terminate-fn make-http-request-fn service-id->service-description-fn]]
+   :async-result-handler-fn (pc/fnk [[:routines async-trigger-terminate-fn make-http-request-fn service-id->service-description-fn]
+                                     handle-secure-request-fn]
                               (fn async-result-handler-fn [request]
-                                (handler/async-result-handler async-trigger-terminate-fn make-http-request-fn service-id->service-description-fn request)))
-   :async-status-handler-fn (pc/fnk [[:routines async-trigger-terminate-fn make-http-request-fn service-id->service-description-fn]]
+                                (handle-secure-request-fn
+                                  (fn inner-async-result-handler-fn [request]
+                                    (handler/async-result-handler async-trigger-terminate-fn make-http-request-fn service-id->service-description-fn request))
+                                  request)))
+   :async-status-handler-fn (pc/fnk [[:routines async-trigger-terminate-fn make-http-request-fn service-id->service-description-fn]
+                                     handle-secure-request-fn]
                               (fn async-status-handler-fn [request]
-                                (handler/async-status-handler async-trigger-terminate-fn make-http-request-fn service-id->service-description-fn request)))
+                                (handle-secure-request-fn
+                                  (fn inner-async-status-handler-fn [request]
+                                    (handler/async-status-handler async-trigger-terminate-fn make-http-request-fn service-id->service-description-fn request))
+                                  request)))
    :blacklist-instance-handler-fn (pc/fnk [[:state instance-rpc-chan]
                                            handle-inter-router-request-fn]
                                     (fn blacklist-instance-handler-fn [request]


Remove pointless operation

Remove pointless operation

--- src/refactor_nrepl/find/find_symbol.clj
+++ src/refactor_nrepl/find/find_symbol.clj
@@ -126,8 +126,7 @@
     (->> dir
          java.io.File.
          find/find-sources-in-dir
-         (mapcat (partial find-symbol-in-file fully-qualified-name ignore-errors))
-         (map identity))))
+         (mapcat (partial find-symbol-in-file fully-qualified-name ignore-errors)))))

 (defn- get&read-enclosing-sexps
   [file-content {:keys [line-beg col-beg]}]


Minor cosmetic improvements on header.

Minor cosmetic improvements on header.

--- src/uxbox/main/ui/dashboard/header.cljs
+++ src/uxbox/main/ui/dashboard/header.cljs
@@ -7,19 +7,19 @@

 (ns uxbox.main.ui.dashboard.header
   (:require [lentes.core :as l]
-            [uxbox.util.i18n :refer (tr)]
-            [uxbox.util.router :as r]
-            [uxbox.util.rstore :as rs]
-            [uxbox.main.state :as s]
+            [uxbox.main.state :as st]
             [uxbox.main.data.projects :as dp]
             [uxbox.main.ui.navigation :as nav]
             [uxbox.main.ui.icons :as i]
             [uxbox.main.ui.users :as ui.u]
-            [uxbox.util.mixins :as mx]))
+            [uxbox.util.i18n :refer (tr)]
+            [uxbox.util.router :as r]
+            [uxbox.util.mixins :as mx :include-macros true]
+            [uxbox.util.rstore :as rs]))

 (def header-ref
-  (-> (l/in [:dashboard])
-      (l/derive s/state)))
+  (-> (l/key :dashboard)
+      (l/derive st/state)))

 (mx/defc header-link
   [section content]


Makign a test cljs in cljs macro

Makign a test cljs in cljs macro

finally works. Macros in clojurescript must be defined in their own file

--- src/webapp/framework/client/macros.cljs
+++ src/webapp/framework/client/macros.cljs
@@ -10,5 +10,5 @@

 (defmacro zoo [attr]
-  1)
+  attr)


refactoring dom helper

refactoring dom helper

--- src-cljs/complico/dom_helper.cljs
+++ src-cljs/complico/dom_helper.cljs
@@ -1,25 +1,28 @@
-(ns complico.dom-helper)
-
-(defn is-text-node [node]
-  (= (.-nodeType node) 3))
-
-(defn get-child-nodes [node]
-  (.-childNodes node))
-
-(defn get-text-node [node]
-  (first (filter #(is-text-node %) (get-child-nodes node))))
-
-(defn get-text-from-node [node]
-  (let [text-node (get-text-node node)]
-    (if (= text-node nil)
-      nil
-      (.-nodeValue text-node))))
-
-(defn set-text-on-node [node text]
-  (set! (.-nodeValue node) text))
-
-(defn replace-text-on-node! [elem text]
-  (let [node (get-text-node elem)]
-    (set-text-on-node node text))
-  elem)
-
+(ns complico.dom-helper)
+
+(defn is-text-node [node]
+  (-> node
+    (.-nodeType)
+    (= 3)))
+
+(defn get-child-nodes [node]
+  (.-childNodes node))
+
+(defn get-text-node [node]
+  (->> node
+    (get-child-nodes)
+    (filter is-text-node)
+    (first)))
+
+(defn get-text-from-node [node]
+  (if-let [text-node (get-text-node node)]
+    (.-nodeValue text-node)))
+
+(defn set-text-on-node [node text]
+  (-> node
+    (.-nodeValue)
+    (set! text)))
+
+(defn replace-text-on-node! [elem text]
+  (let [node (get-text-node elem)]
+    (set-text-on-node node text)))


shorten integration test CIDs (#811)

shorten integration test CIDs (#811)

--- waiter/src/waiter/util/client_tools.clj
+++ waiter/src/waiter/util/client_tools.clj
@@ -215,7 +215,9 @@
 (defn current-test-name
   "Get the name of the currently-running test."
   []
-  (-> *testing-vars* first meta :name (or "test-unknown-name") str))
+  (str (-> *testing-vars* first meta :ns str)
+       "/"
+       (-> *testing-vars* first meta :name)))

 (defmacro testing-using-waiter-url
   [& body]
@@ -251,16 +253,27 @@
       :instance-id instance-id
       :service-id service-id)))

+(defn extract-acronym
+  "Shortens the name taking only the leading characters across the delimiters.
+   E.g. `(extract-acronym \"aaa.bbb-ccc/ddd#eee-fff.ggg\") -> \"abcdfg\"`"
+  [name-with-dashes]
+  (->> (str/split (str name-with-dashes) #"-|\.|/")
+    (remove str/blank?)
+    (map first)
+    (str/join "")
+    str/lower-case))
+
 (defn ensure-cid-in-headers
   [request-headers & {:keys [verbose] :or {verbose false}}]
   (let [cid (or (get request-headers "x-cid")
                 (get request-headers :x-cid))]
     (if cid
       request-headers
-      (let [new-cid (str (cid/get-correlation-id) "-" (utils/unique-identifier))]
+      (let [correlation-id (cid/get-correlation-id)
+            new-cid (str "test-" (extract-acronym (current-test-name)) "-" (utils/unique-identifier))]
         (when verbose
           (log/info "Using cid" new-cid))
-        (when (str/includes? new-cid "UNKNOWN")
+        (when (str/includes? correlation-id "UNKNOWN")
           (log/info "Correlation id context unspecified")
           (when verbose
             (log/warn (RuntimeException.))))
@@ -709,12 +722,11 @@

 (defn rand-name
   ([]
-   (let [service-name (str (or (:name (meta (first *testing-vars*))) "test-unknown-name"))]
+   (let [service-name (current-test-name)]
      (rand-name service-name)))
   ([service-name]
-   (let [username (System/getProperty "user.name")
-         test-prefix (System/getenv "WAITER_TEST_PREFIX")]
-     (str/replace (str test-prefix service-name username (rand-int 3000000)) #"-" ""))))
+   (let [test-prefix (System/getenv "WAITER_TEST_PREFIX")]
+     (str/replace (str test-prefix (extract-acronym service-name) (System/nanoTime)) #"-" ""))))

 (defn- token->etag
   "Returns the current etag of a token"


Add depth function.

Add depth function.

--- src/algebolic/expression/tree.clj
+++ src/algebolic/expression/tree.clj
@@ -32,6 +32,22 @@
            :sin (+ 1 (count-nodes (nth expr 1)))
            :cos (+ 1 (count-nodes (nth expr 1)))
            :square (+ 1 (count-nodes (nth expr 1))))))
+
+;; TODO: use arity, rather than explicitly listing all function symbols
+(defn depth
+  "Count the depth of a tree, including both the function symbols and terminals."
+  [expr]
+  (cond
+    (symbol? expr) 1
+    (number? expr) 1
+    true (case (nth expr 0)
+           :plus (+ 1 (max (depth (nth expr 1)) (depth (nth expr 2))))
+           :minus (+ 1 (max (depth (nth expr 1)) (depth (nth expr 2))))
+           :times (+ 1 (max (depth (nth expr 1)) (depth (nth expr 2))))
+           :div (+ 1 (max (depth (nth expr 1)) (depth (nth expr 2))))
+           :sin (+ 1 (depth (nth expr 1)))
+           :cos (+ 1 (depth (nth expr 1)))
+           :square (+ 1 (depth (nth expr 1))))))

 (defn expr-zip
   "We define a zipper constructor for manipulating expression trees. Differs from the ordinary


Dont extend Array

Dont extend Array

--- src/aurora/editor/ReactDommy.cljs
+++ src/aurora/editor/ReactDommy.cljs
@@ -91,8 +91,9 @@
   js/React.__internals.DOMComponent
   (-elem [this] this)

-  js/Array
-  (-elem [this] (compound-element this))
+  ;; TODO just ... just don't
+  ;; js/Array
+  ;; (-elem [this] (compound-element this))

   js/Element
   (-elem [this] this)


Improve console output of sync script

Improve console output of sync script

--- scripts/gosync.clj
+++ scripts/gosync.clj
@@ -1,6 +1,6 @@
 (println "Syncing Go.cd builds to buildviz")

-(println "Loading dependencies...")
+(print "Loading dependencies...")
 (use '[leiningen.exec :only (deps)])
 (deps '[[clj-http "1.1.2"]
         [clj-time "0.9.0"]
@@ -13,7 +13,7 @@
          '[clj-time.format :as tf]
          '[clj-time.coerce :as tc]
          '[clojure.tools.cli :refer [parse-opts]])
-(println "Loading dependencies done")
+(println "done")

 (def tz (t/default-time-zone))

@@ -37,9 +37,8 @@

 (def selected-pipeline-group-names (set (drop 2 (:arguments args))))

-(println "Storing build information to" buildviz-url)
-(println "Reading groups" selected-pipeline-group-names "from url" go-url)
-(println "Will load all builds starting from" (tf/unparse date-formatter load-builds-from))
+(println "Go" selected-pipeline-group-names go-url "-> buildviz" buildviz-url)
+(println "Syncing all builds starting from" (tf/unparse date-formatter load-builds-from))

 ;; util


add no param execution

add no param execution

--- src/aurman/core.clj
+++ src/aurman/core.clj
@@ -84,11 +84,15 @@
        )))

 (defn -main
+  "search query -> shows info for package that match the query
+install id -> install the package with that package id
+install query -> search for packages that match query and lets you decide which package to install
   "
-  search query -> shows info for package that match the query
-  install id -> install the package with that package id
-  install query -> search for packages that match query and lets you decide which package to install
-  "
+  ([] (-> -main
+          var
+          meta
+          :doc
+          println))
   ([arg] ; Default op is search if omitted
    (-main "search" arg))
   ([op arg & args]


Added some more pamela files for schema testing.

--- test/clj/testing/pamela/plan_schema.clj
+++ test/clj/testing/pamela/plan_schema.clj
@@ -15,7 +15,9 @@
             [clojure.pprint :refer :all])
   (:import [java.io.File]))

-(def pamela-files [["test/pamela/cannon.pamela" "(game.main)"]])
+(def pamela-files [["test/pamela/cannon.pamela" "(game.main)"]
+                   ["test/pamela/ir-test.pamela" "(game.main)"]
+                   ["test/pamela/tpn-between.pamela" "(tpn.elephant)"]])
 (def outdir "test/gen-files/")
 (def htn-edn-suffix ".htn.edn")
 (def htn-json-suffix ".htn.json")


Update server to clojure 1.5

Update server to clojure 1.5

--- server/project.clj
+++ server/project.clj
@@ -3,7 +3,7 @@
   :url "http://example.com/FIXME"
   :license {:name "Public Domain"
             :url "http://unlicense.org/UNLICENSE"}
-  :dependencies [[org.clojure/clojure "1.4.0"]]
+  :dependencies [[org.clojure/clojure "1.5.0"]]
   :main nightweb-server.core
   :source-paths ["src" "../common/clojure"]
   :java-source-paths ["../common/java"])


add world tile setter

add world tile setter

--- src/cas/client.cljs
+++ src/cas/client.cljs
@@ -8,6 +8,19 @@
 (def keystate (atom {}))

 (defn world-at [world x y] ((world x) (- world-height y)))
+
+(defn set-world-at!
+  [x y kind]
+  (let [tile (world-at (:world @state) x y)
+        sprite (:sprite tile)
+        tex (kind tile-textures)]
+    (set! (.-texture sprite) tex)
+    (swap! state update-in
+           [:world x (- world-height y) :kind]
+           (fn [] kind))
+    (swap! state update-in
+           [:world x (- world-height y) :passable]
+           (fn [] (world/passability kind)))))

 ;; Helper functions for traversing the world's state tile-by-tile
 (defn each-tile [world func]
@@ -141,6 +154,8 @@
 ;; Set up the basic program structure.
 (setup!)

+(set-world-at! 3 4 :stone)
+
 (js/setInterval tick! 100)

 (defn render-tick! []


namespace math fn

namespace math fn

--- src/cellf/core.cljs
+++ src/cellf/core.cljs
@@ -86,7 +86,7 @@

 (defn blank-at-row [grid size]
-  (Math.floor (/ (:empty grid) size)))
+  (js/Math.floor (/ (:empty grid) size)))

 (def solvable?


added timeout back

added timeout back

--- src/cellf/core.cljs
+++ src/cellf/core.cljs
@@ -347,7 +347,7 @@
                   :ctx         (.getContext canvas "2d")
                   :show-about? (not skip-howto?)
                   :media-error nil})
-                (js/setTimeout start! 0)
+                (js/setTimeout start! 100)
                 (.setItem js/localStorage ls-key "1"))))
            (aset "srcObject" data)))
        (do


Add missing require.

Add missing require.

--- src/cgdata/core.clj
+++ src/cgdata/core.clj
@@ -11,6 +11,7 @@
   (:require [cavm.fs-utils :refer [normalized-path relativize]]) ; should copy these fns if releasing cgdata stand-alone
   (:require [cavm.chrom-pos :refer [chrom-pos-vec]]) ; move to this directory?
   (:require [cavm.lazy-utils :refer [consume-vec]])
+  (:require [clojure.set])
   (:gen-class))

 ;


working on diagnostics for (overc) failure

--- src/babel/over.cljc
+++ src/babel/over.cljc
@@ -121,6 +121,28 @@
    (fail? (unifyc (get-in parent [:head :synsem :subcat :2] :top)
                   (get-in child [:synsem :subcat :2] :top)))))

+(def comp-precheck-pairs
+  [{:parent [:comp :synsem :cat]
+    :childc [:synsem :cat]}
+
+   {:parent [:comp :synsem :agr]
+    :childc [:synsem :agr]}
+
+   {:parent [:comp :synsem :case]
+    :childc [:synsem :case]}
+
+   {:parent [:comp :synsem :sem]
+    :childc [:synsem :sem]}
+
+   {:parent [:comp :synsem :reflexive]
+    :childc [:synsem :reflexive]}
+
+   {:parent [:comp :synsem :pronoun]
+    :childc [:synsem :pronoun]}
+
+   {:parent [:comp :synsem :subcat]
+    :childc [:synsem :subcat]}])
+
 (defn comp-pre-checks [parent child]
   (or
    (fail? (unifyc (get-in parent [:comp :synsem :cat] :top)
@@ -146,7 +168,7 @@
           result
           (if head-pre-checks
             (do
-              (log/debug (str "head failed prechecks."))
+              (log/debug (str "moreover-head: head failed prechecks for parent: " (get-in parent [:rule])))
               :fail)
             (unify
              (copy parent)
@@ -211,8 +233,8 @@
 (def ^:dynamic *throw-exception-if-failed-to-add-complement* false)

 (defn moreover-comp [parent child lexfn-sem-impl]
-  (log/debug (str "moreover-comp type parent: " (type parent)))
-  (log/debug (str "moreover-comp type comp:" (type child)))
+  (log/trace (str "moreover-comp type parent: " (type parent)))
+  (log/trace (str "moreover-comp type comp:" (type child)))
   (log/debug (str "moreover-comp: child cat: " (get-in child [:synsem :cat])))
   (log/debug (str "moreover-comp: parent comp cat: " (get-in parent [:comp :synsem :cat])))

@@ -220,7 +242,7 @@
         result
         (if pre-check
           (do
-            (log/debug (str "child failed pre-check."))
+            (log/debug (str "moreover-comp: child failed pre-check for parent: " (get-in parent [:rule])))
             :fail)
           (unifyc parent
                   {:comp child}
@@ -302,13 +324,13 @@
 (defn overc [parent comp]
   "add given child as the comp child of the phrase: parent."

-  (log/debug (str "set? parent:" (set? parent)))
-  (log/debug (str "seq? parent:" (seq? parent)))
-  (log/debug (str "seq? comp:" (seq? comp)))
-
-  (log/debug (str "type of parent: " (type parent)))
-  (log/debug (str "type of comp  : " (type comp)))
-  (log/debug (str "nil? comp  : " (nil? comp)))
+  (log/trace (str "set? parent:" (set? parent)))
+  (log/trace (str "seq? parent:" (seq? parent)))
+  (log/trace (str "seq? comp:" (seq? comp)))
+
+  (log/trace (str "type of parent: " (type parent)))
+  (log/trace (str "type of comp  : " (type comp)))
+  (log/trace (str "nil? comp  : " (nil? comp)))

   (cond
    (nil? comp) nil
@@ -351,6 +373,7 @@
 ;; 2) called with both a child1 and a child2, but child2's supplied value is nil:
 ;;    should be treated the same as empty list.
 (defn over [parents child1 & [child2]]
+  (log/trace (str "over:" (count parents)))
   (cond (vector? child1)
         (over parents (seq child1) child2)

@@ -359,7 +382,7 @@

         (map? parents)
         (do
-          (log/debug (str "parents is a map: converting to a list and re-calling."))
+          (log/trace (str "parents is a map: converting to a list and re-calling."))
           (over (list parents) child1 child2))

         (nil? child2)
@@ -389,11 +412,11 @@
               (log/debug (str "over: parent: " (get-in parent [:rule]) " with schema symbol: " (get-in parent [:schema-symbol])))
               (if (= (:first parent) :head)
                 ;; else, head is left child.
-                (do (log/debug "over: left child (head):" child1)
-                    (log/debug "over: right child (comp):" child2))
+                (do (log/debug "over: left child (head):" (strip-refs child1))
+                    (log/debug "over: right child (comp):" (strip-refs child2)))
                 ;; else, head is right child.
-                (do (log/debug "over: left child (comp):" child1)
-                    (log/debug "over: right child (head):" child2)))
+                (do (log/debug "over: left child (comp):" (strip-refs child1))
+                    (log/debug "over: right child (head):" (strip-refs child2))))

               (concat
                ;; if parent is map, do introspection: figure out the schema from the :schema-symbol attribute,
@@ -406,7 +429,3 @@
                                (if (= (:first parent) :head)
                                  child2 child1)))
                (over (rest parents) child1 child2)))))))
-
-
-
-


remove recursive (defn over-each-parent-comp); use (mapcat) instead

--- src/babel/over.cljc
+++ src/babel/over.cljc
@@ -41,20 +41,6 @@

 (declare overh)
 (declare overc)
-
-(defn over-each-parent-comp [parents comp]
-  (log/trace (str "over-each-parent-comp: parents type: " (type parents)))
-  (log/trace (str "over-each-parent-comp: comp type: " (type comp)))
-  (if (not (empty? parents))
-    (let [each-parent (first parents)]
-      (log/trace (str "over-each-parent-comp: each-parent type:" (type (first parents))))
-      (log/trace (str "over-each-parent-comp: comp type:" (type comp)))
-      (lazy-cat
-       (overc each-parent comp)
-       (over-each-parent-comp (rest parents) comp)))
-    (do
-      (log/trace (str "over-each-parent-comp: done. returning nil"))
-      nil)))

 (def ^:dynamic *extra-diagnostics* false)
 (def ^:dynamic *check-parent-and-head-child-cat-equal* true)
@@ -375,7 +361,9 @@
    (let [parents (lazy-seq parent)]
      (filter (fn [result]
                (not (fail? result)))
-             (over-each-parent-comp parents comp)))
+             (mapcat (fn [parent]
+                       (overc parent comp))
+                     parents)))

    #?(:clj (future? comp))
    #?(:clj (overc parent (deref comp)))


Don't run two servers.

Don't run two servers.

--- src/circle/init.clj
+++ src/circle/init.clj
@@ -24,7 +24,6 @@
         (error e "error starting swank")))
     (circle.repl/init)
     (circle.db/init)
-    (circle.api.server/init)
     (circle.resque/init)
     (circle.http.server/init)


Make with-runtime useful

Make with-runtime useful

--- src/circle/ruby.clj
+++ src/circle/ruby.clj
@@ -82,8 +82,8 @@
     (swap! runtime (constantly (WeakReference. (new-runtime))))))

 (defn ruby []
-  (ensure-runtime)
-  (-> runtime deref (.get)))
+  (or *runtime* (do (ensure-runtime)
+                    (-> runtime deref (.get)))))

 ;; Each of these must return an IRubyObject.
 (defmulti ->ruby


Remove warning about hash-set.

Remove warning about hash-set.

--- src/circle/ruby.clj
+++ src/circle/ruby.clj
@@ -1,5 +1,5 @@
 (ns circle.ruby
-  (:refer-clojure :exclude [eval send methods])
+  (:refer-clojure :exclude [eval send methods hash-set])
   (:import org.jruby.RubySymbol)
   (:import java.io.PrintWriter)
   (:import java.io.StringWriter)


Use :require :as instead of :refer :all for cli ns.

--- src/cli4clj/cli.clj
+++ src/cli4clj/cli.clj
@@ -15,8 +15,8 @@
     [clojure.main :only [repl skip-if-eol skip-whitespace]]
     [clojure.string :only [blank? split]])
   (:require
-    (clj-assorted-utils [util :refer :all])
-    (clojure [stacktrace :refer :all]))
+    (clj-assorted-utils [util :as utils])
+    (clojure [stacktrace :as strace]))
   (:import
     (java.io PushbackReader StringReader)
     (jline.console ConsoleReader)
@@ -223,7 +223,7 @@
                                   (println "print-exception-trace is set to:" @print-exception-trace))
                             :short-info "Enable/Disable Printing of Full Exception Traces"
                             :long-info "When set to false (default), only the exception message will be printed when an exception occurs. When set to true, the full traces of exceptions will be printed."}
-            :_sleep {:fn (fn [duration] (sleep duration))
+            :_sleep {:fn (fn [duration] (utils/sleep duration))
                      :short-info "Sleep for n milliseconds."
                      :long-info "Pause the UI thread for n milliseconds. One use case for this is unit testing of CLIs with asynchronous interaction."}}
      :print-exception-trace (fn [] @print-exception-trace)}))
@@ -236,9 +236,9 @@
   (cond
     (and
       (instance? Exception arg)
-      ((:print-exception-trace opts))) (print-cause-trace arg)
-    (instance? Exception arg) (println-err (.getMessage arg))
-    :default (println-err (str arg))))
+      ((:print-exception-trace opts))) (strace/print-cause-trace arg)
+    (instance? Exception arg) (utils/println-err (.getMessage arg))
+    :default (utils/println-err (str arg))))

 (def cli-default-options
   {:allow-eval false
@@ -281,9 +281,9 @@
     (fn [m k]
       (let [f (get-in opts [:cmds k :fn])
             args (cond
-                   (symbol? f) (map-quote-vec (get-defn-arglists (eval `(var ~f))))
+                   (symbol? f) (utils/map-quote-vec (utils/get-defn-arglists (eval `(var ~f))))
                    (and (list? f)
-                        (= 'fn (first f))) (:args (get-fn-arglists f))
+                        (= 'fn (first f))) (:args (utils/get-fn-arglists f))
                    :default nil)]
         (if (and
               (not (nil? args))


Fix bug in specifying comparator for sorting

there may be more of those

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

--- src/conexp/base.clj
+++ src/conexp/base.clj
@@ -263,8 +263,7 @@
   (let [cards    (map-by-fn (fn [x]
                               (count (set-of X | X edges :when (contains? X x))))
                             vertices),
-        elements (sort (fn [x y]
-                         (>= (cards x) (cards y)))
+        elements (sort #(compare (cards %2) (cards %1))
                        vertices),
         result   (atom []),
         search   (fn search [rest-sets current rest-elements]


sql extent refactoring

sql extent refactoring

--- configuration/sql-input-extent.clj
+++ configuration/sql-input-extent.clj
@@ -4,10 +4,10 @@
     (mapping [:Name] :Name)
     (mapping [:CreationTime] :CreationTime)
     (mapping [:Validity] :Validity))
-  (add-relation :activity_fk_EndpointId)
-  (add-relation :activity_fk_ResourceId)
-  (add-relation :activity_fk_ShareId)
-  (add-relation :activity_fk_UserDomainId))
+  (add-association :activity_fk_EndpointId)
+  (add-association :activity_fk_ResourceId)
+  (add-association :activity_fk_ShareId)
+  (add-association :activity_fk_UserDomainId))
 ;TODO ASSOC ACTIIVITY: ACTIVITY (table "activityactivity" :activityactivity  (column "activityId2" :activityId2 :pk :notnull)  (column "activityId1" :activityId1 :pk :notnull))

 (foreach [:contact]
@@ -38,7 +38,7 @@
     (mapping [:IssuerCA] :IssuerCA)
     (mapping [:DowntimeAnnounce] :DowntimeAnnounce)
     (mapping [:DowntimeInfo] :DowntimeInfo))
-  (add-relation :endpoint_fk_ServiceId))
+  (add-association :endpoint_fk_ServiceId))

 (foreach [:location]
@@ -61,8 +61,8 @@
     (mapping [:Validity] :Validity)
     (mapping [:ProductName] :ProductName)
     (mapping [:ProductVersion] :ProductVersion))
-  (add-relation [:managerId :Id]); ?????
-  (add-relation :manager_fk_ServiceId))
+  (add-association [:managerId :Id]); ?????
+  (add-association :manager_fk_ServiceId))
 ;TODO ASSOC MANAGER: MANAGER   (column "managerId" :managerId :notnull) // IS IT NOT RELATION!?

@@ -73,7 +73,7 @@
     (mapping [:Name] :Name)
     (mapping [:CreationTime] :CreationTime)
     (mapping [:Validity] :Validity))
-  (add-relation :resource_fk_ManagerId))
+  (add-association :resource_fk_ManagerId))
 ;TODO ASSOC RESOURCE: SHARE (table "resourceshare" :resourceshare   (column "resourceId" :resourceId :pk :notnull) (column "shareId" :shareId :pk :notnull))

 (foreach [:service]
@@ -85,8 +85,8 @@
     (mapping [:Type] :Type)
     (mapping [:QualityLevel] :QualityLevel)
     (mapping [:Complexity] :Complexity))
-  (add-relation :service_fk_LocationId)
-  (add-relation :service_fk_AdminDomainId))
+  (add-association :service_fk_LocationId)
+  (add-association :service_fk_AdminDomainId))
 ;TODO ASSOC SERVICE: CONTACT   (table "serviceservice" :serviceservice (column "serviceId2" :serviceId2 :pk :notnull) (column "contactId" :contactId :pk :notnull))
 ;TODO ASSOC SERVICE: SERVICE (table "serviceservice" :serviceservice (column "serviceId2" :serviceId2 :pk :notnull) (column "serviceId1" :serviceId1 :pk :notnull))

@@ -98,13 +98,13 @@
     (mapping [:CreationTime] :CreationTime)
     (mapping [:Validity] :Validity)
     (mapping [:Description] :Description))
-  (add-relation :share_fk_ServiceId))
+  (add-association :share_fk_ServiceId))
 ;TODO ASSOC SHARE: ENDPOINT (table "shareendpoint" :shareendpoint (column "shareId" :shareId :pk :notnull) (column "endpointId" :endpointId :pk :notnull))

 (foreach [:admindomain]
   (add-instance :AdminDomain (mapping-pk [:Id] :ID)
     (mapping [:domain :Description] :Description))
-  (add-relation :adminDomain_fk_AdminDomainId))
+  (add-association :adminDomain_fk_AdminDomainId))
 ;TODO ASSOC ADMINDOMAIN: ADMINDOMAIN   (column "adminDomainId" :adminDomainId)

@@ -115,14 +115,14 @@
     (mapping [:CreationTime] :CreationTime)
     (mapping [:Validity] :Validity)
     (mapping [:Description] :Description))
-  (add-relation :domain_fk_LocationId))
+  (add-association :domain_fk_LocationId))
 ;TODO ASSOC DOMAIN: CONTACT  (table "domaincontact" :domaincontact   (column "domainId" :domainId :pk :notnull)  (column "contactId" :contactId :pk :notnull))

 (foreach [:userdomain]
   (add-instance :UserDomain
     (mapping-pk [:Id] :ID)
     (mapping [:Level] :Level))
-  (add-relation :userDomain_fk_UserDomainId))
+  (add-association :userDomain_fk_UserDomainId))
 ;TODO ASSOC USERDOMAIN: POLICY (table "userdomainpolicy" :userdomainpolicy (column "userDomainId" :userDomainId :pk :notnull) (column "policyId" :policyId :pk :notnull))

 (foreach [:policy]
@@ -141,9 +141,9 @@
     (mapping [:CreationTime] :CreationTime)
     (mapping [:Validity] :Validity)
     (mapping [:Scheme] :Scheme))
-  (add-relation :mappingPolicy_fk_ShareId))
+  (add-association :mappingPolicy_fk_ShareId))

 (foreach [:accesspolicy]
   (add-instance :AcessPolicy
     (mapping-pk [:Id] :Id))
-  (add-relation :accessPolicy_fk_EndpointId))
+  (add-association :accessPolicy_fk_EndpointId))


`document` CRUD ops.

`document` CRUD ops.

--- src/doctopus/db.clj
+++ src/doctopus/db.clj
@@ -202,3 +202,37 @@
   [tentacle]
   (select head-tentacle-mappings
           (where {:name (:name tentacle)})))
+
+(defn get-document-by-name
+  [doc-name]
+  (select documents
+          (where {:name doc-name})))
+
+(defn get-document-by-uri
+  [uri]
+  (select documents
+          (where {:uri uri})))
+
+(defn get-document-for-tentacle
+  [tentacle]
+  (select documents
+          (where {:tentacle_name (:name tentacle)})))
+
+(defn create-document!
+  [document]
+  (log/info "Creating new document named:" (:name document))
+  (insert documents
+          (values document)))
+
+(defn update-document!
+  [document]
+  (log/info "Updating document named:" (:name document))
+  (update documents
+          (set-fields document)
+          (where {:name (:name document)})))
+
+(defn save-document!
+  [document]
+  (if-not (empty? (get-document-by-name (:name document)))
+    (update-document! document)
+    (create-document! document)))


prune commented code

prune commented code

--- src/keypin/core.clj
+++ src/keypin/core.clj
@@ -369,9 +369,8 @@
                              cm-sym  (with-meta 'config-map (:cmarg-meta options))
                              nf-sym  (with-meta 'not-found (:nfarg-meta options))
                              arities (if (:source options)
-                                       `'([] [~cm-sym] [~cm-sym ~nf-sym]) ; ''([] [config-map] [config-map not-found])
-                                       `'([~cm-sym] [~cm-sym ~nf-sym])    ; ''([config-map] [config-map not-found])
-                                       )
+                                       `'([] [~cm-sym] [~cm-sym ~nf-sym])
+                                       `'([~cm-sym] [~cm-sym ~nf-sym]))
                              meta-fn (partial merge {:arglists arities :doc descrip} (:dkvar-meta options))
                              def-sym (vary-meta each-sym meta-fn)
                              arg-map (conj (get each-vec 3 {})


tidier

tidier

--- src-cljs/core.cljs
+++ src-cljs/core.cljs
@@ -184,13 +184,12 @@
                                   :placeholder "Search artist/album/title"
                                   :value (:string state)
                                   :onChange
-                                  (fn [e]
-                                    (let [str (.. e -target -value)]
-                                      (om/set-state! owner :string str)
-                                      ))
+                                  #(om/set-state! owner :string
+                                                  (.. % -target -value))
                                   :onKeyUp
-                                  (fn [e] (if (= 13 (.-which e))
-                                            (send-search e)))
+                                  #(when (= 13 (.-which %))
+                                     (send-search %)
+                                     (om/set-state! owner :string ""))
                                   :onBlur send-search
                                   }))
                  (apply dom/div #js {:className "filters" }


use binding conveyor proxy fn

use binding conveyor proxy fn

--- src/clj/com/climate/claypoole.clj
+++ src/clj/com/climate/claypoole.clj
@@ -310,10 +310,11 @@
    ;; If requested, use the default threadpool.
    (= :builtin pool) (completable-future-call clojure.lang.Agent/soloExecutor f)
    :else
-   (CompletableFuture/supplyAsync
-    (reify Supplier
-      (get [_]
-        (f))) pool)))
+   (let [f* (impl/binding-conveyor-fn f)]
+     (CompletableFuture/supplyAsync
+      (reify Supplier
+        (get [_]
+          (f*))) pool))))

 (defmacro completable-future
   "Like clojure.core/future, but using a threadpool and returns a CompletableFuture.


Use re-seq rather than re-find.

Use re-seq rather than re-find.

--- src/clj/com/rpl/specter/navs.cljc
+++ src/clj/com/rpl/specter/navs.cljc
@@ -622,12 +622,12 @@
     (do-keypath-transform vals structure key next-fn)
     ))

-(defrichnav ^{:doc "Navigates to the regex applied to a string, navigating to nil if it does not exist or nothing is found."}
+(defrichnav ^{:doc "Navigates to the lazy sequence of successive matches when a regex is applied to a string, navigating to nil if it does not exist or nothing is found."}
   ;;           Setting the value to NONE will remove it from the collection.}
   regex*
   [re]
   (select* [this vals structure next-fn]
-           (next-fn vals (re-find re structure)))
+           (next-fn vals (re-seq re structure)))
   #_(transform* [this vals structure next-fn]
                 (next-fn (clojure.string/replace structure re vals))))


find data by query and regex

find data by query and regex

--- src/hypertext_ray/finders.clj
+++ src/hypertext_ray/finders.clj
@@ -30,7 +30,7 @@
                                     [(keyword a) (attribute e (keyword a))])))

 (defn get-attributes-plus
-  "Returns attributes of element along with (text e) and (value e)"
+  "Returns map of attributes of element along with (text e) and (value e)"
   [e] (merge (get-attributes e)
              (hash-map :text (text e) :value (text e)))
   )
@@ -231,11 +231,22 @@
     )
   )

+(defn matches-attribute? [e re]
+  (first (remove nil? (map #(re-matches re %) (vals (get-attributes-plus e)))))
+  )
+
+(defn find-data-by-q-and-re [q re attr]
+  (let [match (first (filter #(matches-attribute? % re) (find-elements q)))]
+    (when match (attribute match attr))
+    )
+  )
+
 (defn dispatch-location [location]
   (println "dispatching" location)
   (case (first location)
     :table (find-table-data-by-location (rest location))
-    :miss)
+    (apply find-data-by-q-and-re location)
+    )
     )

 ;To be used to find a bit of data in a page
@@ -248,8 +259,8 @@
 ; which contains a map of keynames and scraped data
 (defn find-data [siteinfo page]
   (reset! itables (index-tables))
-  (assoc siteinfo :data (merge (:data siteinfo) (let [items (page (:datamatcher siteinfo))]
+  (assoc siteinfo :data (merge (:data siteinfo) (into {} (let [items (page (:datamatcher siteinfo))]
     (for [[keyname item] items]
         [keyname (dispatch-location item)]
-        )))))
-
+        ))))))
+


actually added previous countries

actually added previous countries


update 24/7 test to ensure Breaking News tags remain after turn end

--- src/clj/test/cards-operations.clj
+++ src/clj/test/cards-operations.clj
@@ -42,4 +42,6 @@
       (prompt-card :corp (find-card "Breaking News" (:scored (get-corp))))
       (is (= 1 (:agenda-point (get-corp))) "Forfeited Breaking News")
       (prompt-select :corp (find-card "Breaking News" (:scored (get-corp))))
-      (is (= 2 (:tag (get-runner))) "Runner given 2 tags"))))
+      (is (= 2 (:tag (get-runner))) "Runner given 2 tags")
+      (take-credits state :corp 2)
+      (is (= 2 (:tag (get-runner))) "Tags remained after Corp ended turn"))))


Make secretary use a rooted prefix

Make secretary use a rooted prefix

No more double octothorpes!!

--- src/cljs/comic_reader/routes.cljs
+++ src/cljs/comic_reader/routes.cljs
@@ -26,4 +26,4 @@
   (h/set-token page))

 (defn setup-secretary! []
-  (secretary/set-config! :prefix "#"))
+  (secretary/set-config! :prefix "/#"))


ideas

ideas

--- src/cljs/triboard/logic/move.cljs
+++ src/cljs/triboard/logic/move.cljs
@@ -64,6 +64,11 @@
 ;; Public API
 ;; -----------------------------------------

+;; TODO - Refactor to get two things out
+;; 1. A new board
+;; 2. A list of the converted cells
+;; All grouped by point and by player
+
 (defn empty-cell-conversion
   "Create a move to take an empty cell"
   [player point]


Refactor

Refactor

--- src/clojure/nightcode/editors.clj
+++ src/clojure/nightcode/editors.clj
@@ -298,22 +298,29 @@
   (let [res (Parinfer/indentMode text (int x) (int line) nil)]
     {:x (.-cursorX res) :text (.-text res)}))

+(defn run-parinfer!
+  [text-area paren-mode?]
+  (let [old-pos (.getCaretPosition text-area)
+        old-x (.getCaretOffsetFromLineStart text-area)
+        old-line (.getCaretLineNumber text-area)
+        old-text (.getText text-area)
+        result (if paren-mode?
+                 (paren-mode old-text old-x old-line)
+                 (indent-mode old-text old-x old-line))
+        new-text (:text result)
+        new-x (:x result)
+        new-pos (+ old-pos (- new-x old-x))]
+    (.setText text-area new-text)
+    (.setCaretPosition text-area new-pos)))
+
 (defn init-parinfer!
   [text-area extension]
   (when (contains? utils/clojure-exts extension)
     ; use paren mode to preprocess the code
-    (let [old-pos (.getCaretPosition text-area)
-          old-x (.getCaretOffsetFromLineStart text-area)
-          old-line (.getCaretLineNumber text-area)
-          old-text (.getText text-area)
-          result (paren-mode old-text old-x old-line)
-          new-text (:text result)
-          new-x (:x result)
-          new-pos (+ old-pos (- new-x old-x))]
-      (.setText text-area new-text)
-      (.setCaretPosition text-area new-pos)
+    (let [old-text (.getText text-area)]
+      (run-parinfer! text-area true)
       (.discardAllEdits text-area)
-      (.setDirty text-area (not= old-text new-text)))
+      (.setDirty text-area (not= old-text (.getText text-area))))
     ; add a listener to run indent mode when a key is pressed
     (.addKeyListener text-area
       (reify KeyListener
@@ -321,18 +328,7 @@
           (when-not (contains? #{KeyEvent/VK_DOWN KeyEvent/VK_UP
                                  KeyEvent/VK_RIGHT KeyEvent/VK_LEFT}
                                (.getKeyCode e))
-            (let [old-pos (.getCaretPosition text-area)
-                  old-x (.getCaretOffsetFromLineStart text-area)
-                  old-line (.getCaretLineNumber text-area)
-                  old-text (.getText text-area)
-                  result (if (= (.getKeyCode e) KeyEvent/VK_ENTER)
-                           (paren-mode old-text old-x old-line)
-                           (indent-mode old-text old-x old-line))
-                  new-text (:text result)
-                  new-x (:x result)
-                  new-pos (+ old-pos (- new-x old-x))]
-              (.setText text-area new-text)
-              (.setCaretPosition text-area new-pos))))
+            (run-parinfer! text-area (= (.getKeyCode e) KeyEvent/VK_ENTER))))
         (keyTyped [this e] nil)
         (keyPressed [this e] nil))))
   text-area)


wu algo works

wu algo works

--- src/labs_4_cource/primitives.cljs
+++ src/labs_4_cource/primitives.cljs
@@ -106,12 +106,16 @@
                  (take (+ 1 max))
                  (map
                   ;; smooth across basis axis
-                  (if (>= dx dy)
-                      (fn [[x y e]] [[x y (- 1 e)] [x (+ y y-step) e]])
-                      (if (<= y1 y2)
+                  (if (spy :debug "smoot across y-axis" (>= dx dy))
+                      ;; when y1 lesser then y2 line passes under center
+                      (if (spy :debug "passes under center" (<= y1 y2))
+                          (fn [[x y e]] [[x y e] [x (- y 1) (- 1 e)]])
+                          (fn [[x y e]] [[x y e] [x (+ y 1) (- 1 e)]]))
+                      ;; when x1 lesser then x2 line passes to the left of center
+                      (if (spy :debug "passes to the left of center" (<= x1 x2))
                           ;; reverse error
-                          (fn [[x y e]] [[x y e] [(+ x x-step) y (- 1 e)]])
-                          (fn [[x y e]] [[x y (- 1 e)] [(+ x x-step) y e]]))) )
+                          (fn [[x y e]] [[x y e] [(- x 1) y (- 1 e)]])
+                          (fn [[x y e]] [[x y e] [(+ x 1) y (- 1 e)]]))) )
                  ;; collect flat list
                  (mapcat identity)
                  (map (fn [[x y e]]  [(floor x) (floor y) e]))))


加入一个新的例子

加入一个新的例子

--- src/learnclojure/chapt3/core5.clj
+++ src/learnclojure/chapt3/core5.clj
@@ -91,7 +91,7 @@
 ;;返回值的第一个元素是(f [0 col0]),第二个元素是(f [1 col1]).....
 ;;下面的表达式是对一个元素是多个vector的lazy-seq排序结果，按照它的vector的第一个元素从大到小排序
 (sort-by first > (map-indexed vector "clojure"))
-;;sort用于元素是非集合的集合排序，而sorted by 对于元素是集合的集合排序，其中的比较器参数可以省略，默认是用compare
+;;sort用于元素是非集合的集合排序，而sorted by 对于元素是集合的集合排序，它们的比较器参数可以省略，会默认使用compare

 ;;clojure怎么把一个谓词变成一个比较器的呢？
 ;;对于谓词fn，先顺序调用谓词(fn a b)如果为true，返回-1否则反序调用谓词(fn b a)，如果是true返回1，否则返回0
@@ -104,4 +104,26 @@
 (less 1 1)
 ;;但我们很少这么干，因为clojure里面接受比较器作为参数的函数都默认做了这个转换，而且两参函数已经实现了java.util.Comparator接口

-;;所以，sorted-map和sorted-set是通过compare来定义默认规则进行排序的map和set+;;所以，sorted-map和sorted-set是通过compare来定义默认规则进行排序的map和set
+;;sorted-map-by和sorted-set-by接受一个比较器(任何两参的微词函数也可以)来定义排序规则
+;;除了compare之外，能传给有序集合的最简单的比较器可能是(comp - compare)了，正好定义了compare的反序
+(sorted-map-by compare :z 5 :x 9 :y 0 :b 2 :a 3 :c 4)
+(sorted-map-by (comp - compare) :z 5 :x 9 :y 0 :b 2 :a 3 :c 4)
+
+;;需要注意，排序规则在有序map和有序set中也同时定义了两个元素是否相等，这个特点有时候会产生逻辑正确但让人吃惊的结果。
+;;例子:有一个函数来计算参数是10的几次方
+(defn magnitude
+  [x]
+  (-> x Math/log10 Math/floor))
+(magnitude 100)
+(magnitude 100000)
+;;现在用magnitude创建一个谓词函数
+(defn compare-magnitude
+  [a b]
+  (neg? (- (magnitude a) (magnitude b))))
+(def comparator-magnitued (comparator compare-magnitude))
+(comparator-magnitued 10 10000)
+(comparator-magnitued 10000 10)
+(comparator-magnitued 10 66)
+
+


removed comment with qimessaging error now that I have callbacks working with java shim

--- src/main/clojure/naojure/core.clj
+++ src/main/clojure/naojure/core.clj
@@ -109,10 +109,6 @@
   (.call (get-proxy robot proxy-sym) operation (into-array params)))

 ; event handling
-
-; almost there, but get
-;[E] 4426 qimessaging.jni: Cannot find java method invoke (Ljava/lang/Object;)V
-;[W] 4426 qitype.signal: Exception caught from signal subscriber: Cannot find method
 (defn add-event-handler
   "Call the provided clojure function on the named event"
   [robot event callback]


fixed argument ordering for event dispatcher

--- src/main/clojure/naojure/core.clj
+++ src/main/clojure/naojure/core.clj
@@ -112,7 +112,7 @@
 ;; event handling
 (defn- event-dispatcher
   "Calls callback functions and sends data on channel. Expects atom containign map of channel to use and possibly empty sequence of functions"
-  [event event-state value]
+  [event value event-state]
   (do
     (doseq [cb (:callbacks @event-state)] (cb event value))
     (go (doseq [ch (:channels @event-state)] (>! ch event value)))))


Webserver component improved with more mature component lifecycle

--- src/hellhound/components/webserver.clj
+++ src/hellhound/components/webserver.clj
@@ -35,19 +35,20 @@
                            (log/info))
                        (web/run handler config))]
         (assoc component
-               :server server
-               :host   host
-               :port   port))
+               :server  server
+               :host    host
+               :handler handler
+               :config  config
+               :port    port))
       component))

   (stop [component]
-    (if-let [server (:server component)]
-      (do (-> (str "Stopping web server on host: %s and port: %d")
-              (format (:host component) (:port component))
-              (println))
-          (web/stop server)
-          (dissoc component :server))
-      component)))
+    (let [server (:server component)]
+      (-> (str "Stopping web server on host: %s and port: %d")
+          (format (:host component) (:port component))
+          (println))
+      (web/stop server)
+      (dissoc component :server))))


Update builtins.clj

Update builtins.clj

--- src/iyye/subcon/knowledge/builtins.clj
+++ src/iyye/subcon/knowledge/builtins.clj
@@ -85,7 +85,7 @@
 (defn- create-iyye-builtin-relation [name types func pred-func]
   (words/create-iyye-relation
     name
-    (words/->Iyye_ModalPredicate :IYE :AXIOM (persistence/current-time-to-string) :ALWAYS)
+    (words/->Iyye_ModalPredicate :IYE :AXIOM (persistence/local-time-to-string) :ALWAYS)
     types func pred-func true))

 (defn- create-entry [entry] {(:Uname (:atom entry)) entry})
@@ -136,8 +136,7 @@
 ; (apply str (rest (str (:When {:When :ALWAYS}))))

 (defn- init-db-kb []
-  (let [
-        types-loaded (persistence/read-knowledge-from-db "types" {})
+  (let [types-loaded (persistence/read-knowledge-from-db "types" {})
         types (map words/create-iyye-type-from-db types-loaded)
         a-f (fn [col el] (conj col (create-entry el)))]
     (dosync (alter words/action-words #(apply conj %1 %2) (persistence/read-knowledge-from-db "relations" {}))) ; {:When :ALWAYS}


Move normalize-args into "Legacy API" section

This function is a shim for the old cli/cli function.

--- src/main/clojure/clojure/tools/cli.clj
+++ src/main/clojure/clojure/tools/cli.clj
@@ -53,19 +53,6 @@
             (recur opts (conj argv car) cdr)))
         [opts argv]))))

-(defn- normalize-args
-  "Rewrite arguments sequence into a normalized form that is parsable by cli."
-  [specs args]
-  (let [required-opts (->> specs
-                           (filter (complement :flag))
-                           (mapcat :switches)
-                           (into #{}))
-        ;; Preserve double-dash since this is a pre-processing step
-        largs (take-while (partial not= "--") args)
-        rargs (drop (count largs) args)
-        [opts largs] (tokenize-args required-opts largs)]
-    (concat (mapcat rest opts) largs rargs)))
-
 ;;
 ;; Legacy API
 ;;
@@ -176,6 +163,19 @@
             :flag     flag}
            (when flag {:default false})
            options)))
+
+(defn- normalize-args
+  "Rewrite arguments sequence into a normalized form that is parsable by cli."
+  [specs args]
+  (let [required-opts (->> specs
+                           (filter (complement :flag))
+                           (mapcat :switches)
+                           (into #{}))
+        ;; Preserve double-dash since this is a pre-processing step
+        largs (take-while (partial not= "--") args)
+        rargs (drop (count largs) args)
+        [opts largs] (tokenize-args required-opts largs)]
+    (concat (mapcat rest opts) largs rargs)))

 (defn cli
   "THIS IS A LEGACY FUNCTION and may be deprecated in the future. Please use


Fix new launcher to work with uberjar and uberwar.

--- src/ruuvi_server/database/entities.clj
+++ src/ruuvi_server/database/entities.clj
@@ -17,7 +17,6 @@
 (declare event-annotation)

 (defn init []
-  (in-ns 'ruuvi-server.database.entities)
   (info "Initializing database connection")
   (let [database-conf (:database (conf/get-config))
         conn-pool (pool/create-connection-pool database-conf)
@@ -25,56 +24,56 @@
                      :options (korma.config/extract-options {})}]
     (default-connection pooled-conn)
     )
-
-  (info "Mapping entities")
-
-  (defentity tracker
-    (table :trackers)
-    (pk :id)
-    (entity-fields :id :tracker_code :name :latest_activity :shared_secret)
-    )
-
-  (defentity event-session
-    (table :event_sessions)
-    (pk :id)
-    (entity-fields :id :session_code :first_event_time :latest_event_time)
-    (belongs-to tracker {:fk :tracker_id})
-    )
-
-  (defentity event-extension-type
-    (table :event_extension_types)
-    (pk :id)
-    (entity-fields :name :description)
-    )
-
-  (defentity event-extension-value
-    (table :event_extension_values)
-    (pk :id)
-    (entity-fields :value)
-    (belongs-to event-extension-type {:fk :event_extension_type_id})
-    )
-
-  (defentity event-location
-    (table :event_locations)
-    (pk :id)
-    (entity-fields :latitude :longitude)
-    )
-
-  (defentity event
-    (table :events)
-    (pk :id)
-    (entity-fields :event_time :created_on)
-    (belongs-to tracker {:fk :tracker_id})
-    (belongs-to event-session {:fk :event_session_id})
-    (has-many event-location {:fk :event_id})
-    (has-many event-extension-value {:fk :event_id})
-    (has-many event-annotation {:fk :event_id})
-    )
+  )

-  (defentity event-annotation
-    (table :event_annotations)
-    (pk :id)
-    (entity-fields :event-annotation :created_on)
-    )
-
-  )+(info "Mapping entities")
+(defentity tracker
+  (table :trackers)
+  (pk :id)
+  (entity-fields :id :tracker_code :name :latest_activity :shared_secret)
+  )
+
+(defentity event-session
+  (table :event_sessions)
+  (pk :id)
+  (entity-fields :id :session_code :first_event_time :latest_event_time)
+  (belongs-to tracker {:fk :tracker_id})
+  )
+
+(defentity event-extension-type
+  (table :event_extension_types)
+  (pk :id)
+  (entity-fields :name :description)
+  )
+
+(defentity event-extension-value
+  (table :event_extension_values)
+  (pk :id)
+  (entity-fields :value)
+  (belongs-to event-extension-type {:fk :event_extension_type_id})
+  )
+
+(defentity event-location
+  (table :event_locations)
+  (pk :id)
+  (entity-fields :latitude :longitude)
+  )
+
+(defentity event
+  (table :events)
+  (pk :id)
+  (entity-fields :event_time :created_on)
+  (belongs-to tracker {:fk :tracker_id})
+  (belongs-to event-session {:fk :event_session_id})
+  (has-many event-location {:fk :event_id})
+  (has-many event-extension-value {:fk :event_id})
+  (has-many event-annotation {:fk :event_id})
+  )
+
+(defentity event-annotation
+  (table :event_annotations)
+  (pk :id)
+  (entity-fields :event-annotation :created_on)
+  )
+
+


Complete sets koans test

Complete sets koans test

--- clojure/koans/src/koans/04_sets.clj
+++ clojure/koans/src/koans/04_sets.clj
@@ -1,18 +1,18 @@
 (meditations
   "You can create a set in two ways"
-  (= #{} (set __))
+  (= #{} (set nil))

   "They are another important data structure in clojure"
-  (= __ (count #{1 2 3}))
+  (= 3 (count #{1 2 3}))

   "Remember that a set is a 'set'"
-  (= __ (set '(1 1 2 2 3 3 4 4 5 5)))
+  (= #{1 2 3 4 5} (set '(1 1 2 2 3 3 4 4 5 5)))

   "You can ask clojure for the union of two sets"
-  (= __ (clojure.set/union #{1 2 3 4} #{2 3 5}))
+  (= #{1 2 3 4 5} (clojure.set/union #{1 2 3 4} #{2 3 5}))

   "And also the intersection"
-  (= __ (clojure.set/intersection #{1 2 3 4} #{2 3 5}))
+  (= #{2 3} (clojure.set/intersection #{1 2 3 4} #{2 3 5}))

   "But don't forget about the difference"
-  (= __ (clojure.set/difference #{1 2 3 4 5} #{2 3 5})))
+  (= #{1 4} (clojure.set/difference #{1 2 3 4 5} #{2 3 5})))