Removed c.c.fuzzy

Removed c.c.fuzzy

since with-fuzzy-logics does not work

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

--- src/conexp/contrib/fuzzy.clj
+++ src/conexp/contrib/fuzzy.clj
@@ -1,27 +0,0 @@
-;; Copyright (c) Daniel Borchmann. All rights reserved.
-;; The use and distribution terms for this software are covered by the
-;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
-;; which can be found in the file LICENSE at the root of this distribution.
-;; By using this software in any fashion, you are agreeing to be bound by
-;; the terms of this license.
-;; You must not remove this notice, or any other, from this software.
-
-(ns conexp.contrib.fuzzy
-  (:use conexp.main)
-  (:use [clojure.contrib.ns-utils :only (immigrate)])
-  (:require conexp.contrib.fuzzy.sets
-            conexp.contrib.fuzzy.logics
-            conexp.contrib.fuzzy.fca))
-
-(ns-doc "Fuzzy Logics for Formal Concept Analysis")
-
-;;;
-
-(immigrate 'conexp.contrib.fuzzy.sets
-           'conexp.contrib.fuzzy.logics
-           'conexp.contrib.fuzzy.fca)
-
-;;;
-
-nil
-


sm/cs|return the started system

sm/cs|return the started system

--- src/de/otto/tesla/system.clj
+++ src/de/otto/tesla/system.clj
@@ -18,9 +18,10 @@
   (log/info "<- system stopped"))

 (defn start-system [system]
-  (let [system (c/start system)]
+  (let [started (c/start system)]
       (doseq [sig ["INT" "TERM"]]
-        (reset! (beckon/signal-atom sig) #{(partial stop system)}))))
+        (reset! (beckon/signal-atom sig) #{(partial stop started)}))
+      started))

 (defn empty-system [runtime-config]
   (c/system-map


Added character display rosters on left/right sides.

--- src-browser/simplestrat/renderstate.cljs
+++ src-browser/simplestrat/renderstate.cljs
@@ -63,13 +63,14 @@
 ;; character sprite functions
 ;;

-(defn- displaycharactersprite [renderstate character]
-  ;; create sprite if needed
-  (let [spritemap (:spritemap renderstate)
+(defn- displaycharactermapsprite [renderstate character]
+  (let [spritemap (:mapsprites renderstate)
         charactersprite (get spritemap (:uniqueid character))
         newx (* tilespacing (:x character))
         newy (* tilespacing (:y character))
         characterstage (:stage-characters renderstate)]
+    ;;(js/console.log (clj->js spritemap))
+    ;;(js/console.log (clj->js character))
     (positionsprite charactersprite newx newy)
     (makestandardsizeandorigin charactersprite)
     (.addChild characterstage charactersprite)))
@@ -78,7 +79,7 @@
   (let [freshbitmap (createjs/BitmapAnimation. (getspritesheet "icons"))
         standardscale spritescale
         hightlightedscale (* 1.2 spritescale)]
-    #_(js/console.log iconindex)
+    ;;(js/console.log (clj->js character))
     ;; right now sprites are simple animations with one frame.
     (.gotoAndStop freshbitmap (:iconindex character))
     (makestandardsizeandorigin freshbitmap)
@@ -103,28 +104,36 @@

 (defn- syncspritemaptocharacters [spritemap characters]
   "Adds sprites for charaters that do not yet have them, and removes any sprites that do not have a character using them"
-  (let [characteruniqueids (set (map #(:uniqueid %1) characters))
+  (let [characteruniqueids (set (keys characters))
         spriteuniqueids (set (keys spritemap))
-        unusedsprites (difference spriteuniqueids characteruniqueids)
-        missingsprites (difference characteruniqueids spriteuniqueids)]
+        unusedspriteids (difference spriteuniqueids characteruniqueids)
+        missingspriteids (difference characteruniqueids spriteuniqueids)]
     ;; now add the new sprites and remove the old ones
-    ;;(js/console.log (clj->js missingsprites))
-    ;;(js/console.log (clj->js unusedsprites))
+    ;;(js/console.log (clj->js spritemap))
+    ;;(js/console.log (clj->js missingspriteids))
+    ;;(js/console.log (clj->js unusedspriteids))
     (-> spritemap
-        (generatemissingsprites missingsprites characters)
-        (removeunusedsprites unusedsprites))))
+        (generatemissingsprites (map characters missingspriteids))
+        (removeunusedsprites unusedspriteids))))
+
+(defn- syncsprites! [spritemapkeyword characters]
+  (let [
+        ;; if spritemap is nil, defaults to {}
+        spritemap (or (spritemapkeyword @displayed-renderstate) {})
+        syncedspritemap (syncspritemaptocharacters spritemap characters)]
+    ;; swap if something changed
+    (if (= spritemap syncedspritemap) nil
+        (swap! displayed-renderstate assoc spritemapkeyword syncedspritemap))))

 (defn rebuildcharacterdisplaylist [gamestate]
-  (let [characters (:characters gamestate)
-        spritemap (:spritemap @displayed-renderstate)
-        syncedspritemap (syncspritemaptocharacters spritemap characters)]
+  (let [characters (:characters gamestate)]
     ;; mutating step to add missing sprites and remove unused sprites
-    (swap! displayed-renderstate assoc :spritemap syncedspritemap)
+    (syncsprites! :mapsprites characters)
     (let [renderstate @displayed-renderstate
           stage-characters (:stage-characters renderstate)]
       (.removeAllChildren stage-characters)
-      (doseq [character characters]
-        (displaycharactersprite renderstate character)))))
+      (doseq [character (vals characters)]
+        (displaycharactermapsprite renderstate character)))))

 ;;
 ;; map sprite function(s)
@@ -149,6 +158,25 @@
 ;; left/right GUI functions
 ;;

+(defn- displaycharacterrostersprite [roster character x y]
+  )
+
+(defn rebuildrosterdisplaylist [gamestate rosterteam]
+  (let [roster (get (:rostermap @displayed-renderstate) rosterteam)
+        allcharacters (vals (:characters gamestate))
+        teamcharacters (filter #(= (:team %1) rosterteam) allcharacters)
+        orderedteamcharacters (sort-by :uniqueid teamcharacters)
+        rostersize (count teamcharacters)]
+    (.removeAllChildren roster)
+    (syncsprites! :team1rostersprites allcharacters)
+    (let [renderstate @displayed-renderstate
+          rostersprites (:team1rostersprites renderstate)]
+      (doseq [characterindex (range rostersize)
+              character (get orderedteamcharacters characterindex)
+              drawx 0
+              drawy (* tilespacing characterindex)]
+        (displaycharacterrostersprite roster character drawx drawy)))))
+

 ;;
 ;; initialization functions
@@ -175,8 +203,9 @@
   (let [stage (:stage @displayed-renderstate)
         tilemap (createeaseljscontainer "tilemap" 100 100)
         characters (createeaseljscontainer "characters" 100 100)
-        leftRoster (createcharacterroster "leftRoster" 0 100)
-        rightRoster (createcharacterroster "rightRoster" 500 100)]
+        leftRoster (createcharacterroster "team1Roster" 0 100)
+        rightRoster (createcharacterroster "team2Roster" 500 100)
+        rostermap {1 leftRoster 2 rightRoster}]
     (.removeAllChildren stage)
     (.addChild stage tilemap)
     (.addChild stage characters)
@@ -185,7 +214,7 @@
     ;; embed direct references to the map and character containers for
     ;; easy manipulation later
     (swap! displayed-renderstate assoc :stage-map tilemap :stage-characters characters)
-    (swap! displayed-renderstate assoc :leftRoster leftRoster :rightRoster rightRoster)))
+    (swap! displayed-renderstate assoc :leftRoster leftRoster :rightRoster rightRoster :rostermap rostermap)))

 (defn initializerenderer [canvasname]
   (let [canvas (dom/get-element canvasname)


Clear menu options in sample-project view

--- src-cljs/frontend/components/header.cljs
+++ src-cljs/frontend/components/header.cljs
@@ -128,70 +128,74 @@
                           "/signup/")}
                  "Sign up"])]
              [:div.navbar-container {:class hamburger-state}
-              [:ul.nav.navbar-nav
-               (when (config/show-marketing-pages?)
-                 (list
-                   [:li.dropdown {:class (when (contains? #{:features
-                                                            :mobile
-                                                            :ios
-                                                            :android
-                                                            :integrations
-                                                            :enterprise}
-                                                          nav-point)
-                                           "active")}
-                    [:a.menu-item {:href "/features/"}
-                     "Product "
-                     [:i.fa.fa-caret-down]]
-                    [:ul.dropdown-menu
-                     [:li {:role "presentation"}
-                      [:a.sub.menu-item (merge
-                                         (maybe-active nav-point :features)
-                                         {:role "menuitem"
-                                          :tabIndex "-1"
-                                          :href "/features/"})
-                       "Features"]]
-                     [:li {:role "presentation"}
-                      [:a.sub.menu-item (merge
-                                          (maybe-active nav-point :mobile)
-                                          {:role "menuitem"
-                                           :tabIndex "-1"
-                                           :href "/mobile/"})
-                       "Mobile"]]
-                     [:li {:role "presentation"}
-                      [:a.sub.menu-item (merge
-                                          (maybe-active nav-point :integrations)
-                                          {:role "menuitem"
-                                           :tabIndex "-1"
-                                           :href "/integrations/docker/"})
-                       "Docker"]]
-                     [:li {:role "presentation"}
-                      [:a.sub.menu-item (merge
-                                          (maybe-active nav-point :enterprise)
-                                          {:role "menuitem"
-                                           :tabIndex "-1"
-                                           :href "/enterprise/"})
-                       "Enterprise"]]]]
-                   [:li (maybe-active nav-point :pricing)
-                    [:a.menu-item {:href "/pricing/"} "Pricing"]]))
-               [:li (maybe-active nav-point :documentation)
-                [:a.menu-item {:href "https://circleci.com/docs/"}
+              (if (:current-build-data app)
+                [:ul.nav.navbar-nav
+                  [:li [:span.demo "You are viewing the CircleCI open source dashboard!"]]]
+                [:ul.nav.navbar-nav
+                 (when (config/show-marketing-pages?)
+                   (list
+                     [:li.dropdown {:class (when (contains? #{:features
+                                                              :mobile
+                                                              :ios
+                                                              :android
+                                                              :integrations
+                                                              :enterprise}
+                                                            nav-point)
+                                             "active")}
+                      [:a.menu-item {:href "/features/"}
+                       "Product "
+                       [:i.fa.fa-caret-down]]
+                      [:ul.dropdown-menu
+                       [:li {:role "presentation"}
+                        [:a.sub.menu-item (merge
+                                           (maybe-active nav-point :features)
+                                           {:role "menuitem"
+                                            :tabIndex "-1"
+                                            :href "/features/"})
+                         "Features"]]
+                       [:li {:role "presentation"}
+                        [:a.sub.menu-item (merge
+                                            (maybe-active nav-point :mobile)
+                                            {:role "menuitem"
+                                             :tabIndex "-1"
+                                             :href "/mobile/"})
+                         "Mobile"]]
+                       [:li {:role "presentation"}
+                        [:a.sub.menu-item (merge
+                                            (maybe-active nav-point :integrations)
+                                            {:role "menuitem"
+                                             :tabIndex "-1"
+                                             :href "/integrations/docker/"})
+                         "Docker"]]
+                       [:li {:role "presentation"}
+                        [:a.sub.menu-item (merge
+                                            (maybe-active nav-point :enterprise)
+                                            {:role "menuitem"
+                                             :tabIndex "-1"
+                                             :href "/enterprise/"})
+                         "Enterprise"]]]]
+                     [:li (maybe-active nav-point :pricing)
+                      [:a.menu-item {:href "/pricing/"} "Pricing"]]))
+                 [:li (maybe-active nav-point :documentation)
+                  [:a.menu-item {:href "https://circleci.com/docs/"}
+                   (if (config/enterprise?)
+                    "CircleCI Documentation"
+                    "Documentation")]]
                  (if (config/enterprise?)
-                  "CircleCI Documentation"
-                  "Documentation")]]
-               (if (config/enterprise?)
-                 [:li [:a.menu-item {:href "https://enterprise-docs.circleci.com"} "Enterprise Documentation"]])
-               [:li [:a.menu-item {:href "https://discuss.circleci.com" :target "_blank"} "Discuss"]]
-               (when (config/show-marketing-pages?)
-                 (list
-                   [:li {:class (when (contains? #{:about
-                                                   :contact
-                                                   :team
-                                                   :jobs
-                                                   :press}
-                                                 nav-point)
-                                  "active")}
-                    [:a.menu-item {:href "/about/"} "About Us"]]
-                   [:li [:a.menu-item {:href "http://blog.circleci.com"} "Blog"]]))]
+                   [:li [:a.menu-item {:href "https://enterprise-docs.circleci.com"} "Enterprise Documentation"]])
+                 [:li [:a.menu-item {:href "https://discuss.circleci.com" :target "_blank"} "Discuss"]]
+                 (when (config/show-marketing-pages?)
+                   (list
+                     [:li {:class (when (contains? #{:about
+                                                     :contact
+                                                     :team
+                                                     :jobs
+                                                     :press}
+                                                   nav-point)
+                                    "active")}
+                      [:a.menu-item {:href "/about/"} "About Us"]]
+                     [:li [:a.menu-item {:href "http://blog.circleci.com"} "Blog"]]))])
+
               (if logged-in?
                 [:ul.nav.navbar-nav.navbar-right.back-to-app
                  [:li [:a.menu-item {:href "/dashboard"} "Back to app"]]]


Some bugs are fixed.

Some bugs are fixed.

--- src-cljx/polyomino_enclosure/engine.cljx
+++ src-cljx/polyomino_enclosure/engine.cljx
@@ -138,9 +138,8 @@
             (if-not (every? #(some (fn [[x y]] (and (= x 0) (= y 0))) %) polyominos)
               "原点を含まないポリオミノがあります。"))
           (validate-form []
-            (let [[omino-count & omino-counts] (map count polyominos)]
-              (if-not (and (<= 1 (first omino-counts) 12)
-                           (every? #(= % omino-count) omino-counts)
+            (let [omino-count (count (first polyominos))]
+              (if-not (and (<= 1 omino-count 12)
                            (every? #(= (area-size (board %)) omino-count) polyominos))
                 "不正なポリオミノがあります。")))
           (validate-duplication []


change a dot to a space

change a dot to a space

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

--- plugins/DataBrowser/src/org/micromanager/browser/core.clj
+++ plugins/DataBrowser/src/org/micromanager/browser/core.clj
@@ -28,7 +28,7 @@
                            WindowAdapter WindowListener]
            [com.swtdesigner SwingResourceManager]
            [org.micromanager.acquisition ImageStorageListener MMImageCache]
-           [org.micromanager.utils.ReportingUtils])
+           [org.micromanager.utils ReportingUtils])
   (:use [org.micromanager.browser.utils
             :only (gen-map constrain-to-parent create-button create-icon-button
                    attach-action-key remove-borders choose-directory


Set up an application model, dispatch events to multimethods.

--- src/fm/simrunner/gui/app.clj
+++ src/fm/simrunner/gui/app.clj
@@ -11,21 +11,37 @@
   (:import
     (java.awt BorderLayout)
     (javax.swing SwingUtilities
-                 JFrame
-                 JPanel
-                 JButton
-                 JTextField
-                 JCheckBox)))
+                 JOptionPane)))

-(defn- on-event [& args]
-  (println (format "-- on-event: %s" args)))
+(defmulti on-action {:private true} (fn [action & _] action))
+
+(defmethod on-action :open-config [_ model & args]
+  (println (format "open-config{model: %s args: %s}" model args))
+  (JOptionPane/showMessageDialog (-> args first :widget)
+                                 "Open SimRunner config file."
+                                 "Open Config"
+                                 JOptionPane/INFORMATION_MESSAGE))
+
+(defmethod on-action :default [action model & args]
+  (println (format "on-action{action: %s model: %s args: %s}"
+                   action model args)))
+
+(defmulti on-event {:private true} (fn [_ event-id & _] event-id))
+
+(defmethod on-event :action-performed [model _ & args]
+  (on-action (-> args first meta :action) model args))
+
+(defmethod on-event :default [model event-id & args]
+  (println (format "on-event{model: %s id: %s args: %s}" model event-id args)))

 (defn start [config]
   @(gui/gui-do
     (let [frame (view/simrunner-frame)
           view  (-> frame :contents :simrunner-view)
-          frame (:widget frame)]
-      (wiring/wire-up view on-event)
+          frame (:widget frame)
+          model (ref {:app-config config
+                      :worker     (agent nil)})]
+      (wiring/wire-up view (partial on-event model))
       (.setTitle frame "SimRunner (c) 2014 DEINC")
       (.show frame))))


squash! Misused config here

squash! Misused config here

Squashing unapproved problems fix and whitespace fixes.

--- src/foreclojure/problems.clj
+++ src/foreclojure/problems.clj
@@ -3,6 +3,7 @@
             [sandbar.stateful-session :as      session]
             [clojure.string           :as      s]
             [ring.util.response       :as      response])
+  (:import  [org.apache.commons.mail  EmailException])
   (:use     [foreclojure.utils        :only    [from-mongo get-user get-solved login-link *url* flash-msg flash-error def-page row-class approver? can-submit? send-email image-builder]]
             [foreclojure.social       :only    [tweet-link gist!]]
             [foreclojure.feeds        :only    [create-feed]]
@@ -40,7 +41,7 @@
                        (from-mongo
                         (fetch :problems
                                :only [:_id :title]
-                               :where {:_id {:$nin solved-problems}}
+                               :where {:_id {:$nin solved-problems}, :approved true}
                                :sort {:_id 1})))]
     (let [[skipped not-yet-tried] (split-with #(< (:_id %) just-solved-id)
                                               unsolved)]
@@ -245,8 +246,8 @@
                :golfChart (html (render-golf-chart))})))

 (def-page code-box [id]
-  (let [{:keys [_id title difficulty tags description restricted tests approved user]}
-        (get-problem (Integer. id))]
+  (let [{:keys [_id title difficulty tags description
+                restricted tests approved user]} (get-problem (Integer. id))]
     [:div
      [:span#prob-title
       (when-not approved
@@ -294,9 +295,15 @@
           [:button.large {:id "edit-button"} "Edit"]
           [:button.large {:id "approve-button"} "Approve"]]))]))

+(defn problem-page [id]
+  (if (or (:approved (get-problem (Integer. id)))
+          (approver? (session/session-get :user)))
+    (code-box id)
+    (flash-error "You cannot access this page" "/problems")))
+
 (let [checkbox-img (image-builder {true ["/images/checkmark.png" "completed"]
                                    false ["/images/empty-sq.png" "incomplete"]})]
-  (def-page problem-page []
+  (def-page problem-list-page []
     [:div.message (session/flash-get :message)]
     [:div#problems-error.error (session/flash-get :error)]
     (link-to "/problems/rss" [:div {:class "rss"}])
@@ -326,7 +333,7 @@
            [:td.centered (checkbox-img (contains? solved id))]])
         problems))]))

-(def-page unapproved-problem-page []
+(def-page unapproved-problem-list-page []
   [:div.message (session/flash-get :message)]
   [:div#problems-error.error (session/flash-get :error)]
   [:table#unapproved-problems.my-table
@@ -350,10 +357,10 @@
          [:td.centered user]])
       problems))])

-(defn unapproved-problems []
+(defn unapproved-problem-list []
   (let [user (session/session-get :user)]
     (if (approver? user)
-      (unapproved-problem-page)
+      (unapproved-problem-list-page)
       (flash-error "You cannot access this page" "/problems"))))

 (def-page problem-submission-page []
@@ -393,14 +400,17 @@
                      id)]

         (when (empty? author) ; newly submitted, not a moderator tweak
-          (send-email
-           {:from "team@4clojure.com"
-            :to ["team@4clojure.com"]
-            :reply-to [(users/email-address user)]
-            :subject (str "User submission: " title)
-            :html (html [:h3 (link-to edit-url title)]
-                        [:div description])
-            :text (str title ": " edit-url "\n" description)}))
+          (try
+            (send-email
+             {:from "team@4clojure.com"
+              :to ["team@4clojure.com"]
+              :reply-to [(users/email-address user)]
+              :subject (str "User submission: " title)
+              :html (html [:h3 (link-to edit-url title)]
+                          [:div description])
+              :text (str title ": " edit-url "\n" description)})
+            ;; TODO: dump this in a proper log
+            (catch EmailException e (println (str "email failed to send on newly submitted problem #" id)))))

         (update! :problems
                  {:_id id}
@@ -466,12 +476,12 @@
     (flash-error "You do not have permission to access this page" "/problems")))

 (defroutes problems-routes
-  (GET "/problems" [] (problem-page))
-  (GET "/problem/:id" [id] (code-box id))
+  (GET "/problems" [] (problem-list-page))
+  (GET "/problem/:id" [id] (problem-page id))
   (GET "/problems/submit" [] (problem-submission-page))
   (POST "/problems/submit" [prob-id author title difficulty tags restricted description code]
     (create-problem title difficulty tags restricted description code (when (not= "" prob-id) (Integer. prob-id)) author))
-  (GET "/problems/unapproved" [] (unapproved-problems))
+  (GET "/problems/unapproved" [] (unapproved-problem-list))
   (POST "/problem/edit" [id]
     (edit-problem (Integer. id)))
   (POST "/problem/approve" [id]


No longer need to concatenate secret tests

--- src/foreclojure/problems.clj
+++ src/foreclojure/problems.clj
@@ -53,7 +53,7 @@
 (defn run-code [id raw-code]
   (let [code (.trim raw-code)
 	p (get-problem id)
-        tests (concat (:tests p) (:secret-tests p))
+        tests (:tests p)
         func-name (:function-name p)
         sb-tester (get-tester (:restricted p))]
     (if (empty? code)


whitespace

whitespace

--- sidecar/test/figwheel-sidecar/type_check_test.clj
+++ sidecar/test/figwheel-sidecar/type_check_test.clj
@@ -293,9 +293,9 @@
       (test-grammer)
       {:cljsbuild
        {:server-rt []}}))
-
-
   )
+
+


Recur on inner type

Recur on inner type

--- src/graphql_clj/executor.clj
+++ src/graphql_clj/executor.clj
@@ -141,10 +141,7 @@
       (is-scalar-field-type? field-type) result
       (is-enum-field-type? field-type) result
       (is-object-field-type? field-type) (execute-fields context schema resolver-fn field-type result sub-selection-set fragments variables)
-      (is-list-field-type? field-type) (let [inner-type (type/get-inner-type schema field-type)]
-                                         (cond->> result
-                                                  (is-object-field-type? inner-type)
-                                                  (map #(execute-fields context schema resolver-fn inner-type % sub-selection-set fragments variables))))
+      (is-list-field-type? field-type) (map #(complete-value context schema resolver-fn (type/get-inner-type schema field-type) % sub-selection-set fragments variables) result)
       (is-not-null-type? field-type) (let [not-null-result (complete-value context schema resolver-fn (type/get-inner-type schema field-type) result sub-selection-set fragments variables)]
                                        (if not-null-result
                                          not-null-result


wording changes

wording changes

--- src/cljs/early_vote_site/early_vote_site_form/views.cljs
+++ src/cljs/early_vote_site/early_vote_site_form/views.cljs
@@ -143,10 +143,10 @@
       [:p "* required"]
       [:button.button
        {:on-click #(re-frame/dispatch [:early-vote-site-form/save])}
-       "Save Early Vote Site"]
+       "Save Location"]
       [:button.button
        {:on-click #(re-frame/dispatch [:early-vote-site-form/save true])}
-       "Add Schedules"]
+       "Save Location & Add Schedules"]
       [:button.button
        {:on-click #(re-frame/dispatch [:navigate/election-detail])}
        "Cancel"]]]))


cleanup, added messaging around upstream dependencies

--- src/clj/cljs/closure.clj
+++ src/clj/cljs/closure.clj
@@ -166,7 +166,6 @@
     (let [js-sources (-> externs filter-js add-target load-js)
           ups-sources (-> ups-externs filter-cp-js add-target load-js)
           all-sources (concat js-sources ups-sources)]
-      (println all-sources)
       (if use-only-custom-externs
         all-sources
         (into all-sources (CommandLineRunner/getDefaultExterns))))))
@@ -835,6 +834,8 @@
   []
   (let [classloader (. (Thread/currentThread) (getContextClassLoader))
         upstream-deps (map #(read-string (slurp %)) (enumeration-seq (. classloader (findResources "deps.cljs"))))]
+    (doseq [dep upstream-deps]
+      (println (str "Upstream deps.cljs found on classpath. " dep " This is an EXPERIMENTAL FEATURE and is not guarenteed to remain stable in future versions.")))
     (apply merge-with concat upstream-deps)))

 (def get-upstream-deps (memoize get-upstream-deps*))
@@ -863,7 +864,6 @@
         js-sources (if (coll? compiled)
                      (apply add-dependencies all-opts compiled)
                      (add-dependencies all-opts compiled))]
-    (println "Compiler Options:" (pr-str all-opts))
     (if (:optimizations all-opts)
       (->> js-sources
            (apply optimize all-opts)


Multiple arity for TimeSeries*

Multiple arity for TimeSeries*

--- src/clj/forma/thrift.clj
+++ src/clj/forma/thrift.clj
@@ -248,11 +248,18 @@

 (defn TimeSeries*
   "Create a TimeSeries."
-  [start end val]
-    {:pre [(every? #(instance? java.lang.Long %) [start end])
+  ([start vals]
+    {:pre [;;(every? #(instance? java.lang.Long %) [start end])
+           (coll? vals)]}
+    (let [elems (count vals)]
+      (TimeSeries* start
+                   (dec (+ start (count vals)))
+                   vals)))
+  ([start end val]
+    {:pre [;;(every? #(instance? java.lang.Long %) [start end])
            (coll? val)]}
     (let [series (if (coll? val) (pack val) val)]
-      (TimeSeries. start end (mk-array-value series))))
+      (TimeSeries. start end (mk-array-value series)))))

 (defn FormaValue*
   "Create a FormaValue."


Migrate the db handler to Failjure

Migrate the db handler to Failjure

--- src/clj/mdr2/db/core.clj
+++ src/clj/mdr2/db/core.clj
@@ -1,13 +1,13 @@
 (ns mdr2.db.core
   (:require
-    [next.jdbc.date-time]
-    [next.jdbc.result-set]
-    [clojure.string :as string]
-    [clojure.tools.logging :as log]
-    [conman.core :as conman]
-    [mdr2.config :refer [env]]
-    [mount.core :refer [defstate]]
-    [de.otto.nom.core :as nom]))
+   [next.jdbc.date-time]
+   [next.jdbc.result-set]
+   [clojure.string :as string]
+   [clojure.tools.logging :as log]
+   [conman.core :as conman]
+   [mdr2.config :refer [env]]
+   [mount.core :refer [defstate]]
+   [failjure.core :as fail]))

 (defstate ^:dynamic *db*
   :start (if-let [jdbc-url (env :database-url)]
@@ -62,7 +62,7 @@
 (defn insert-production
   "Insert the given `production`. Return it with the updated primary key `id`"
   [production]
-  (nom/try-nom
+  (fail/try*
     (if-let [key (-> (insert-raw production) first :generated_key)]
       (assoc production :id key)
       production)))


Actually use improvement-discount

Actually use improvement-discount

--- src/clojush/evaluate.clj
+++ src/clojush/evaluate.clj
@@ -35,7 +35,7 @@
      :rand (a random floating-point value)
      :rand-bit (randomly 0 or 1)
      :age (minimize genealogical age of program)"
-  [ind {:keys [meta-error-categories error-threshold] :as argmap}]
+  [ind {:keys [meta-error-categories error-threshold improvement-discount] :as argmap}]
   (let [meta-error-fn (fn [cat]
                         (cond
                           (fn? cat) (cat ind argmap)
@@ -159,7 +159,7 @@
                                        (let [improvements (mapv (fn [[older-error newer-error]]
                                                                   (- older-error newer-error))
                                                                 (partition 2 1 case-history))
-                                             weights (iterate (partial * 0.01) 1)
+                                             weights (iterate (partial * (- 1 improvement-discount)) 1)
                                              sum (reduce + (mapv * improvements weights))]
                                          (if (<= sum 0)
                                            1.0E100
@@ -261,3 +261,4 @@
             me (calculate-meta-errors new-ind argmap)]
         (assoc new-ind :meta-errors me)))))

+


Finish basic app.

Finish basic app.

--- src/hello_figwheel/core.cljs
+++ src/hello_figwheel/core.cljs
@@ -2,7 +2,8 @@
   (:require [sablono.core :as sab])
   )

-(def app-state (atom { :likes 0 }))
+(defonce app-state (atom { :likes 0 }))
+

 (defn like-figwheel [data]
   (sab/html [:div
@@ -12,7 +13,11 @@
                     "Thumbs up"]]
              ]
   )
+  )

 (defn render! []
   (.render js/React
            (like-figwheel app-state)
+           (.getElementById js/document "app")))
+(add-watch app-state :on-change (fn [_ _ _ _] (render!)))
+(render!)


adjust CLJS hacks for analyzer changes

adjust CLJS hacks for analyzer changes

--- src/main/shadow/build/cljs_hacks.cljc
+++ src/main/shadow/build/cljs_hacks.cljc
@@ -392,8 +392,14 @@
           (symbol (str ns) (str tsym))
           tsym-meta)

+        defrecord?
+        (or (= :defrecord op)
+            ;; 1.10.335 changed this to the above
+            ;; FIXME: remove additional check in the future when everyone is on 1.10.335+
+            (= :defrecord* op))
+
         locals-fields
-        (if (= :defrecord* op)
+        (if defrecord?
           (concat fields '[__meta __extmap ^:mutable __hash])
           fields)

@@ -424,7 +430,7 @@
               :type true
               :tag type-sym
               :num-fields (count fields)
-              :record (= :defrecord* op))
+              :record defrecord?)
             (merge (source-info tsym env)))))

     {:op op :env env :form form :t type-sym :fields fields :pmasks pmasks


Now responds to \o/ with \ӧ/.

Now responds to \o/ with \ӧ/.

--- Spraff/src/spraff/core.clj
+++ Spraff/src/spraff/core.clj
@@ -272,6 +272,8 @@
             (join (take 450 (join " " (generate-sentence
                 @state-ref
                 (set (remove #(.contains % (:name @irc)) (split-sentence-to-words message)))))))))
+    (if (= message "\\o/")
+        (send-message irc channel "\\ӧ/"))
     (if (.startsWith message "!burrito")
         (send-message irc channel
             (generate-burrito)))


Worked on macros chapter

Worked on macros chapter

--- brave-true/clojure-noob/src/clojure_noob/brews.clj
+++ brave-true/clojure-noob/src/clojure_noob/brews.clj
@@ -45,6 +45,57 @@
   => '("Please enter a postal code that looks like a US postal code"))

+
+
+
+
+
+(def shipping-details-validation
+  {:name
+   ["Please enter a name" not-empty]
+
+   :address
+   ["Please enter an address" not-empty]
+
+   :city
+   ["Please enter a city" not-empty]
+
+   :postal-code
+   ["Please enter a postal code" not-empty
+
+    "Please enter a postal code that looks like a postal code"
+    #(or (empty? %)
+         (not (re-seq #"[^0-9-]" %)))]
+
+   :email
+   ["Please enter an email address" not-empty
+
+    "Your email address doesn't look like an email address"
+    (or #(empty? %)
+        #(re-seq #"@" %))]})
+
+(defn validate
+  "returns a map with a vec of errors for each key"
+  [to-validate validations]
+  (reduce (fn [errors validation]
+            (let [[fieldname validation-check-groups] validation
+                  value (get to-validate fieldname)
+                  error-messages (error-messages-for value validation-check-groups)]
+              (if (empty? error-messages)
+                errors
+                (assoc errors fieldname error-messages))))
+          {}
+          validations))
+
+
+
+
+(fact "test 'validate'"
+
+  (validate {:address "123 Clinkenbeard Ct"})
+  => {:name ["Please enter a name"]})
+
+
 (def shipping-details
   {:name "Mitchard Blimmons"
    :address "134 Wonderment Ln"
@@ -53,25 +104,45 @@
    :postal-code "32501"
    :email "mitchard.blimmonsgmail.com"})

-
-(def shipping-details-validations
-  {:name
-   ["Please enter a name" not-empty]
-
-   :address
-   ["Please enter an address" not-empty]})
-
-
-
-(fact "test 'validate'"
-
-  (validate {:address "123 Clinkenbeard Ct"})
-  =>) {:name ["Please enter a name"]}
-
-
 (fact "example of validate function"

   (validate shipping-details shipping-details-validations)
   =>
   {:email ["Your email address doesn't look like an email address."]
    :city ["Please enter a city"]} )
+
+
+(comment "can be used like:"
+
+  (let [errors (validate shipping-details shipping-details-validation)]
+    (if (empty? errors)
+      (render :success)
+      (render :failure errors)))
+
+  (let [errors (validate shipping-details shipping-details-validation)]
+    (if (empty? errors)
+      (do (save-shipping-details shipping-details)
+          (redirect-to (url-for :order-confirmation)))
+      (render "shipping-details" {:errors errors})))
+  )
+
+(defmacro if-valid
+  "Handle validation more concisely"
+  [to-validate validations errors-name & then-else]
+  `(let [~errors-name (validate ~to-validate ~validations)]
+     (if (empty? ~errors-name)
+       ~@then-else)))
+
+
+(comment
+
+  (if-valid shipping-details shipping-details-validation errors
+            (render :success)
+            (render :failure errors))
+
+  (if-valid shipping-details shipping-details-validation errors
+            (do (save-shipping-details shipping-details)
+                (redirect-to (url-for :order-confirmation)))
+            (render "shipping-details" {:errors errors}))
+
+  )


More work on chapter 02

More work on chapter 02

--- clojure-programming/src/clojure_programming/chp02.clj
+++ clojure-programming/src/clojure_programming/chp02.clj
@@ -4,7 +4,7 @@

 [[:section {:title "Functional Programming and Values --  page: 52"}]]

-"Fuctional programming:
+"Functional programming:
 - Preference of working with immutable data structures.
 - Functions as values themselves.
 - Preference for working wih declarative processing of data rather than using
@@ -17,7 +17,7 @@
 "
 Values:
  Most programming language incourage the use of mutable state. Functional lanugages
-including Clojure incourage the use of immutable values.
+ including Clojure incourage the use of immutable values.

 Since clojure values are immutable:
 "
@@ -89,7 +89,7 @@
 "
 (require 'clojure.string)

-(facts "clojures versions are easy to call separate fucntions"
+(facts "clojures versions are easy to call separate functions"
   (fact
     (max 5 6)
     => 6)
@@ -118,10 +118,10 @@
   => '(5 12 21 32))

 "
-Differnces between map and 'toLowercase':
+Differences between map and 'toLowercase':
 - 'toLowercase' mutated it's argument.
 - if 'toLowercase' returned a new collection, we would have to handle memory allocation
-  and type of collection. Map aways returns a sequence.
+i  and type of collection. Map aways returns a sequence.
 - We would have to worry about the imperative flow of control.

 Reduce  applies a function to a collection producing a single value
@@ -140,12 +140,108 @@
   (reduce + [1 2 3 4])
   => 10)

+(fact "using a collection a seed alows us to reduce to that type of collection"
+  (reduce
+   (fn [m v]
+     (assoc m v (* v v)))
+   {}
+   [1 2 3 4])
+  => {4 16, 3 9, 2 4, 1 1})
+
+(fact "using a function literal"
+  (reduce
+   #(assoc %1 %2 (* %2 %2))
+   {}
+   [1 2 3 4])
+  => {4 16, 3 9, 2 4, 1 1})
+
+"
+No one would define 'maxOf' of 'toLowercase' type functions that operate over
+entire collections in Clojure. It makes more sense core functions like 'max' or
+'lower-case' and use higher-order functions to apply them to collections.
+"

 [[:subsection {:title "Applying Ourselves Partially -- page: 65"}]]

-
+"Function application is the invocation of a function  on a sequence of values:"
+
+(fact "clojure function application:"
+  (apply hash-map [:a 5 :b 6])
+  => {:b 6, :a 5})
+
+(def args [2 -2 10])
+
+(fact "prefix with a number of arguments"
+  (apply * 0.5 3 args)
+  => -60.0)
+
+"
+'apply' applies a function to all arguments in a sequence, 'partial' only applies
+some of the arguments returning a new function that applies to the rest.
+"
+(def only-strings (partial filter string?))
+
+(fact "partial application"
+  (only-strings ["a" 5 "b" 6])
+  => '("a" "b"))
+
+(fact "function literals are similar to partials:"
+  (#(filter string? %) ["a" 5 "b" 6])
+  => '("a" "b"))
+
+(facts "not just limited to initial arguments"
+  (fact (#(filter % ["a" 5 "b" 6]) number?)
+    => '(5 6))
+  (fact (#(filter % ["a" 5 "b" 6]) string?)
+    => '("a" "b")))
+
+(facts "But function literals require all arguments to be fully specified"
+  (fact "must account for number of arguments"
+    (#(map *) [1 2 3] [4 5 6] [7 8 9])
+    => (throws clojure.lang.ArityException))
+  (fact "enumerating arguments"
+    (#(map * %1 %2 %3) [1 2 3] [4 5 6] [7 8 9])
+    => '(28 80 162))
+  (fact "must align wiht passed arguments"
+    (#(map * %1 %2 %3) [1 2 3] [4 5 6])
+    => (throws clojure.lang.ArityException))
+  (fact "apply using 'rest' arguments"
+    (#(apply map * %&) [1 2 3] [4 5 6] [7 8 9])
+    => '(28 80 162))
+  (fact "still works but duplicates what 'partial' does better"
+    (#(apply map * %&) [1 2 3])
+    => '(1 2 3))
+  (fact "much better"
+    ((partial map *) [1 2 3] [4 5 6] [7 8 9])
+    => '(28 80 162)))
+
+
+(comp-negated-sum-str 10 12 3.4)
+(comp-negated-sum-str 10 12 3.4)
 [[:section {:title "Composition of Functionality --  page: 68"}]]

+"
+Compositionality is the ability to build more complex things out of smaller simpler parts. Different programming languages use diffent methods of composition. Functional languages us functions.
+"
+(defn negated-sum-str
+  "negate a sum of some given numbers"
+  [& numbers]
+  (str (- (apply + numbers))))
+
+(fact (negated-sum-str 10 12 3.4)
+  => "-25.4")
+
+(def comp-negated-sum-str (comp str - +))
+
+(fact "composed version:"
+  (comp-negated-sum-str 10 12 3.4)
+  => "-25.4")
+
+" (comp f g h) acts like a pipeline passing arguments from h to g to f
+"
+
+
+
 [[:subsection {:title "Writing Higher-Order Functions -- page: 71"}]]

 [[:subsection {:title "Primative Logging System Example -- page: 72"}]]


Complete high order functions koans test

--- clojure/koans/src/koans/08_higher_order_functions.clj
+++ clojure/koans/src/koans/08_higher_order_functions.clj
@@ -1,32 +1,32 @@
 (meditations
   "The map function relates a sequence to another"
-  (= [__ __ __] (map (fn [x] (* 4 x)) [1 2 3]))
+  (= [4 8 12] (map (fn [x] (* 4 x)) [1 2 3]))

   "You may create that mapping"
-  (= [1 4 9 16 25] (map (fn [x] __) [1 2 3 4 5]))
+  (= [1 4 9 16 25] (map (fn [x] (* x x)) [1 2 3 4 5]))

   "Or use the names of existing functions"
-  (= __ (map nil? [:a :b nil :c :d]))
+  (= [false false true false false] (map nil? [:a :b nil :c :d]))

   "A filter can be strong"
-  (= __ (filter (fn [x] false) '(:anything :goes :here)))
+  (= '() (filter (fn [x] false) '(:anything :goes :here)))

   "Or very weak"
-  (= __ (filter (fn [x] true) '(:anything :goes :here)))
+  (= '(:anything :goes :here) (filter (fn [x] true) '(:anything :goes :here)))

   "Or somewhere in between"
-  (= [10 20 30] (filter (fn [x] __) [10 20 30 40 50 60 70 80]))
+  (= [10 20 30] (filter (fn [x] (< x 35)) [10 20 30 40 50 60 70 80]))

   "Maps and filters may be combined"
-  (= [10 20 30] (map (fn [x] __) (filter (fn [x] __) [1 2 3 4 5 6 7 8])))
+  (= [10 20 30] (map (fn [x] (* 10 x)) (filter (fn [x] (< x 4)) [1 2 3 4 5 6 7 8])))

   "Reducing can increase the result"
-  (= __ (reduce (fn [a b] (* a b)) [1 2 3 4]))
+  (= 24 (reduce (fn [a b] (* a b)) [1 2 3 4]))

   "You can start somewhere else"
-  (= 2400 (reduce (fn [a b] (* a b)) __ [1 2 3 4]))
+  (= 2400 (reduce (fn [a b] (* a b)) 100 [1 2 3 4]))

   "Numbers are not the only things one can reduce"
   (= "longest" (reduce (fn [a b]
-                         (if (< __ __) b a))
+                         (if (< (count a) (count b)) b a))
                        ["which" "word" "is" "longest"])))


Command line options for IRC nick/channel/server.

--- Spraff/src/spraff/core.clj
+++ Spraff/src/spraff/core.clj
@@ -9,14 +9,13 @@
 (ns spraff.core
     (:gen-class)
     (:use
+        [clojure.contrib.command-line]
         [clojure.java.io]
         [clojure.string :only [join]]
-        [irclj.core])
+        [irclj.core]
+    )
 )

-(def irc-server "localhost")
-(def bot-nick "spraffbot")
-(def irc-channels ["#sprafftest"])
 (def corpus-file "corpus.txt")
 (def word-pattern #"\S+")
 (def prefix-length 3)
@@ -101,18 +100,27 @@

 (defn -main
     [& args]
-    (let [state-ref (ref empty-state)] (do
-        (connect
-            (create-irc {
-                :name bot-nick
-                :server irc-server
-                :fnmap {
-                    :on-message (fn [event] (on-message event state-ref))
-                }
-            })
-            :channels irc-channels)
-        (with-open [in (reader corpus-file)]
-            (dorun (map #(update-state! % state-ref) (line-seq in)))))))
+    (with-command-line
+        args
+        "Arguments: -channel #mychannel -nick botnick -server irc.server.com"
+        [
+            [channel c "IRC Channel to join." "#sprafftest"]
+            [nick n "Bot's IRC nick." "spraffbot"]
+            [server s "IRC server address." "localhost"]
+        ]
+        (let [state-ref (ref empty-state)] (do
+            (println channel nick server)
+            (connect
+                (create-irc {
+                    :name nick
+                    :server server
+                    :fnmap {
+                        :on-message (fn [event] (on-message event state-ref))
+                    }
+                })
+                :channels [channel])
+            (with-open [in (reader corpus-file)]
+                (dorun (map #(update-state! % state-ref) (line-seq in))))))))


Using new routes to link up with org settings page.


Add comment on CLJ-2168

Add comment on CLJ-2168


Make Eastwood happy.

Make Eastwood happy.

--- src/oc/storage/resources/reaction.clj
+++ src/oc/storage/resources/reaction.clj
@@ -55,12 +55,12 @@
         ;; user's favorite reactions if we need them
         user-faves (when (and user-id (< (count reactions) config/max-favorite-reaction-count))
                       (user-favorites conn user-id))
-        filtered-user-faves (filter #(not (reaction-unicodes %)) user-faves)
+        filtered-user-faves (remove reaction-unicodes user-faves)
         reactions-and-user-faves (concat reactions
                                          (map #(hash-map :reaction % :count 0 :authors []) filtered-user-faves))
         ; org's favorite reactions if we need them
         reaction-unicodes (set (map :reaction reactions-and-user-faves))
         org-faves (when (< (count reactions-and-user-faves) config/max-favorite-reaction-count)
                     (org-favorites conn org-id))
-        filtered-org-faves (filter #(not (reaction-unicodes %)) org-faves)]
+        filtered-org-faves (remove reaction-unicodes org-faves)]
     (concat reactions-and-user-faves (map #(hash-map :reaction % :count 0 :authors []) filtered-org-faves))))


Removed trailing parens.

Removed trailing parens.

--- src/overtunes/songs/frere_jacques.clj
+++ src/overtunes/songs/frere_jacques.clj
@@ -12,8 +12,7 @@
   frère-jacques frère-jacques
   dormez-vous dormez-vous
   sonnez-les-matines sonnez-les-matines
-  din-dan-don din-dan-don
-))
+  din-dan-don din-dan-don))

 (defn frere-jacques-round []
   (let [metro (metronome 120)]


fast default for colaboration

fast default for colaboration

--- integration/dda/pallet/crate/dda_user_crate/instantiate_aws.clj
+++ integration/dda/pallet/crate/dda_user_crate/instantiate_aws.clj
@@ -24,22 +24,26 @@
     [dda.pallet.crate.dda-user-crate.group :as group]
     [dda.pallet.domain.dda-user-crate :as domain]))

-(def ssh-pub-key
-  (os-user/read-ssh-pub-key-to-config))
+(def shantanu-key
+  {:type "ssh-rsa"
+   :public-key "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDY96t89DVhJsCw1yulH1fi6YUiguAc2a6nKCXwvo+IxP/JZyq5j2zM+j84Sj9vdGcRnpeFDW/OhiNIA1gxmgvWnCbm3AI6uoLF08bWXCWaGpcQIANpuIWyh2oQhHD+3twaL8jPZXHZvBWNYxlXY+z1JSpSJ2r8JHebwe4mcypCWtXCkoBw4+/j4iU3ksPpFhJFRY1ij1bWEFnUSYhMWNCIvps4OPz9tLKRDjBd7rWYSSia04AuFjRgMHiZ79rY+brxQSVj4a0fnppomfe9QOsGzl0LlQMAea7ahOxFOtuenngyHA56U2kv5Fhu71ZBtEikIJpY6S6TNJEhiITfvEdB"
+   :comment "kumar.shantanu@gmail.com"})

-(def ssh-priv-key "$YOUR_PRIVATE_KEY")
+(def jem-key-host
+ {:type "ssh-rsa"
+  :public-key "AAAAB3NzaC1yc2EAAAADAQABAAABAQDd0NIMownb4CSsifH2OBoO3+Hv7I04EjblR5S1VdEOZ2a59nVjWJMIwVj+JkFoon7YaYhgRoqzmDuR7nX8yfHXTljJ2VRwecvbcPV3exaNTcWSMUZMwBKIAEKdTwaZ5wHogJRYeGtPTBYf6k433sGS3TH2zy6YOCwftGKFKc4LkhB7ZnjHTQ4AWefmazt6FV8xi4ohZv/sgy3Tnm9ylxI7vHdVwvwZM4MzOoCIQTHNJWvOMgxuFmSj9vZlwj/IpwmHimxEjBszMf1gzoA7lb/3MShfCB8u3WFpTUiHOlNu1xsbrzC3f0sK9PO1qpQ2QunModw7r3Avx7lE5mK0xPW/"
+  :comment "mje@host"})

-(def ssh-key-pair
-  {:public-key ssh-pub-key
-   :private-key ssh-priv-key})
+(def jem-key-vm
+ {:type "ssh-rsa"
+  :public-key "AAAAB3NzaC1yc2EAAAADAQABAAABAQCeO+eiYDonq3OfxyaUx259y/1OqbhLciD4UlCkguD5PgOuXw+kCXS1Wbdor9cvU8HnsL2j70sPSwCWkcDrrGQ0kpC0GuNO47pKawAOSv07ELpSIIp/nPK5AX2+qI1H3MADBWBE5N1L7sdgatON2A/cC3u5pzcWDaEH7/IJdOkRm8H+qqG+uva6ceFUoYFiJKDixmsmaUXhhDcfYhfpAPBUCSes+HTeT/hk6pdLTX9xXd4H5wyAc+j1e6kPq9ZcxvzZNr9qEMIFjnNL/S9w1ozxQa3sKJQHj8SyVZDlwjvepGS7fKrdlRps938A7I3Y4BaXGX//M1y2HNbUWbMOllLL"
+  :comment "mje@jergerProject"})

 (def domain-config
-  {:test1 {:encrypted-password "USER_PASSWORD"
-           :authorized-keys [ssh-pub-key]
-           :personal-key ssh-key-pair}
-   :test2 {:encrypted-password "ZvLZwke.Bvczw"
-           :authorized-keys [ssh-pub-key]
-           :personal-key ssh-key-pair}})
+  {:jem {:encrypted-password "kpwejjj0r04u09rg90rfj"
+         :authorized-keys [jem-key-host jem-key-vm]}
+   :shantanu {:encrypted-password "kpwejjj0r04u09rg90rfj"
+              :authorized-keys [shantanu-key]}})

 (defn integrated-group-spec [count]
   (merge


fix repl error when refreshing

fix repl error when refreshing

--- src/user.clj
+++ src/user.clj
@@ -1,9 +1,10 @@
 (ns user
   (:require [clojure.tools.namespace.repl :as tn]
             [mount.core :as mount]
-
             [buyme-aggregation-backend.core :as app]))

+(defn fix-ns []
+  (ns-unalias (find-ns 'user) 'app))

 (defn start []
   (app/-main))
@@ -13,10 +14,12 @@

 (defn refresh []
   (stop)
+  (fix-ns)
   (tn/refresh))

 (defn refresh-all []
   (stop)
+  (fix-ns)
   (tn/refresh-all))

 (defn go
@@ -29,6 +32,7 @@
   "stops all states defined by defstate, reloads modified source files, and restarts the states"
   []
   (stop)
+  (fix-ns)
   (tn/refresh :after 'user/go))

 (tn/set-refresh-dirs "./src/buyme_aggregation_backend")


Pretty print fns too.

Pretty print fns too.

--- src/dsbdp/experiment_helper.clj
+++ src/dsbdp/experiment_helper.clj
@@ -12,6 +12,7 @@
   dsbdp.experiment-helper
   (:require
     [clojure.walk :refer :all]
+    [clojure.pprint :refer :all]
     [dsbdp.byte-array-conversion :refer :all])
   (:import
     (java.util HashMap Map)))
@@ -24,6 +25,7 @@
       (do
         (println "proc-fns-full:" fns)
         (println "proc-fns-short:" (.replaceAll (str fns) "(?<=\\()([a-zA-Z\\.\\-]++/)" ""))
+        (println "proc-fns-pretty:\n" (.replaceAll (with-out-str (pprint fns)) "(?<=\\()([a-zA-Z\\.\\-]++/)" ""))
         fns))))

 (defmacro create-no-op-proc-fns


Read and write attachments as well as main asset content

--- src/io/aviso/twixt/fs_cache.clj
+++ src/io/aviso/twixt/fs_cache.clj
@@ -11,7 +11,8 @@
      [pprint :as pp]
      [string :as s]]
     [clojure.tools.logging :as l]
-    [io.aviso.tracker :as t]))
+    [io.aviso.tracker :as t]
+    [io.aviso.twixt.utils :as utils]))

 (defn- checksum-matches?
@@ -36,6 +37,16 @@
     (with-open [reader (-> file io/reader PushbackReader.)]
       (edn/read reader))))

+(defn- read-attachments
+  [asset asset-cache-dir]
+  (if (-> asset :attachments empty?)
+    asset
+    (update-in asset [:attachments]
+               (fn [attachments]
+                 (utils/map-values
+                   attachments
+                   #(assoc % :content (io/file asset-cache-dir (:content %))))))))
+
 (def ^:private asset-file-name "asset.edn")
 (def ^:private content-file-name "content")

@@ -50,7 +61,30 @@
       (some->
         (io/file asset-cache-dir asset-file-name)
         read-cached-asset-data
-        (assoc :content (io/file asset-cache-dir content-file-name))))))
+        (assoc :content (io/file asset-cache-dir content-file-name))
+        (read-attachments asset-cache-dir)))))
+
+
+(defn- write-attachment
+  "Writes the attachment's content to a file, returns the attachment with :content modified
+  to be the simple name of the file written."
+  [asset-cache-dir name attachment]
+  (let [file-name (str (UUID/randomUUID) "-" name)
+        content-file (io/file asset-cache-dir file-name)]
+    (io/copy (:content attachment) content-file)
+    (assoc attachment :content file-name)))
+
+(defn- write-attachments
+  "Writes attachments as files in the cache dir, updating each's :content key into a simple file name."
+  [asset asset-cache-dir]
+  (if (-> asset :attachments empty?)
+    asset
+    (update-in asset [:attachments]
+               (fn [attachments]
+                 (into {}
+                       (map (fn [[name attachment]]
+                              [name (write-attachment asset-cache-dir name attachment)])
+                            attachments))))))

 (defn- write-cached-asset [^File asset-cache-dir asset]
   (t/track
@@ -61,11 +95,13 @@
       ;; Write the content first
       (io/copy (:content asset) content-file)
       (with-open [^Writer writer (io/writer asset-file)]
-        (.write writer (->
-                         asset
-                         (dissoc :content)
-                         ;; Override *print-length* and *print-level* to ensure it is all written out.
-                         ^String (pp/write :length nil :level nil :stream nil)))
+        (.write writer (-> asset
+                           (write-attachments asset-cache-dir)
+                           ;; The name of the content file is (currently) a fixed value,
+                           ;; so we can just remove the key, rather than replace it with a file name.
+                           (dissoc :content)
+                           ;; Override *print-length* and *print-level* to ensure it is all written out.
+                           ^String (pp/write :length nil :level nil :stream nil)))
         (.write writer "\n")))))

 (defn- delete-dir-and-contents


[skip ci] ws

[skip ci] ws

--- src/java_time/defconversion.clj
+++ src/java_time/defconversion.clj
@@ -54,9 +54,9 @@

 (defn ^:internal call-conversion [nm tp args]
   (if-let [[path f] (g/conversion-fn
-                       @graph
-                       (types-of args)
-                       (g/types [tp]))]
+                      @graph
+                      (types-of args)
+                      (g/types [tp]))]
     (or (try (first (f args))
              (catch Exception e
                (throw


var is now a common special form

var is now a common special form

--- src/main/clojure/clojure/tools/analyzer/js/cljs/core.clj
+++ src/main/clojure/clojure/tools/analyzer/js/cljs/core.clj
@@ -1678,22 +1678,10 @@
        (this-as this#
          (cljs.core/es6-iterator this#)))))

-(defmacro var [sym]
-  (core/let [{sym-ns :ns sym-name :name :as info} (a/resolve-sym sym (dissoc &env :locals))]
-    `(cljs.core/Var. ~sym
-                     (symbol ~(name sym-ns) ~(name sym-name))
-                     (merge
-                      {:ns (symbol ~(name sym-ns))
-                       :name (symbol ~(name sym-name))}
-                      ~(select-keys (meta info) [:file :line :column :doc])
-                      {:arglists ~(list 'quote (-> info meta :arglists))}
-                      ~(when (:test info)
-                         `{:test (.-cljs$lang$test ~sym)})))))
-
 (defmacro ns-interns
   "Returns a map of the intern mappings for the namespace."
   [[quote ns]]
   (core/assert (core/and (= quote 'quote) (core/symbol? ns))
                "Argument to ns-interns must be a quoted symbol")
-  `(into {} ~(mapv (fn [[sym {:keys [ns name]}]] `[~sym (cljs.core/var ~(core/symbol (core/name ns) (core/name name)))])
+  `(into {} ~(mapv (fn [[sym {:keys [ns name]}]] `[~sym (var ~(core/symbol (core/name ns) (core/name name)))])
                    (get-in (env/deref-env) [:namespaces ns :mappings]))))


minor code cleanup

minor code cleanup

--- src/main/clojure/com/xebia/visualreview/service_util.clj
+++ src/main/clojure/com/xebia/visualreview/service_util.clj
@@ -17,14 +17,18 @@
 (ns com.xebia.visualreview.service-util
   (:require [slingshot.slingshot :as ex]))

+(defn get-message-from-object-or-exception
+  [object-or-exception]
+  (if (instance? Exception object-or-exception)
+    (.getMessage object-or-exception)
+    (:message object-or-exception)))
+
 (defn throw-service-exception [message code]
   (ex/throw+ {:type :service-exception :code code :message message}))

 (defn rethrow-as-service-exception [object-or-exception message code]
-  (if (instance? Exception object-or-exception)
-    (throw-service-exception (format message (.getMessage object-or-exception)) code)
-    (throw-service-exception (format message (:message object-or-exception)) code)))
-
+  (let [exception-msg (get-message-from-object-or-exception object-or-exception)]
+    (throw-service-exception (format message exception-msg) code)))

 (defmacro attempt
   "Attempts to execute the given form. If the form throws an exception (of either the Java or slingshot kind),
@@ -36,7 +40,10 @@
   `(ex/try+
      ~form
      (catch Object o#
-       (rethrow-as-service-exception o# ~err-msg ~err-code))))
+       (let [exception-msg# (get-message-from-object-or-exception o#)]
+         (do
+           (taoensso.timbre/log :debug (str "An error has occured and was caught as a service exception: " exception-msg#))
+           (throw-service-exception (format ~err-msg exception-msg#) ~err-code))))))

 (defmacro assume
   "When the given form returns a falsy value, assume will throw a service exception with the given error message and code.


depth is not needed anymore

depth is not needed anymore

--- cljs/src/main/plastic/cogs/editor/layout/code.cljs
+++ cljs/src/main/plastic/cogs/editor/layout/code.cljs
@@ -39,7 +39,7 @@
     (layout-utils/keyword-node? node) (helpers/strip-colon (node/string node))
     :else (node/string node)))

-(defn build-node-code-render-tree-node [depth loc]
+(defn build-node-code-render-tree-node [loc]
   (let [node (zip/node loc)
         node-id (:id node)
         tag (node/tag node)
@@ -48,13 +48,12 @@
       (merge
         {:id    node-id
          :tag   tag
-         :depth depth
          :line  (current-line-id)}
         (when (or (node/linebreak? node) (node/comment? node)) ; comments have newlines embedded
           (next-line-id!)
           {:tag :newline})
         (if (node/inner? node)
-          {:children (keep (partial build-node-code-render-tree-node (inc depth)) (child-locs loc))}
+          {:children (keep build-node-code-render-tree-node (child-locs loc))}
           {:text (prepare-node-text node)})
         (if (layout-utils/is-selectable? tag) {:selectable? true})
         (if (layout-utils/string-node? node) {:type :string})
@@ -63,4 +62,4 @@
 (defn build-code-render-tree [loc]
   (reset-line-id!)
   {:tag      :code
-   :children [(doall (build-node-code-render-tree-node 0 loc))]})+   :children [(doall (build-node-code-render-tree-node loc))]})


Bugfix for buttons etc: some :pressed-trigger changes were missed

--- flatguiwidgets/src/flatgui/widgets/abstractbutton.clj
+++ flatguiwidgets/src/flatgui/widgets/abstractbutton.clj
@@ -58,8 +58,15 @@
     :else old-pressed))

 (fg/defevolverfn :pressed-trigger
-  (let [ pressed (get-property component [:this] :pressed)]
-    [(nth old-pressed-trigger 1) pressed]))
+  ;; Important: :pressed-trigger should change only as a concequence of :pressed change. Otherwise
+  ;; if it is changed during the same evolve call with :pressed (e.g. input even processing), it is
+  ;; called again by dependency. This means some :pressed-trigger changes are missed (do not invoke
+  ;; dependents). This is why it has if (= (fg/get-reason) [:this]) check. This will not be needed
+  ;; when evolvers are called only for input events they are interested in.
+  (if (= (fg/get-reason) [:this])
+    (let [ pressed (get-property component [:this] :pressed)]
+      [(nth old-pressed-trigger 1) pressed])
+    old-pressed-trigger))

 (defn button-pressed? [trigger-value]


Update alfa.clj

Update alfa.clj

--- clein/src/practice/alfa.clj
+++ clein/src/practice/alfa.clj
@@ -93,19 +93,13 @@
       res
       (recur (rest i) (conj res (f (first i)))))))

-;;check
-(defn check [f a]
-  (if (= (f a) true)
-    a
-    false))
-
 ;;take-while
 (defn take-while'' [f col]
   (loop [i col
          res []]
     (if (or (= (count i) 0) (= (f (first i)) false))
       res
-      (recur (rest i) (conj res (check f (first i)))))))
+      (recur (rest i) (conj res (first i))))))

 (defn take-while$
   [f col]


Fill out params.

Fill out params.

--- src/onyx/peer/task_pipeline.clj
+++ src/onyx/peer/task_pipeline.clj
@@ -4,7 +4,7 @@
             [onyx.queue.hornetq :refer [hornetq]]
             [onyx.extensions :as extensions]))

-(defn open-session-loop [read-ch]
+(defn open-session-loop [queue read-ch]
   (loop []
     (recur)))

@@ -87,17 +87,17 @@
         :complete-task-ch complete-task-ch
         :reset-payload-node-ch reset-payload-node-ch

-        :open-session-loop (future)
-        :read-batch-loop (future)
-        :decompress-tx-loop (future)
-        :apply-fn-loop (future)
-        :compress-tx-loop (future)
-        :write-batch-loop (future)
-        :status-check-loop (future)
-        :commit-tx-loop (future)
-        :close-session-loop (future)
-        :complete-task-loop (future)
-        :reset-payload-node-loop (future))))
+        :open-session-loop (future (open-session-loop queue read-batch-ch))
+        :read-batch-loop (future (read-batch-loop read-batch-ch decompress-tx-ch))
+        :decompress-tx-loop (future (decompress-tx-loop decompress-tx-ch apply-fn-ch))
+        :apply-fn-loop (future (apply-fn-loop apply-fn-ch compress-tx-ch))
+        :compress-tx-loop (future (compress-tx-loop compress-tx-ch write-batch-ch))
+        :write-batch-loop (future (write-batch-loop write-batch-ch status-check-ch))
+        :status-check-loop (future (status-check-loop status-check-ch commit-tx-ch))
+        :commit-tx-loop (future (commit-tx-loop commit-tx-ch close-session-ch))
+        :close-session-loop (future (close-session-loop close-session-ch complete-task-ch))
+        :complete-task-loop (future (complete-task-loop complete-task-ch reset-payload-node-ch))
+        :reset-payload-node-loop (future (reset-payload-node-loop reset-payload-node-ch)))))

   (stop [component]
     (prn "Stopping Task Pipeline")


CMR-5797 test update.

CMR-5797 test update.

--- access-control-app/int-test/cmr/access_control/int_test/acl_crud_test.clj
+++ access-control-app/int-test/cmr/access_control/int_test/acl_crud_test.clj
@@ -1282,32 +1282,32 @@
                                    (:concept_id acl)
                                    {:token token})))

-    (is (= {"NON_NASA_DRAFT_USER" ["read" "create" "update" "delete"]}
-           (json/parse-string
-             (access-control/get-permissions
-              (test-util/conn-context)
-              {:user_id "user1"
-               :provider "PROV1"
-               :target "NON_NASA_DRAFT_USER"}
-              {:token token}))))
-
-    (is (= {"NON_NASA_DRAFT_USER" ["read" "create" "update" "delete"]}
-           (json/parse-string
-             (access-control/get-permissions
-              (test-util/conn-context)
-              {:user_type "guest"
-               :provider "PROV1"
-               :target "NON_NASA_DRAFT_USER"}
-              {:token token}))))
-
-    (is (= {"NON_NASA_DRAFT_USER" ["read" "update"]}
-           (json/parse-string
-             (access-control/get-permissions
-              (test-util/conn-context)
-              {:user_id "user2"
-               :provider "PROV1"
-               :target "NON_NASA_DRAFT_USER"}
-              {:token token}))))))
+    (testing "MMT DRAFT NON NASA USERS Acl permissions"
+      (are3 [perms params]
+        (is (= {"NON_NASA_DRAFT_USER" perms}
+               (json/parse-string
+                 (access-control/get-permissions
+                  (test-util/conn-context)
+                  params
+                  {:token token}))))
+
+        "user1 permissions"
+        ["read" "create" "update" "delete"]
+        {:user_id "user1"
+         :provider "PROV1"
+         :target "NON_NASA_DRAFT_USER"}
+
+        "guest permissions"
+        ["read"]
+        {:user_type "guest"
+         :provider "PROV1"
+         :target "NON_NASA_DRAFT_USER"}
+
+        "user2 permissions"
+        ["read" "update"]
+        {:user_id "user2"
+         :provider "PROV1"
+         :target "NON_NASA_DRAFT_USER"}))))

 (deftest CMR-5128-mmt-dashboard-acl-test
   (let [token (echo-util/login (test-util/conn-context) "admin")


don't ignore empty lines (close #27)

don't ignore empty lines (close #27)

--- src/parinfer/format/string.cljc
+++ src/parinfer/format/string.cljc
@@ -14,8 +14,7 @@
        (subs orig end)))

 (defn get-lines
-  "fix split-lines by including the last empty line."
+  "get all lines (even empty ones)
+  source: http://stackoverflow.com/a/29614863/142317"
   [text]
-  (let [last-char (str (last text))]
-    (cond-> (vec (string/split-lines text))
-      (= "\n" last-char) (conj ""))))
+  (string/split text #"\n" -1))


Debug mapbox extern

Debug mapbox extern

--- src/pasmo_gigi/geo/ui/core.cljs
+++ src/pasmo_gigi/geo/ui/core.cljs
@@ -11,9 +11,10 @@
             [mapbox.L :as L])
   (:require-macros [cljs.core.async.macros :refer [go]]))

-(.log js/console "access token: " js/L)
+(.log js/console "access token: " (-> js/L .-mapbox))

-(set! (-> js/L .-mapbox .-accessToken) "pk.eyJ1IjoidXJpczc3IiwiYSI6InRuYTZRa3MifQ._Bo-JRcA7QVGocCJvdSoJg")
+(let [mapbox (.-mapbox js/L)]
+  (set! (-> mapbox .-accessToken) "pk.eyJ1IjoidXJpczc3IiwiYSI6InRuYTZRa3MifQ._Bo-JRcA7QVGocCJvdSoJg"))

 (defn mount-root
   []


Ensure side effects are evaluated when inserting/update documents

Thanks to [1], I learned about the dorun function.

  [1] http://stackoverflow.com/a/10857931/28804

--- src/chameleon/crawler.clj
+++ src/chameleon/crawler.clj
@@ -28,7 +28,7 @@
   (mc/insert db/db "samples" (create-sample-document user-map)))

 (defn update-users! [user-maps]
-  (map update-user! user-maps))
+  (dorun (map update-user! user-maps)))

 (defn insert-samples! [user-maps]
-  (map create-sample! user-maps))
+  (dorun (map create-sample! user-maps)))


remove game key events when quitting game

--- src/client/game/core.cljs
+++ src/client/game/core.cljs
@@ -63,7 +63,7 @@

                  :soft-drop false

-                 :game-over false
+                 :quit false
                  :quit-chan (chan)}))

 ; required for pausing/resuming the gravity routine
@@ -88,8 +88,9 @@
   (let [redraw-chan (chan)
         request-anim #(.requestAnimationFrame js/window %)]
     (letfn [(trigger-redraw []
-              (put! redraw-chan 1)
-              (request-anim trigger-redraw))]
+              (when-not (:quit @state)
+                (put! redraw-chan 1)
+                (request-anim trigger-redraw)))]
       (request-anim trigger-redraw)
       redraw-chan)))

@@ -331,37 +332,38 @@
                    56 :eight
                    57 :nine
                    48 :zero}
-        key-name #(-> % .-keyCode key-names)]
-
-    (.addEventListener js/window "keydown"
-      (fn [e]
-        (case (key-name e)
-          :one (do (swap! state assoc :theme 0) (.preventDefault e))
-          :two (do (swap! state assoc :theme 1) (.preventDefault e))
-          :three (do (swap! state assoc :theme 2) (.preventDefault e))
-          :four (do (swap! state assoc :theme 3) (.preventDefault e))
-          :five (do (swap! state assoc :theme 4) (.preventDefault e))
-          :six (do (swap! state assoc :theme 5) (.preventDefault e))
-          :seven (do (swap! state assoc :theme 6) (.preventDefault e))
-          :eight (do (swap! state assoc :theme 7) (.preventDefault e))
-          :nine (do (swap! state assoc :theme 8) (.preventDefault e))
-          :zero (do (swap! state assoc :theme 9) (.preventDefault e))
-          nil)
-        (if (:piece @state)
-          (case (key-name e)
-            :down  (do (put! down-chan true) (.preventDefault e))
-            :left  (do (try-move! -1  0)     (.preventDefault e))
-            :right (do (try-move!  1  0)     (.preventDefault e))
-            :space (do (hard-drop!)          (.preventDefault e))
-            :up    (do (try-rotate!)         (.preventDefault e))
-            nil))))
-
-    (.addEventListener js/window "keyup"
-      (fn [e]
-        (case (key-name e)
-          :down  (put! down-chan false)
-          :shift (toggle-record!)
-          nil)))
+        key-name #(-> % .-keyCode key-names)
+        key-down (fn [e]
+                   (case (key-name e)
+                     :one (do (swap! state assoc :theme 0) (.preventDefault e))
+                     :two (do (swap! state assoc :theme 1) (.preventDefault e))
+                     :three (do (swap! state assoc :theme 2) (.preventDefault e))
+                     :four (do (swap! state assoc :theme 3) (.preventDefault e))
+                     :five (do (swap! state assoc :theme 4) (.preventDefault e))
+                     :six (do (swap! state assoc :theme 5) (.preventDefault e))
+                     :seven (do (swap! state assoc :theme 6) (.preventDefault e))
+                     :eight (do (swap! state assoc :theme 7) (.preventDefault e))
+                     :nine (do (swap! state assoc :theme 8) (.preventDefault e))
+                     :zero (do (swap! state assoc :theme 9) (.preventDefault e))
+                     nil)
+                   (if (:piece @state)
+                     (case (key-name e)
+                       :down  (do (put! down-chan true) (.preventDefault e))
+                       :left  (do (try-move! -1  0)     (.preventDefault e))
+                       :right (do (try-move!  1  0)     (.preventDefault e))
+                       :space (do (hard-drop!)          (.preventDefault e))
+                       :up    (do (try-rotate!)         (.preventDefault e))
+                       nil)))
+        key-up (fn [e]
+                 (when-not (:quit @state)
+                   (case (key-name e)
+                     :down  (put! down-chan false)
+                     :shift (toggle-record!)
+                     nil)))]
+
+    ; Add key events
+    (.addEventListener js/window "keydown" key-down)
+    (.addEventListener js/window "keyup" key-up)

     ; Listen to the down key, but ignore repeats.
     (let [uc (unique down-chan)]
@@ -374,7 +376,13 @@
               ; force gravity to reset
               (put! pause-grav 0)
               (put! resume-grav 0)
-              (recur))))))))
+              (recur))))))
+
+    ; Remove key events when quitting
+    (go
+      (<! (:quit-chan @state))
+      (.removeEventListener js/window "keydown" key-down)
+      (.removeEventListener js/window "keyup" key-up))))

 ;;------------------------------------------------------------
 ;; Opponent drawing
@@ -412,7 +420,7 @@

 (defn cleanup []

-  ; Create new quit channel (used to stop go-blocks)
+  (swap! state assoc :quit true)
   (close! (:quit-chan @state))

   )


add helpers for streams

add helpers for streams

--- src/clj/cheshire/core.clj
+++ src/clj/cheshire/core.clj
@@ -38,6 +38,7 @@

 ;; alias for clojure-json users
 (def encode generate-string)
+(def encode-stream generate-stream)

 (defn generate-smile
   "Returns a SMILE-encoded byte-array for the given Clojure object."
@@ -65,6 +66,7 @@

 ;; alias for clojure-json users
 (def decode parse-string)
+(def decode-stream parse-stream)

 (defn parse-smile
   "Returns the Clojure object corresponding to the given SMILE-encoded bytes."


* src/clj/cljs/compiler.clj: fix typo

* src/clj/cljs/compiler.clj: fix typo

--- src/clj/cljs/compiler.clj
+++ src/clj/cljs/compiler.clj
@@ -396,7 +396,7 @@
   (when-not (= :statement (:context env))
     (let [loop-locals (seq (concat
                             (mapcat :names (filter #(and % @(:flag %)) recur-frames))
-                            (mapcat :name loop-lets)))]
+                            (mapcat :names loop-lets)))]
       (when loop-locals
         (when (= :return (:context env))
             (print "return "))


Removing symbol? check from simple-keys? in analyze-map. Fixes issue with #<undefined> values in maps

--- src/clj/cljs/compiler.clj
+++ src/clj/cljs/compiler.clj
@@ -823,7 +823,7 @@
 (defn analyze-map
   [env form name]
   (let [expr-env (assoc env :context :expr)
-        simple-keys? (every? #(or (string? %) (keyword? %) (symbol? %))
+        simple-keys? (every? #(or (string? %) (keyword? %))
                              (keys form))
         ks (disallowing-recur (vec (map #(analyze expr-env % name) (keys form))))
         vs (disallowing-recur (vec (map #(analyze expr-env % name) (vals form))))]


Print input value on change.

Print input value on change.

--- src/cljs/tunnit/core.cljs
+++ src/cljs/tunnit/core.cljs
@@ -50,17 +50,28 @@
 (defn week-dates []
   (map-kv day-map count-date))

+(defn handle-change [e]
+  (print (str "value: " (.. e -target -value))))
+
 (defcomponent project-entries [app]
   (render [this]
     (ot/div
       (map (fn [project]
              (ot/div {:id "project-row" :class "project-row"}
-                     (ot/input {:class "project-name" :type "text" :value (:name project)})
+                     (ot/input {
+                                :class "project-name"
+                                :type "text"
+                                :value (:name project)
+                                :on-change #(handle-change %)})

                      (for [day (range 1 8)]
                        (let [hours
                              (get-in project [:entries day :hours])]
-                         (ot/input {:class "hour-entry" :value hours})))))
+                         (ot/input {
+                                    :class "hour-entry"
+                                    :value hours
+                                    :on-change #(handle-change %)}
+                                   )))))
            (:projects app)))))

 (defcomponent week-view [app]


ns'ed

ns'ed

--- src/cljs_dnd/wrapper.cljs
+++ src/cljs_dnd/wrapper.cljs
@@ -1,6 +1,5 @@
-; (defn draggable []
-;   (reagent/create-class {:reagent-render draggable-render
-;                          :component-did-mount draggable-did-mount}))
+
+(ns cljs-dnd.wrapper)

 (defn drag-source [type comp target conn-fn]
@@ -14,3 +13,7 @@
   @type is enum
   @comp is component to decorate
   @conn-fn accepts @connect & @monitor")
+
+; (defn draggable []
+;   (reagent/create-class {:reagent-render draggable-render
+;                          :component-did-mount draggable-did-mount}))


Cleaning a bit

Cleaning a bit

--- src/clojure/yaw/scene.clj
+++ src/clojure/yaw/scene.clj
@@ -80,19 +80,19 @@
                 (w/set-point-light!
                  world
                  n
-                 :color (color-rgb (get v :color [:kw :white]))
+                 :color (color-rgb (:color v))
                  :i (get v :i 0.3)
-                 :position (get v :pos [0 0 0]))))
+                 :position (:pos v))))
             (-> items :lights :points))
       (run! (fn [[k v]]
               (let [n (:id-n v)]
                 (w/set-spot-light!
                  world
                  n
-                 :color (color-rgb (get v :color [:kw :white]))
+                 :color (color-rgb (:color v))
                  :i (get v :i 0.3)
-                 :position (get v :pos [0 0 0])
-                 :direction (get v :dir [0 0 -1])
+                 :position (:pos v)
+                 :direction (:dir v)
                  :angle (get v :angle 20))))
             (-> items :lights :spots))
       (run! (fn [[k v]]
@@ -104,17 +104,8 @@
                     i (w/create-item!
                        world
                        :id (str k)
-                       :position (get v :pos [0 0 0])
+                       :position (:pos v)
                        :scale (get v :scale 1)
                        :mesh m)]
                 (apply w/rotate! i (explode (get v :rot [0 0 0])))))
             (:items items)))))
-
-(display [:scene
-          {:skybox {:color [0.3 0 0.3] :scale [30 30 30]}}
-          [:ambient {:color :white :i 0.1}]
-          [:light :test/point 0 {:i 0.5 :color :red :pos [1 1 -5]}]
-          [:spot :test/spot 0 {:i 0.6 :color [0 0 1] :pos [0 0 0] :dir [0 0 -1] :angle 1}]
-          [:sun {:color :yellow :i 0.4 :dir [-1 -1 -1]}]
-          [:item :test/cone {:mesh :mesh/cone :mat :white :pos [0 0 -5] :rot [-90 0 0]}]
-          [:item :test/box {:mesh :mesh/box :pos [2 1 -7] :mat :blue}]])


Работа надо отображением выбора от dataform-search в отдельной панели

--- radiolamp-6P3S/src/r6p3s/complex/dataform_search.cljs
+++ radiolamp-6P3S/src/r6p3s/complex/dataform_search.cljs
@@ -8,6 +8,7 @@
             [r6p3s.net :as rnet]
             [r6p3s.ui.panel-with-table :as panel-with-table]
             [r6p3s.ui.glyphicon :as glyphicon]
+            [r6p3s.ui.font-icon :as font-icon]
             [r6p3s.ui.button :as button]
             [r6p3s.cpt.input :as input]
             [r6p3s.cpt.toggle-button :as toggle-button]
@@ -15,8 +16,7 @@
             [r6p3s.cpt.nav-tabs :as nav-tabs]
             [r6p3s.cpt.select :as select]
             [r6p3s.cpt.textarea :as textarea]
-            [r6p3s.cpt.multi-select :as multi-select]
-            [r6p3s.cpt.toggle-button :as toggle-button]))
+            [r6p3s.cpt.multi-select :as multi-select]))

 (def ^:const padding 4)
@@ -26,7 +26,8 @@
          selector
          selector-selected
          selector-selected-set
-         selector-selected-clean)
+         selector-selected-clean
+         selector-selected-as-panel)

 (defn make-app-init
@@ -105,6 +106,29 @@

+(defn selected-render
+  "Панель отображения выбранных элементов"
+  [{:keys [on? realtype selectors]}
+   {:keys [fields] :as rbs-scheme}
+   rbs-data
+   opts]
+
+  (let [{:keys [icon text]} (get-in rbs-scheme [:realtype realtype])]
+    (dom/div nil
+             (dom/div nil "Фильтр: " (if on? "да" "нет")
+                      (when on? (dom/b #js {:className "text-primary"}
+                                       " - " (font-icon/render icon) " " text)))
+             (->> selectors
+                  (map (fn [{:keys [field selected]}]
+                         (selector-selected-as-panel
+                          selected (fields field)
+                          rbs-data
+                          opts)))
+                  (filter (comp not nil?))
+                  (interpose ", ")
+                  (apply dom/div nil)))))
+
+

@@ -229,7 +253,12 @@
                     e)))

-
+(defn- cell-panel
+  [opts class-name t e]
+  (dom/span #js {:className class-name}
+            (glyphicon/render "asterisk")
+            (dom/span nil t ": ")
+            (dom/b #js {:className "text-success"} e)))

@@ -242,13 +271,13 @@
 ;;;**************************************************************************************************

-(defmulti selector-app-init       (fn [_ {{type :type} :search}] type))
-(defmulti selector-fill-rbs       (fn [_ {{type :type} :search} _] type))
-(defmulti selector                (fn [_ {{type :type} :search} _ opts] type))
-(defmulti selector-selected       (fn [_ {{type :type} :search}] type))
-(defmulti selector-selected-set   (fn [_ {{type :type} :search} _] type))
-(defmulti selector-selected-clean (fn [_ {{type :type} :search}] type))
-
+(defmulti selector-app-init          (fn [_ {{type :type} :search}] type))
+(defmulti selector-fill-rbs          (fn [_ {{type :type} :search} _] type))
+(defmulti selector                   (fn [_ {{type :type} :search} _ opts] type))
+(defmulti selector-selected          (fn [_ {{type :type} :search}] type))
+(defmulti selector-selected-set      (fn [_ {{type :type} :search} _] type))
+(defmulti selector-selected-clean    (fn [_ {{type :type} :search}] type))
+(defmulti selector-selected-as-panel (fn [_ {{type :type} :search} _ opts] type))

 ;;------------------------------------------------------------------------------
@@ -289,6 +318,13 @@
   (println "app: " app)
   (println)
   (selector-app-init app meta))
+
+(defmethod selector-selected-as-panel :default
+  [selected {{type :type} :search :as meta} _ opts]
+  (println "type: " type)
+  (println "selected: " selected)
+  (println)
+  (cell-panel opts "text-danger" (str type) (str selected)))

 ;; END default
 ;;..............................................................................
@@ -335,6 +371,15 @@
        (toggle-button/set-value! row (contains? selected-vals val)))
      app)))

+(defmethod selector-selected-as-panel :multi-buttons
+  [selected {:keys [text]} _ opts]
+  (when-not (empty? selected)
+    (->> selected
+         (map (fn [{:keys [val cmp]}]
+                (str val (if (= cmp :<=) "+" ""))))
+         (clojure.string/join ",")
+         (cell-panel opts "" text))))
+

 ;; END multi-buttons
 ;;..............................................................................
@@ -375,6 +420,11 @@
   [app _ selected]
   (input/set-value! app selected))

+(defmethod selector-selected-as-panel :band-integer-from
+  [selected {:keys [text]} _ opts]
+  (when-not (nil? selected)
+    (cell-panel opts "" text (str "oт " selected))))
+

 ;; END band-integer-from
 ;;..............................................................................
@@ -413,6 +463,11 @@
 (defmethod selector-selected-set :band-integer-to
   [app _ selected]
   (input/set-value! app selected))
+
+(defmethod selector-selected-as-panel :band-integer-to
+  [selected {:keys [text]} _ opts]
+  (when-not (nil? selected)
+    (cell-panel opts "" text (str "до " selected))))

 ;; END band-integer-to
@@ -466,6 +521,12 @@
       (update-in [:to] input/set-value! to)))

+(defmethod selector-selected-as-panel :band-integer-from-to
+  [{:keys [from to]} {:keys [text]} _ opts]
+  (when (or (not (nil? from)) (not (nil? to)))
+    (cell-panel opts "" text (str "от " (or from "...") " до " (or to "...")))))
+
+
 ;; END band-integer-from-to
 ;;..............................................................................

@@ -497,6 +558,12 @@
 (defmethod selector-selected-set :boolean
   [app _ selected]
   (toggle-button/set-value! app selected))
+
+
+(defmethod selector-selected-as-panel :boolean
+  [selected {:keys [text]} _ opts]
+  (when-not (nil? selected)
+    (cell-panel opts "" text (if selected "да" "нет"))))

 ;; END boolean
@@ -540,6 +607,13 @@
   [app _ selected]
   (toggle-buttons-selector/set-selected app [selected]))

+(defmethod selector-selected-as-panel :boolean-nm
+  [selected {:keys [text]} _ opts]
+  (condp = selected
+      :y (cell-panel opts "" text "да")
+      :n (cell-panel opts "" text "нет")
+      nil))
+
 ;; END boolean-nm
 ;;..............................................................................

@@ -583,6 +657,13 @@
   [app _]
   (multi-select/selected-clean app))

+
+
+(defmethod selector-selected-as-panel :rbs-multi-select
+  [selected {:keys [text]} rbs-data opts]
+  (when-not (empty? selected)
+    (cell-panel opts "" text (str selected))))
+
 ;; END rbs-multi-select
 ;;..............................................................................


Parse trivial patches

Parse trivial patches

--- src/atom_finder/questions/edit_lines.clj
+++ src/atom_finder/questions/edit_lines.clj
@@ -86,8 +86,6 @@
     {:author author
      :project project}))

-(def svn-repo (gitp/load-repo (expand-home "~/opt/src/atom-finder/subversion")))
-
 ;; find commented atoms for Baishakhi 2017-11-29
 '((-<>> "~/opt/src/atom-finder"
        expand-home
@@ -113,6 +111,6 @@
                                )))
                 (take 100))))
        (map #(array-map :atom (:atom %) :url (github-commit-url (:author %) (:project %) (:rev-str %) (:file %) (:line %) "L")))
-       (maps-to-csv "baishakhi-atom-commits_2017-11-30.csv")
+       (maps-to-csv "baishakhi-atom-commits_2017-11-30_2.csv")
        time-mins
    ))


Order the comments before they are coerced to an array.

--- src/oc/storage/db/common.clj
+++ src/oc/storage/db/common.clj
@@ -37,8 +37,8 @@
                                        (r/filter (r/fn [interaction-row]
                                         ;; Filter out reactions
                                         (r/ge (r/get-field interaction-row :body) "")))
+                                       (r/order-by (r/desc :created-at))
                                        (r/coerce-to :array)
-                                       (r/order-by (r/desc :created-at))
                                        (r/default (r/fn [_err]
                                         {:created-at (r/default
                                                        (r/get-field post-row :published-at)
@@ -113,8 +113,8 @@
                                       (r/and
                                        (r/ge (r/get-field interaction-row :body) "")
                                        (r/ne (r/get-field (r/get-field interaction-row :author) :user-id) user-id))))
+                                     (r/order-by (r/desc :created-at))
                                      (r/coerce-to :array)
-                                     (r/order-by (r/desc :created-at))
                                      (r/nth 0)
                                      (r/default {:created-at (r/default
                                                                (r/get-field post-row :published-at)


Fix guessing of group-url

Fix guessing of group-url

--- src/braid/client/gateway/create_group/events.cljs
+++ src/braid/client/gateway/create_group/events.cljs
@@ -15,15 +15,15 @@
 (reg-event-fx
   :gateway.action.create-group/guess-group-url
   (fn [{state :db} _]
-    (let [group-name (get-in state [:fields :gateway.action.create-group/name :value])
-          group-url (get-in state [:fields :gateway.action.create-group/url :value])]
+    (let [group-name (get-in state [:fields :gateway.action.create-group/group-name :value])
+          group-url (get-in state [:fields :gateway.action.create-group/group-url :value])]
       {:db (if (string/blank? group-url)
              (-> state
-                 (assoc-in [:fields :gateway.action.create-group/url :value] (slugify group-name))
-                 (assoc-in [:fields :gateway.action.create-group/url :untouched?] false))
+                 (assoc-in [:fields :gateway.action.create-group/group-url :value] (slugify group-name))
+                 (assoc-in [:fields :gateway.action.create-group/group-url :untouched?] false))
              state)
-       :dispatch-n [[:gateway/clear-errors :gateway-action.create-group/url]
-                    [:gateway/validate-field :gateway-action.create-group/url]]})))
+       :dispatch-n [[:gateway/clear-errors :gateway.action.create-group/group-url]
+                    [:gateway/validate-field :gateway.action.create-group/group-url]]})))

 (reg-event-fx
   :gateway.action.create-group/remote-create-group


(TK-214) Update puppetlabs.puppetserver.jruby-request/wrap-with-environment-validation doc string

--- src/clj/puppetlabs/puppetserver/jruby_request.clj
+++ src/clj/puppetlabs/puppetserver/jruby_request.clj
@@ -57,7 +57,7 @@

 (defn wrap-with-environment-validation
   "Middleware function which validates the presence and syntactical content
-  of an environment in a ring request.  If validation fails, a ::bad-request
+  of an environment in a ring request.  If validation fails, a :bad-request
   slingshot exception is thrown."
   [handler]
   (fn [request]


Fix typo in doc string param

Fix typo in doc string param

--- src/cognitect/transit.clj
+++ src/cognitect/transit.clj
@@ -114,7 +114,7 @@

    An optional opts map may be passed. Supported options are:

-   :Handlers - a map of types to WriteHandler instances, they are merged
+   :handlers - a map of types to WriteHandler instances, they are merged
    with the default-handlers and then with the default handlers
    provided by transit-java."
   ([out type] (writer out type {}))


admin event notification, empty stream

admin event notification, empty stream

--- src/cljs/salava/social/ui/dashboard.cljs
+++ src/cljs/salava/social/ui/dashboard.cljs
@@ -209,7 +209,7 @@
              [:li (t :social/Notactivatedbody5)]
              [:li (t :social/Notactivatedbody6)]]]]
           [:div.content
-           (when (and (admin?) (seq admin-events)) [:div.notification-div.ax_default {:style {:text-align "left" :margin-bottom "25px" :height "35px"}}
+           (when (and (admin?) (seq admin-events)) [:div.notification-div.ax_default {:style {:text-align "left" :margin-bottom "20px" :height "35px"}}
                                                     [:a {:href (path-for "/admin/tickets") :style {:color "unset"}}
                                                      [:div {:class "media"}
                                                            [:div.media-left
@@ -218,18 +218,19 @@
                                                             [:div.content-text
                                                              [:p.content-heading (str (count admin-events) " " (t :social/Emailadmintickets))]]]]]])

-           (reduce (fn [r event]
-                       (conj r [:div.notification-div.ax_default
-                                (cond
-                                  (and (= "badge" (:type event)) (= "follow" (:verb event))) (follow-event-badge event state)
-                                  (and (= "user" (:type event)) (= "follow" (:verb event))) (follow-event-user event state)
-                                  (and (= "badge" (:type event)) (= "publish" (:verb event))) (publish-event-badge event state)
-                                  (and (= "page" (:type event)) (= "publish" (:verb event))) (publish-event-page event state)
-                                  (= "advert" (:type event)) (badge-advert-event event state)
-                                  (= "message" (:verb event)) [message-event event state]
-                                  :else "")]))
-
-                   [:div] events)])]]]]))
+           (if (seq (:events @state))(reduce (fn [r event]
+                                              (conj r [:div.notification-div.ax_default
+                                                       (cond
+                                                         (and (= "badge" (:type event)) (= "follow" (:verb event))) (follow-event-badge event state)
+                                                         (and (= "user" (:type event)) (= "follow" (:verb event))) (follow-event-user event state)
+                                                         (and (= "badge" (:type event)) (= "publish" (:verb event))) (publish-event-badge event state)
+                                                         (and (= "page" (:type event)) (= "publish" (:verb event))) (publish-event-page event state)
+                                                         (= "advert" (:type event)) (badge-advert-event event state)
+                                                         (= "message" (:verb event)) [message-event event state]
+                                                         :else "")]))
+
+                                      [:div] events)
+            [:div.col-md-12 (t :social/Emptystreamheader)])])]]]]))

 (defn latest-earnable-badges []


Doubled max points

Doubled max points

--- src/clojush/problems/boolean/valiant.clj
+++ src/clojush/problems/boolean/valiant.clj
@@ -97,7 +97,7 @@
 ;                                   (repeat 25
 ;                                           '(boolean_and boolean_or boolean_not exec_if))))
 ;   :use-lexicase-selection true
-;   :max-points 20000
+;   :max-points 40000
 ;   :max-genome-size-in-initial-program 10
 ;   :population-size 100
 ;   :evalpush-limit 10000
@@ -121,11 +121,11 @@
                             (apply concat
                                    (repeat 25
                                            '(boolean_and boolean_or boolean_not exec_if))))
-   :max-points 2000
+   :max-points 4000
    :max-genome-size-in-initial-program 100
    :population-size 100
    :evalpush-limit 2000
    :genetic-operator-probabilities {[:alternation :uniform-mutation] 1.0} ;Somewhat equivalent to normal Push's ULTRA operator
    :alignment-deviation 20
    ;:use-single-thread true
-   })+   })


touch up docstring

touch up docstring

--- src/puppetlabs/trapperkeeper/core.clj
+++ src/puppetlabs/trapperkeeper/core.clj
@@ -180,7 +180,9 @@

 (defn main
   "Launches the trapperkeeper framework. This function blocks until
-  trapperkeeper is shut down. This is called by the magic, AOT-compiled `-main`."
+  trapperkeeper is shut down. This may be called directly, but is also called by
+  `puppetlabs.trapperkeeper.core/-main` if you use `puppetlabs.trapperkeeper.core`
+  as the `:main` namespace in your leinengen project."
   [& args]
   {:pre [(seq? args)
          (every? string? args)]}


Fix set constructor

Fix set constructor


Update redis host

Update redis host

--- clojure-lang/src/clojure_lang/util.clj
+++ clojure-lang/src/clojure_lang/util.clj
@@ -9,7 +9,7 @@
           :max-wait-ms 5000
           :soft-min-evictable-idle-time-ms 60000
           :min-evictable-idle-time-ms -1}
-   :spec {:host "shiva.local"
+   :spec {:host "localhost"
           :port 6379}})


delaney.clj: print-method for DSymbol now produces the usual code.

--- clojure/org/gavrog/clojure/delaney.clj
+++ clojure/org/gavrog/clojure/delaney.clj
@@ -202,12 +202,18 @@
                (= (.v# self) (.v# other)))))

 (defmethod print-method DSymbol [ds ^Writer w]
-  (print-method (list (symbol "DSymbol.")
-                      (dim ds)
-                      (size ds)
-                      (.s# ds)
-                      (.v# ds))
-                w))
+  (let [images (fn [i] (map #(or (s ds i %) 0) (orbit-reps ds [i])))
+        spins (fn [i] (map #(or (v ds i (inc i) %) 0)
+                           (orbit-reps ds [i (inc i)])))
+        ops-str (s/join "," (map #(s/join " " (images %)) (indices ds)))
+        vs-str (s/join "," (map #(s/join " " (spins %)) (range (.dim ds))))
+        dims-str (if (= 2 (.dim ds))
+                   (str (.size ds))
+                   (str (.size ds) " " (.dim ds)))
+        code (str "<1.1:" dims-str ":" ops-str ":" vs-str ">")]
+    (if *print-readably*
+      (print-simple (str "(dsymbol \"" code "\")") w)
+      (print-simple code w))))

 (defmulti dsymbol class)


delaney.clj: changed parameter names in (covers)

--- clojure/org/gavrog/clojure/delaney.clj
+++ clojure/org/gavrog/clojure/delaney.clj
@@ -579,17 +579,17 @@
   ([ds1 ds2 & xds]
     (reduce append (append ds1 ds2) xds)))

-(defn cover [ds nr-cosets action]
+(defn cover [ds nr-sheets transfer]
   (let [ds (dsymbol ds)
         idcs (indices ds)
         d (dim ds)
         n (size ds)
         ops (into {} (for [i idcs]
                        [i (into {} (for [D (elements ds)
-                                         k (range nr-cosets)]
+                                         k (range nr-sheets)]
                                      [(+ (* k n) D)
-                                      (+ (* (action k i D) n) (s ds i D))]))]))
-        t (DSymbol. d (* n nr-cosets) ops {})
+                                      (+ (* (transfer k i D) n) (s ds i D))]))]))
+        t (DSymbol. d (* n nr-sheets) ops {})
         vs (into {} (for [[i j] (zipmap idcs (rest idcs))]
                       [i (into {} (for [D (orbit-reps t [i j])
                                         :let [D0 (-> D dec (mod n) inc)


fix date formatting

fix date formatting

--- src/cljs/early_vote_site/early_vote_site_form/views.cljs
+++ src/cljs/early_vote_site/early_vote_site_form/views.cljs
@@ -10,7 +10,7 @@
         fips (first @(re-frame/subscribe [:fips-codes]))]
     [:div
      [:h1 (-> election :state-fips utils/format-fips)]
-     [:h2 (-> election :election-date utils/format-date)]
+     [:h2 (-> election :election-date utils/format-date-string)]
      [:div {:name "create-early-vote-site-form"}
       [:div {:class "form-group row mx-sm-3"
              :style


Added a test for the default plugin's `pass`

--- test/midje/emission/plugins/t_default.clj
+++ test/midje/emission/plugins/t_default.clj
@@ -1,9 +1,19 @@
 (ns midje.emission.plugins.t-default
-  (:use midje.emission.plugins.default
-        [midje sweet util test-util])
+  (:use [midje sweet util test-util])
   (:require [midje.config :as config]
+            [midje.emission.plugins.default :as plugin]
+            [midje.emission.api :as emit]
+            [midje.emission.state :as state]
             [midje.clojure-test-facade :as ctf]))

+
+(defmacro innocuously [& body]
+  `(state/with-emission-map plugin/emission-map
+     (captured-output
+      ~@body)))
+
+(fact "passes produce no output"
+  (innocuously (emit/pass)) => "")

 (fact "report fact being entered"
   (let [name+desc-fact (with-meta (fn[])
@@ -13,7 +23,7 @@

     (fact "prints names in preference to descriptions"
-      (captured-output (starting-to-check-fact name+desc-fact)) => #"Checking named"
-      (captured-output (starting-to-check-fact desc-fact)) => #"Checking desc"
-      (captured-output (starting-to-check-fact unnamed)) => #"Checking fact at \(file:3\)")))
+      (innocuously (plugin/starting-to-check-fact name+desc-fact)) => #"Checking named"
+      (innocuously (plugin/starting-to-check-fact desc-fact)) => #"Checking desc"
+      (innocuously (plugin/starting-to-check-fact unnamed)) => #"Checking fact at \(file:3\)")))


[#92] Generate a var for each multimethod implementation

--- priv/clojure/core.clj
+++ priv/clojure/core.clj
@@ -1668,7 +1668,12 @@
   "Creates and installs a new method of multimethod associated with dispatch-value. "
   {:added "1.0"}
   [multifn dispatch-val & fn-tail]
-  `(clojerl.MultiFn/add_method.e ~(name multifn) ~dispatch-val (fn ~@fn-tail)))
+  (let [fn-name (gensym (str (name multifn) "_method_"))]
+    `(do
+       (defn ~fn-name ~@fn-tail)
+       (clojerl.MultiFn/add_method.e ~(name multifn)
+                                     ~dispatch-val
+                                     (var ~fn-name)))))

 (defn remove-all-methods
   "Removes all of the methods of multimethod."