Add new Interface for Meta Data.

Add new Interface for Meta Data.

--- src/konserve/filestore.clj
+++ src/konserve/filestore.clj
@@ -57,6 +57,10 @@

 (def version 1)

+(def compresson 1)
+
+(def encrypt 1)
+
 (defprotocol BlobToChannel
   (blob->channel [input buffer-size]))

@@ -156,23 +160,20 @@
           (.clear buffer)
           (.close bos)))))

-                                        ;TODO 1 Version 1 Compresson 1 Encrypt 1 Serializer 1 Metasize 4
-                                        ;TC GC als erstes und unit test
-;Make unit test
-
-(defn to-byte-array [version serializer meta]
+(defn to-byte-array
+  "Return 8 Byte Array with following content
+     1th Byte = Version of Konserve
+     2th Byte = Compression Type
+     3th Byte = Encrypt Type
+     4th Byte = Serializer Type
+   5-8th Byte = Meta-Size"
+  [version serializer meta]
   (let [int-bb           (ByteBuffer/allocate 4)
-        short-bb-v       (ByteBuffer/allocate 2)
-        short-bb-s       (ByteBuffer/allocate 2)
         _                (.putInt int-bb meta)
         meta-array       (.array int-bb)
-        _                (.putShort short-bb-v (short version))
-        version-array    (.array short-bb-v)
-        _                (.putShort short-bb-s (short serializer))
-        serializer-array (.array short-bb-s)
+        env-array        (byte-array [version compresson encrypt serializer])
         return-buffer    (ByteBuffer/allocate 8)
-        _                (.put return-buffer version-array)
-        _                (.put return-buffer serializer-array)
+        _                (.put return-buffer env-array)
         _                (.put return-buffer meta-array)
         return-array     (.array return-buffer)]
     (.clear return-buffer)
@@ -180,7 +181,7 @@

 (defn- update-file
   "Write File into Filesystem. It Write first the meta-size, that is stored in (1Byte), the meta-data and the actual data."
-  [folder config path serializer write-handlers buffer-size [key & rkey] {:keys [version file-name up-fn up-fn-args up-fn-meta type config operation input msg]} [old-meta old-value]]
+  [folder config path serializer write-handlers buffer-size [key & rkey] {:keys [compressor encryptor version file-name up-fn up-fn-args up-fn-meta config operation input msg]} [old-meta old-value]]
   (try
     (let [path-new             (Paths/get (str file-name ".new") (into-array String []))
           standard-open-option (into-array StandardOpenOption
@@ -197,7 +198,7 @@
           meta-size            (.size bos)
           _                    (.close bos)
           start-byte           (+ Long/BYTES meta-size)
-          serializer-id        22  #_(->> (type serializer) (get ser/class->serializer) (get ser/serializer->int))
+          serializer-id        (->> (type serializer) (get ser/class->serializer) (get ser/serializer->int))
           byte-array           (to-byte-array version serializer-id meta-size)]
       (go-try
         (<? (write-edn ac-new key serializer write-handlers 0 meta byte-array))
@@ -303,37 +304,6 @@
       (put! res-ch (ex-info "Could not read key."
                             (assoc msg :exception t))))))

-(defn- list-keys
-  "Return all Keys of the Filestore."
-  [folder serializer read-handlers]
-  (let [path       (Paths/get folder (into-array String []))
-        file-paths (Files/newDirectoryStream path)]
-    (->> (reduce
-          (fn [list-keys path]
-            (if (and (Files/exists path (into-array LinkOption [])) (clojure.string/includes? (.toString path) ".ksv"))
-              (let [ac        (AsynchronousFileChannel/open path (into-array StandardOpenOption [StandardOpenOption/READ]))
-                    bb        (ByteBuffer/allocate Integer/BYTES)
-                    path-name (.toString path)
-                    env       {:operation :read-meta
-                               :msg       {:type :read-meta-error
-                                           :path path-name}}
-                    res-ch    (chan)]
-                (into list-keys [(go-try
-                                     (.read ac bb Integer/BYTES Long/BYTES
-                                            (completion-read-meta-size-handler res-ch bb
-                                                                               {:type :read-list-keys
-                                                                                :path path-name}))
-                                   (<? (read-file ac serializer read-handlers env (<? res-ch)))
-                                   (finally
-                                     (.clear bb)
-                                     (.close ac)
-                                     (close! res-ch)))]))
-              list-keys))
-          (list)
-          file-paths)
-         async/merge
-         (async/into #{}))))
-
 (defn completion-read-old-handler [res-ch bb serializer read-handlers msg]
   (proxy [CompletionHandler] []
     (completed [res att]
@@ -346,7 +316,7 @@
             (ex-info "Could not read key."
                      (assoc msg :exception e))))))))

-(defn migrate-file-v1
+(defn- migrate-file-v1
   "Migration Function For Konserve Version, who has old file-schema."
   [folder key {:keys [version input up-fn detect-old-files operation msg]} buffer-size old-file-name new-file-name serializer read-handlers write-handlers]
   (let [standard-open-option (into-array StandardOpenOption [StandardOpenOption/READ])
@@ -364,26 +334,32 @@
                  (completion-read-old-handler res-ch-data bb-data serializer read-handlers
                                               {:type :read-data-old-error
                                                :path data-path})))
-      (let [[_ data]   (when-not binary? (<? res-ch-data))
+      (let [[[nkey] data]   (if binary?
+                              [[key] true]
+                              (<? res-ch-data))
             [meta old] (if binary?
                          [{:key key :type :binary ::timestamp (java.util.Date.)}
                           {:operation :write-binary
                            :input     (if input input (FileInputStream. old-file-name))
                            :msg       {:type :write-binary-error
                                        :key  key}}]
-                         [{:key key :type :edn ::timestamp (java.util.Date.)}
+                         [{:key nkey :type :edn ::timestamp (java.util.Date.)}
                           {:operation :write-edn
-                           :up-fn     (if up-fn (up-fn data) (fn [] data))
+                           :up-fn     (if up-fn (up-fn data) (fn [_] data))
                            :msg       {:type :write-edn-error
                                        :key  key}}])
             env        (merge {:version    version
                                :file-name  new-file-name
                                :up-fn-meta (fn [_] meta)}
                               old)
-            return-value (fn [r] (do (Files/delete data-path) (swap! detect-old-files disj old-file-name) r))]
+            return-value (fn [r]
+                           (do
+                             (Files/delete data-path)
+                             (swap! detect-old-files disj old-file-name)
+                             r))]
         (if (contains? #{:write-binary :write-edn} operation)
-          (<? (update-file folder nil new-path serializer write-handlers buffer-size [key] env [nil nil]))
-          (let [[_ value] (<? (update-file folder nil new-path serializer write-handlers buffer-size [key] env [nil nil]))]
+          (<? (update-file folder nil new-path serializer write-handlers buffer-size [nkey] env [nil nil]))
+          (let [[_ value] (<? (update-file folder nil new-path serializer write-handlers buffer-size [nkey] env [nil nil]))]
             (if (= operation :read-meta)
               (return-value meta)
               (if (= operation :read-binary)
@@ -521,7 +497,8 @@
                                                             {:type :read-meta-size-error
                                                              :key  key}))
                 (let [[ser meta-size] (<? res-ch)
-                      old       (<? (read-file ac serializer read-handlers env meta-size))]
+                      old       (<? (read-file ac serializer read-handlers env meta-size))
+                      ]
                   (if (or (= :write-edn operation) (= :write-binary operation))
                     (<? (update-file folder config path serializer write-handlers buffer-size key-vec env old))
                     old))
@@ -560,25 +537,28 @@
                                     (.close ac)
                                     (close! res-ch)))))
               (let [file-name (-> path .toString)
-                    fn        (-> path .getFileName .toString)
-                    env       (update-in env [:msg :keys] file-name)]
+                    fn-l      (-> path .getFileName .toString)
+                    env       (update-in env [:msg :keys] (fn [_] file-name))
+                           ]
                 (if (clojure.string/includes? file-name "meta")
                   (into list-keys (map
-                                   #(let [old-file-name (-> path .toString)
-                                          fn            (-> path .getFileName .toString)
-                                          env           (update-in env [:msg :keys] old-file-name)]
-                                      (migrate-file-v2 folder fn env buffer-size old-file-name fn serializer read-handlers write-handlers))
+                                   #(let [old-file-name (-> % .toString)
+                                          fn            (-> % .getFileName .toString)
+                                          env           (assoc-in env [:msg :keys] old-file-name)]
+                                      (migrate-file-v2 folder fn-l env buffer-size old-file-name file-name serializer read-handlers write-handlers))
                                    (Files/newDirectoryStream (Paths/get file-name (into-array String [])))))
-                  (conj list-keys (migrate-file-v1 folder fn env buffer-size file-name fn serializer read-handlers write-handlers))))))
+                  (conj list-keys (migrate-file-v1 folder fn-l env buffer-size file-name file-name serializer read-handlers write-handlers))))))
           #{}
           file-paths)
          async/merge
          (async/into #{}))))

-(defrecord FileSystemStore [folder serializer read-handlers write-handlers buffer-size detect-old-version locks config]
+(defrecord FileSystemStore [folder serializer compressor encryptor read-handlers write-handlers buffer-size detect-old-version locks config]
   PEDNAsyncKeyValueStore
   (-get [this key]
     (io-operation [key] folder config serializer read-handlers write-handlers buffer-size {:operation :read-edn
+                                                                                :compressor compressor
+                                                                                :encryptor  encryptor
                                                                                :format    :data
                                                                                :version version
                                                                                :detect-old-files detect-old-version
@@ -670,13 +650,13 @@
    :write-handlers empty
    :buffer-size    1 MB
    :config         config} "
-  [path  & {:keys [serializer read-handlers write-handlers buffer-size config version detect-old-file-schema?]
-            :or   {serializer     (ser/fressian-serializer)
-                   read-handlers  (atom {})
-                   write-handlers (atom {})
-                   buffer-size    (* 1024 1024)
-                   config         {:fsync true}}}]
-  (let [detect-old-version (when detect-old-file-schema? (atom (detect-old-file-schema  "/tmp/konserve-fs-migration-test")))
+  [path & {:keys [serializer compressor encryptor read-handlers write-handlers buffer-size config version detect-old-file-schema?]
+           :or   {serializer     (ser/fressian-serializer)
+                  read-handlers  (atom {})
+                  write-handlers (atom {})
+                  buffer-size    (* 1024 1024)
+                  config         {:fsync true}}}]
+  (let [detect-old-version (when detect-old-file-schema? (atom (detect-old-file-schema path)))
         _                  (check-and-create-folder path)
         store              (map->FileSystemStore {:detect-old-version detect-old-version
                                                   :folder             path
@@ -689,6 +669,11 @@
     (go store)))

 (comment
+                                        ;compressor => function , encrpto => function
+
+  ;=> ser then compressoion then encrpt
+
+;=> TODO add compressor ns

   ;TODO list-keys => old-files + test => for migration
                                         ;TODO gc test => create own gc
@@ -706,7 +691,7 @@

                                         ; :100,120s/"erse"/"ersete"/g => va
   (do
-    (def store (<!! (new-fs-store "/tmp/konserve-fs-migration-test"))))
+    (def store (<!! (new-fs-store "/tmp/konserve-test"))))

                                   ;:serializer-map :fress :detect-old-file-schema? true))))

@@ -714,10 +699,6 @@

-;new idea
-  {:fressian (ser/fressian-serializer)}
-
-  (<!! (-assoc-in store ["lol2"] (fn [e] {:foo "foo"}) 1))

   (<!! (-assoc-in store ["foo4"] (fn [e] {:foo "foo4"}) 1))


Remove unnecessary log messages

Remove unnecessary log messages

--- src/server/handler.clj
+++ src/server/handler.clj
@@ -35,12 +35,9 @@

 (defn handle-query [params]
   (let [ret (parser {:custard (:custard system)} params)]
-    (println ">>" ret)
     (response ret)))

 (defn handle-echo [params]
-  (println "<<" params (type params))
-  (println ">>" params)
   (response params))

 (defn generate-uml-svg [uml]


Simplify nested `into`s

Simplify nested `into`s

Former-commit-id: 05c13cf097d3e5e4fe1c7cc9514343fb3b5c68cd

--- planck-cljs/src/planck/core.cljs
+++ planck-cljs/src/planck/core.cljs
@@ -86,13 +86,10 @@
 (defn ^:export get-completions [buffer]
   (let [namespace-candidates (map str
                                (keys (:cljs.analyzer/namespaces @planck.core/st)))
-        all-candidates (into
-                         (into
-                           (into
-                             (into #{} namespace-candidates)
-                             (completion-candidates-for-ns 'cljs.core false))
-                           (completion-candidates-for-ns @current-ns true))
-                         (map str repl-specials))]
+        all-candidates (set (concat namespace-candidates
+                                    (completion-candidates-for-ns 'cljs.core false)
+                                    (completion-candidates-for-ns @current-ns true)
+                                    (map str repl-specials)))]
     (let [buffer-match-suffix (re-find #"[a-zA-Z]*$" buffer)
           buffer-prefix (subs buffer 0 (- (count buffer) (count buffer-match-suffix)))]
       (clj->js (if (= "" buffer-match-suffix)


Fix regression in enabling verbose mode

Fix regression in enabling verbose mode

--- planck-cljs/src/planck/repl.cljs
+++ planck-cljs/src/planck/repl.cljs
@@ -40,7 +40,7 @@
 (defonce app-env (atom nil))

 (defn ^:export init-app-env [verbose]
-  (reset! planck.repl/app-env (:verbose verbose)))
+  (reset! planck.repl/app-env {:verbose verbose}))

 (defn repl-read-string [line]
   (r/read-string {:read-cond :allow :features #{:cljs}} line))


Add action to search button

Add action to search button

--- nightweb-android/src/clojure/net/nightweb/menus.clj
+++ nightweb-android/src/clojure/net/nightweb/menus.clj
@@ -5,27 +5,34 @@

 (defn create-main-menu
   [context menu]
-  (let [new-post-item (.add menu (get-string :new_post))
-        search-item (.add menu (get-string :search))
+  (let [search-item (.add menu (get-string :search))
+        new-post-item (.add menu (get-string :new_post))
         share-item (.add menu (get-string :share))
-        if-room android.view.MenuItem/SHOW_AS_ACTION_IF_ROOM]
+        if-room android.view.MenuItem/SHOW_AS_ACTION_IF_ROOM
+        collapse-action-view
+        android.view.MenuItem/SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW
+        search-view (android.widget.SearchView. context)]
+    (.setIcon search-item (get-resource :drawable :android/ic_menu_search))
     (.setIcon new-post-item (get-resource :drawable :android/ic_menu_add))
-    (.setIcon search-item (get-resource :drawable :android/ic_menu_search))
     (.setIcon share-item (get-resource :drawable :android/ic_menu_share))
+    (.setShowAsAction search-item (bit-or if-room collapse-action-view))
     (.setShowAsAction new-post-item if-room)
-    (.setShowAsAction search-item if-room)
     (.setShowAsAction share-item if-room)
+    (.setOnQueryTextListener
+      search-view
+      (proxy [android.widget.SearchView$OnQueryTextListener] []
+        (onQueryTextChange [new-text]
+          (println "typing:" new-text)
+          true)
+        (onQueryTextSubmit [query]
+          (println "submitted:" query)
+          true)))
+    (.setActionView search-item search-view)
     (.setOnMenuItemClickListener
       new-post-item
       (proxy [android.view.MenuItem$OnMenuItemClickListener] []
         (onMenuItemClick [menu-item]
           (show-page context "net.nightweb.NewPostPage")
-          true)))
-    (.setOnMenuItemClickListener
-      search-item
-      (proxy [android.view.MenuItem$OnMenuItemClickListener] []
-        (onMenuItemClick [menu-item]
-          (println "search")
           true)))
     (.setOnMenuItemClickListener
       share-item


Remove the cosine-2 test series and replace with a sawtooth series for identiying sign issues.

--- metlog-agent/config.clj
+++ metlog-agent/config.clj
@@ -1,10 +1,11 @@
 (def start-t (System/currentTimeMillis))

 (defsensor sine {:poll-interval (seconds 10)}
-  (Math/sin (/ (- (System/currentTimeMillis) start-t) 60000.0)))
+  (Math/sin (/ (- (System/currentTimeMillis) start-t) (minutes 1))))

 (defsensor cosine {:poll-interval (seconds 10)}
-  (Math/cos (/ (- (System/currentTimeMillis) start-t) 60000.0)))
+  (Math/cos (/ (- (System/currentTimeMillis) start-t) (minutes 1))))

-(defsensor cosine-2 {:poll-interval (seconds 5)}
-  (Math/cos (/ (- (System/currentTimeMillis) start-t) 30000.0)))
+(defsensor steps-ascending {:poll-interval (seconds 5)}
+  (mod (/ (- (System/currentTimeMillis) start-t) (minutes 2))
+       3))


Update finance.clj (#150)

Update finance.clj (#150)

Added currency format for Australian dollar currency.

--- resources/languages/en/rules/finance.clj
+++ resources/languages/en/rules/finance.clj
@@ -32,6 +32,12 @@
 #"(?i)£|pounds?"
 {:dim :unit
  :unit "£"}
+
+;Australian Dollar Currency
+"AUD"
+#"(?i)AUD"
+{:dim :unit
+ :unit "AUD"}

 "USD"
 #"(?i)US[D\$]"


Shrinking build status badge wording if it gets too long.

--- src-cljs/frontend/components/builds_table.cljs
+++ src-cljs/frontend/components/builds_table.cljs
@@ -114,6 +114,14 @@
                     "badge-text")}
      wording]))

+(defn build-status-badge-wording [build]
+  (let [wording       (build-model/status-words build)
+        too-long?     (> (count wording) 10)]
+    [:div {:class (if too-long?
+                    "badge-text small-text"
+                    "badge-text")}
+     wording]))
+
 (defn build-status-badge [build]
   [:div.recent-status-badge {:class (build-model/status-class build)}
    [:img.badge-icon {:src (-> build build-model/status-icon-v2 common/icon-path)}]


builds-table checks user's permissions before showing actions

--- src-cljs/frontend/components/builds_table.cljs
+++ src-cljs/frontend/components/builds_table.cljs
@@ -8,6 +8,7 @@
             [frontend.components.svg :refer [svg]]
             [frontend.models.build :as build-model]
             [frontend.models.feature :as feature]
+            [frontend.models.project :as project-model]
             [frontend.utils.vcs-url :as vcs-url]
             [frontend.utils :as utils :include-macros true]
             [om.core :as om :include-macros true]
@@ -53,13 +54,17 @@
         icon-class [:i.button-icon {:class icon-class}])
       [:span.button-text text]])])

-(defn build-row [build owner {:keys [show-actions? show-branch? show-project?]}]
+(defn build-row [{:keys [build project]} owner {:keys [show-actions? show-branch? show-project?]}]
   (let [url (build-model/path-for (select-keys build [:vcs_url]) build)
         raise-build-action! (fn [event] (raise! owner [event (build-model/build-args build)]))
         raise-merge-action! (fn [] (raise! owner [:merge-pull-request-clicked (build-model/merge-args build)]))
         status-words (build-model/status-words build)
-        should-show-rebuild? (#{"timedout" "failed"} (:outcome build))
+        should-show-cancel? (and (project-model/can-trigger-builds? project)
+                                 (build-model/can-cancel? build))
+        should-show-rebuild? (and (project-model/can-trigger-builds? project)
+                                  (#{"timedout" "failed"} (:outcome build)))
         should-show-merge? (and (feature/enabled? :merge-pull-request)
+                                (project-model/can-write-settings? project)
                                 (build-model/can-merge-at-least-one-pr? build))]
     [:div.build {:class (cond-> [(build-model/status-class build)]
                           (:dont_build build) (conj "dont_build"))}
@@ -71,10 +76,11 @@
        (build-status-badge build)]

-      ;; These two cases should be mutually exclusive. Just in case they aren't,
-      ;; use a cond so it doesn't try to render both in the same place
+      ;; Actions should be mutually exclusive. Just in case they
+      ;; aren't, use a cond so it doesn't try to render both in the
+      ;; same place
       (cond
-        (build-model/can-cancel? build)
+        should-show-cancel?
         (build-action
           {:text "cancel"
            :loading-text "Cancelling..."
@@ -184,16 +190,20 @@
                                                                              :org (:username build)}})}
             (build-model/github-revision build)])]]]]))

-(defn builds-table [{:keys [builds]} owner {:keys [show-actions? show-branch? show-project?]
-                                            :or {show-branch? true
-                                                 show-project? true}}]
+(defn builds-table [{:keys [builds projects]}
+                    owner
+                    {:keys [show-actions? show-branch? show-project?]
+                     :or {show-branch? true
+                          show-project? true}}]
   (reify
     om/IDisplayName (display-name [_] "Builds Table V2")
     om/IRender
     (render [_]
       (html
         [:div.container-fluid
-         (map #(build-row % owner {:show-actions? show-actions?
-                                   :show-branch? show-branch?
-                                   :show-project? show-project?})
+         (map #(build-row {:build %
+                           :project (get projects (:vcs_url %))}
+                          owner {:show-actions? show-actions?
+                                 :show-branch? show-branch?
+                                 :show-project? show-project?})
               builds)]))))


Hooking up usage from backend.

Hooking up usage from backend.

--- src-cljs/frontend/components/org_settings.cljs
+++ src-cljs/frontend/components/org_settings.cljs
@@ -4,6 +4,8 @@
             [frontend.async :refer [raise!]]
             [frontend.routes :as routes]
             [frontend.datetime :as datetime]
+            [cljs-time.core :as time]
+            [cljs-time.format :as time-format]
             [frontend.models.organization :as org-model]
             [frontend.models.plan :as pm]
             [frontend.models.repo :as repo-model]
@@ -966,21 +968,29 @@
         (om/build progress-bar {:class "monthly-usage-bar" :max max :value usage})
         [:div.usage-label (gstring/format "%d/%d minutes (%d%)" usage max (* 100 (/ usage max)))]]))))

+(def usage-parser (time-format/formatter "yyyy_MM"))
+(def usage-formatter (time-format/formatter "MMMM"))
+
+(defn key->date [key]
+  (time-format/parse (time-format/formatter "yyyy_MM") key))
+
+(defn date->month [date]
+  (time-format/unparse (time-format/formatter "MMMM") date))
+
 (defn osx-usage-table [{:keys [plan]} owner]
   (reify
     om/IRender
     (render [_]
       (let [org-name (:org_name plan)
-            usage (:usage plan)]
+            osx-usage (-> plan :usage :os:osx)]
         (html
          [:div
           [:fieldset [:legend (str org-name "'s iOS usage")]]
-          (if true #_(not-empty usage)
+          (if (not-empty osx-usage)
             [:div.monthly-usage
-             (om/build usage-bar {:usage 200 :max 1000 :month "December"})
-             (om/build usage-bar {:usage 900 :max 1000 :month "November"})
-             (om/build usage-bar {:usage 700 :max 1000 :month "October"})
-             (om/build usage-bar {:usage 800 :max 1000 :month "September"})]
+             (om/build-all usage-bar
+                           (map (fn [[month amount]]
+                                  {:usage amount :max 1000 :month (date->month (key->date (name month)))}) osx-usage))]
             [:div.explanation
              [:p "Looks like you haven't run any builds yet."]])])))))


undo changes to dev main.cljs

undo changes to dev main.cljs

--- env/dev/cljs/dice/main.cljs
+++ env/dev/cljs/dice/main.cljs
@@ -1,5 +1,16 @@
 (ns dice.main
   (:require [dice.core :as core]
-            [cljs.core.async]))
+            [figwheel.client :as figwheel :include-macros true]
+            [cljs.core.async :refer [put!]]
+            [weasel.repl :as weasel]))
+
+(enable-console-print!)
+
+(figwheel/watch-and-reload
+  :websocket-url "ws://localhost:3449/figwheel-ws"
+  :jsload-callback (fn []
+                     (core/main)))
+
+(weasel/connect "ws://localhost:9001" :verbose true :print #{:repl :console})

 (core/main)


fix spinner

fix spinner


added quedarse, modeled after alzarsi

added quedarse, modeled after alzarsi


fix explain-defcon-level

fix explain-defcon-level

--- resources/workshop/do-things.clj
+++ resources/workshop/do-things.clj
@@ -79,15 +79,15 @@
   "It was the panda " .concat ("in the library ", "with a dust buster")
   )

-"La structure de Clojure est très simple et cohérent par comparaison.
- Peu importe l'opérateur vous utilisez ou quel type de données que vous êtes d'exploitation sur, la structure est la même.
-
-Une dernière remarque: j'utilise aussi l'expression de terme pour désigner les forms Clojure. Ne soyez pas trop accroché sur la terminologie, cependant."
+"La structure de Clojure est très simple et cohérente par comparaison.
+ Peu importe l'opérateur utilisé ou le type de données que vous êtes d'exploiter , la structure est la même.
+
+Une dernière remarque: j'utilise aussi le terme **expression** pour désigner les forms Clojure. Cependant, ne soyez pas trop rigide sur la terminologie."

 [[:section {:tag "flow_control" :title "Flow Control"}]]

-"Voici quelques opérateurs de contrôle de flux de base. Tout au long tuto, vous rencontrez plus."
+"Voici quelques opérateurs de contrôle  de base. Tout au long tuto, vous en rencontrerez plus."

 [[:subsection {:tag "if" :title "if"}]]
@@ -110,7 +110,7 @@
   )

-"Notez que chaque branche du cas ne peut avoir une forme. Ceci est différent de la plupart des langues. Par exemple, en Ruby vous pouvez écrire:"
+"Notez que chaque branche d'un *if* ne peut avoir qu'une form. Ceci est différent de la plupart des langues. Par exemple, en Ruby vous pouvez écrire:"

 (comment

@@ -124,7 +124,7 @@
   )

-"Pour contourner cette limitation apparente, nous avons le do opérateur:"
+"Pour contourner cette limitation, nous avons l'opérateur  *do* :"

 (exercice
   "Vous ferez face à de nombreuses décisions"
@@ -157,6 +157,15 @@
   [(= 'doom (if-not (zero? __)
               'doom
               'more-doom))]1)
+
+(defn explain-defcon-level [exercise-term]
+  (case exercise-term
+    :fade-out          :you-and-what-army
+    :double-take       :call-me-when-its-important
+    :round-house       :o-rly
+    :fast-pace         :thats-pretty-bad
+    :cocked-pistol     :sirens
+    :say-what?))

 (exercice


Upgrade refactor-nrepl

Upgrade refactor-nrepl

--- roles/clojure/files/profiles.clj
+++ roles/clojure/files/profiles.clj
@@ -24,7 +24,7 @@
                   [lein-swank "1.4.4"]
                   [lein-try "0.4.3"]
                   [lein-typed "0.3.5"]
-                  [refactor-nrepl "1.0.3"]]
+                  [refactor-nrepl "1.1.0-SNAPSHOT"]]

         :shorthand {. [^:lazy alembic.still/distill
                        ^:lazy alembic.still/load-project


Fix blockly editor high-lighting

Fix blockly editor high-lighting

So that the current category is highlighted

--- idecode/myappshare/mainapp.cljs
+++ idecode/myappshare/mainapp.cljs
@@ -245,17 +245,20 @@

+(def current-toolbox (atom ""))

 (defn add-blocks [section-name  block-names]
   (let [xxx (fn [e]
-              (do
-              (js/uuuttt
-                (str "<xml>"
-                     (apply str
-                            (map (fn [x] (str "<block type=\"" x "\"></block>"))
-                                 block-names))
-                     "</xml>")))
-              (swap! app-state assoc :blockly-category section-name)
+              (let [this-toolbox   (str "<xml>"
+                       (apply str
+                              (map (fn [x] (str "<block type=\"" x "\"></block>"))
+                                   block-names))
+                       "</xml>")]
+                (js/uuuttt  this-toolbox)
+                (reset! current-toolbox  this-toolbox)
+                (swap! app-state assoc :blockly-category section-name)
+                (js/setTimeout (fn [ee] (touch [:ui :editor])) 100)
+                )
               )]
     (div {
            :onMouseOver  xxx
@@ -303,7 +306,11 @@
                                                      :height "800px"
                                                      :width "100px"
                                                      :display "inline-block"
-                                                     :verticalAlign "text-top"}}
+                                                     :verticalAlign "text-top"}
+               :onMouseOver (fn[ee]
+                              (if @current-toolbox (js/uuuttt  @current-toolbox))
+                              )
+               }
               (add-blocks "Samples"  ["appshare_samples_helloworld"])


remove also

remove also

--- frontend/components/language_landing.cljs
+++ frontend/components/language_landing.cljs
@@ -22,7 +22,7 @@
 (def templates {"ruby" {:language "Ruby"
                         :headline "CircleCI makes Continous Integration and Deployment for Ruby projects a breeze."
                         :logo-path "/img/outer/languages/ruby-logo.svg"
-                        :features [{:feature "CircleCI provides support for a wide variety of Ruby versions and gems, including Ruby on Rails. It is also trivial to add any packages or frameworks that are not installed on our machines by default, allowing you to effortlessly customize your test enviroment.  CircleCI also supports Test::Unit, RSpec, Cucumber, Spinach, Jasmine, Konacha, and just about any other testing framework you use for your Ruby project."
+                        :features [{:feature "CircleCI provides support for a wide variety of Ruby versions and gems, including Ruby on Rails. It is trivial to add any packages or frameworks that are not installed on our machines by default, allowing you to effortlessly customize your test enviroment.  CircleCI also supports Test::Unit, RSpec, Cucumber, Spinach, Jasmine, Konacha, and just about any other testing framework you use for your Ruby project."
                                     :title "Built For Ruby"
                                     :icon "/img/outer/languages/gear-icon.svg"}
                                    {:feature "Circle manages all your database requirements for you, such as running your rake commands for creating, loading, and migrating your database. We have pre-installed more than a dozen databases and queues, including PostgreSQL, MySQL, and MongoDB as well as frameworks such as DataMapper, Mongoid, ActiveRecord. You can also add custom database commands via your circle.yml."


fix disappearing handles for lines

fix disappearing handles for lines

--- src-cljs/frontend/components/canvas.cljs
+++ src-cljs/frontend/components/canvas.cljs
@@ -152,12 +152,13 @@
     om/IRender
     (render [_]
       (let [cast! (om/get-shared owner [:cast!])
+            width (js/Math.abs (- (:layer/start-x layer) (:layer/end-x layer)))
+            height (js/Math.abs (- (:layer/start-y layer) (:layer/end-y layer)))
             ;; easier than calcing width, b/c we can just multiply by 2
             handle-offset (max 1
                                (min 4
-                                    (int (/ (min (js/Math.abs (- (:layer/start-x layer) (:layer/end-x layer)))
-                                                 (js/Math.abs (- (:layer/start-y layer) (:layer/end-y layer))))
-                                            4))))]
+                                    (int (/ (Math/sqrt (+ (* width width) (* height height)))
+                                            6))))]
         (apply dom/g #js {:className "edit-handles"}
                (for [[x y] (layers/endpoints layer)]
                  (dom/rect #js {:className (str "edit-handle "


improve login/logout icons to match other icons


Calculating score bug is fixed.

Calculating score bug is fixed.

--- src-cljx/polyomino_enclosure/engine.cljx
+++ src-cljx/polyomino_enclosure/engine.cljx
@@ -151,9 +151,11 @@

 (defn execute-programs
   [polyominos programs]
-  (letfn [(execute-functions [polyomino [function & more]]
-            (cons polyomino (lazy-seq (if function
-                                        (execute-functions (function polyomino) more)))))
+  (letfn [(execute-functions [polyomino [function & more :as functions]]
+            (cons polyomino (lazy-seq (if functions
+                                        (execute-functions (cond->> polyomino
+                                                             function (function))
+                                                           more)))))
           (execute-program [polyomino program]
             (if-not (empty? program)
               (execute-functions polyomino program)))]
@@ -162,6 +164,8 @@
 (defn result
   [execute-program-result]
   (map last execute-program-result))
+
+(declare score)

 (defn validate-result
   [result]
@@ -174,7 +178,7 @@
                 "ポリオミノが重なっています。"))
             (validate-enclosed []
               (try
-                (and (area-size board :search-8-way? true) nil)
+                (and (score result) nil)
                 (catch #+clj clojure.lang.ExceptionInfo #+cljs cljs.core.ExceptionInfo _ "ポリオミノで囲み込めていません。")))]
       (or (validate-origin)
           (validate-overlaps)
@@ -182,4 +186,4 @@

 (defn score
   [result]
-  (area-size (apply board result)))
+  (area-size (apply board result) :search-8-way? true))


153 add squares calculator

153 add squares calculator


reg bugs: keywordizing

reg bugs: keywordizing

--- src/cljs/main/broadfcui/page/workspace/monitor/submission_details.cljs
+++ src/cljs/main/broadfcui/page/workspace/monitor/submission_details.cljs
@@ -162,10 +162,10 @@
            (style/create-paragraph
             [:div {}
              [:div {:style {:fontWeight 200 :display "inline-block" :width 90}} "Namespace:"]
-             [:span {:style {:fontWeight 500}} (submission "methodConfigurationNamespace")]]
+             [:span {:style {:fontWeight 500}} (:methodConfigurationNamespace submission)]]
             [:div {}
              [:div {:style {:fontWeight 200 :display "inline-block" :width 90}} "Name:"]
-             [:span {:style {:fontWeight 500}} (submission "methodConfigurationName")]])
+             [:span {:style {:fontWeight 500}} (:methodConfigurationName submission)]])
            (style/create-section-header "Submission Entity")
            (style/create-paragraph
             [:div {}


contract for assoc-state

contract for assoc-state


eliminate use of is-first-path in html formatting due to high time cost

--- src/babel/html.clj
+++ src/babel/html.clj
@@ -566,14 +566,8 @@
      (str "<i>" arg "</i>")

      (ref? arg)
-     (let [is-first (fs/is-first-path serialized path 0
-                                      (fs/path-to-ref-index serialized path 0))]
-       (str (if (and (or (= (last path) :subcat)
-                         (= is-first true))
-                     (or false (not (= (last path) :head)))
-                     (or false (not (= (last path) :comp))))
-              (tablize @arg path serialized
-                       (merge opts {:as-tree false})))))
+     (tablize @arg path serialized
+              (merge opts {:as-tree false}))

      (fn? arg)
      "λ"


refactors code in scale-app to improve readability (#347)

--- waiter/src/waiter/scaling.clj
+++ waiter/src/waiter/scaling.clj
@@ -300,7 +300,8 @@
   between scaling operations.
   Additionally, the autoscaler attempts to replace expired instances. For every expired instance, the autoscaler increases
   its target by one additional instance. Then, it scales down one instance for each healthy instance in excess of its target."
-  [{:strs [concurrency-level expired-instance-restart-rate jitter-threshold max-instances min-instances scale-down-factor scale-factor scale-ticks scale-up-factor]}
+  [{:strs [concurrency-level expired-instance-restart-rate jitter-threshold max-instances min-instances
+           scale-down-factor scale-factor scale-ticks scale-up-factor]}
    {:keys [expired-instances healthy-instances outstanding-requests target-instances total-instances]}]
   {:pre [(<= 0 scale-up-factor 1)
          (<= 0 scale-down-factor 1)
@@ -320,10 +321,11 @@
                                     (* (- 1 scale-up-factor) target-instances))
         smoothed-scale-down-target (+ (* scale-down-factor ideal-instances)
                                       (* (- 1 scale-down-factor) target-instances))
-        target-instances' (max min-instances (min max-instances
-                                                  (if (>= smoothed-scale-up-target target-instances)
-                                                    smoothed-scale-up-target
-                                                    smoothed-scale-down-target)))
+        target-instances' (->> (if (>= smoothed-scale-up-target target-instances)
+                                 smoothed-scale-up-target
+                                 smoothed-scale-down-target)
+                               (min max-instances)
+                               (max min-instances))
         ^double delta (- target-instances' total-instances)
         integer-delta (if (>= (Math/abs delta) jitter-threshold)
                         (int (Math/ceil (- delta epsilon)))
@@ -336,10 +338,10 @@
         ; since the instance killer will kill the expired instances
         scaling-down (< integer-delta 0)
         all-instances-are-healthy (= total-instances healthy-instances)
-        scale-to-instances' (if (or (and scaling-down all-instances-are-healthy)
-                                    (zero? expired-instances))
-                              scale-to-instances
-                              (- (+ scale-to-instances expired-instances-to-replace) excess-instances))
+        scale-to-instances' (cond-> scale-to-instances
+                              (and (pos? expired-instances)
+                                   (not (and scaling-down all-instances-are-healthy)))
+                              (+ (- expired-instances-to-replace excess-instances)))
         integer-delta' (int (- scale-to-instances' total-instances))]
     {:scale-to-instances scale-to-instances'
      :target-instances target-instances'


Quick commit

Quick commit

--- src/baustellen.clj
+++ src/baustellen.clj
@@ -63,7 +63,7 @@
                    agents)))

 (defn allocation-for-skill
-  [location [skill n-needed] agents]
+  [site-k static-data]
   (let [sorted-agents (sorted-map-by-distance location
                                               (filter-skill skill agents))]
     (loop [n-remaining n-needed
@@ -91,8 +91,6 @@
   heuristically good allocation for this site. Returns the coalition and and the
   agent datastructure with capacities reduced according to the allocation."
   [site agents]
-  (println site)
-  (println (:skills site))
   (let [allocs-agents (map (fn [demand]
                              (allocation-for-skill (:location site)
                                                    demand
@@ -101,6 +99,34 @@
         allocs (map first allocs-agents)
         agents (map second allocs-agents)]
     [(into {} allocs) (into {} agents)]))
+
+(defn allocate-full
+  "Allocates as many units of skill as possible and needed to site with site-k,
+  returning the new distribution."
+  [{:keys allocation reservoir :as distribution} site-k skill static-data]
+  (loop [available (good-agents (count (:agents static-data)) site-k skill
+                                reservoir static-data)
+         cur-distr distribution]
+    (if (and (seq available)
+             (pos? (demand allocation [site-k skill] static-data)))
+      (recur (rest available)
+             (allocate-max-bundle cur-distr [site-k skill] (first available)
+                                  static-data))
+      cur-distr)))
+
+(defn find-single-distribution
+  "For each skill needed by site site-k, allocates as many units of that skill
+  as possible and needed to it. Returns the new distribution."
+  [{:keys allocation reservoir :as distribution} site-k static-data]
+  (let [allocator (fn [prev-distr skill] (allocate-full prev-distr site-k
+                                                        skill static-data))]
+    (reduce allocator distribution
+            (keys (get-in static-data [:sites site-k :skills])))))
+
+(defn find-initial-distribution [reservoir static-data]
+  (let [allocator (fn [prev-distr site-k])])
+  (reduce find-single-distribution {:allocation {} :reservoir reservoir}
+          (keys (:sites static-data))))

 ;;; Credits: http://stackoverflow.com/questions/14488150/how-to-write-a-dissoc-in-command-for-clojure
 (defn dissoc-in
@@ -135,9 +161,18 @@
                              (keys non-exhausted))]
     (take n by-distance)))

+(defn demand
+  "Return the demand for skill of the site with site-k given an allocation."
+  [allocation [site-k skill] static-data]
+  {:pre [(>= % 0)]}
+  (let [bundles (get-in allocation path)
+        n-allocated (apply + (values bundles))
+        initial-capacity (get-in static-data [:sites site-k :skills skill])]
+    (- initial-capacity n-allocated)))
+
 (defn allocate-max-bundle
   [{:keys allocation reservoir} [site-k skill :as path] agent-k static-data]
-  (let [demand (demand allocation path)
+  (let [demand (demand allocation path static-data)
         to-allocate (min demand (get-in reservoir [skill agent-k]))]
     {:allocation (update-in allocation path
                             #(if % (+ % to-allocate) to-allocate))
@@ -153,8 +188,7 @@
       (move-to-reservoir distribution [site-k skill agent-k]))
     (for [site-k (keys allocation)
           skill (keys site)]
-      (if (incomplete-alloc? site-k (get-in [site-k skill] allocation)
-                             static-data)
+      (if (pos? (demand (demand allocation [site-k skill] static-data)))
         (for [a (good-agents n-good-agents site-k skill reservoir static-data)]
           (allocate-max-bundle distribution [site-k skill] a static-data))))))


Removed move-time.

Removed move-time.

--- src/cas/state.cljs
+++ src/cas/state.cljs
@@ -6,5 +6,4 @@
 (def tile-dim 32)

 (def state (atom {:world []
-                  :player {:pos {:x 3 :y 3}
-                           :mov-time [0 0]}}))
+                  :player {:pos {:x 3 :y 3}}}))


build name

build name

--- src/ci3/server.clj
+++ src/ci3/server.clj
@@ -73,7 +73,7 @@
     {:body (k8s/create cfg :builds
                        {:kind "Build"
                         :apiVersion "ci3.io/v1"
-                        :metadata {:name  hashcommit}
+                        :metadata {:name  build-name}
                         :payload {:ref (:ref payload)
                                   :diff (:compare payload)
                                   :repository (select-keys repository


Fix prepared statements

Fix prepared statements

--- src/clojure/clojurewerkz/cassaforte/client.clj
+++ src/clojure/clojurewerkz/cassaforte/client.clj
@@ -15,11 +15,11 @@
 (ns clojurewerkz.cassaforte.client
   "Provides fundamental functions for

-   * connecting to Cassandra nodes and clusters
-   * configuring connections
-   * tuning load balancing, retries, reconnection strategies and consistency settings
-   * preparing and executing queries constructed via DSL
-   * working with executing results"
+  * connecting to Cassandra nodes and clusters
+  * configuring connections
+  * tuning load balancing, retries, reconnection strategies and consistency settings
+  * preparing and executing queries constructed via DSL
+  * working with executing results"
   (:require [clojure.java.io                    :as io]
             [clojurewerkz.cassaforte.policies   :as cp]
             [clojurewerkz.cassaforte.conversion :as conv]
@@ -51,13 +51,13 @@
 (defmacro prepare
   "Prepare a single statement, return prepared statement"
   ([body]
-     `(binding [hayt/*prepared-statement* true
-                hayt/*param-stack*        (atom [])]
-        ~body))
+   `(binding [hayt/*prepared-statement* true
+              hayt/*param-stack*        (atom [])]
+      ~body))
   ([session body]
-     `(binding [hayt/*prepared-statement* true
-                hayt/*param-stack*        (atom [])]
-        (.prepare ~session ~body))))
+   `(binding [hayt/*prepared-statement* true
+              hayt/*param-stack*        (atom [])]
+      (.prepare ~session ~body))))

 ;;
 ;; Protocols
@@ -208,25 +208,25 @@
 (defn ^Session connect
   "Connects to the Cassandra cluster. Use `build-cluster` to build a cluster."
   ([hosts]
-     (connect-or-close (build-cluster {:hosts hosts})))
+   (connect-or-close (build-cluster {:hosts hosts})))
   ([hosts keyspace-or-opts]
-     (if (string? keyspace-or-opts)
-       (connect hosts keyspace-or-opts {})
-       (let [keyspace (:keyspace keyspace-or-opts)
-             opts     (dissoc keyspace-or-opts :keyspace)]
-         (if keyspace
-           (connect hosts keyspace opts)
-           (connect-or-close (-> opts (merge {:hosts hosts}) build-cluster))))))
+   (if (string? keyspace-or-opts)
+     (connect hosts keyspace-or-opts {})
+     (let [keyspace (:keyspace keyspace-or-opts)
+           opts     (dissoc keyspace-or-opts :keyspace)]
+       (if keyspace
+         (connect hosts keyspace opts)
+         (connect-or-close (-> opts (merge {:hosts hosts}) build-cluster))))))
   ([hosts keyspace opts]
-     (let [c (build-cluster (merge opts {:hosts hosts}))]
-       (connect-or-close c (name keyspace)))))
+   (let [c (build-cluster (merge opts {:hosts hosts}))]
+     (connect-or-close c (name keyspace)))))

 (defn ^Session connect-with-uri
   ([^String uri]
-     (connect-with-uri uri {}))
+   (connect-with-uri uri {}))
   ([^String uri opts]
-     (let [^URI u (URI. uri)]
-       (connect [(.getHost u)] (merge {:port (.getPort u) :keyspace (-> u .getPath (.substring 1))} opts)))))
+   (let [^URI u (URI. uri)]
+     (connect [(.getHost u)] (merge {:port (.getPort u) :keyspace (-> u .getPath (.substring 1))} opts)))))

 (defn disconnect
   "1-arity version receives Session, and shuts it down. It doesn't shut down all other sessions
@@ -247,51 +247,50 @@
 (defn bind
   "Binds prepared statement to values, for example:

-   With string statement:
-
-      (client/bind
-             (client/prepare s \"INSERT INTO users (name, city, age) VALUES (?, ?, ?);\")
-             [\"Alex\" \"Munich\" (int 19)])
-
-    With queries:
-
-      (let [prepared (client/prepare (insert s :users {:name ? :city ? :age  ?}))]
-        (client/execute s
-                (client/bind prepared [\"Alex\" \"Munich\" (int 19)]))"
+  With string statement:
+
+  (client/bind
+  (client/prepare s \"INSERT INTO users (name, city, age) VALUES (?, ?, ?);\")
+  [\"Alex\" \"Munich\" (int 19)])
+
+  With queries:
+
+  (let [prepared (client/prepare (insert s :users {:name ? :city ? :age  ?}))]
+  (client/execute s
+  (client/bind prepared [\"Alex\" \"Munich\" (int 19)]))"
   [^PreparedStatement statement values]
   (.bind statement (to-array values)))

 (defn execute
   "Executes a statement"
   ([^Session session query]
-     (if hayt/*prepared-statement*
-       (let [^String q (hayt/->raw query)]
-         (.prepare session q))
-       (let [^Statement built-statement (build-statement query)]
-         (if *async*
-           (AsyncResult. (.executeAsync session built-statement))
-           (-> (.execute session built-statement)
-               (conv/to-clj))))))
+   (if hayt/*prepared-statement*
+     (.prepare session query)
+     (let [^Statement built-statement (build-statement query)]
+       (if *async*
+         (AsyncResult. (.executeAsync session built-statement))
+         (-> (.execute session built-statement)
+             (conv/to-clj))))))
   ([^Session session query & {:keys [retry-policy
                                      consistency-level
                                      fetch-size
                                      enable-tracing
                                      default-timestamp]}]
-     (let [^Statement built-statement (build-statement query)]
-       (when default-timestamp
-         (.setDefaultTimestamp built-statement))
-       (when enable-tracing
-         (.enableTracing built-statement))
-       (when fetch-size
-         (.setFetchSize built-statement (int fetch-size)))
-       (when retry-policy
-         (.setRetryPolicy built-statement retry-policy))
-       (when consistency-level
-         (.setConsistencyLevel built-statement consistency-level))
-       (if *async*
-         (AsyncResult. (.executeAsync session built-statement))
-         (-> (.execute session built-statement)
-             (conv/to-clj))))))
+   (let [^Statement built-statement (build-statement query)]
+     (when default-timestamp
+       (.setDefaultTimestamp built-statement))
+     (when enable-tracing
+       (.enableTracing built-statement))
+     (when fetch-size
+       (.setFetchSize built-statement (int fetch-size)))
+     (when retry-policy
+       (.setRetryPolicy built-statement retry-policy))
+     (when consistency-level
+       (.setConsistencyLevel built-statement consistency-level))
+     (if *async*
+       (AsyncResult. (.executeAsync session built-statement))
+       (-> (.execute session built-statement)
+           (conv/to-clj))))))

 (defn ^String export-schema
   "Exports the schema as a string"


Add "are" macro

Add "are" macro

--- src/main/clojure/com/stuartsierra/lazytest.clj
+++ src/main/clojure/com/stuartsierra/lazytest.clj
@@ -159,6 +159,32 @@
                             :line ~(:line (meta &form))
                             :form '~&form}
                         nil))))
+
+(defmacro are
+  "A series of assertions reusing a single expression.
+  Creates a function of (fn argv expr).  Values will be partitioned
+  into groups of the same size as argv.  The function will be applied
+  to each group.
+
+  Example:
+
+      (are [x y z] (= (+ x y) z)
+          2 2  4
+          3 2  5
+          8 -1 7)
+
+      ;; Compiles to:
+
+      (is (= (+ 2 2) 4)
+          (= (+ 3 2) 5)
+          (= (+ 8 -1) 7))
+"
+  [argv expr & values]
+  (let [argc (count argv)]
+    (assert (vector? argv))
+    (assert (zero? (rem (count values) argc)))
+    `(is ~@(map (fn [vs] `((fn ~argv ~expr) ~@vs))
+                (partition argc values)))))

 (defmacro given
   "A series of assertions using values from contexts.
@@ -268,3 +294,4 @@
                      `(SimpleAssertion (fn [] ~@body :ok) '~m nil))]
          ~(when (:name m) `(intern *ns* '~(:name m) ~sym))
          ~sym))))
+


Added clj-time dependency to the project.

--- app/project.clj
+++ app/project.clj
@@ -16,7 +16,8 @@
                  [org.clojure/clojurescript "0.0-3269"]
                  [reagent "0.5.0"]
                  [secretary "1.2.3"]
-                 [com.novemberain/monger "2.0.1"]]
+                 [com.novemberain/monger "2.0.1"]
+                 [clj-time "0.9.0"]]
   :main ^:skip-aot clj-web-example.main
   :target-path "target/%s"
   :profiles {:dev {:resource-paths ["target/dev"]


no need to change the name of the internal `process` function.

--- src/metabase/driver/generic_sql/query_processor.clj
+++ src/metabase/driver/generic_sql/query_processor.clj
@@ -17,7 +17,7 @@

 ;; ## Public Functions

-(defn -process
+(defn process
   "Convert QUERY into a korma `select` form."
   [{{:keys [source_table] :as query} :query}]
   (when-not (zero? source_table)
@@ -38,7 +38,7 @@
   {:pre [(integer? (:database query)) ; double check that the query being passed is valid
          (map? (:query query))
          (= (name (:type query)) "query")]}
-  (->> (-process query)
+  (->> (process query)
     eval
     (annotate/annotate query)))


Rework monitoring foo.

Rework monitoring foo.

--- src/dsbdp/main.clj
+++ src/dsbdp/main.clj
@@ -24,23 +24,28 @@

 (defn create-thread-info-fn
   []
-  (let [tmxb (ManagementFactory/getThreadMXBean)
+  (let [^ThreadMXBean tmxb (ManagementFactory/getThreadMXBean)
+        cpu-time-supported (.isThreadCpuTimeSupported tmxb)
         delta-cntr (delta-counter)]
-;    (println (.isThreadCpuTimeSupported tmxb))
-;    (println (.isThreadContentionMonitoringSupported tmxb))
     (.setThreadContentionMonitoringEnabled tmxb true)
     (fn []
       (let [t-ids (vec (.getAllThreadIds tmxb))]
         (doseq [t-id t-ids]
-          (let [t-info (.getThreadInfo tmxb t-id)
+          (let [^ThreadInfo t-info (.getThreadInfo tmxb ^long t-id)
                 t-name (.getThreadName t-info)
+                cpu-time (if cpu-time-supported
+                           (.getThreadCpuTime tmxb t-id)
+                           -1)
+                user-time (if cpu-time-supported
+                            (.getThreadUserTime tmxb t-id)
+                            -1)
                 waited (.getWaitedTime t-info)
-                blocked (.getBlockedTime t-info)
-                kw-w (keyword (str "waited" t-id))]
-            (print kw-w)
-            (println (str t-name "," waited "," blocked ","
-                          (delta-cntr kw-w waited) ","
-                          (delta-cntr (keyword t-name) blocked)))))))))
+                blocked (.getBlockedTime t-info)]
+            (println (str t-id "," t-name "," cpu-time "," user-time "," waited "," blocked ","
+                          (delta-cntr (keyword (str "cpu" t-id)) cpu-time) ","
+                          (delta-cntr (keyword (str "user" t-id)) user-time) ","
+                          (delta-cntr (keyword (str "waited" t-id)) waited) ","
+                          (delta-cntr (keyword (str "blocked" t-id)) blocked)))))))))

 (defn -main [& args]


It should be not equal, they structs get all keys

--- src/fatty/core.clj
+++ src/fatty/core.clj
@@ -76,7 +76,7 @@
 (defn clean
   "Clean a previous build directory"
   [soft]
-  (if (= (contains? soft :source))
+  (if (not (= (soft :source) nil))
     (let [status (sh "rm" "-rf" (.getPath (file-str fatty-build-dir "/" (soft :source))) :return-map true)]
       (log-sh-result status
                      (str "Removed old build directory for " (soft :source))
@@ -85,7 +85,7 @@
 (defn prep
   "Prepare to build a software package by copying its source to a pristine build directory"
   [soft]
-  (if (= (contains? soft :source))
+  (if (not (= (soft :source) nil))
     (do
       (.mkdirs fatty-build-dir)
       (copy-source-to-build soft))))
@@ -104,9 +104,9 @@
   (log :info (str "Building " (soft :source)))
   (for [step (soft :steps)]
     (execute-step step (.getPath (file-str fatty-build-dir "/"
-                                           (if (= (contains? soft :build-subdir) true)
+                                           (if (not (= (soft :build-subdir) nil))
                                              (str (soft :source) "/" (soft :build-subdir))
-                                             (if (= (contains? soft :source) true)
+                                             (if (not (= (soft :source) nil))
                                                (soft :source)
                                                ""))))))) ; It's cool, we just want the top build directory if there is no source


Handling nil values by ensuring everything is a string.

--- src/ahnentafel/server/pages.clj
+++ src/ahnentafel/server/pages.clj
@@ -9,21 +9,25 @@
 (html/defsnippet home-page-snippet "site/templates/home.html" [:div]
   [header-data]
   [:#home-contents]
-  (html/transform-content
-   (html/replace-vars {:number-of-records (str (:number-of-records header-data))
+  (letfn [(ensure-strings [m]
+            (zipmap (keys m) (map str (vals m))))]
+    (html/transform-content
+     (html/replace-vars
+      (ensure-strings {:number-of-records (:number-of-records header-data)
                        :file (:file header-data)
                        :source-name (:source header-data)
                        :destination-name (:destination header-data)
                        :file-time (:file-time header-data)
                        :gedcom-version (get-in header-data [:gedcom :version])
                        :gedcom-type (get-in header-data [:gedcom :type])
-                       :encoding (:encoding header-data)}))
+                       :encoding (:encoding header-data)}))))

   [:#home-contents :a#submitter]
   (html/do->
    (html/content (get-in header-data [:submitter :name]))
    (html/set-attr "href"
-                  (record-link (get-in header-data [:submitter :xref])))))
+                  (record-link (get-in header-data [:submitter :xref]))))
+  )

 (defn- format-names [name & akas]
   (str name


instaparse dependency removed from logic.util

--- src/logic/util.clj
+++ src/logic/util.clj
@@ -1,11 +1,10 @@
 (ns logic.util
-  (:require [instaparse.core :as insta]
-            [clojure.string :as cstr]
+  (:require [clojure.string :as cstr]
             [mpa.cst.parser.parser :as mpaParser]
-            [clojure.repl :refer :all])
-  (:use     [clojure.math.combinatorics :only (selections combinations)]
-            [clojure.walk :only (postwalk)]
-            [clojure.set :only (union)]))
+            [clojure.repl :refer :all]
+            [clojure.math.combinatorics :refer (selections combinations)]
+            [clojure.walk :refer (postwalk)]
+            [clojure.set :refer (union)]))

 (def tseitin-prefix "t_")


Bug! Don't seek if offset bigger than file!

--- src/monocle/io.clj
+++ src/monocle/io.clj
@@ -27,7 +27,8 @@
   ([file offset]
      (let [f (io/file file)
            cis (CountingInputStream. (io/input-stream f))]
-       (.skip cis offset)
+       (when (<= offset (.length f))
+         (.skip cis offset))
        [cis (io/reader cis)])))

 (defmacro with-offset


Add log function.

Add log function.

--- src/ombs/funcs.clj
+++ src/ombs/funcs.clj
@@ -28,3 +28,7 @@
   (map #(replace % ks) sq))

 (defn part-price [event-price parts] (/ event-price parts))
+
+(defn with-log [f]
+  (print f)
+  (f))


The native file watching is buggy, use hybrid approach

--- boot/core/src/boot/task/built_in.clj
+++ boot/core/src/boot/task/built_in.clj
@@ -124,13 +124,12 @@
   [d debounce MSEC long "The time to wait (millisec) for filesystem to settle down."]

   (.require @pod/worker-pod (into-array String ["boot.watcher"]))
-  (let [ms   TimeUnit/MILLISECONDS
-        q    (LinkedBlockingQueue.)
-        ps   (into-array String (:src-paths (core/get-env)))
-        ps   (->> (core/get-env) :src-paths
-               (remove core/tmpfile?) (into-array String))
-        k    (.invoke @pod/worker-pod "boot.watcher/make-watcher" q ps)
-        ign? (git/make-gitignore-matcher (core/get-env :src-paths))]
+  (let [q        (LinkedBlockingQueue.)
+        srcdirs  (->> (core/get-env :src-paths) (remove core/tmpfile?))
+        watchers (map file/make-watcher srcdirs)
+        paths    (into-array String srcdirs)
+        k        (.invoke @pod/worker-pod "boot.watcher/make-watcher" q paths)
+        ign?     (git/make-gitignore-matcher (core/get-env :src-paths))]
     (fn [continue]
       (fn [event]
         (loop [ret (util/guard [(.take q)])]
@@ -139,7 +138,9 @@
               (recur (conj ret more))
               (let [start   (System/currentTimeMillis)
                     etime   #(- (System/currentTimeMillis) start)
-                    changed (->> ret (remove (comp ign? io/file)) set)]
+                    changed (->> (map #(%) watchers)
+                              (reduce (partial merge-with set/union))
+                              :time (remove ign?) set)]
                 (when-not (empty? changed)
                   (-> event core/prep-build! (assoc ::watch changed) continue)
                   (util/info "Elapsed time: %.3f sec\n\n" (float (/ (etime) 1000))))


Fix a few small bugs in imagery.clj

Fix a few small bugs in imagery.clj

--- src/clj/org/openforis/ceo/db/imagery.clj
+++ src/clj/org/openforis/ceo/db/imagery.clj
@@ -23,14 +23,14 @@

 (defn get-institution-imagery [{:keys [params]}]
   (let [institution-id (tc/str->int (:institutionId params))
-        user-id        (tc/str->int (:userId params))]
+        user-id        (:userId params)]
     (data-response (prepare-imagery (call-sql "select_imagery_by_institution" institution-id user-id)
                                     (is-inst-admin-query? user-id institution-id)))))

 (defn get-project-imagery [{:keys [params]}]
   (let [project-id (tc/str->int (:projectId params))
-        user-id    (tc/str->int (:userId params))
-        token-key   (:tokenKey params)]
+        user-id    (:userId params)
+        token-key  (:tokenKey params)]
     (data-response (prepare-imagery (call-sql "select_imagery_by_project" project-id user-id token-key)
                                     false))))

@@ -50,7 +50,7 @@
   (let [institution-id       (tc/str->int (:institutionId params))
         imagery-title        (:imageryTitle params)
         imagery-attribution  (:imageryAttribution params)
-        source-config        (tc/json->jsonb (:sourceConfig params))
+        source-config        (tc/clj->jsonb (:sourceConfig params))
         add-to-all-projects? (tc/str->bool (:addToAllProjects params) true)]
     (if (sql-primitive (call-sql "imagery_name_taken" institution-id imagery-title -1))
       (data-response "The title you have chosen is already taken.")
@@ -91,10 +91,10 @@
   (let [imagery-id           (tc/str->int (:imageryId params))
         imagery-title        (:imageryTitle params)
         imagery-attribution  (:imageryAttribution params)
-        source-config        (tc/json->jsonb (:sourceConfig params))
+        source-config        (tc/clj->jsonb (:sourceConfig params))
         add-to-all-projects? (tc/str->bool (:addToAllProjects params) true)
-        institution-id       (:institution_rid (get-imagery-by-id imagery-id))]
-    (if (call-sql "imagery_name_taken" institution-id imagery-title imagery-id)
+        institution-id       (:institution_id (get-imagery-by-id imagery-id))]
+    (if (sql-primitive (call-sql "imagery_name_taken" institution-id imagery-title imagery-id))
       (data-response "The title you have chosen is already taken.")
       (do
         (call-sql "update_institution_imagery"


move in resize channel

move in resize channel

--- src/cljs/infinitelives/utils/events.cljs
+++ src/cljs/infinitelives/utils/events.cljs
@@ -225,3 +225,32 @@
   ```"
   [delay]
   (wait-frames (* 60 (/ delay 1000))))
+
+
+;;
+;; Resize Channel
+;; --------------
+;; resize channels receive [width height]
+;;
+(def *resize-chans* (atom #{}))
+
+(defn new-resize-chan []
+  (let [c (chan)]
+    (swap! *resize-chans* conj c)
+    c))
+
+(defn del-resize-chan [c]
+  (swap! *resize-chans* disj c))
+
+(defn clear-resize-chans! []
+  (swap! *resize-chans* #{}))
+
+(defn resize-event-chan-handler [ev]
+  (let [size [(.-innerWidth js/window) (.-innerHeight js/window)]]
+    (doseq [c @*resize-chans*] (put! c size))))
+
+(defn install-resize-handler
+  "install the resize callback to resize the main canvas renderer"
+  []
+  (.addEventListener js/window "resize" resize-event-chan-handler))
+


add indices to french

add indices to french

--- src/babel/francais/grammar.cljc
+++ src/babel/francais/grammar.cljc
@@ -6,9 +6,7 @@
    #?(:cljs [babel.logjs :as log])
    [babel.francais.lexicon :refer [lexicon]]
    [babel.francais.morphology :as morph :refer [fo]]
-   [babel.index :refer (build-lex-sch-index
-                        create-index map-subset-by-path
-                        spec-to-phrases)]
+   [babel.index :refer [build-lex-sch-index create-indices lookup-spec]]
    [babel.parse :as parse]
    [babel.ug :refer [comp-modifies-head comp-specs-head head-principle
                      root-is-comp root-is-head-root root-is-head
@@ -17,6 +15,12 @@
                      subcat-2-2-principle subcat-5-principle]]
    [clojure.core.cache :as cache]
    [dag_unify.core :refer (fail? get-in strip-refs unify)]))
+
+(def index-lexicon-on-paths
+  [[:synsem :cat]
+   [:synsem :aux]
+   [:synsem :sem :pred]])
+
 (declare against-pred)
 (declare matching-head-lexemes)

@@ -475,8 +479,10 @@
                                    (= (get-in % [:synsem :pronoun]) true))
                               v)]
                   (if (not (empty? filtered-v))
-                    [k filtered-v]))))]
+                    [k filtered-v]))))
+        indices (create-indices lexicon index-lexicon-on-paths)]
     {:name "small"
+     :index-fn (fn [spec] (lookup-spec spec indices index-lexicon-on-paths))
      :morph-walk-tree (fn [tree]
                         (do
                           (merge tree
@@ -488,12 +494,6 @@
      :morph-ps fo-ps
      :enrich enrich

-     :pred2lex ;; map:<pred => subset of lexicon with that pred>
-     (map-subset-by-path lexicon [:synsem :sem :pred])
-
-     :cat2lex ;; map:<cat => subset of lexicon with that cat>
-     (map-subset-by-path lexicon [:synsem :cat])
-
      :grammar grammar
      ;; Will throw exception if more than 1 rule has the same :rule value:
      :grammar-map (zipmap
@@ -502,8 +502,7 @@
                    grammar)
      :lexical-cache (atom (cache/fifo-cache-factory {} :threshold 1024))
      :lexicon lexicon
-     :morph fo
-     :index (create-index grammar (flatten (vals lexicon)) head-principle)}))
+     :morph fo}))

 (defn analyze [arg]
   (morph/analyze arg lexicon))
@@ -533,8 +532,10 @@
                             (= (:rule %) "s-imperfect-nonphrasal")
                             (= (:rule %) "s-aux")
                             (= (:rule %) "vp-aux"))
-                          grammar)))]
+                          grammar)))
+        indices (create-indices lexicon index-lexicon-on-paths)]
     {:name "medium"
+     :index-fn (fn [spec] (lookup-spec spec indices index-lexicon-on-paths))
      :enrich enrich
      :grammar grammar
      ;; Will throw exception if more than 1 rule has the same :rule value:
@@ -544,18 +545,10 @@
                    grammar)
      :lexical-cache (atom (cache/fifo-cache-factory {} :threshold 1024))
      :lexicon lexicon
-     :index (create-index grammar (flatten (vals lexicon)) head-principle)
      :morph-walk-tree (fn [tree]
                         (do
                           (merge tree
                                  (morph-walk-tree tree))))
-
-     :pred2lex ;; map:<pred => subset of lexicon with that pred>
-     (map-subset-by-path lexicon [:synsem :sem :pred])
-
-     :cat2lex ;; map:<cat => subset of lexicon with that cat>
-     (map-subset-by-path lexicon [:synsem :cat])
-
      :morph-ps fo-ps
      :language "fr"
      :language-keyword :français


Added :progressive age-combining-function.

--- src/clojush/pushgp/genetic_operators.clj
+++ src/clojush/pushgp/genetic_operators.clj
@@ -46,7 +46,20 @@
                                  (- (inc (:age p2))
                                     (inc (:age p1)))))))))
     :first (fn [p1 p2 g]
-             (inc (:age p1)))))
+             (inc (:age p1)))
+    :progressive (fn [p1 p2 g]
+                   (if (= (:age p1) (:age p2))
+                     (inc (:age p1))
+                     (if (= (:genome p1) (:genome p2))
+                       (/ (+ (inc (:age p1)) (inc (:age p2))) 2)
+                       (if (> (:age p2) (:age p1))
+                         (inc (:age p1))
+                         (let [p1-dist (levenshtein-distance g (:genome p1))
+                               p2-dist (levenshtein-distance g (:genome p2))]
+                           (+ (inc (:age p1))
+                              (* (/ p1-dist (+ p1-dist p2-dist))
+                                 (- (inc (:age p2))
+                                    (inc (:age p1))))))))))))

 ;; test effects of :proportionate with expressions like this:
 ;(float ((age-combining-function {:age-combining-function :proportionate})
@@ -1076,3 +1089,4 @@
         (if use-child false true)))))

+


Remove limiter

Remove limiter

--- src/bltool/data/backloggery.clj
+++ src/bltool/data/backloggery.clj
@@ -84,7 +84,7 @@
     (loop [games []
            params { "aid" "1" "temp_sys" "ZZZ" "ajid" "0" "total" "0" }]
       (println "Fetched" (count games) "games from Backloggery...")
-      (if (and params (= 0 (count games)))
+      (if params
         (let [page (bl-more-games cookies user params)]
           (recur (concat games (bl-extract-games page)) (bl-extract-params page)))
         (sort-by :name games)))))


Add name attribute to metadata categories

--- src/clj/cglossa/models/core.clj
+++ src/clj/cglossa/models/core.clj
@@ -17,6 +17,7 @@
    (schema metadata-category
            (fields
              [short-nane :string]
+             [name :string]
              [widget-type :enum [:list :range]]
              [values :ref :many "One or more text-values, bool-values or numeric-values"]
              [text-value :string]


Just a bit of storm spec namespace cleanup...

--- src/storm_spec.clj
+++ src/storm_spec.clj
@@ -1,10 +1,7 @@
 (ns storm-spec
   (:import [backtype.storm StormSubmitter LocalCluster])
+  (:require [incanter.core :as ic.core])
   (:use [backtype.storm clojure config]
-        [incanter [core :exclude [trace]] stats charts]
-        clojure.tools.trace
-        lamina.core aleph.tcp
-        gloss.core
         matrix-utils
         [clojure.data.json :as json])
   (:gen-class))


not use pool

not use pool

--- src/clj/neb/durability/core.clj
+++ src/clj/neb/durability/core.clj
@@ -19,11 +19,9 @@
 (defn sync-trunk [^Trunk trunk]
   (try
     (let [dirty-segments (.getDirtySegments trunk)
-          sync-pool (cp/threadpool (* 2 (count @server-sids)) :name "Backup-Remote-Sync")
-          seg-pool (cp/threadpool 2 :name "Backup-Segment")
+          sync-pool (cp/threadpool (count @server-sids) :name "Backup-Remote")
           trunk-id (.getId trunk)]
-      (cp/pdoseq
-        seg-pool [^Segment seg dirty-segments]
+      (doseq [^Segment seg dirty-segments]
         (try
           (.lockWrite seg)
           (let [base-addr (- (.getBaseAddr seg) (.getStoreAddress trunk))
@@ -51,7 +49,6 @@
       (cp/pdoseq
         sync-pool [[sn sid] @server-sids]
         (rfi/invoke sn 'neb.durability.serv.core/sync-trunk-completed sid trunk-id))
-      (cp/shutdown sync-pool)
-      (cp/shutdown seg-pool))
+      (cp/shutdown sync-pool))
     (catch Exception ex
       (clojure.stacktrace/print-cause-trace ex))))


Run render in separate thread from rendering

--- src/clj/robinson/glterminal.clj
+++ src/clj/robinson/glterminal.clj
@@ -526,7 +526,7 @@
       (GL11/glDrawArrays GL11/GL_TRIANGLE_STRIP 0 vertices-count)
       (except-gl-errors "bg color texture data")
       (except-gl-errors "end of refresh")
-      (Display/sync 60)
+      ;(Display/sync 60)
       (Display/update)))
   (clear! [_]
     (reset! character-map character-map-cleared)))
@@ -741,17 +741,17 @@
     (Thread/sleep 1000)
     (when (pos? i)
       (recur (dec i))))
-  (loop [terminal nil]
-    (if (nil? terminal)
-      (let [terminal (make-terminal 80 20)]
-        (rat/clear! terminal)
-        (put-string terminal 5 5 "Hello world")
-        (rat/refresh! terminal)
-        (recur terminal))
+  (let [terminal (make-terminal 80 24)
+        last-key (atom nil)]
+    (future (go-loop []
+              (reset! last-key (async/<! (rat/get-key-chan terminal)))
+              (log/info "got key" @last-key)
+              (recur)))
+
+    (loop []
       (when (not (Display/isCloseRequested))
-        (let [key-in (async/<!! (rat/get-key-chan terminal))]
+        (let [key-in (or @last-key \?)]
         ;(let [key-in (rat/wait-for-key terminal)]
-          (log/info "got key" key-in)
           (rat/clear! terminal)
           (put-string terminal 0 0 "Hello world 0 0")
           (put-string terminal 0 1 "abcdefghijklmno")
@@ -760,7 +760,7 @@
           (put-string terminal 60 19 "Hello world 0 19")
           (put-string terminal 5 10 (str key-in))
           (rat/refresh! terminal)
-          (recur terminal)))))
+          (recur)))))
   (Display/destroy)
   (System/exit 0))


add budget items to serialization

add budget items to serialization

--- src/clj_money/serialization.clj
+++ src/clj_money/serialization.clj
@@ -107,11 +107,20 @@
   [storage-spec context]
   (update-in context [:transactions] #(create-transactions storage-spec context %)))

+(defn- append-budget-items
+  [storage-spec context items budget]
+  (assoc budget :items (->> items
+                            (map #(resolve-account context %))
+                            (map #(assoc % :budget-id (:id budget)))
+                            (mapv #(budgets/create-item storage-spec %)))))
+
 (defn- create-budgets
   [storage-spec context budgets]
   (mapv (fn [attributes]
-          (budgets/create storage-spec (->> attributes
-                                            (resolve-entity context))))
+          (->> attributes
+               (resolve-entity context)
+               (budgets/create storage-spec)
+               (append-budget-items storage-spec context (:items attributes))))
         budgets))

 (defn- realize-budgets


Fill out the fake comic reader component

--- src/cljs/comic_reader/main.cljs
+++ src/cljs/comic_reader/main.cljs
@@ -82,7 +82,10 @@
                    comic-imgs)
           [:div (str "Display chapter " (:chapter location)
                      " page " (:page location)
-                     " of comic " (:comic location))])))))
+                     " of comic " (:comic location)
+                     " on site " site)
+           [:br]
+           comic-imgs])))))

 (defn comic-reader []
   (let [page (rf/subscribe [:page])]


Remove old cache call

Remove old cache call

--- src/cljs/hacker_agent/core.cljs
+++ src/cljs/hacker_agent/core.cljs
@@ -238,7 +238,6 @@

 (secretary/defroute "/items/:id" [id]
   (swap! app-state assoc :render-view :item)
-  (base/r-cache! app-state [:items] id)
   (base/unbind! app-state [:current-item])
   (base/bind! app-state [:current-item]
               (base/id->fbref id)


refactor Sleep event to rx/delay (#5)

refactor Sleep event to rx/delay (#5)

Instead of relying on global window.setTimeout, the Sleep event is now delayed by rx/delay.

--- src/cljs/potok_rumu/events.cljs
+++ src/cljs/potok_rumu/events.cljs
@@ -35,7 +35,13 @@
 (defrecord ^:private Sleep []
   ptk/EffectEvent
   (effect [_ _ _]
-    (js/window.setTimeout #(js/alert "Psssst, he is sleeping!") 2500)))
+    (js/alert "Psssst, he is sleeping!") ))
+
+(defrecord ^:private DelayedSleep []
+  ptk/WatchEvent
+  (watch [_ _ _]
+    (->> (rx/just (->Sleep))
+         (rx/delay 2500))))

 (defrecord ^:private GoHome []
   ptk/WatchEvent
@@ -43,4 +49,4 @@
     (rx/merge
      (rx/just (->LeavePub))
      (rx/just (->Drain))
-     (rx/just(->Sleep)))))
+     (rx/just (->DelayedSleep)))))


upgrade material ns regarding new comp

upgrade material ns regarding new comp

--- src/cljs/swarmpit/material.cljs
+++ src/cljs/swarmpit/material.cljs
@@ -32,6 +32,9 @@
 (def raised-button (create-factory js/MaterialUI.RaisedButton))
 (def toogle (create-factory js/MaterialUI.Toggle))
 (def checkbox (create-factory js/MaterialUI.Checkbox))
+(def dialog (create-factory js/MaterialUI.Dialog))
+(def circular-progress (create-factory js/MaterialUI.CircularProgress))
+(def refresh-indicator (create-factory js/MaterialUI.RefreshIndicator))
 (def table (create-factory js/MaterialUI.Table))
 (def table-header (create-factory js/MaterialUI.TableHeader))
 (def table-header-column (create-factory js/MaterialUI.TableHeaderColumn))


Fix some world bounds values

Fix some world bounds values

--- src/cljx/robinson/worldgen.cljx
+++ src/cljx/robinson/worldgen.cljx
@@ -114,7 +114,7 @@

 (defn find-starting-pos [seed max-x max-y]
   (let [angle (dg/rand-nth (range (* 2 Math/PI)))
-        radius (/ (min max-x max-y) 2)
+        radius (min max-x max-y)
         [x y]   [(* radius (Math/cos angle))
                  (* radius (Math/sin angle))]
         points  (line-segment [x y] [0 0])
@@ -302,10 +302,11 @@
   ;; Assign hotkeys to inventory and remove from remaining hotkeys
   (let [width                  80
         height                 23
-        max-x                  800
-        max-y                  800
-        x                      (/ max-x 2)
-        y                      (/ max-y 2)
+        ;; min-x and min-y are -400 and -400
+        max-x                  400
+        max-y                  400
+        x                      0
+        y                      0
         inventory              []
         remaining-hotkeys      (vec (seq "abcdefghijklmnopqrstuvwxyzABCdEFGHIJKLMNOPQRSTUVWQYZ"))
         hotkey-groups          (split-at (count inventory) remaining-hotkeys)


fix creating dirs in postmortem handler (#267)

--- src/etaoin/api.clj
+++ src/etaoin/api.clj
@@ -2760,6 +2760,10 @@
         path-src (join-path dir-src file-src)
         path-log (join-path dir-log file-log)]

+    (clojure.java.io/make-parents path-img)
+    (clojure.java.io/make-parents path-src)
+    (clojure.java.io/make-parents path-log)
+
     (log/debugf "Writing screenshot: %s" path-img)
     (screenshot driver path-img)


Add get-element-inner-html

Add get-element-inner-html

--- src/etaoin/api.clj
+++ src/etaoin/api.clj
@@ -880,6 +880,26 @@
     (vec
      (for [prop props]
        (get-element-css-el driver el prop)))))
+
+;;
+;; element inner HTML
+;;
+
+(defn get-element-inner-html-el
+  "Returns element's inner text by its identifier."
+  [driver el]
+  (:value (execute {:driver driver
+                    :method :get
+                    :path [:session (:session @driver) :element el :property :innerHTML]})))
+
+(defn get-element-inner-html
+  "Returns element's inner HTML.
+
+  For element `el` in `<div id=\"el\"><p class=\"foo\">hello</p></div>` it will
+  be \"
hello
\" string.
+"
+  [driver q]
+  (get-element-inner-html-el driver (query driver q)))

 ;;
 ;; element text, name and value


Return document_date column from db

Return document_date column from db

When we query the db for a document we return the document_date column
too.

--- src/pepa/model.clj
+++ src/pepa/model.clj
@@ -103,10 +103,11 @@
                                             (vals grouped)))))))

 (defn get-documents [db ids]
+  (prn "Get document ids" ids)
   (db/with-transaction [conn db]
     (if-not (seq ids)
       []
-      (let [documents (db/query conn (db/sql+placeholders "SELECT id, title, created, modified, notes FROM documents WHERE id IN (%s)" ids))
+      (let [documents (db/query conn (db/sql+placeholders "SELECT id, title, created, modified, document_date, notes FROM documents WHERE id IN (%s)" ids))
             pages (get-associated conn "SELECT dp.document, p.id, p.rotation, p.render_status AS \"render-status\",
                                           (SELECT array_agg(dpi) from page_images where page = id) AS dpi
                                         FROM pages AS p


add extra debug info when clipboard copy fails

--- src-cljs/frontend/clipboard.cljs
+++ src-cljs/frontend/clipboard.cljs
@@ -119,6 +119,11 @@

 (defmulti svg-element (fn [layer opts] (:layer/type layer)))
+
+(defmethod svg-element :default
+  [layer opts]
+  (js/Rollbar.error "Called clipboard/svg-element for non-drawing" layer)
+  nil)

 (defmethod svg-element :layer.type/rect
   [layer opts]


Register parse-fixture at non-octal 0.

Register parse-fixture at non-octal 0.

--- src/incise/once/fixtures/impl/incise.clj
+++ src/incise/once/fixtures/impl/incise.clj
@@ -12,4 +12,4 @@
   (doall (parse-all-input-files)))

 (register load-fixture -500)
-(register parse-fixture 000)
+(register parse-fixture   0)


Demonstrating that lazy =streams=> doesn't work for `throws`.

--- test/as_documentation/t_streaming_prerequisites.clj
+++ test/as_documentation/t_streaming_prerequisites.clj
@@ -139,3 +139,40 @@
 (fact
   @reported => has-bad-result
   @reported => (has-thrown-message useful-message))
+
+
+
+;;;; This does not work
+
+(unfinished a-try)
+
+(defn a-try []
+  (   (fn [] (throw (Exception. "fooooooo"))) ))
+
+(defn msg []
+  (try
+    (a-try)
+    (catch Exception ex
+      (prn "#'msg going to return " (.getMessage ex))
+      (.getMessage ex))))
+
+
+(defn longest-msg []
+  (reduce (fn [so-far text]
+            (prn "longest-msg working with " text)
+            (if (> (count text) (count so-far))
+              text
+              so-far))
+            [(msg) (msg) (msg)]))
+
+; (prn [(msg) (msg) (msg)])
+
+; (prn (longest-msg))
+
+(future-fact "streaming exceptions actually works"
+  (longest-msg) => "i am long"
+  (provided
+    (a-try) =streams=> [ (throw (Exception. "short"))
+                         (throw (Exception. "shorter"))
+                         (throw (Exception. "i am long")) ]))
+


add a subcommand "help" to display usage

--- src/utree/core.clj
+++ src/utree/core.clj
@@ -1,6 +1,7 @@
 (ns utree.core
   (:require (utree.dot))
-  (:require (clojure [string :as str]))
+  (:require (clojure [string :as str])
+            (clojure [pprint :only (cl-format)]))
   (:gen-class))

 (defn ^{:cli true :usage "filename"} dot
@@ -8,9 +9,14 @@
   [filename]
   (utree.dot/dot filename))

+(defn ^{:cli true :usage ""} help
+  "Display help message"
+  []
+  (command-help))
+
 (defn subcommands
   []
-  (filter :cli (map (fn [[k v]] (meta v)) (ns-publics 'utree.core))))
+  (filter :cli (map meta (vals (ns-publics 'utree.core)))))

 (defn find-first
   [pred coll]
@@ -26,11 +32,11 @@

 (defn command-help
   []
-  (println "Usage: utree [subcommand] command-options")
+  (println "Usage: utree subcommand [command-options]")
   (println "\nSubcommands:")
   (doseq [c (subcommands)]
-    (apply print (interpose "\t" (map c [:name :usage :doc])))
-    (println)))
+    (clojure.pprint/cl-format true "~10A~30A~40A~%" (:name c) (:usage c) (:doc c)))
+  (println))

 (defn -main
   ([] (command-help))


added tests for oversized behavior in :vectorized instructions

--- test/push/instructions/standard/vectorized_test.clj
+++ test/push/instructions/standard/vectorized_test.clj
@@ -1,18 +1,25 @@
 (ns push.instructions.standard.vectorized_test
   (:require [push.interpreter.core :as i]
-            [push.type.core :as t])
+            [push.type.core :as t]
+            [push.core :as push])
   (:use midje.sweet)
   (:use [push.util.test-helpers])
   (:use [push.type.item.vectorized])
   )

+;; fixtures
+
 (def foo-type (t/make-type :foo
                            :recognized-by number?
                            :attributes #{:foo}))

 (def foos-type (build-vectorized-type foo-type))

+(def teeny (-> (push/interpreter :config {:max-collection-size 9})
+               (i/register-type , foos-type)))
+
+;; tests

 (fact "foos-type knows some instructions"
   (keys (:instructions foos-type)) =>
@@ -90,6 +97,28 @@
      :scalar  '(99)}           :foos-build       {:foos    '([] [1 2 3])
                                                   :foo     '()
                                                   :scalar  '()})
+
+
+(tabular
+  (fact "foos-build produces an error when the result is oversized"
+    (check-instruction-here-using-this
+      teeny
+      ?new-stacks ?instruction) => (contains ?expected))
+
+    ?new-stacks                ?instruction       ?expected
+    {:foos    '([1 2 3])
+     :foo     '(7 77 777 7777)
+     :scalar  '(3)}            :foos-build       {:foos    '([7 77 777] [1 2 3])
+                                                  :foo     '(7777)
+                                                  :error  '()}
+     ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+     {:foos    '(1 2 3 4 5 6 7 8)
+      :foo     '(7 77 777 7777)
+      :scalar  '(3)}            :foos-build       {:foos    '(1 2 3 4 5 6 7 8)
+                                                   :foo     '(7777)
+                                                   :error   '({:item ":foos-build tried to push an overized item to :foos", :step 0})}
+      ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+     )

 (tabular
@@ -107,6 +136,23 @@

 (tabular
+  (fact "foos-concat produces an error when the result is oversized"
+    (check-instruction-here-using-this
+      teeny
+      ?new-stacks ?instruction) => (contains ?expected))
+
+    ?new-stacks                ?instruction       ?expected
+    {:foos    '([1 2 3][4])}   :foos-concat       {:foos    '([4 1 2 3])
+                                                  :error  '()}
+     ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+     {:foos    '([1 2 3][4] 5 6 7 8 9)}
+                               :foos-concat       {:foos    '(5 6 7 8 9)
+                                                   :error   '({:item ":foos-concat tried to push an overized item to :foos", :step 0})}
+      ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+     )
+
+
+(tabular
   (fact "`foos-conj` conjes the top :foo item onto the top :foos vector"
     (check-instruction-with-all-kinds-of-stack-stuff
         ?new-stacks foos-type ?instruction) => (contains ?expected))
@@ -127,6 +173,24 @@
     ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     )

+(tabular
+  (fact "foos-conj produces an error when the result is oversized"
+    (check-instruction-here-using-this
+      teeny
+      ?new-stacks ?instruction) => (contains ?expected))
+
+    ?new-stacks                ?instruction       ?expected
+    {:foos    '([1 2 3])
+     :foo     '(9)}             :foos-conj       {:foos    '([1 2 3 9])
+                                                  :foo     '()
+                                                  :error   '()}
+     ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+     {:foos    '([1 2 3] 4 5 6 7 8)
+      :foo     '(9)}             :foos-conj       {:foos    '(4 5 6 7 8)
+                                                   :foo     '()
+                                                   :error   '({:item ":foos-conj tried to push an overized item to :foos", :step 0})}
+      ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+     )

 (tabular
@@ -167,8 +231,8 @@

     ?new-stacks              ?instruction     ?expected

-    {:foos '([3 1 1 2 3 1 2 2])}
-                             :foos-distinct
+    {:foos '([3 1 1 2 3 1 2 2])}
+                             :foos-distinct
                                               {:foos '([3 1 2])}
     ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     {:foos '([1 2 3])}       :foos-distinct   {:foos '([1 2 3])}
@@ -588,7 +652,7 @@
                                                 :foo  '(1 2 3 9.9)}
     ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     {:foos   '([])
-     :foo    '(9.9)}       :foos-shatter       {:foos '()
+     :foo    '(9.9)}       :foos-shatter       {:foos '()
                                                 :foo  '(9.9)}
     ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     {:foos   '([1 2 3])
@@ -713,7 +777,7 @@
                                                  :foo    '(9.9)}
     ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     {:foos   '([])
-     :foo    '(9.9)}          :foos-reverse       {:foos   '([])
+     :foo    '(9.9)}          :foos-reverse       {:foos   '([])
                                                  :foo    '(9.9)}
     ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     )
@@ -823,25 +887,25 @@

     {:foos   '([1 2 3 4 5 6]
                [99 88 77 66])
-     :scalar '(3 1)}
+     :scalar '(3 1)}
                            :foos-pt-crossover       {:foos '([1 2 3 88 77 66]
                                                              [99 4 5 6])}
     ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     {:foos   '([1 2 3 4 5 6]
                [99 88 77 66])
-     :scalar '(3/2 -11.7)}
+     :scalar '(3/2 -11.7)}
                            :foos-pt-crossover       {:foos '([1 99 88 77 66]
                                                              [2 3 4 5 6])}
     ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     {:foos   '([1 2 3 4 5 6]
                [])
-     :scalar '(3/2 -11.7)}
+     :scalar '(3/2 -11.7)}
                            :foos-pt-crossover       {:foos '([1]
                                                              [2 3 4 5 6])}
     ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     {:foos   '([]
                [99 88 77 66])
-     :scalar '(3/2 -11.7)}
+     :scalar '(3/2 -11.7)}
                            :foos-pt-crossover       {:foos '([99 88 77 66]
                                                              [])}
     ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -857,10 +921,10 @@

     ?new-stacks             ?instruction         ?expected

-    {:foos   '([1 2 3 4 5 6])}
+    {:foos   '([1 2 3 4 5 6])}
                              :foos-items       {:exec '( (1 2 3 4 5 6) )}
     ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-    {:foos   '([])}
+    {:foos   '([])}
                              :foos-items       {:exec '(  )} ;; because `(seq '())` = nil
     ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     )
@@ -876,28 +940,28 @@

     {:foos   '()
      :foo    '(0)
-     :scalar '(3 6)}
+     :scalar '(3 6)}
                              :foos-fillvector       {:foos '( [0 0 0 0 0 0] )
                                                      :foo  '()
                                                      :scalar '()}
     ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     {:foos   '()
      :foo    '(0)
-     :scalar '(0 603)}
+     :scalar '(0 603)}
                              :foos-fillvector       {:foos '( [0 0 0] )
                                                      :foo  '()
                                                      :scalar '()}
     ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     {:foos   '()
      :foo    '(0)
-     :scalar '(1 603)}
+     :scalar '(1 603)}
                              :foos-fillvector       {:foos '( [0 0 0] )
                                                      :foo  '()
                                                      :scalar '()}
     ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     {:foos   '()
      :foo    '(0)
-     :scalar '(-7/2 111)}
+     :scalar '(-7/2 111)}
                              :foos-fillvector       {:foos (list
                                                       (into [] (take 111 (repeat 0))))
                                                      :foo  '()
@@ -905,7 +969,7 @@
     ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     {:foos   '()
      :foo    '(0)
-     :scalar '(-11/2 111)}
+     :scalar '(-11/2 111)}
                              :foos-fillvector       {:foos '([0])
                                                      :foo  '()
                                                      :scalar '()}
@@ -924,7 +988,7 @@

     {:foos   '()
      :foo    (list (take 10000 (range)))
-     :scalar '(2 999)}
+     :scalar '(2 999)}
                              :foos-fillvector       {:foos '()
                                                      :foo  '()
                                                      :error '("foos-fillvector produced oversized result")}
@@ -942,21 +1006,21 @@

     {:foos   '()
      :foo    '(1/2 3.4)
-     :scalar '(3 5)}
+     :scalar '(3 5)}
                              :foos-cyclevector       {:foos '( [1/2 3.4 1/2 3.4 1/2] )
                                                      :foo  '(1/2 3.4)
                                                      :scalar '()}
     ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     {:foos   '()
      :foo    '(1/2 3.4)
-     :scalar '(0 603)}
+     :scalar '(0 603)}
                              :foos-cyclevector       {:foos '( [1/2 3.4 1/2] )
                                                      :foo  '(1/2 3.4)
                                                      :scalar '()}
     ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     {:foos   '()
      :foo    '(1/2 3.4)
-     :scalar '(-7/2 111)}
+     :scalar '(-7/2 111)}
                              :foos-cyclevector       {:foos (list
                                                        (into [] (take 111 (cycle [1/2 3.4]))))
                                                      :foo  '(1/2 3.4)
@@ -964,11 +1028,10 @@
     ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     {:foos   '()
      :foo    '()
-     :scalar '(-1.2246467991473532E-16 1356)}
+     :scalar '(-1.2246467991473532E-16 1356)}
                              :foos-cyclevector       {:foos '([])
                                                      :foo  '()
                                                      :scalar '()}
     ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

     )
-


More comment fixes.

More comment fixes.

--- src/main/clj/lemur/bootstrap_actions.clj
+++ src/main/clj/lemur/bootstrap_actions.clj
@@ -56,7 +56,7 @@
   (mk-config "hbase"))

 (defn configure-hadoop
-  "Add support for inline 'configure-hadoop' keys in defcluster."
+  "Add support for inline :hadoop-config.* keys in defcluster."
   [eopts]
   (when-let [hc (seq (mk-hadoop-config eopts))]
     ["Hadoop Config"
@@ -64,7 +64,7 @@
      hc]))

 (defn configure-hbase
-  "Add support for inline 'configure-hbase' keys in defcluster."
+  "Add support for inline :hbase-config.* keys in defcluster."
   [eopts]
   (when-let [hc (seq (mk-hbase-config eopts))]
     ["HBase Config"


Minor refactoring.

Minor refactoring.

--- modules/messaging/src/main/clojure/immutant/pipeline.clj
+++ modules/messaging/src/main/clojure/immutant/pipeline.clj
@@ -114,13 +114,15 @@

 (defn- wrap-result-passing
   [f pl next-step]
-  (fn [m]
-    ;; FIXME: a blind force instead of a deref w/o a timeout may be a bad idea here
-    (let [m (force (f m))]
-      (when-not (= halt m)
-        (msg/publish pl m
-                     :correlation-id (.getJMSCorrelationID msg/*raw-message*)
-                     :properties {"step" next-step})))))
+  (if next-step
+    (fn [m]
+      ;; FIXME: a blind force instead of a deref w/o a timeout may be a bad idea here
+      (let [m (force (f m))]
+        (when-not (= halt m)
+          (msg/publish pl m
+                       :correlation-id (.getJMSCorrelationID msg/*raw-message*)
+                       :properties {"step" next-step}))))
+    f))

 (defn- wrap-no-tx
   [f]
@@ -133,18 +135,22 @@
   (let [{:keys [step next-step]} (meta f)
         opts (-> opts
                  (merge (meta f))
-                 (assoc :selector
-                   (str "step = '" step "'")))
-        f (-> f
-              (wrap-error-handler opts)
-              (wrap-step-bindings step next-step)
-              wrap-no-tx)]
-    (mapply msg/listen
-            pl
-            (if next-step
-              (wrap-result-passing f pl next-step)
-              f)
-            opts)))
+                 (assoc :selector (str "step = '" step "'")))]
+    (mapply msg/listen pl
+      (-> f
+          (wrap-error-handler opts)
+          (wrap-step-bindings step next-step)
+          wrap-no-tx
+          (wrap-result-passing pl next-step))
+      opts)))
+
+(defn- create-delay
+  [pl id keep-result?]
+  (if keep-result?
+    (msg/delayed-receive pl
+                         :selector (str "JMSCorrelationID='" id "' AND result = true"))
+    (delay (throw (IllegalStateException.
+                   "Attempt to derefence a pipeline that doesn't provide a result")))))

 (defn- pipeline-fn
   "Creates a fn that places it's first arg onto the pipeline,
@@ -158,12 +164,7 @@
          (throw (IllegalArgumentException.
                  (format "'%s' is not one of the available steps: %s" step (vec step-names)))))
        (msg/publish pl m :properties {"step" step} :correlation-id id)
-       (if keep-result?
-         (msg/delayed-receive pl
-                              :selector (str "JMSCorrelationID='" id
-                                             "' AND result = true"))
-         (delay (throw (IllegalStateException.
-                        "Attempt to derefence a pipeline that doesn't provide a result"))))))
+       (create-delay pl id keep-result?)))
    assoc
    :pipeline pl))


Makes kibit happy.

Makes kibit happy.

--- src/oc/storage/resources/maintenance.clj
+++ src/oc/storage/resources/maintenance.clj
@@ -41,7 +41,7 @@
     (for [entry entries]
       (do
         (timbre/info "    Checking entry" (:uuid entry) "shared:" (count (:shared entry)))
-        (when (> (count (:shared entry)) 0)
+        (when (pos? (count (:shared entry)))
           (shared-dedup-and-limit-for-entry! conn entry limit dry-run))))))

 (defn shared-limit!
@@ -64,8 +64,8 @@
       (timbre/info "---- Dry-run not updating ----"))
     (let [orgs (org-res/list-orgs conn)
           partition-length (min batch-length (count orgs))
-          batches (into [] (partition-all partition-length orgs))
-          batch (into [] (get batches batch-offset))]
+          batches (vec (partition-all partition-length orgs))
+          batch (vec (get batches batch-offset))]
       (timbre/info "Total orgs:" (count orgs) " batch: " batch-offset "/" (count batches))
       (timbre/info " Current batch size:" (count batch))
       (for [org batch]