more logging

more logging

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -123,8 +123,11 @@
   "return a lazy sequence of bolts for all possible complements
   that can be added to the end of the _path_ within _bolt_."
   [bolt path model depth max-depth]
-  (log/debug (str "comp-path-to-complements:" depth "/" max-depth ":" ((:morph-ps model) bolt) "@" path))
-  (let [spec (get-in bolt path)
+  (let [log-message-prefix
+        (str "comp-path-to-complements:" depth "/" max-depth ":"
+             ((:morph-ps model) bolt) "@" path)
+        debug (log/trace (str log-message-prefix ": start."))
+        spec (get-in bolt path)
         lexemes (shufflefn (get-lexemes model spec))
         bolts-at (if (< depth max-depth)
                    (lazy-seq (generate-all (get-in bolt path) model


Add changelog. Add more info to passive skillgem pages

--- src/poehub/pages.clj
+++ src/poehub/pages.clj
@@ -78,7 +78,8 @@
         [:li [:a {:href "/affixes/"} "Affixes"]]
         [:li [:a {:href "/quests/"} "Quests"]]
         [:li [:a {:href "/archive/"} "Archive"]]
-        [:li [:a {:href "/data/"} "Data"]]]]]]
+        [:li [:a {:href "/data/"} "Data"]]
+        [:li [:a {:href "/changelog/"} "Changelog"]]]]]]
     [:div.container
      [:div.main
       page]]
@@ -153,7 +154,7 @@
        %1)
     (.split s " "))))

-(defn get-skill-small-table [item meta id]
+(defn get-skill-small-table [item active-skill id skill-gem]
   (let [all-tags (get (find-first data/skill-gems "BaseItemTypesKey" id) "GemTagsKeys")
         display-tags (filter #(> (.length (get %1 "Tag")) 0)
                              (map #(find-first data/gem-tags "Row" %1)
@@ -175,15 +176,15 @@
      [:tr
       [:td.column-key "Required level"]
       [:td (get item "DropLevel")]]
-     [:tr
-      [:td.column-key "Cast time"]
-      [:td (if meta
-             (str (format "%.2f" (/ (get meta "CastTime") 1000.0)) " secs")
-             "N/A")]]
+     (if active-skill
+       [:tr
+        [:td.column-key "Cast time"]
+        [:td (str (format "%.2f" (/ (get active-skill "CastTime") 1000.0)) " secs")]])
      [:tr
       [:td.column-key "Per 1% quality"]
-      [:td (if meta
-             (let [row (first (filter #(> (count (get %1 "Quality_StatsKeys")) 0) (find-all data/granted-effects-per-level "ActiveSkillsKey" (get meta "Row"))))]
+      ;; FIXME: Copy-paste code, this whole page really needs refactoring/cleaning
+      [:td (if active-skill
+             (let [row (first (filter #(> (count (get %1 "Quality_StatsKeys")) 0) (find-all data/granted-effects-per-level "ActiveSkillsKey" (get active-skill "Row"))))]
                (if row
                  (let [stats-keys (get row "Quality_StatsKeys")
                        stats-values (get row "Quality_Values")]
@@ -193,23 +194,32 @@
                            (str (format "%.2f " (/ (nth stats-values i) 1000.0)) (get (find-first data/stats "Row" (nth stats-keys i)) "Id")))
                          (range (count stats-keys)))))
                  "N/A"))
-             "Unknown")]]]))
-
+             (let [row (first (filter #(> (count (get %1 "Quality_StatsKeys")) 0) (find-all data/granted-effects-per-level "GrantedEffectsKey" (get skill-gem "GrantedEffectsKey"))))]
+               (if row
+                 (let [stats-keys (get row "Quality_StatsKeys")
+                       stats-values (get row "Quality_Values")]
+                   (string/join
+                    ", "
+                    (map (fn [i]
+                           (str (format "%.2f " (/ (nth stats-values i) 1000.0)) (get (find-first data/stats "Row" (nth stats-keys i)) "Id")))
+                         (range (count stats-keys))))))))]]]))
+
+(find-first data/skill-gems "BaseItemTypesKey" 1531)
 (defn skillgem-page [id]
   (fn [ctx]
     (let [item (find-first data/base-item-types "Row" id)
-          meta (find-first data/active-skills "DisplayedName" (get item "Name"))]
+          skill-gem (find-first data/skill-gems "BaseItemTypesKey" id)
+          active-skill (find-first data/active-skills "DisplayedName" (get item "Name"))]
       (layout-page
        ctx
        (get item "Name")
        [:div
         [:h1 (get item "Name")]
-        (if meta
-          [:div
-           [:div.skill-small-table
-            (get-skill-small-table item meta id)
-             [:img {:style "padding-top: 10px; width: 100%" :src (get meta "WebsiteImage")}]]
-           [:p (get meta "Description")]])
+        [:div
+         [:div.skill-small-table
+          (get-skill-small-table item active-skill id skill-gem)
+          [:img {:style "padding-top: 10px; width: 100%" :src (get active-skill "WebsiteImage")}]]
+         [:p (get active-skill "Description")]]
         [:h3 {:style "clear: both"} "Quest rewards"]
         [:table
          [:tr
@@ -260,10 +270,35 @@
                        (assoc (find-first data/quests "Row" (get quest-state "QuestKey"))
                               "CharactersKey" (first (get quest-vendor-reward "CharactersKeys")))))))
                (find-all-contains data/quest-vendor-rewards "BaseItemTypesKeys" id)))]
-        (if meta
+        ;; FIXME: Copy-paste code, this whole page really needs refactoring/cleaning
+        (if active-skill
           (let [ge (filter
                     #(> (count (get %1 "Quality_StatsKeys")) 0)
-                    (find-all data/granted-effects-per-level "ActiveSkillsKey" (get meta "Row")))
+                    (find-all data/granted-effects-per-level "ActiveSkillsKey" (get active-skill "Row")))
+                stat-keys (if (> (count ge) 0)
+                            (get (first ge) "StatsKeys")
+                            '())]
+            [:div
+             [:h3 "Effects"]
+             [:table
+              [:tr
+               [:th "level"]
+               [:th "mana cost"]
+               (map
+                (fn [stat-key]
+                  [:th (get (find-first data/stats "Row" stat-key) "Id")])
+                stat-keys)]
+              (map
+               (fn [effect]
+                 [:tr
+                  [:td (get effect "Level")]
+                  [:td (get effect "ManaCost")]
+                  (for [i (range (count stat-keys))]
+                    [:td (get effect (str "Stat" (+ i 1) "Value"))])])
+               ge)]])
+          (let [ge (filter
+                    #(> (count (get %1 "Quality_StatsKeys")) 0)
+                    (find-all data/granted-effects-per-level "GrantedEffectsKey" (get skill-gem "GrantedEffectsKey")))
                 stat-keys (if (> (count ge) 0)
                             (get (first ge) "StatsKeys")
                             '())]
@@ -526,10 +561,23 @@
            (map #(vector (str "/gemtags/" (get %1 "Row") "/") (get-gemtag %1))
                 (filter #(> (.length (get %1 "Tag")) 0) data/gem-tags)))))

+(defn changelog  [ctx]
+  (layout-page
+   ctx
+   nil
+   [:div
+    [:h3 "2015-12-10"]
+    [:ul
+     [:li "Added some info to passive skill pages"]]
+    [:h3 "2015-12-09"]
+    [:ul
+     [:li "Added mana cost to skill page"]]]))
+
 (defn get-pages []
   (merge {"/index.html" index
           "/404.html" not-found
-          "/50x.html" server-error}
+          "/50x.html" server-error
+          "/changelog/" changelog}
          (get-gemtags)
          (get-affixes)
          (get-item-classes)


removed duplicate sentence in /data/table


map-keys

map-keys

--- src/tupelo/impl.cljc
+++ src/tupelo/impl.cljc
@@ -90,6 +90,7 @@
 ; #todo    and, or    (& :strict :safe reassignments)
 ; #todo    = not=   (others?)  (& :strict :safe reassignments)
 ; #todo    (drop-last N coll)  (take-last N coll)
+; #todo    subvec
 ; #todo    others???

 (s/defn kw->sym :- s/Symbol
@@ -1054,6 +1055,16 @@
     tst-map))

 ; #todo: perhaps add map-keys & map-vals
+(s/defn map-keys :- tsk/Map
+  [map-in :- tsk/Map
+   tx-fn  ; #todo function
+   & tx-args
+  ]
+  (let [tuple-seq-orig (vec map-in)
+        tuple-seq-out  (for [[tuple-key tuple-val] tuple-seq-orig]
+                         [ (apply tx-fn tuple-key tx-args) tuple-val])
+        map-out        (into {} tuple-seq-out) ]
+    map-out))

 ; #todo: rename labeled-map
 (defmacro vals->context ; #todo -> README


remove login prints

remove login prints

--- src/cljs/swarmpit/component/page_login.cljs
+++ src/cljs/swarmpit/component/page_login.cljs
@@ -84,7 +84,6 @@

 (defn- form-password [value error local-state]
   (let [show-password? (:showPassword @local-state)]
-    (print error)
     (comp/text-field
       {:id              "password"
        :key             "Swarmpit-login-password-input"
@@ -140,7 +139,6 @@
         username (:username @local-state)
         password (:password @local-state)
         message (:message @local-state)]
-    (print initialized)
     [:div.Swarmpit-page
      [:div.Swarmpit-login-layout
       (comp/mui


Context info implemented.

Context info implemented.

--- src/clojure/uncomplicate/clojurecl/core.clj
+++ src/clojure/uncomplicate/clojurecl/core.clj
@@ -6,7 +6,8 @@
             [uncomplicate.fluokitten jvm
              [core :refer [fmap]]])
   (:import [org.jocl CL cl_platform_id cl_context_properties cl_device_id
-            cl_context cl_command_queue cl_mem cl_program cl_kernel Sizeof Pointer]
+            cl_context cl_command_queue cl_mem cl_program cl_kernel
+            Sizeof Pointer CreateContextFunction]
            [java.nio ByteBuffer ByteOrder]))

 (def device-types
@@ -28,14 +29,15 @@
    :extensions CL/CL_PLATFORM_EXTENSIONS
    :icd-suffix-khr CL/CL_PLATFORM_ICD_SUFFIX_KHR})

+;;TODO update for JOCL 2.0
 (def context-prop-table
   {:platform CL/CL_CONTEXT_PLATFORM
    :interop-user-sync CL/CL_CONTEXT_INTEROP_USER_SYNC
-   :gl CL/CL_GL_CONTEXT_KHR
-   :cgl CL/CL_CGL_SHAREGROUP_KHR
-   :egl CL/CL_EGL_DISPLAY_KHR
-   :glx CL/CL_GLX_DISPLAY_KHR
-   :wgl CL/CL_WGL_HDC_KHR})
+   :gl-context-khr CL/CL_GL_CONTEXT_KHR
+   :cgl-sharegroup-khr CL/CL_CGL_SHAREGROUP_KHR
+   :egl-display-khr CL/CL_EGL_DISPLAY_KHR
+   :glx-display-khr CL/CL_GLX_DISPLAY_KHR
+   :wgl-hdc-khr CL/CL_WGL_HDC_KHR})

 (def error-codes
   {CL/CL_INVALID_VALUE "CL_INVALID_VALUE"
@@ -45,7 +47,9 @@
    CL/CL_INVALID_DEVICE_TYPE "CL_INVALID_DEVICE_TYPE"
    CL/CL_DEVICE_NOT_FOUND "CL_DEVICE_NOT_FOUND"
    CL/CL_OUT_OF_RESOURCES "CL_OUT_OF_RESOURCES"
-   CL/CL_INVALID_DEVICE "CL_INVALID_DEVICE"})
+   CL/CL_INVALID_DEVICE "CL_INVALID_DEVICE"
+   CL/CL_DEVICE_NOT_AVAILABLE "CL_DEVICE_NOT_AVAILABLE"
+   CL/CL_INVALID_CONTEXT "CL_INVALID_CONTEXT"})

 ;; ============= Utils ============================================
 (defmacro ^:private info-string* [method clobject info]
@@ -61,6 +65,22 @@
            (String. res# 0 (dec size#))
            (throw (error err#))))
        (throw (error err#)))))
+
+(let [native-pointer (fn [^"[Lorg.jocl.NativePointerObject;" np]
+                       (Pointer/to np))]
+  (defmacro ^:private info-native* [method clobject info type size]
+    `(let [size# (long-array 1)
+           err# (~method ~clobject ~info 0 nil size#)]
+       (if (= 0 err#)
+         (let [size# (aget size# 0)
+               res# (make-array ~type (/ size# ~size))
+               err# (~method ~clobject ~info
+                             size# (~native-pointer res#)
+                             nil)]
+           (if (= 0 err#)
+             res#
+             (throw (error err#))))
+         (throw (error err#))))))

 (defmacro info-mask* [method clobject info table]
   `(let [mask# (info-long* ~method ~clobject ~info)]
@@ -92,7 +112,7 @@
                          (byte-seq res#))
           (throw (error err#)))))
     ([method clobject info]
-     `(first (info-long* ~method ~clobject ~info 1)))))
+     `(first (info-size* ~method ~clobject ~info 1)))))

 (defmacro ^:private info-long*
   ([method clobject info num]
@@ -107,7 +127,6 @@
   ([method clobject info]
    `(aget (longs (info-long* ~method ~clobject ~info 1)) 0)))

-
 (defmacro ^:private info-int*
   ([method clobject info num]
    `(let [res# (int-array ~num)
@@ -220,10 +239,15 @@
               CL/CL_DEVICE_DOUBLE_FP_CONFIG
               exec-capabilities-table))

-(defn info-extensions [device]
-  (str/split (info-string* CL/clGetDeviceInfo device
-                           CL/CL_DEVICE_EXTENSIONS)
-             #" "))
+(defn info-extensions [clid]
+  (str/split
+   (cond
+    (instance? cl_device_id clid)
+    (info-string* CL/clGetDeviceInfo clid CL/CL_DEVICE_EXTENSIONS)
+    (instance? cl_platform_id clid)
+    (info-string* CL/clGetPlatformInfo clid CL/CL_PLATFORM_EXTENSIONS)
+    :default nil)
+   #" "))

 (defn info-global-mem-cache-size [device]
   (info-long* CL/clGetDeviceInfo device CL/CL_DEVICE_GLOBAL_MEM_CACHE_SIZE))
@@ -641,6 +665,7 @@
           (cl_context_properties.)
           props))

+;;TODO Callback function
 (defn ^:private context* [^objects devices ^objects properties]
   (let [err (int-array 1)
         res (CL/clCreateContext properties
@@ -654,4 +679,33 @@
   ([devices properties]
    (context* (into-array devices) (context-properties properties)))
   ([devices]
-   (context* devices nil)))
+   (context* (into-array devices) nil)))
+
+(defn info-num-devices [context]
+  (info-int* CL/clGetContextInfo context CL/CL_CONTEXT_NUM_DEVICES))
+
+(defn info-num-reference-count [context]
+  (info-int* CL/clGetContextInfo context CL/CL_CONTEXT_REFERENCE_COUNT))
+
+(defn info-devices [context]
+  (vec (info-native* CL/clGetContextInfo context CL/CL_CONTEXT_DEVICES
+                    cl_device_id Sizeof/cl_device_id)))
+
+;; TODO see how to retreive variable length objects.
+(defn info-context-properties [context]
+  nil)
+
+(def context-info-table
+  {:num-devices info-num-devices
+   :num-reference-count info-num-reference-count
+   :devices info-devices
+   :context-properties info-context-properties})
+
+(defn context-info
+  ([context info]
+   (if-let [info-f (context-info-table info)]
+     (info-f context)
+     nil))
+  ([context]
+   (fmap #(% context) context-info-table)))
+;; ================================================================


4clojure: another 12 exercises: recursion + hofs + bindings

--- src/clojure_learning/4clojure-exercises.clj
+++ src/clojure_learning/4clojure-exercises.clj
@@ -144,3 +144,86 @@
 ;; -> Returns the result of applying concat to the result of applying map
 ;; to f and one-level-nested-colls.  Thus function f should return a collection.
 (mapcat #(if (coll? %) % (list %)) [[1 2 3] [4 5 6]]); (1 2 3 4 5 6)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Write a function which takes a string and returns a new string containing only the capital letters.
+#(apply str (re-seq #"[A-Z]+" %))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Write a function which removes consecutive duplicates from a sequence.
+;; "Leeeeeerrroyyy" -> "Leroy"
+(defn discard-dups
+  [subject]
+    (loop [[head & tail] (vec subject)
+            uniques []]
+      (if (nil? head)
+        uniques
+        (if-not (= head (peek uniques))
+          (recur tail (conj uniques head))
+          (recur tail uniques)))))
+
+(require 'clojure.string)
+(clojure.string/split "Leeeeeerrroyyy" #"")
+(vec "Leeeeeerrroyyy")
+(seq [[1 3] [1 3]])
+(discard-dups "Leeeeerooooyyyy")
+
+(= (last [\A \B]) \B)
+(peek [1 2 3])
+
+;; another one of my versions, might be using the HOF [reduce]:
+(reduce (fn [f s] (if (= s (peek f)) f (conj f s))) [] (vec "Leeeeerrrrooooy"))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Write a function which packs consecutive duplicates into sub-lists.
+;; [:a :a :b :b :c]) -> '((:a :a) (:b :b) (:c))
+(partition-by identity [:a :a :b :b :c])
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Write a function which duplicates each element of a sequence.
+;; [1 2 3]) -> [1 1 2 2 3 3]
+(reduce (fn [f n] (conj (conj f n) n)) [] [1 2 3])
+
+;; others solution
+(mapcat #(vector % %) [1 2 3])
+; (1 1 2 2 3 3)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Write a function which replicates each element of a sequence a variable number of times
+;; [1 2 3] 2) -> '(1 1 2 2 3 3)
+(#(mapcat (fn [each] (repeat %2 each)) %) [1 2 3] 2)
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Write a function which creates a list of all integers in a given range
+;; 1 4 -> '(1 2 3)
+(
+   (fn range-within [lower higher] (take (- higher lower) (iterate #(inc %) lower)))
+-2 2); (-2 -1 0 1)
+;; take handles negative numbers as well now
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Write a function which takes a variable number of parameters and returns
+;; the maximum value
+(reduce min [1 8 3 4])
+(defn find-max
+  [head & tail]
+  (loop [biggest head
+         remained tail]
+    (cond
+       (empty? remained)
+          biggest
+       :else
+         (if (< biggest (first remained))
+            (recur (first remained) (rest remained))
+            (recur biggest (rest remained))))))
+
+;; soon a master of recursivity :)
+(find-max 1 8 3 4); 8
+
+;; alin's solution is to use [sort] + [last] instead of the recursivity solution
+((fn [& args]
+  (last (sort args))) 1 8 3 4) ; -> 8


Movies for current date are now retrieved.

--- src/vertigo/core.clj
+++ src/vertigo/core.clj
@@ -31,7 +31,8 @@
             [compojure.core]
             [ring.adapter.jetty]
             [clojure.string :only (split)]
-            [clj-time.format]))
+            [clj-time.format]
+            [clj-time.core :only (now)]))

 (defrecord Show [title
                  theatre
@@ -39,7 +40,10 @@
                  genres
                  image])

-(def url "http://finnkino.fi/xml/Schedule/?area=1002&dt=16.12.2010")
+(def finnish-date-format (formatter "dd.MM.yyyy"))
+
+(def url (str "http://finnkino.fi/xml/Schedule/?area=1002&dt="
+              (unparse finnish-date-format (now))))

 (def movies (zip/xml-zip (xml/parse url)))


test the test-server is using the correct index for testing

--- test/wb_es/core_test.clj
+++ test/wb_es/core_test.clj
@@ -88,7 +88,15 @@
 (deftest server-start-test
   (testing "server started"
     (let [response (http/get test-server-uri)]
-      (is (= 200 (:status response))))))
+      (is (= 200 (:status response)))))
+  (testing "server using correct index"
+    (let [db (d/db datomic-conn)]
+      (do
+        (index-datomic-entity (d/entity db [:gene/id "WBGene00000904"]))
+        (let [hit (-> (search "WBGene00000904")
+                      (get-in [:hits :hits 0]))]
+          (is (= "WBGene00000904" (get-in hit [:_source :wbid])))
+          (is (= index-name (:_index hit))))))))

 (deftest anatomy-type-test
   (testing "anatomy type using \"tl\" prefixed terms"


Minor: reformat

Minor: reformat

--- test/yadic/core_test.clj
+++ test/yadic/core_test.clj
@@ -271,20 +271,20 @@

 (fact "Destructors still get called on decorated activators"
   (let [close-called-with (atom [])
-        activators            (-> (->activators
-                                    :a (reify
-                                         Activator
-                                         (activate [this container]
-                                           "hello")
-                                         (close [this instance]
-                                           (swap! close-called-with conj instance))))
-                                  (decorate :a (reify
-                                                 Activator
-                                                 (activate [this {:keys [a]}]
-                                                   (str a " world"))
-                                                 (close [this instance]
-                                                   (swap! close-called-with conj instance)))))
-        container             (->container activators)]
+        activators        (-> (->activators
+                                :a (reify
+                                     Activator
+                                     (activate [this container]
+                                       "hello")
+                                     (close [this instance]
+                                       (swap! close-called-with conj instance))))
+                              (decorate :a (reify
+                                             Activator
+                                             (activate [this {:keys [a]}]
+                                               (str a " world"))
+                                             (close [this instance]
+                                               (swap! close-called-with conj instance)))))
+        container         (->container activators)]

     (:a container) => "hello world"


s/handle-/read-/

s/handle-/read-/


Added GNIP rule export for domains.

Added GNIP rule export for domains.

--- src/member_domains/server.clj
+++ src/member_domains/server.clj
@@ -47,6 +47,19 @@
                      domain-names (set (map #(->> % etld/get-main-domain (drop 1)) full-domains))]
                  (map #(clojure.string/join "." %) domain-names))))

+; GNIP text format rules for member domains.
+(defresource data-domain-names-gnip-txt
+  []
+  :available-media-types ["text/plain"]
+  :handle-ok (fn [ctx]
+               (let [full-domains (db/unique-member-domains)
+                     domain-name-parts (set (map #(->> % etld/get-main-domain (drop 1)) full-domains))
+                     domain-names (map #(clojure.string/join "." %) domain-name-parts)
+                     gnip-rules (map #(format "url_contains:\"%s\"" %) domain-names)
+                     result (clojure.string/join "\n" gnip-rules)]
+                result)))
+
+
 (defresource member-prefixes
   []
   :available-media-types ["application/json"]
@@ -78,6 +91,7 @@
   (GET "/" [] (home))
   (GET "/data/full-domain-names.json" [] (data-full-domain-names))
   (GET "/data/domain-names.json" [] (data-domain-names))
+  (GET "/data/domain-names.gnip.txt" [] (data-domain-names-gnip-txt))
   (GET "/data/member-prefixes.json" [] (member-prefixes))
   (GET "/guess-doi" [] (guess-doi))
   (route/resources "/"))


Do not return drafts when assebling board entries.

--- src/oc/storage/api/boards.clj
+++ src/oc/storage/api/boards.clj
@@ -54,7 +54,7 @@
         user-id (-> ctx :user :user-id)
         order (if (= direction :before) :desc :asc)
         entries (entry-res/paginated-entries-by-board conn (:uuid board) order start direction
-                 config/default-activity-limit sort-type {:must-see must-see :status :all})]
+                 config/default-activity-limit sort-type {:must-see must-see :status :published})]
     ;; Give each activity its board name
     (merge board {:next-count (count entries)
                   :direction direction


curiositymsl.com changed its name

curiositymsl.com changed its name

--- src/mars_ogler/scrape.clj
+++ src/mars_ogler/scrape.clj
@@ -80,7 +80,7 @@
 (defn fetch-page
   [i]
   (let [page (:body (http/post
-                      "http://curiositymsl.com/localphp/loadmore.php"
+                      "http://curiosityrover.com/localphp/loadmore.php"
                       {:headers {"Cookie" "PHPSESSID=3v55ibi7c0l25836c2chenpmo1"
                                  "User-Agent" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.13 (KHTML, like Gecko) Chrome/24.0.1290.1 Safari/537.13"
                                  "X-Requested-With" "XMLHttpRequest"}


Return real board info in stories embedded in drafts board response.

--- src/oc/storage/api/boards.clj
+++ src/oc/storage/api/boards.clj
@@ -1,6 +1,7 @@
 (ns oc.storage.api.boards
   "Liberator API for board resources."
   (:require [if-let.core :refer (if-let*)]
+            [defun.core :refer (defun-)]
             [taoensso.timbre :as timbre]
             [compojure.core :as compojure :refer (defroutes ANY OPTIONS POST)]
             [liberator.core :refer (defresource by-method)]
@@ -38,8 +39,9 @@

 (defn- assemble-board
   "Assemble the entry, topic, author, and viewer data needed for a board response."
-  [conn org-slug slug board ctx]
-  (let [entries (entry-res/list-entries-by-board conn (:uuid board)) ; all entries for the board
+  [conn org-slug board ctx]
+  (let [slug (:slug board)
+        entries (entry-res/list-entries-by-board conn (:uuid board)) ; all entries for the board
         board-topics (->> entries
                         (map #(select-keys % [:topic-slug :topic-name]))
                         (filter :topic-slug) ; remove entries w/ no topic
@@ -63,19 +65,36 @@
       (assoc :entries entry-reps)
       (assoc :topics (sort-by :name topics)))))

-(defn- assemble-storyboard
+(defun- assemble-storyboard
   "Assemble the story, author, and viewer data needed for a board response."
-  [conn org slug board ctx]
+
+  ;; Draft storyboard
+  ([conn org :guard map? board :guard #(= (:slug %) (:slug board-res/default-drafts-storyboard)) ctx]
   (let [org-slug (:slug org)
-        stories (if (= slug (:slug board-res/default-drafts-storyboard))
-                  ;; drafts by the user
-                  (story-res/list-stories-by-org-author conn (:uuid org) (-> ctx :user :user-id) :draft)
-                  ;; all stories for the board
-                  (story-res/list-stories-by-board conn (:uuid board)))
+        slug (:slug board)
+        stories (story-res/list-stories-by-org-author conn (:uuid org) (-> ctx :user :user-id) :draft)
+        storyboard-uuids (distinct (map :board-uuid stories))
+        storyboards (filter map? (map #(board-res/get-board conn %) storyboard-uuids))
+        storyboard-map (zipmap (map :uuid storyboards) storyboards)
+        story-reps (map #(story-rep/render-story-for-collection org (or (storyboard-map (:board-uuid %)) board) %
+                            (comments %) (reactions %)
+                            (:access-level ctx) (-> ctx :user :user-id))
+                      stories)]
+    (assemble-storyboard org-slug board story-reps ctx)))
+
+  ;; Regular storyboard
+  ([conn org :guard map? board :guard map? ctx]
+  (let [org-slug (:slug org)
+        stories (story-res/list-stories-by-board conn (:uuid board))
         story-reps (map #(story-rep/render-story-for-collection org board %
                             (comments %) (reactions %)
                             (:access-level ctx) (-> ctx :user :user-id))
-                      stories)
+                      stories)]
+    (assemble-storyboard org-slug board story-reps ctx)))
+
+  ;; Recursion to finish up both kinds of storyboards
+  ([org-slug :guard string? board :guard map? story-reps :guard seq? ctx]
+  (let [slug (:slug board)
         authors (:authors board)
         author-reps (map #(board-rep/render-author-for-collection org-slug slug % (:access-level ctx)) authors)
         viewers (:viewers board)
@@ -83,7 +102,7 @@
     (-> board
       (assoc :authors author-reps)
       (assoc :viewers viewer-reps)
-      (assoc :stories story-reps))))
+      (assoc :stories story-reps)))))

 ;; ----- Validations -----

@@ -211,9 +230,9 @@
                                org (or (:existing-org ctx) (org-res/get-org conn org-slug))
                                org-uuid (:uuid org)
                                board (or (:existing-board ctx)
-                                         (when (= slug (:slug board-res/default-drafts-storyboard))
-                                            (board-res/drafts-storyboard org-uuid (:user ctx)))
-                                         (board-res/get-board conn org-uuid slug))]
+                                         (if (= slug (:slug board-res/default-drafts-storyboard))
+                                            (board-res/drafts-storyboard org-uuid (:user ctx))
+                                            (board-res/get-board conn org-uuid slug)))]
                         {:existing-org org :existing-board board}
                         false))

@@ -224,8 +243,8 @@
   ;; Responses
   :handle-ok (fn [ctx] (let [board (or (:updated-board ctx) (:existing-board ctx))
                              full-board (if (= (keyword (:type board)) :story)
-                                          (assemble-storyboard conn (:existing-org ctx) slug board ctx)
-                                          (assemble-board conn org-slug slug board ctx))]
+                                          (assemble-storyboard conn (:existing-org ctx) board ctx)
+                                          (assemble-board conn org-slug board ctx))]
                           (board-rep/render-board org-slug full-board (:access-level ctx))))
   :handle-unprocessable-entity (fn [ctx]
     (api-common/unprocessable-entity-response (schema/check common-res/Board (:board-update ctx)))))


WIP: update async logging.

WIP: update async logging.

--- src/oc/storage/components.clj
+++ src/oc/storage/components.clj
@@ -6,31 +6,41 @@
             [oc.storage.async.notification :as notification]
             [oc.storage.config :as c]))

-(defrecord HttpKit [options handler server]
+(defrecord HttpKit [options handler]
   component/Lifecycle
+
   (start [component]
+    (timbre/info "[http] starting...")
     (let [handler (get-in component [:handler :handler] handler)
           server  (httpkit/run-server handler options)]
-      (assoc component :server server)))
-  (stop [component]
-    (if-not server
-      component
+      (timbre/info "[http] started")
+      (assoc component :http-kit server)))
+
+  (stop [{:keys [http-kit] :as component}]
+    (if http-kit
       (do
-        (server)
-        (dissoc component :server)))))
+        (timbre/info "[http] stopping...")
+        (http-kit)
+        (timbre/info "[http] stopped")
+        (dissoc component :http-kit))
+      component)))

 (defrecord RethinkPool [size regenerate-interval pool]
   component/Lifecycle
+
   (start [component]
     (timbre/info "[rehinkdb-pool] starting")
     (let [pool (pool/fixed-pool (partial pool/init-conn c/db-options) pool/close-conn
                                 {:size size :regenerate-interval regenerate-interval})]
       (timbre/info "[rehinkdb-pool] started")
       (assoc component :pool pool)))
+
   (stop [component]
     (if pool
       (do
+        (timbre/info "[rethinkdb-pool] stopping...")
         (pool/shutdown-pool! pool)
+        (timbre/info "[rethinkdb-pool] stopped")
         (dissoc component :pool))
       component)))

@@ -40,6 +50,7 @@
   (start [component]
     (timbre/info "[async-consumers] starting")
     (notification/start) ; core.async channel consumer for notification events
+    (timbre/info "[async-consumers] started")
     (assoc component :async-consumers true))

   (stop [{:keys [async-consumers] :as component}]
@@ -47,15 +58,17 @@
       (do
         (timbre/info "[async-consumers] stopping")
         (notification/stop) ; core.async channel consumer for notification events
+        (timbre/info "[async-consumers] stopped")
         (dissoc component :async-consumers))
     component)))

 (defrecord Handler [handler-fn]
   component/Lifecycle
   (start [component]
-    (timbre/info "[handler] starting")
+    (timbre/info "[handler] started")
     (assoc component :handler (handler-fn component)))
   (stop [component]
+    (timbre/info "[handler] stopped")
     (dissoc component :handler)))

 (defn storage-system [{:keys [host port handler-fn] :as opts}]


Change cond to an if

Change cond to an if

--- src/midje/unprocessed.clj
+++ src/midje/unprocessed.clj
@@ -55,11 +55,9 @@

   (defn- check-result [actual call]
-    (cond (= (:desired-check call) :check-match)
-          (check-result-positive actual call)
-
-          :else
-          (check-result-negated actual call)))
+    (if (= (:desired-check call) :check-match)
+      (check-result-positive actual call)
+      (check-result-negated actual call)))

 )
 (defn expect*


use coerced transaction

use coerced transaction

--- src/clj/clj_money/models/transactions.clj
+++ src/clj/clj_money/models/transactions.clj
@@ -557,14 +557,14 @@
     (let [validated (validate s ::new-transaction transaction)]
       (if (validation/has-error? validated)
         validated
-        (let [created (->> transaction
+        (let [created (->> validated
                            before-save
                            (create-transaction s)
                            (link-lots s))
               account-ids (->> (:items validated)
                               (map :account-id)
                               (into #{}))]
-          (doall (->> (:items transaction)
+          (doall (->> (:items validated)
                       (map #(assoc %
                                    :transaction-id (:id created)
                                    :transaction-date (:transaction-date validated)


Fixing granule spatial function.

Fixing granule spatial function.

--- src/cmr/system_int_test/data2/granule.clj
+++ src/cmr/system_int_test/data2/granule.clj
@@ -63,7 +63,7 @@

 (defn spatial
   [& geometries]
-  (g/->SpatialCoverage geometries))
+  (g/map->SpatialCoverage {:geometries geometries}))

 (defn granule
   "Creates a granule"


Format docstrings

Format docstrings

--- src/overtone/sc/cgens/mix.clj
+++ src/overtone/sc/cgens/mix.clj
@@ -6,21 +6,25 @@
 (defcgen sum
   "sum a list of input channels into a single channel."
   [ins {:default [] :doc "list of input channels to sum"}]
-  "Sum the list of input channels by summing them together. Be careful about summing too many channels together as the resulting signal will be progressively amplified."
+  "Sum the list of input channels by summing them together. Be careful
+   about summing too many channels together as the resulting signal will
+   be progressively amplified."
   (:ar (apply + ins)))

 (defcgen mix
   "Mix a list of input channels into a single channel."
   [ins {:default [] :doc "list of input channels to mix"}]
-  "Mix the list of input channels by summing them together and dividing by the number of input signals. See sum if you wish to just add the signals together."
+  "Mix the list of input channels by summing them together and dividing
+   by the number of input signals. See sum if you wish to just add the
+   signals together."
   (:ar (* (apply + ins) (/ 1 (count ins)))))

 (defcgen splay
   "Spread input channels across a stereo field"
-  [in-array {:default [] :doc "List of input channels to splay."}
-   spread {:default 1 :doc "The audio spread width."}
-   level {:default 1 :doc "Ampilitude level of each individual spread channel (only used if level-comp is false)."}
-   center {:default 0 :doc "Center point of audio spread."}
+  [in-array    {:default [] :doc "List of input channels to splay."}
+   spread      {:default 1 :doc "The audio spread width."}
+   level       {:default 1 :doc "Ampilitude level of each individual spread channel (only used if level-comp is false)."}
+   center      {:default 0 :doc "Center point of audio spread."}
    level-comp? {:default true :doc "Boolean switch to determine whether automatic level compensation should be used."}]
   "Spread input channels across a stereo field, with control over the center point
   and spread width of the target field, and level compensation that lowers the volume


Focus management #38

Focus management #38

--- src/flatgui/samples/forms/fdemowindow.clj
+++ src/flatgui/samples/forms/fdemowindow.clj
@@ -23,14 +23,18 @@
   [(fgp/call-look component/component-look)
    (awt/setColor (:prime-2 theme))
    (awt/drawRect 0 0 w- h-)
-   (awt/drawString (str (:mode focus-state) "/" (:focused-child focus-state)) (awt/px) 0.25)])
+   (awt/drawString (str (:mode focus-state) "/"
+                        (:focused-child focus-state)
+                        (if (= (:mode focus-state) :throws-focus) (str "/" (:throw-mode focus-state)))) (awt/px) 0.25)])

 (fg/defevolverfn tf-model-evolver :model
   (if (= (fg/get-reason) [:this])
     {:text (let [focus-state (get-property [:this] :focus-state)]
-             (str (:mode focus-state) "/" (:focused-child focus-state)))
+             (str (:mode focus-state) "/"
+                  (:focused-child focus-state)
+                  (if (= (:mode focus-state) :throws-focus) (str "/" (:throw-mode focus-state)))))
      :caret-pos 0
      :selection-mark 0}
     (textfield/text-model-evolver component)))
@@ -61,26 +65,51 @@
        :evolvers {:model tf-model-evolver}})))

+(def title-1 "Focus Example - 1 - ")
+
+(fg/defevolverfn window-text-evolver :text
+  (let [focus-state (get-property [:this] :focus-state)]
+    (str title-1 (:mode focus-state) "/" (:focused-child focus-state))))
+
+(def title-2 "Focus Example - 2 - ")
+
+(fg/defevolverfn window-text-evolver-2 :text
+  (let [focus-state (get-property [:this] :focus-state)]
+    (str title-2 (:mode focus-state) "/" (:focused-child focus-state))))
+
+(def title-3 "Focus Example - 3 - ")
+
+(fg/defevolverfn window-text-evolver-3 :text
+  (let [focus-state (get-property [:this] :focus-state)]
+    (str title-3 (:mode focus-state) "/" (:focused-child focus-state))))
+
+(def title-4 "Focus Example - 4 - ")
+
+(fg/defevolverfn window-text-evolver-4 :text
+  (let [focus-state (get-property [:this] :focus-state)]
+    (str title-4 (:mode focus-state) "/" (:focused-child focus-state))))
+
+(def title-5 "Focus Example - 5 - ")
+
+(fg/defevolverfn window-text-evolver-5 :text
+  (let [focus-state (get-property [:this] :focus-state)]
+    (str title-5 (:mode focus-state) "/" (:focused-child focus-state))))
+
+(def title-6 "Focus Example - 6 - ")
+
+(fg/defevolverfn window-text-evolver-6 :text
+  (let [focus-state (get-property [:this] :focus-state)]
+    (str title-6 (:mode focus-state) "/" (:focused-child focus-state))))
+
+
 ;; Window 1
-
-(def title-1 "Focus Example - 1 - ")
-
-(fg/defevolverfn window-text-evolver :text
-  (let [focus-state (get-property [:this] :focus-state)]
-    (str title-1 (:mode focus-state) "/" (:focused-child focus-state))))
-
-(def title-2 "Focus Example - 2 - ")
-
-(fg/defevolverfn window-text-evolver-2 :text
-  (let [focus-state (get-property [:this] :focus-state)]
-    (str title-2 (:mode focus-state) "/" (:focused-child focus-state))))

 (def focus-window
   (fg/defcomponent
     window/window
     :hello
     {:clip-size (m/defpoint 7 7)
-     :position-matrix (m/translation 1 1)
+     :position-matrix (m/translation 1 0.25)
      :text title-1
      :evolvers {:text window-text-evolver}}

@@ -144,7 +173,7 @@
     window/window
     :hello2
     {:clip-size (m/defpoint 7 7)
-     :position-matrix (m/translation 9 1)
+     :position-matrix (m/translation 9 0.25)
      :text title-2
      :evolvers {:text window-text-evolver-2}}

@@ -203,6 +232,107 @@
                   :position-matrix (m/translation 0.125 0.5)
                   :evolvers {:model tf-model-evolver}})))))))

+(def focus-window-3
+  (fg/defcomponent
+    window/window
+    :hello3
+    {:clip-size (m/defpoint 7 3.25)
+     :position-matrix (m/translation 1 7.5)
+     :text title-3
+     :evolvers {:text window-text-evolver-3}}
+
+    (fg/defcomponent panel/panel :panel
+      {:clip-size (m/defpoint 6.75 2.5)
+       :position-matrix (m/translation 0.125 0.5)
+       :look container-look}
+
+      (fg/defcomponent panel/panel :panel1
+        {:clip-size (m/defpoint 3.0 0.875)
+         :position-matrix (m/translation 0.25 0.75)
+         :look container-look}
+
+        (fg/defcomponent textfield/textfield :entry1-1
+                         {:clip-size (m/defpoint 1.0 0.375)
+                          :position-matrix (m/translation 0.125 0.375)
+                          :evolvers {:model tf-model-evolver}}))
+
+      (fg/defcomponent textfield/textfield :entry1
+        {:clip-size (m/defpoint 1.5 0.375)
+         :position-matrix (m/translation 0.125 1.75)
+         :evolvers {:model tf-model-evolver}})
+
+      (fg/defcomponent textfield/textfield :entry2
+        {:clip-size (m/defpoint 1.5 0.375)
+         :position-matrix (m/translation 1.75 1.75)
+         :evolvers {:model tf-model-evolver}})
+
+      (fg/defcomponent textfield/textfield :entry3
+        {:clip-size (m/defpoint 1.5 0.375)
+         :position-matrix (m/translation 3.375 1.75)
+         :evolvers {:model tf-model-evolver}})
+     )
+    ))
+
+(def focus-window-4
+  (fg/defcomponent
+    window/window
+    :hello4
+    {:clip-size (m/defpoint 7.0 2.0)
+     :position-matrix (m/translation 9 7.5)
+     :text title-4
+     :evolvers {:text window-text-evolver-4}}
+
+    (fg/defcomponent panel/panel :panel
+                     {:clip-size (m/defpoint 3.0 1.375)
+                      :position-matrix (m/translation 0.125 0.5)
+                      :look container-look}
+
+                     (fg/defcomponent panel/panel :panel1
+                                      {:clip-size (m/defpoint 2.75 0.875)
+                                       :position-matrix (m/translation 0.125 0.375)
+                                       :look container-look}
+
+                                      (fg/defcomponent textfield/textfield :entry1-1
+                                                       {:clip-size (m/defpoint 2.5 0.375)
+                                                        :position-matrix (m/translation 0.125 0.375)
+                                                        :evolvers {:model tf-model-evolver}}))
+                     )
+    ))
+
+(def focus-window-5
+  (fg/defcomponent
+    window/window
+    :hello5
+    {:clip-size (m/defpoint 4.25 1.625)
+     :position-matrix (m/translation 9 9.75)
+     :text title-5
+     :evolvers {:text window-text-evolver-5}}
+
+    (fg/defcomponent panel/panel :panel1
+                     {:clip-size (m/defpoint 2.75 0.875)
+                      :position-matrix (m/translation 0.125 0.5)
+                      :look container-look}
+
+                     (fg/defcomponent textfield/textfield :entry1-1
+                                      {:clip-size (m/defpoint 2.5 0.375)
+                                       :position-matrix (m/translation 0.125 0.375)
+                                       :evolvers {:model tf-model-evolver}}))
+    ))
+
+(def focus-window-6
+  (fg/defcomponent
+    window/window
+    :hello6
+    {:clip-size (m/defpoint 4.25 1.625)
+     :position-matrix (m/translation 13.5 9.75)
+     :text title-6
+     :evolvers {:text window-text-evolver-6}}
+
+    (fg/defcomponent textfield/textfield :entry1-1
+                     {:clip-size (m/defpoint 2.5 0.375)
+                      :position-matrix (m/translation 0.125 0.5)
+                      :evolvers {:model tf-model-evolver}})    ))
+

 (def root-panel
   (fg/defcomponent
@@ -217,4 +347,8 @@
                    :focused-child nil}}

     focus-window
-    focus-window-2))+    focus-window-2
+    focus-window-3
+    focus-window-4
+    focus-window-5
+    focus-window-6))


Run gofmt on the generated code

Run gofmt on the generated code

Signed-off-by: Gregory Haskins <640d9fe47775e6723f0355b7315e38f7d98d3539@gmail.com>

--- src/obcc/build/golang.clj
+++ src/obcc/build/golang.clj
@@ -84,6 +84,10 @@
     (with-open [output (io/writer shimpath :truncate true)]
       (.write output shim))

+    ;; clean up the generated code with gofmt
+    (let [gofmt (conch/programs gofmt)]
+      (gofmt "-w" (.getAbsolutePath shimpath)))
+
     ;; generate protobuf output
     (protoc protofile)


fix previous commit

fix previous commit

--- src/main/clojure/clojure/tools/reader.clj
+++ src/main/clojure/clojure/tools/reader.clj
@@ -514,11 +514,10 @@
     ret))

 (defn- syntax-quote-coll [type coll]
-  (let [res (list 'clojure.core/rest
-                  (list 'clojure.core/sequence
-                        (list 'clojure.core/seq
-                              (cons 'clojure.core/concat
-                                    (expand-list coll)))))]
+  (let [res (list 'clojure.core/sequence
+                  (list 'clojure.core/seq
+                        (cons 'clojure.core/concat
+                              (expand-list coll))))]
     (if type
       (list 'clojure.core/apply type res)
       res)))


use ns-name rather than .name

use ns-name rather than .name

--- src/main/clojure/clojure/tools/reader.clj
+++ src/main/clojure/clojure/tools/reader.clj
@@ -626,11 +626,11 @@
   (if (pos? (.indexOf (name s) "."))
     s ;; If there is a period, it is interop
     (if-let [ns-str (namespace s)]
-      (let [^Namespace ns (resolve-ns (symbol ns-str))]
+      (let [ns (resolve-ns (symbol ns-str))]
         (if (or (nil? ns)
                 (= (name (ns-name ns)) ns-str)) ;; not an alias
           s
-          (symbol (name (.name ns)) (name s))))
+          (symbol (name (ns-name ns)) (name s))))
       (if-let [o ((ns-map *ns*) s)]
         (if (class? o)
           (symbol (.getName ^Class o))


Include the dcos-journalctl-file in user-data so that beats can pick it up

--- src/terraboot/cluster.clj
+++ src/terraboot/cluster.clj
@@ -79,6 +79,7 @@
 (def beats-user-data
   {:coreos {:units [{:name "filebeat.service" :command "start" :content (snippet "systemd/filebeat.service")}
                     {:name "metricbeat.service" :command "start" :content (snippet "systemd/metricbeat.service")}
+                    {:name "dcos-journalctl-file.service" :command "start" :content (snippet "systemd/dcos-journalctl-file.service")}
                     {:name "copy-bins.service" :command "start" :content (snippet "systemd/copy-bins.service")}]}
    :write_files [{:path "/etc/beats/filebeat.yml"
                   :content (snippet "system-files/filebeat.yml")}


small change

small change

--- src/webapp/neo_stuff.cljs
+++ src/webapp/neo_stuff.cljs
@@ -40,13 +40,13 @@
 ( go (log (str (<!
   (neo4j-nodes
    "create (u:User { email : { email2 }, title : 'Developer' }) return u"
-   {:email2 "zubairq@gmail.com"} "u")))))
+   {:email2 "dfsfdsf@gmail.com"} "u")))))

 ( go (log (str (<!
   (neo4j-nodes
    "create (u:User { email : { email2 }, title : 'Developer' }) return u"
-   {:email2 "zubairq@gmail.com"} "u")))))
+   {:email2 "dffds@gmail.com"} "u")))))


Simplify framebuffer size code

Simplify framebuffer size code

--- src/zaffre/glterminal.clj
+++ src/zaffre/glterminal.clj
@@ -641,9 +641,7 @@
                      fg-image-data
                      bg-image-data]} :data
              :keys [p-matrix-buffer mv-matrix-buffer]} gl
-            [framebuffer-width framebuffer-height] @framebuffer-size
-            [display-width display-height] (let [mode (GLFW/glfwGetVideoMode (GLFW/glfwGetPrimaryMonitor))]
-                                             [(.width mode) (.height mode)])]
+            [framebuffer-width framebuffer-height] @framebuffer-size]
         #_(log/info "drawing with" (mapv vec [glyph-textures fg-textures bg-textures glyph-image-data fg-image-data bg-image-data]))
         ;; Setup render to FBO
         (try
@@ -717,7 +715,7 @@
                 (log/info (vec line))))
             (try
               (log/info "y" (+ y-pos (- framebuffer-height (* rows character-height)) (- (/ framebuffer-height 2)))
-                y-pos framebuffer-height rows character-height)
+                "y-pos" y-pos "fb-h" framebuffer-height "rows" rows "ch-h" character-height)
               (GL20/glUniformMatrix4fv
                 u-MVMatrix
                 false
@@ -726,7 +724,7 @@
                    (+ y-pos (- framebuffer-height (* rows character-height)) (- (/ framebuffer-height 2)))
                    -1.0
                    0.0]
-                  [(* character-width columns) (* character-height rows) 1.0]
+                  [framebuffer-width framebuffer-height 1.0]
                   mv-matrix-buffer))
               (except-gl-errors (str "u-MVMatrix - glUniformMatrix4  " u-MVMatrix))
               ; Setup uniforms for glyph, fg, bg, textures


Use port from the environment variable PORT.

--- src/sumptus/web.clj
+++ src/sumptus/web.clj
@@ -10,5 +10,10 @@
      :headers {"Content-Type" "text/plain"}
      :body "pong"}))

+(defn start [port]
+  (ring/run-jetty #'routes {:port port
+                            :join? false}))
+
 (defn -main []
-  (ring/run-jetty #'routes {:port 5000 :join? false}))
+  (let [port (Integer. (or (System/getenv "PORT") "5000"))]
+    (start port)))


level description

level description

--- src-clj/acha/achievement_static.clj
+++ src-clj/acha/achievement_static.clj
@@ -255,10 +255,12 @@
         :description "Make 10+ commits with the same message"}
     :bad-motherfucker
        {:name "Bad motherfucker"
-        :description "Swear in a commit message"}
+        :description "Swear in a commit message"
+        :level-description "Number of swear words used"}
     :hello-linus
        {:name "Hello, Linus"
-        :description "10+ swear words in a commit message"}
+        :description "10+ swear words in a commit message"
+        :level-description "Number of swear words used"}
     :man-of-few-words
        {:name "A man of few words"
         :description "Commit message with 3 letters or less"}
@@ -279,7 +281,8 @@
         :description "Ask for an achievement in a commit message"}
     :borat
        {:name "Borat"
-        :description "Misspell a word in a commit message"}
+        :description "Misspell a word in a commit message"
+        :level-description "Maximum number of misspellings"}
     :hack
        {:name "Real Hacker"
         :description "Use word “hack” in a commit message"}


om/update! requires a function on the cursor, using update-in

--- src-cljs/kixi/hecuba/web/chart.cljs
+++ src-cljs/kixi/hecuba/web/chart.cljs
@@ -92,7 +92,7 @@
       om/IWillMount
       (will-mount [this]
         (.log js/console "[chart-item] I will mount")
-        (om/update! cursor [:data] (fn [data] (get mock-data (:selected cursor)))))
+        (om/update! cursor update-in [:data] (fn [data] (get mock-data (:selected cursor)))))
       om/IRender
       (render [this]
         (.log js/console "[chart-item] I render")


Force worker to take 5-10 secs to complete work

--- src/worker/core.clj
+++ src/worker/core.clj
@@ -19,11 +19,24 @@

 (def worker-id (generate-id))

+(defn to-json
+  "Converts raw message payload to json"
+  [payload]
+  (-> payload
+      (String. "utf-8")
+      (json/read-str :key-fn keyword)))
+
+(defn print-job-info
+  "Prints info"
+  [{:keys [input jobId serverId clientId]}]
+  (println "Job received" "input:" input "jobId:" jobId
+           "client:" clientId "server:" serverId))
+
 (defn simulate-computation
   "Simulates a long-running CPU-intensive computation.
   Reverses the input string after a forced delay"
   [input]
-  (Thread/sleep 5)
+  (Thread/sleep (* 1000 (rand-int 5 11)))
   (s/reverse input))

 (defn emit-event
@@ -42,19 +55,6 @@
     (lb/ack ch delivery-tag)
     (emit-event ch result)))

-(defn print-job-info
-  "Prints info"
-  [{:keys [input jobId serverId clientId]}]
-  (println "Job received" "input:" input "jobId:" jobId
-           "client:" clientId "server:" serverId))
-
-(defn to-json
-  "Converts raw message payload to json"
-  [payload]
-  (-> payload
-      (String. "utf-8")
-      (json/read-str :key-fn keyword)))
-
 (defn on-message
   "Handles incoming message"
   [ch {:keys [delivery-tag]} payload]


improve copy for custom name overlay

improve copy for custom name overlay

--- src-cljs/frontend/components/app.cljs
+++ src-cljs/frontend/components/app.cljs
@@ -230,10 +230,10 @@
                  [:a.overlay-close {:role "button"}
                   (common/icon :times)]
                  [:article {:on-click #(.stopPropagation %)}
-                  [:h2 "Communicate faster with a display name."]
+                  [:h2 "Let's change that name."]
                   [:p
-                   "Help your team recognize you in Precursor by using your name in chat. "
-                   "Sign up using your Google account and edit your display name."]
+                   "Help your team communicate faster with eachother by using custom names. "
+                   "Log in or sign up to change how your name appears in chat."]
                   [:div.info-buttons
                    [:a.info-okay {:href (auth/auth-url)
                                   :role "button"}


CMR-5093: Make test more readable.

CMR-5093: Make test more readable.

--- system-int-test/test/cmr/system_int_test/ingest/collection_umm_spec_validation_test.clj
+++ system-int-test/test/cmr/system_int_test/ingest/collection_umm_spec_validation_test.clj
@@ -88,7 +88,7 @@
 (defn assert-invalid-spatial
   ([coord-sys hsd field-path errors]
    (assert-invalid-spatial coord-sys hsd field-path errors nil))
-  ([coord-sys  hsd field-path errors options]
+  ([coord-sys hsd field-path errors options]
    (assert-invalid {:SpatialExtent (data-umm-c/spatial {:gsr coord-sys :hsd hsd})}
                    field-path
                    errors
@@ -99,6 +99,15 @@
    (assert-valid-spatial coord-sys hsd nil))
   ([coord-sys hsd options]
    (assert-valid {:SpatialExtent (data-umm-c/spatial {:gsr coord-sys :hsd hsd})} options)))
+
+(defn- spatial-with-enums
+  "Create a SpatialExtent with spatial enums. Helper for testing."
+  [{:keys [granule-spatial-representation coordinate-system]}]
+  {:SpatialExtent (data-umm-c/spatial {:gsr granule-spatial-representation
+                                       :hsd {:Geometry (umm-cmn/map->GeometryType
+                                                        {:CoordinateSystem coordinate-system
+                                                         :Points [(umm-cmn/map->PointType
+                                                                   {:Longitude 0 :Latitude 0})]})}})})

 (use-fixtures :each (ingest/reset-fixture {"provguid1" "PROV1" "provguid2" "PROV2"}))

@@ -220,27 +229,29 @@
   (testing "Spatial validation"
     (testing "Spatial enums"
       (testing "Invalid GranuleSpatialRepresentation enum"
-        (assert-invalid-spatial "INVALID_GRANULE_SPATIAL_REPRESENTATION"
-                                {}
-                                ["SpatialExtent"]
-                                ["Value [INVALID_GRANULE_SPATIAL_REPRESENTATION] not found in enum (possible values: [\"CARTESIAN\",\"GEODETIC\",\"NO_SPATIAL\",\"ORBIT\"])"]
-                                {:format :iso19115}))
+        (assert-invalid
+         (spatial-with-enums {:granule-spatial-representation "INVALID_GRANULE_SPATIAL_REPRESENTATION"})
+         ["SpatialExtent"]
+         ["Value [INVALID_GRANULE_SPATIAL_REPRESENTATION] not found in enum (possible values: [\"CARTESIAN\",\"GEODETIC\",\"NO_SPATIAL\",\"ORBIT\"])"]
+         {:format :iso19115}))
+
       (testing "Valid GranuleSpatialRepresentation enum"
-        (assert-valid-spatial "CARTESIAN"
-                              {}
-                              {:format :iso19115}))
+        (assert-valid
+         (spatial-with-enums {:granule-spatial-representation "CARTESIAN"})
+         {:format :iso19115}))
+
       (testing "Invalid CoordinateSystem enum"
-        (assert-invalid-spatial "CARTESIAN"
-                                {:Geometry (umm-cmn/map->GeometryType
-                                            {:CoordinateSystem "INVALID_COORDINATE_SYSTEM"})}
-                                ["SpatialExtent" "HorizontalSpatialDomain" "Geometry" "CoordinateSystem"]
-                                ["Value [INVALID_COORDINATE_SYSTEM] not found in enum (possible values: [\"CARTESIAN\",\"GEODETIC\"])"]
-                                {:format :iso19115}))
+        (assert-invalid
+         (spatial-with-enums {:coordinate-system "INVALID_COORDINATE_SYSTEM"})
+         ["SpatialExtent" "HorizontalSpatialDomain" "Geometry" "CoordinateSystem"]
+         ["Value [INVALID_COORDINATE_SYSTEM] not found in enum (possible values: [\"CARTESIAN\",\"GEODETIC\"])"]
+         {:format :iso19115}))
+
       (testing "Valid CoordinateSystem enum"
-        (assert-valid-spatial "CARTESIAN"
-                              {:Geometry (umm-cmn/map->GeometryType
-                                          {:CoordinateSystem "GEODETIC"})}
-                              {:format :iso19115})))
+        (assert-valid
+         (spatial-with-enums {:coordinate-system "GEODETIC"})
+         {:format :iso19115})))
+
     (testing "geodetic polygon"
       ;; Invalid points are caught in the schema validation
       (assert-invalid-spatial


remove user data from bulbs

remove user data from bulbs

--- src/bonews_rest/scraper/threads.clj
+++ src/bonews_rest/scraper/threads.clj
@@ -118,24 +118,45 @@
       :when (contains? (:bulbs reply) :users)]
     users)))))

+(defn get-data-by-ids
+  [subforum-id thread-id]
+  (let [url    (get-thread-url     subforum-id thread-id)
+        table  (get-replies-table  url)
+        rows   (utils/get-rows     table)]
+    {
+      :thread   (get-thread-data   rows thread-id)
+      :replies  (get-replies-data  rows)
+      :users    (get-users-data    rows)
+    }))
+
+(defn get-data-by-url
+  [url]
+  (let [table       (get-replies-table  url)
+        rows        (utils/get-rows     table)
+        thread-id   (get-thread-id      url)
+        replies     (get-replies-data   rows)]
+    {
+      :thread   (get-thread-data   rows thread-id)
+      :replies  replies
+      :users    (collate-users     rows replies)
+    }))
+
+(defn rm-users-from-bulb
+  [reply]
+  (update-in reply [:bulbs] dissoc :users))
+
+(defn clean-replies
+  [replies]
+  (utils/remove-nils (map rm-users-from-bulb replies)))
+
+(defn clean-data
+  [data]
+  (let [replies          (:replies data)
+        cleaned-replies  (clean-replies replies)]
+  (assoc data :replies cleaned-replies)))
+
 (defn get-data
   ([url]
-    (let [table       (get-replies-table  url)
-          rows        (utils/get-rows     table)
-          thread-id   (get-thread-id      url)
-          replies     (get-replies-data   rows)]
-
-      {
-        :thread   (get-thread-data   rows thread-id)
-        :replies  replies
-        :users    (collate-users     rows replies)
-      }))
+    (clean-data (get-data-by-url url)))
   ([subforum-id thread-id]
-    (let [url    (get-thread-url     subforum-id thread-id)
-          table  (get-replies-table  url)
-          rows   (utils/get-rows     table)]
-      {
-        :thread   (get-thread-data   rows thread-id)
-        :replies  (get-replies-data  rows)
-        :users    (get-users-data    rows)
-      })))+    (get-data-by-ids subforum-id thread-id)))


Add logic for handling incorrect 401s from Rawls

--- src/cljs/org/broadinstitute/firecloud_ui/utils.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/utils.cljs
@@ -40,6 +40,11 @@
   (js->clj (js/JSON.parse x)))

+(defn keywordize-keys [m]
+      (into {} (map (fn [[k v]]
+                        [(keyword k) (if (map? v) (keywordize-keys v) v)])
+                    m)))
+
 (defn local-storage-write
   ([k v] (local-storage-write k v false))
   ([k v stringify?]
@@ -68,6 +73,7 @@
  (fn [k r os ns]
    (local-storage-write ::use-live-data? ns true)))

+(def access-token (atom nil))

 (defn ajax [arg-map]
   (let [url (:url arg-map)
@@ -88,10 +94,34 @@
           call-on-done (fn []
                          (let [status-code (.-status xhr)
                                get-parsed-response #(parse-json-string (.-responseText xhr))]
-                           ; TODO: Fix this with a real log-out once the login bug is fixed and logout is implemented.
-                           (if (= status-code 401)
-                             (set! (-> js/window .-location) "/")
-                             (on-done {:xhr xhr
+                              (if (= status-code 401)
+                                (let [us-xhr (js/XMLHttpRequest.)]
+                                     (set! (.-withCredentials us-xhr) true)
+                                     (.addEventListener us-xhr "loadend"
+                                       (fn []
+                                           (let [us-status (.-status us-xhr)
+                                                 parsed-us-response (parse-json-string (.-responseText us-xhr))
+                                                 user-info (keywordize-keys parsed-us-response)]
+                                                (cond
+                                                  (and (= us-status 200) (not (:ldap (:enabled (:userInfo user-info)))))
+                                                  (on-done {:xhr us-xhr
+                                                            :status-code 403
+                                                            :success? false
+                                                            :status-text "Access Disabled"
+                                                            :get-parsed-response parsed-us-response})
+                                                  ;TODO: Fix this with a real log-out once the login bug is fixed and logout is implemented.
+                                                  (= us-status 401) (set! (-> js/window .-location) "/")
+                                                  :else (on-done {:xhr us-xhr
+                                                                  :status-code us-status
+                                                                  :success? false
+                                                                  :status-text (.-statusText us-xhr)
+                                                                  :get-parsed-response parsed-us-response})))))
+                                     (.open us-xhr "GET" "/service/register")
+                                     (.setRequestHeader us-xhr "Authorization" (str "Bearer " @access-token))
+                                     (.setRequestHeader us-xhr "Content-Type" "application/json" )
+                                     (.setRequestHeader us-xhr "Accept" "application/json" )
+                                     (.send us-xhr))
+                              (on-done {:us-xhr xhr
                                        :status-code status-code
                                        :success? (and (>= status-code 200)
                                                       (< status-code 300))
@@ -119,15 +149,12 @@
             (.send xhr)))))))

-(def access-token (atom nil))
-
-
 (defn set-access-token-cookie [token]
-  (.set goog.net.cookies "FCtoken" token 300))
+      (.set goog.net.cookies "FCtoken" token 300))

 (defn get-access-token-cookie []
-  (.get goog.net.cookies "FCtoken"))
+      (.get goog.net.cookies "FCtoken"))

 (defn ajax-orch [path arg-map & {:keys [service-prefix] :or {service-prefix "/service/api"}}]


Include lb-name in the build

Include lb-name in the build

--- src/circle/backend/build/config.clj
+++ src/circle/backend/build/config.clj
@@ -179,6 +179,7 @@
     (assert job-name)
     (build/build (merge
                   {:vcs_url (-> project :vcs_url)
+                   :lb-name (-> project :lb-name)
                    :notify_emails notify
                    :build_num build_num
                    :vcs_revision vcs_revision


src => href

src => href

--- src/cljs/browser_rotation/core.cljs
+++ src/cljs/browser_rotation/core.cljs
@@ -69,8 +69,8 @@

 (defn footer []
   [:ul
-   [:li "Build with " [:a {:src "https://reagent-project.github.io/"} "reagent"]]
-   [:li " by " [:a { :src "https://www.about.me/kitofr" } "kitofr"] " in 2015"]])
+   [:li "Build with " [:a {:href "https://reagent-project.github.io/"} "reagent"]]
+   [:li " by " [:a { :href "https://www.about.me/kitofr" } "kitofr"] " in 2015"]])

 (defn home-page []
   [:div


Now proper function is being called on received msg

previously we were calling partial on a function, which returns a
function, but that returned another function on being called which is
incorrect it should handle the event directly, not return a new
function.

--- src/cljs/websocket_client/core.cljs
+++ src/cljs/websocket_client/core.cljs
@@ -52,12 +52,11 @@

 (defn on-message [aws event]
   "Callback.  When WS receives a message."
-  (fn []
-    (let [recvd-msg (aget event "data")]
-      (go
-        (log "Got message from websocket: >> " recvd-msg " <<")
-        (log "Putting message on app receive channel.")
-        (>! (:app-recv-chan aws) recvd-msg)))))
+  (let [recvd-msg (aget event "data")]
+    (go
+      (log "Got message from websocket: >> " recvd-msg " <<")
+      (log "Putting message on app receive channel.")
+      (>! (:app-recv-chan aws) recvd-msg))))

 (defn dummy-on-msg [event]
   "Callback.  When WS receives a message."
@@ -69,8 +68,8 @@
   ;; (log "NWS: Using websocket url: >> " (:ws-url aws) " <<")
   (let [new-aws (assoc aws :websocket (js/WebSocket. (:ws-url aws)))]
     (aset (:websocket new-aws) "onopen" (on-open new-aws))
-    ;; (aset (:websocket new-aws) "onmessage" (partial on-message new-aws))
-    (aset (:websocket new-aws) "onmessage" dummy-on-msg)
+    (aset (:websocket new-aws) "onmessage" (partial on-message new-aws))
+    ;; (aset (:websocket new-aws) "onmessage" dummy-on-msg)
     ;; (log "NWS: Finished configuring and instantiating websocket.")
     new-aws))
 (defn monitor-send-msg-queue!


Added Jarl André Hübenthal (https://github.com/jarlah) as a contributor

--- src/clojure/alfresco/filefolder.clj
+++ src/clojure/alfresco/filefolder.clj
@@ -1,5 +1,6 @@
 ;
 ; Copyright (C) 2011,2012 Peter Monks
+;               2014      Jarl André Hübenthal - added filefolder writers
 ;
 ; Licensed under the Apache License, Version 2.0 (the "License");
 ; you may not use this file except in compliance with the License.


Use paredit's newline/tab behavior even when it is turned off

--- src/clojure/paredit_widget/core.clj
+++ src/clojure/paredit_widget/core.clj
@@ -50,7 +50,11 @@
    "Ô" "J" ;;join
    })

-(def keymap
+(def ^:const default-keymap
+  {[nil "\t"] :paredit-indent-line
+   [nil "\n"] :paredit-newline})
+
+(def ^:const advanced-keymap
   {[nil "("] :paredit-open-round
    [nil ")"] :paredit-close-round
    [nil "["] :paredit-open-square
@@ -58,7 +62,6 @@
    [nil "{"] :paredit-open-curly
    [nil "}"] :paredit-close-curly
    [nil "\b"] :paredit-backward-delete
-   [nil "\t"] :paredit-indent-line
    ["M" ")"] :paredit-close-round-and-newline
    [nil "\""] :paredit-doublequote
    [nil "DEL"] :paredit-forward-delete
@@ -70,14 +73,14 @@
    ["C" "9"] :paredit-backward-slurp-sexp
    ["C" "Close Bracket"] :paredit-forward-barf-sexp
    ["C" "Open Bracket"] :paredit-backward-barf-sexp
-   [nil "\n"] :paredit-newline
    ["M" "S"] :paredit-split-sexp
    ["M" "J"] :paredit-join-sexps
    ["M" "Right"] :paredit-expand-right
    ["M" "Left"] :paredit-expand-left})

-(defn exec-paredit [k w buffer]
-  (when-let [cmd (keymap k)]
+(defn exec-paredit [k w buffer enable?]
+  (when-let [cmd (or (default-keymap k)
+                     (and @enable? (advanced-keymap k)))]
     (when *debug* (println [cmd k]))
     (let [result (exec-command cmd w buffer)]
       (when *debug* (println [cmd result]))
@@ -102,46 +105,41 @@
          key-text
          (str key-char)))]))

-(defn key-event-handler [w buffer]
+(defn key-event-handler [w buffer enable?]
   (reify java.awt.event.KeyListener
     (keyReleased [this e] nil)
     (keyTyped [this e]
-      (when (get #{"(" ")" "[" "]" "{" "}" "\""}
-                 (str (.getKeyChar e)))
+      (when (and @enable?
+                 (get #{"(" ")" "[" "]" "{" "}" "\""}
+                      (str (.getKeyChar e))))
         (.consume e)))
     (keyPressed [this e]
       (when-not (.isConsumed e)
         (let [k (convert-key-event e)
-              p (exec-paredit k w buffer)]
+              p (exec-paredit k w buffer enable?)]
           (if p (.consume e) (format/exec-format k w)))))))

-(defn input-method-event-handler [w buffer]
+(defn input-method-event-handler [w buffer enable?]
   (reify java.awt.event.InputMethodListener
     (inputMethodTextChanged [this e]
       (let [k (convert-input-method-event e)
-            p (exec-paredit k w buffer)]
+            p (exec-paredit k w buffer enable?)]
         (when p (.consume e))))))

 (defn get-toggle-fn [w]
   (let [buffer (atom (paredit.parser/edit-buffer nil 0 -1 (s/value w)))
-        key-listener (key-event-handler w buffer)
-        input-listener (input-method-event-handler w buffer)]
-    (fn [enable?]
-      (if enable?
-        (doto w
-          (.addKeyListener key-listener)
-          (.addInputMethodListener input-listener))
-        (doto w
-          (.removeKeyListener key-listener)
-          (.removeInputMethodListener input-listener))))))
+        enable? (atom true)]
+    (doto w
+      (.addKeyListener (key-event-handler w buffer enable?))
+      (.addInputMethodListener (input-method-event-handler w buffer enable?)))
+    (fn [enable-paredit?]
+      (reset! enable? enable-paredit?))))

 (defn paredit-widget [x]
-  (let [w (if (string? x)
-            (javax.swing.JTextArea. x)
-            x)
-        toggle-fn (get-toggle-fn w)]
-    (toggle-fn true)
-    w))
+  (doto (if (string? x)
+          (javax.swing.JTextArea. x)
+          x)
+    get-toggle-fn))

 (defn test-paredit-widget []
   (s/native!)


Fixed namespace.

Fixed namespace.

--- src/cmr/common/parameter_parser.clj
+++ src/cmr/common/parameter_parser.clj
@@ -1,4 +1,4 @@
-(ns cmr.common.date-time-parser
+(ns cmr.common.parameter-parser
   "Contains helper functions to parse parameter strings."
   (:require [cmr.common.services.errors :as errors]
             [cmr.common.services.messages :as msg]))


Indicate support of boundary interface to pathom viz

--- src/com/wsscode/pathom/connect.cljc
+++ src/com/wsscode/pathom/connect.cljc
@@ -2118,7 +2118,9 @@

 (def resolver-weights-resolvers [resolver-weights-resolver resolver-weights-sorted-resolver])

-(def connect-resolvers [indexes-resolver resolver-weights-resolvers])
+(def connect-resolvers
+  [indexes-resolver resolver-weights-resolvers
+   (constantly-resolver :pathom.viz/support-boundary-interface? true)])

 ;; plugins


formatting

formatting

--- plugins/matross/tasks/command.clj
+++ plugins/matross/tasks/command.clj
@@ -21,6 +21,7 @@
                (presence-of :command))}

   [conn {:keys [shell command env]}]
+
   (let [key=val (fn [[key val]] (-> (name key) (str "=" val)))
         cmd (concat ["/usr/bin/env" "-i"] (map key=val env) [shell "-c" command])
         proc (run conn {:cmd cmd})]


Get rid of remove-debug-fn-invocations in the client

--- src/refactor_nrepl/client.clj
+++ src/refactor_nrepl/client.clj
@@ -158,37 +158,6 @@
                       :transport transport :ns ns :file file :name name
                       :dir dir :line line :column column))

-(defn remove-debug-invocations
-  "Removes debug function invocations. In reality it could remove any function
-  invocations.
-
-  Expected input:
-  - debug-fns see documenation on find (debug) function invocations for
-  expected format. defaults to \"println,pr,prn\"
-  - file to refactor, provide path as you would provide for slurp
-  - transport optional, however if you don't provide your own repl
-  transport the client will create and store its own. therefore it is
-  preferred that you create, store and manage your own transport by calling
-  the connect function in this namespace so the client does not get stateful"
-  [& {:keys [transport file debug-fns] :or {debug-fns "println,pr,prn"}}]
-  {:pre [file]}
-  (let [tr (or transport @transp (reset! transp (connect)))
-        ns-string (slurp file)
-        result (nrepl-message tr {:op :find-debug-fns
-                                  :ns-string ns-string
-                                  :debug-fns debug-fns})
-        invocations (-> result first :value)]
-    (when (seq invocations)
-      (->> ns-string
-           str/split-lines
-           (remove-invocations
-            (if (string? invocations)
-              (edn/read-string invocations) invocations))
-           (remove (partial = "$remove$"))
-           (str/join "\n")
-           (#(str % "\n"))
-           (spit file)))))
-
 (defn resolve-missing
   "Resolve a missing symbol to provide candidates for imports.


fix html/ul test

fix html/ul test


Add editing feature

Add editing feature

--- src/todomvc_reagent/core.cljs
+++ src/todomvc_reagent/core.cljs
@@ -1,5 +1,6 @@
 (ns todomvc-reagent.core
-    (:require [reagent.core :as r]))
+  (:require [reagent.core :as r]
+            [clojure.string :as s]))

 ;; -------------------------
 ;; Db
@@ -30,8 +31,11 @@
   (swap! todos update-in [id :done] not))
 (defn delete [id]
   (swap! todos dissoc id))
-(defn save [title]
-  (when (not-empty title) (add-todo title)))
+(defn save
+  ([title]
+   (when (not-empty title) (add-todo title)))
+  ([id title]
+   (swap! todos assoc-in [id :title] title)))
 (defn clear-completed []
   (reset! todos (->> (vals @todos)
                      (filter :done)
@@ -43,30 +47,40 @@
 ;; -------------------------
 ;; Views

-(defn todo-header [title placeholder]
-  (let [val (r/atom "")
-        stop #(reset! val "")]
-    (fn []
-      [:header.header
-       [:h1 title]
-       [:input.new-todo
-        {:value @val
-         :autoFocus true
-         :placeholder placeholder
-         :on-change #(reset! val (-> % .-target .-value))
-         :on-key-down #(case (.-which %)
-                         13 (do (save @val) (stop))
-                         27 (stop)
-                         nil)}]])))
+(defn todo-input [{:keys [title on-save on-stop]}]
+  (let [val (r/atom title)
+        stop #(do (reset! val "")
+                  (if on-stop (on-stop)))
+        save #(let [v (-> @val str s/trim)]
+                (if-not (empty? v) (on-save v))
+                (stop))]
+    (fn [{:keys [id class placeholder]}]
+      [:input
+       {:id id :class class
+        :value @val
+        :autoFocus true
+        :placeholder placeholder
+        :on-blur save
+        :on-change #(reset! val (-> % .-target .-value))
+        :on-key-down #(case (.-which %)
+                        13 (save)
+                        27 (stop)
+                        nil)}])))

 (defn todo-item []
-  (fn [{:keys [id title done]}]
-    [:li {:class (if done "completed" "")}
-     [:div.view
-      [:input.toggle {:type "checkbox" :checked done :on-change #(toggle id)}]
-      [:label title]
-      [:button.destroy {:on-click #(delete id)}]
-      [:input.edit {:value ""}]]]))
+  (let [editing (r/atom false)]
+    (fn [{:keys [id title done]}]
+      [:li {:class (str (when done "completed ") (when @editing "editing"))}
+       [:div.view
+        [:input.toggle {:type "checkbox" :checked done :on-change #(toggle id)}]
+        [:label
+         {:on-double-click #(reset! editing true)}
+         title]
+        [:button.destroy {:on-click #(delete id)}]]
+       (when @editing
+         [todo-input {:class "edit" :title title
+                      :on-save #(save id %)
+                      :on-stop #(reset! editing false)}])])))

 (defn todo-list [showing todos]
   [:ul.todo-list
@@ -100,12 +114,17 @@
            active-cnt (- (count items) completed-cnt)]
       [:div
        [:section.todoapp
-        [todo-header "reagent" "What needs to be done?"]
+        [:header.header
+         [:h1 "reagent"]
+         [todo-input {:class "new-todo" :placeholder "What needs to be done?"
+                      :on-save add-todo}]]

         (when (pos? (count items))
           [:div
            [:section.main
-            [:input.toggle-all {:type "checkbox" :checked (zero? active-cnt) :on-click #(complete-all (pos? active-cnt))}]
+            [:input.toggle-all {:type "checkbox"
+                                :checked (zero? active-cnt)
+                                :on-click #(complete-all (pos? active-cnt))}]
             [:label {:for "toggle-all"} "Mark all as complte"]

             [todo-list showing items]]


improved tests

improved tests


add properties to event

add properties to event

--- src-cljs/frontend/components/pieces/page_header.cljs
+++ src-cljs/frontend/components/pieces/page_header.cljs
@@ -257,8 +257,8 @@
                                    :size :small
                                    :href "mailto:beta+ui@circleci.com?Subject=Topbar%20UI%20Feedback"
                                    :on-click #((om/get-shared owner :track-event) {:event-type :feedback-clicked
-                                                                                :properties (:component "topbar"
-                                                                                :treatment "top-bar-beta")})}
+                                                                                :properties {:component "topbar"
+                                                                                :treatment "top-bar-beta"}})}

                                   "Provide Feedback")])


Pass along all params for sine and triangle

--- src/afterglow/effects/oscillators.clj
+++ src/afterglow/effects/oscillators.clj
@@ -314,7 +314,7 @@
   (build-oscillator (fn [phase]
                       (if (< phase 0.5)
                         (* phase 2.0)
-                        (- 2.0 (* phase 2.0))))))
+                        (- 2.0 (* phase 2.0)))) :interval interval :interval-ratio interval-ratio :phase phase))

 (defn triangle-beat
   "In version 0.1.6 this was replaced with the [[triangle]] function,
@@ -500,7 +500,8 @@
   (let [two-pi (* 2.0 Math/PI)]
     (build-oscillator (fn [phase]
                         (let [adjusted-phase (- phase 0.25)]
-                          (+ 0.5 (Math/sin (* two-pi adjusted-phase))))))))
+                          (+ 0.5 (Math/sin (* two-pi adjusted-phase)))))
+                      :interval interval :interval-ratio interval-ratio :phase phase)))

 (defn sine-beat
   "In version 0.1.6 this was replaced with the [[sine]] function,


fix schema test

fix schema test

--- cimi-resources/test/com/sixsq/slipstream/ssclj/resources/spec/deployment_test.cljc
+++ cimi-resources/test/com/sixsq/slipstream/ssclj/resources/spec/deployment_test.cljc
@@ -42,7 +42,7 @@
                        :updated     timestamp
                        :acl         valid-acl

-                       :state       "RUNNING"
+                       :state       "STARTED"
                        :module       (merge {:href "my-module-uuid"} valid-module)})


WIP - Evolution du bot CSB en Clojure avec l'objectif d'améliorer le classement en ligue argent

--- clojure/codingame/competition/coders-strike-back/src/coders_strike_back/Player.clj
+++ clojure/codingame/competition/coders-strike-back/src/coders_strike_back/Player.clj
@@ -36,17 +36,18 @@
 ;;Compute a boost value between 0 and 100
 (defn compute-boost [next-checkpoint-distance next-checkpoint-angle]
   (cond
-    (>= (Math/abs next-checkpoint-angle) 90) "0"
-    (<= next-checkpoint-distance 800) (compute-boost-from-angle next-checkpoint-angle)
+    ;(>= (Math/abs next-checkpoint-angle) 90) "0"
+    (<= next-checkpoint-distance 1000) "40"
     (<= (Math/abs next-checkpoint-angle) 18) "100"
-    true (compute-boost-from-angle next-checkpoint-angle)))
+    true (compute-boost-from-angle (Math/abs next-checkpoint-angle))))

 (defn use-boost? [next-checkpoint-distance next-checkpoint-angle boost-used? game-loop-counter last-shield-usage last-boost-value]
   (and
     (not @boost-used?)
     (< (Math/abs next-checkpoint-angle) 18)
     (> next-checkpoint-distance 4000)
-    (and (not (= @last-boost-value "SHIELD")) (not (= @last-boost-value "BOOST")) (= @last-shield-usage 0) (= (Integer/parseInt @last-boost-value) 100))))
+    ;(and (not (= @last-boost-value "SHIELD")) (not (= @last-boost-value "BOOST")) (= @last-shield-usage 0) (= (Integer/parseInt @last-boost-value) 100))))
+    (and (not (= @last-boost-value "SHIELD")) (not (= @last-boost-value "BOOST")) (= @last-shield-usage 0))))

 (defn use-shield? [x y opponent-x opponent-y boost-used? game-loop-counter max-shield-usage last-shield-usage last-boost-value]
   (and (= @last-shield-usage 0) (> @game-loop-counter 10) (> @max-shield-usage 0) (< (distance opponent-x opponent-y x y) 700)))


Properly handle not-found response on retrieve image endpoint.

--- src/uxbox/frontend/images.clj
+++ src/uxbox/frontend/images.clj
@@ -97,10 +97,13 @@
   (let [params (us/conform ::retrieve-image params)
         params (assoc params :user user :type :retrieve-image)]
     (->> (sv/query params)
-         (p/map populate-thumbnails)
-         (p/map populate-urls)
-         (p/map rsp)
-         (p/map http/ok))))
+         (p/map (fn [result]
+                  (if result
+                    (-> (populate-thumbnails result)
+                        (populate-urls)
+                        (rsp)
+                        (http/ok))
+                    (http/not-found "")))))))

 ;; --- Create Image


Add data-type function.

Add data-type function.

--- src/vault/data/format/edn.clj
+++ src/vault/data/format/edn.clj
@@ -1,5 +1,5 @@
 (ns vault.data.format.edn
-  "Functions to read structured data formatted as EDN."
+  "Functions to handle structured data formatted as EDN."
   (:require
     [byte-streams :refer [bytes=]]
     [clojure.string :as str]
@@ -7,15 +7,12 @@
     [puget.printer :as puget])
   (:import
     (java.io
-      ByteArrayOutputStream
       FilterInputStream
       InputStream
       InputStreamReader
-      OutputStreamWriter
       PushbackReader
-      Reader
-      Writer)
-    java.nio.charset.Charset))
+      Reader)
+    (java.nio.charset Charset)))

 ;; CONSTANTS & CONFIGURATION
@@ -32,6 +29,16 @@
 (def ^:private ^:const blob-width
   "Width of text to use in serialized blobs."
   100)
+
+
+(defn data-type
+  "Determines the 'type' of the given value. By default, the result is just the
+  class of the value. For maps, the :vault.data/type key is used if present.
+  This is the main way types are represented in the data layer."
+  [v]
+  (or (when (map? v)
+        (:vault.data/type v))
+      (class v)))

@@ -56,7 +63,7 @@
         (.getBytes blob-charset))))

-(defn print-data
+(defn print-blob
   "Prints the given data value(s) as canonical EDN in a data blob."
   [value & more]
   (binding [puget/*strict-mode* true]
@@ -67,7 +74,7 @@
       (print-value v))))

-(defn print-data-str
+(defn print-blob-str
   "Prints a canonical EDN representation to a string and returns it. This
   function disables colorization."
   [value & more]
@@ -112,10 +119,10 @@
 (defn- read-secondary-values!
   "Reads the secondary EDN values from a data blob. Returns a seq of the values
   read."
-  [tag-readers reader]
+  [tag-readers
+   ^Reader reader]
   (let [opts {:eof ::end-stream
               :readers tag-readers}
-        reader (PushbackReader. reader)
         read-stream (partial edn/read opts reader)
         edn-stream (repeatedly read-stream)
         not-eos? (partial not= ::end-stream)]
@@ -139,4 +146,4 @@
           (assoc blob
             :data/primary-bytes byte-range
             :data/values (vec (cons pvalue svalues))
-            :data/type nil)))))) ; TODO
+            :data/type (data-type pvalue)))))))


[#11150] Chat icons are black in dark mode

Signed-off-by: andrey <b713972e59b8e606e23253c4a13e948139fea4d1@gmail.com>

--- src/status_im/ui/screens/home/views/inner_item.cljs
+++ src/status_im/ui/screens/home/views/inner_item.cljs
@@ -122,7 +122,7 @@
                     :accessibility-label :unviewed-messages-public}]
        [badge/message-counter unviewed-messages-count])]))

-(def icon-style
+(defn icon-style []
   {:color           colors/black
    :width           15
    :height          15
@@ -147,13 +147,13 @@
                                                :align-items    :center}
                                    (cond
                                      muted
-                                     [icons/icon :main-icons/tiny-muted (assoc icon-style :color colors/gray)]
+                                     [icons/icon :main-icons/tiny-muted (assoc (icon-style) :color colors/gray)]
                                      private-group?
-                                     [icons/icon :main-icons/tiny-group icon-style]
+                                     [icons/icon :main-icons/tiny-group (icon-style)]
                                      public-group?
-                                     [icons/icon :main-icons/tiny-public icon-style]
+                                     [icons/icon :main-icons/tiny-public (icon-style)]
                                      :else
-                                     [icons/icon :main-icons/tiny-new-contact icon-style])
+                                     [icons/icon :main-icons/tiny-new-contact (icon-style)])
                                    [quo/text {:weight              :medium
                                               :color               (when muted :secondary)
                                               :accessibility-label :chat-name-text


make thread close shortcuts on key-down

make thread close shortcuts on key-down

Doing this to match the autocomplete key handlers, so we can dismiss
autocomplete with an escape without also closing the thread

--- src/braid/client/ui/views/thread.cljs
+++ src/braid/client/ui/views/thread.cljs
@@ -167,7 +167,7 @@
             (set-focused! false)
             (dispatch! :mark-thread-read (thread :id)))

-          :on-key-up
+          :on-key-down
           (fn [e]
             (when (or (and
                         (= KeyCodes.X (.-keyCode e))


perm checking tracing

perm checking tracing

--- src/celestial/persistency/systems.clj
+++ src/celestial/persistency/systems.clj
@@ -67,6 +67,7 @@
   [f & args]
   (let [system (first (filter map? args))
         id (first (filter #(or (number? %) (and (string? %) (re-find #"\d+" %))) args))]
+    (trace "perm checking" f args)
     (if (is-system? system)
       (assert-access system)
       (assert-access (hookless-get id)))


Reverting everything to hfs-seqfile after unfortunate lzo-textline experiments

--- src/clj/forma/hadoop/jobs/scatter.clj
+++ src/clj/forma/hadoop/jobs/scatter.clj
@@ -208,25 +208,25 @@

               adjustseries
               ([:tmp-dirs adjusted-series-path]
-                 "Adjusts the lengths of all timeseries
-                               and filters out timeseries below the proper VCF value."
+                 "Adjusts lengths of all timeseries so they all cover the same
+                  time spans."
                  (with-job-conf {"mapred.min.split.size" 805306368}
-                   (?- (hfs-lzo-textline adjusted-series-path)
+                   (?- (hfs-seqfile adjusted-series-path)
                        (forma/dynamic-filter (hfs-seqfile ndvi-path)
                                              (hfs-seqfile reli-path)
                                              (hfs-seqfile rain-path)))))

               cleanseries ([:tmp-dirs clean-series]
                              "Runs the trends processing."
-                             (?- (hfs-lzo-textline clean-series)
+                             (?- (hfs-seqfile clean-series)
                                  (forma/dynamic-clean
-                                  est-map (hfs-lzo-textline adjusted-series-path))))
+                                  est-map (hfs-seqfile adjusted-series-path))))

               trends ([:tmp-dirs trends-path]
                         "Runs the trends processing."
                         (?- (hfs-seqfile trends-path)
                             (forma/analyze-trends
-                             est-map (hfs-lzo-textline clean-series))))
+                             est-map (hfs-seqfile clean-series))))

               mid-forma ([:tmp-dirs forma-mid-path
                           :deps [trends adjustfires]]
@@ -280,4 +280,3 @@
                       "s3n://formaresults/trapped"
                       827))

-


Remove version component from dynamic *user-agent*

Just another thing to try to keep in sync...

--- src/clj/http/async/client/request.clj
+++ src/clj/http/async/client/request.clj
@@ -35,7 +35,7 @@
                     ByteArrayInputStream
                     ByteArrayOutputStream)))

-(def ^:dynamic *user-agent* "http.async.client/0.5.2")
+(def ^:dynamic *user-agent* "http.async.client")

 (def convert-method
   ^{:doc   "Converts clj method (:get, :put, . ..) to Async Client specific."}


extract account-items-on-or-after

extract account-items-on-or-after

--- src/clj_money/models/transactions.clj
+++ src/clj_money/models/transactions.clj
@@ -497,6 +497,16 @@
    (with-storage [s storage-spec]
      (map after-item-read (select-transaction-items s criteria options)))))

+; TODO: This should be lazy
+(defn- account-items-on-or-after
+  "Returns the items in the specified account
+  that occur on or after the specified date"
+  [storage account-id date]
+  (search-items storage
+                {:account-id account-id
+                 :transaction-date [:between date (t/today)]} ; TODO: use last partition value
+                {:sort [:transaction-date :index]}))
+
 (defn- recalculate-account-items
   "Accepts a tuple containing an account-id and a base item,
   selects all subsequent items and recalculates the items until
@@ -504,14 +514,9 @@
   a balance is unchanged.
   Returns the new balance of the account of the balance changed,
   or nil if te balance didn't change."
-  [storage [account-id base-item]]
+  [storage [account-id {:keys [transaction-date]}]]
   (let [account (accounts/find-by-id storage account-id)
-        items (search-items storage
-                            {:account-id account-id
-                             :transaction-date [:between
-                                                (:transaction-date base-item)
-                                                (t/today)]} ; TODO: use last partition value
-                            {:sort [:transaction-date :index]})
+        items (account-items-on-or-after storage account-id transaction-date)
         result (reduce (fn [context item]
                          (let [new-index (+ 1 (:last-index context))
                                polarized-amount (accounts/polarize-amount item account)


Make overlay fade in and out

Make overlay fade in and out

--- src/cljs/comic_reader/ui/overlay.cljs
+++ src/cljs/comic_reader/ui/overlay.cljs
@@ -2,16 +2,25 @@
   (:require [comic-reader.ui.base :as base]
             [garden.core :as g]))

+(defn show [class-name]
+  (.fadeIn (js/jQuery class-name)))
+
+(defn hide [class-name]
+  (.fadeOut (js/jQuery class-name)))
+
 (defn overlay [{:keys [header footer display? toggle-overlay content]}]
   (let [overlay-styles {:position "absolute"
                         :background "black"
-                        :display (if display? "block" "none")
                         :width "100%"
                         :padding "0 2em"}
         overlay-class (base/unique-class :div "overlay")]
-    [:div {:style {:position "relative"}
-           :on-click #(toggle-overlay)}
-     [:style (g/css [overlay-class overlay-styles [:h2 {:color "white"}]])]
-     [overlay-class {:style {:top "0"}} header]
-     [overlay-class {:style {:bottom "0"}} footer]
-     content]))
+    (fn [{:keys [header footer display? toggle-overlay content]}]
+      (let [change-display-fn (if display? show hide)]
+        (change-display-fn (name overlay-class)))
+      [:div {:style {:position "relative"}
+             :on-click #(toggle-overlay)}
+       [:style (g/css [overlay-class overlay-styles
+                       [:h2 {:color "white"}]])]
+       [overlay-class {:style {:top "0"}} header]
+       [overlay-class {:style {:bottom "0"}} footer]
+       content])))


Ensure undo-step is created when changing background color

--- src/cljs/goya/components/palette.cljs
+++ src/cljs/goya/components/palette.cljs
@@ -64,7 +64,11 @@

 (defn set-bg-color [app]
-  (om/update! app [:main-app :background-color] (get-in @app [:tools :paint-color])))
+  (om/update! app [:main-app :background-color] (get-in @app [:tools :paint-color]))
+  (om/transact! app
+                [:main-app :undo-history]
+                #(conj % {:action "Set Background Color" :icon "pipette"})
+                :add-to-undo))

 (defn set-paint-color [app color]
   (om/update! app [:tools :paint-color] color))


Use subscriptions

Use subscriptions

--- src/flux_challenge_re_frame/core.cljs
+++ src/flux_challenge_re_frame/core.cljs
@@ -4,7 +4,8 @@
     [reagent.core :as reagent]
     [chord.client :refer [ws-ch]]
     [cljs.core.async :refer [<!]]
-    [cljs-http.client :as http])
+    [cljs-http.client :as http]
+    [re-frame.core :as re-frame :refer [subscribe register-sub]])
   (:require-macros
     [cljs.core.async.macros :refer [go]]
     [reagent.ratom :refer [reaction]]))
@@ -25,9 +26,6 @@
 (defonce app-state (reagent/atom {:planet {:id nil :name "unknown"}
                                   :jedis []
                                   :first-jedi-id 3616}))
-
-(def current-planet (reaction (:planet @app-state)))
-(def jedis (reaction (:jedis @app-state)))

 (defn pad
   "Pads the collection coll to the given length n with val"
@@ -79,9 +77,31 @@
         (save-jedi jedi)
         (recur (get-in jedi [:apprentice :id]))))))

+
+;;; subs
+
+(defn jedis [db, _]
+  (reaction (:jedis @db)))
+
+(register-sub :jedis jedis)
+
+(defn padded-jedis [db, [_, count]]
+  (->> @(jedis db _)
+       (pad count nil)
+       reaction))
+
+(register-sub :padded-jedis padded-jedis)
+
+(defn current-planet [db, _]
+  (reaction (:planet @db)))
+
+(register-sub :current-planet current-planet)
+
+;;; components
+
 (defn planet-monitor [planet]
   [:h1 {:class "css-planet-monitor"}
-   (str "Obi-Wan currently on " (:name @planet))])
+   (str "Obi-Wan currently on " (:name planet))])

 (defn jedi-slot [jedi]
   [:li {:class "css-slot"}
@@ -90,25 +110,27 @@
       [:h3 (:name jedi)]
       [:h6 (str "Homeworld: " (get-in jedi [:homeworld :name]))]])])

-(defn dark-jedi-list [current-planet jedis]
-  (let [padded-jedis (pad 5 nil @jedis)]
-    [:div {:class "css-root"}
-     [planet-monitor current-planet]
+(defn dark-jedi-list []
+  (let [current-planet (subscribe [:current-planet])
+        padded-jedis (subscribe [:padded-jedis 5])]
+    (fn []
+      [:div {:class "css-root"}
+       [planet-monitor @current-planet]

-     [:section {:class "css-scrollable-list"}
-      [:ul {:class "css-slots"}
-       (for [jedi padded-jedis]
-         (let [key (or
-                     (:name jedi)
-                     (gensym "jedi"))] ; use random name if no name present
-         ^{:key key} [jedi-slot jedi]))]
+       [:section {:class "css-scrollable-list"}
+        [:ul {:class "css-slots"}
+         (for [jedi @padded-jedis]
+           (let [key (or
+                       (:name jedi)
+                       (gensym "jedi"))] ; use random name if no name present
+             ^{:key key} [jedi-slot jedi]))]

-      [:div {:class "css-scroll-buttons"}
-       [:button {:class "css-button-up"}]
-       [:button {:class "css-button-down"}]]]]))
+        [:div {:class "css-scroll-buttons"}
+         [:button {:class "css-button-up"}]
+         [:button {:class "css-button-down"}]]]])))

 (reagent/render-component
-  [dark-jedi-list current-planet jedis]
+  [dark-jedi-list]
   (. js/document (getElementById "app")))

 (defn on-js-reload []