Fixed AQL science-keywords case sensitive search.

--- src/cmr/search/services/aql/conversion.clj
+++ src/cmr/search/services/aql/conversion.clj
@@ -36,13 +36,13 @@
                 :entry-id {:name :entry-id :type :string}
                 :associated-difs {:name :associated-difs :type :string}
                 :scienceKeywords {:name :science-keywords :type :science-keywords}
-                :categoryKeyword {:name :category :type :string}
-                :topicKeyword {:name :topic :type :string}
-                :termKeyword {:name :term :type :string}
-                :variableLevel1Keyword {:name :variable-level-1 :type :string}
-                :variableLevel2Keyword {:name :variable-level-2 :type :string}
-                :variableLevel3Keyword {:name :variable-level-3 :type :string}
-                :detailedVariableKeyword {:name :detailed-variable :type :string}
+                :categoryKeyword {:name :science-keywords.category :type :string}
+                :topicKeyword {:name :science-keywords.topic :type :string}
+                :termKeyword {:name :science-keywords.term :type :string}
+                :variableLevel1Keyword {:name :science-keywords.variable-level-1 :type :string}
+                :variableLevel2Keyword {:name :science-keywords.variable-level-2 :type :string}
+                :variableLevel3Keyword {:name :science-keywords.variable-level-3 :type :string}
+                :detailedVariableKeyword {:name :science-keywords.detailed-variable :type :string}
                 :TwoDCoordinateSystemName {:name :two-d-coordinate-system-name :type :string}
                 :spatial {:name :spatial :type :spatial}}
    :granule {:dataCenterId {:name :provider-id :type :collection-query :coll-tag :dataCenterId}


Using clojure functions instead of Java and dec

--- src/app/interactive.clj
+++ src/app/interactive.clj
@@ -57,10 +57,10 @@

 (defn- load-classes [ast]
   (let [dirnameWithApex (nth (nth (first ast) 2) 1)
-        dirname (subs dirnameWithApex 1 (+ (.length dirnameWithApex) -1))]
+        dirname (subs dirnameWithApex 1 (dec (count dirnameWithApex)))]
     (println "Loading" dirname)
     (let [loadedCus (cus dirname)]
-      (println "Java files loaded:" (.size loadedCus))
+      (println "Java files loaded:" (count loadedCus))
       (interactive {:cus loadedCus}))))

 (defn- mc-operation [state threshold]


Don't use make-implication directly

Don't use make-implication directly

but with conexp/ prefix

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

--- src/conexp/contrib/algorithms/downing_gallier.clj
+++ src/conexp/contrib/algorithms/downing_gallier.clj
@@ -7,7 +7,7 @@
 ;; You must not remove this notice, or any other, from this software.

 (ns conexp.contrib.algorithms.downing-gallier
-  (:use [conexp.base :only (not-yet-implemented, def-)]
+  (:use [conexp.base :only (not-yet-implemented, difference)]
         [conexp.fca.implications :only (premise conclusion)]))

 ;;; Implementation
@@ -69,7 +69,7 @@
 (test/deftest test-close-under-implications
   (test/are [start impls result]
     (= result
-       (close-under-implications (map (partial apply make-implication)
+       (close-under-implications (map (partial apply conexp/make-implication)
                                       impls)
                                  start))
     ;;
@@ -79,9 +79,9 @@
     #{1 2 3 4 5 6 7 8} [[#{1} #{4}] [#{2} #{3}] [#{4} #{5 6 7}] [#{6 7} #{8}] [#{9 10 11} #{8}]] #{1 2 3 4 5 6 7 8}))

 (test/deftest test-clop-by-implications
-  (let [clop (clop-by-implications #{(make-implication #{1} #{2}),
-                                     (make-implication #{3} #{4}),
-                                     (make-implication #{} #{1})})]
+  (let [clop (clop-by-implications #{(conexp/make-implication #{1} #{2}),
+                                     (conexp/make-implication #{3} #{4}),
+                                     (conexp/make-implication #{} #{1})})]
     ;;
     (test/is (= #{1 2} (clop #{1}) (clop #{2}) (clop #{})))
     (test/is (= #{1 2 3 4} (clop #{3})))


Removing dependency for conexp.util.xml

Removing dependency for conexp.util.xml

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

--- src/main/clojure/conexp/io/contexts.clj
+++ src/main/clojure/conexp/io/contexts.clj
@@ -7,8 +7,7 @@
 ;; You must not remove this notice, or any other, from this software.

 (ns conexp.io.contexts
-  (:use [conexp.util.xml :only (prxml)]
-        conexp.base
+  (:use conexp.base
         conexp.fca.contexts
         conexp.io.util
         conexp.io.latex)


Parameterized render-net.

Parameterized render-net.

--- src/cbfg/world-net.cljs
+++ src/cbfg/world-net.cljs
@@ -53,9 +53,9 @@
                                                         conj [ts v])))
                  (recur num-requests (inc num-responses)))))))

-(defn render-net [vis]
+(defn render-net [vis net-actx-id output-el-id]
   (let [net-state (:loop-state (second (first (filter (fn [[actx actx-info]]
-                                                        (= (last actx) "net-1"))
+                                                        (= (last actx) net-actx-id))
                                                       (:actxs vis)))))
         addrs (atom {})
         coords (atom {})]
@@ -110,7 +110,7 @@
                       "
"])
                   (sort-by first @addrs))
              "
"]]
-      (set-el-innerHTML "net"
+      (set-el-innerHTML output-el-id
                         (apply str (flatten h))))))

 (defn world-vis-init [el-prefix init-event-delay]
@@ -140,7 +140,9 @@
                                                client-hist
                                                client-send-ch client-recv-ch
                                                vis-chs world-vis-init el-prefix))))))))
-              el-prefix render-net init-event-delay)
+              el-prefix
+              #(render-net % "net-1" "net")
+              init-event-delay)
     cmd-inject-ch))

 (start-test "net-test" cbfg.net-test/test)


Print commas in cljs-devtools headers

Print commas in cljs-devtools headers

--- src/day8/re_frame/trace/panels/app_db.cljs
+++ src/day8/re_frame/trace/panels/app_db.cljs
@@ -101,7 +101,6 @@
                                       (map jsonml->hiccup children)))

         (= head "object") [data-structure jsonml]
-        (= jsonml ", ") " "
         :else jsonml))))

 (defn subtree [data title]


Made the :verbose option for simulate-some-retinas nicer.

--- src/main/clojure/brainardlab/nben/retina/util.clj
+++ src/main/clojure/brainardlab/nben/retina/util.clj
@@ -131,7 +131,7 @@
                          :image-count image-count
                          :init-reduce (cons [0 nil] (repeat (dec (count my-retinas)) nil))
                          :analysis (cons (fn [[iter dat] sig]
-                                           (if (= 9999 (mod iter 10000))
+                                           (if (= 0 (mod iter 1000))
                                              (println "Iteration " iter "..."))
                                            [(inc iter) (correlation-analysis dat sig)])
                                          (repeat (dec (count my-retinas)) correlation-analysis))


tags can't be hardcoded, they deserve a multimethod implementation too

--- src/clabango/parser.clj
+++ src/clabango/parser.clj
@@ -1,5 +1,6 @@
 (ns clabango.parser
-  (:use [clabango.filters :only [template-filter]]))
+  (:use [clabango.filters :only [template-filter]]
+        [clabango.tags :only [template-tag]]))

 (declare parse)

@@ -142,24 +143,58 @@
               :body token}
              (ast (rest tokens)))))))

-(defn load-template [template]
-  (-> (Thread/currentThread)
-      (.getContextClassLoader)
-      (.getResource template)
-      slurp))
-
-(defn parse-tags [ast context]
+(def valid-tags {"include" :inline
+                 "block" "endblock"})
+
+(defn valid-tag? [tag-name]
+  (or (valid-tags tag-name)
+      (when-let [start-tag-name (second (re-find #"end(.*)" tag-name))]
+        (valid-tags start-tag-name))))
+
+(defn parse-tags [ast]
   (lazy-seq
    (when-let [node (first ast)]
      (if (= :tag (:type node))
        (let [[tag & args] (.split (.trim (:token (:body node))) " ")]
-         (case tag
-           "include" (let [[template] args
-                           template (second (re-find #"\"(.*)\"" template))]
-                       (concat (parse (load-template template) context)
-                               (parse-tags (rest ast) context)))
+         (if (valid-tag? tag)
+           (cons (assoc node
+                   :tag-name tag
+                   :args args)
+                 (parse-tags (rest ast)))
            (throw (Exception. (str "unknown tag: " node)))))
-       (cons node (parse-tags (rest ast) context))))))
+       (cons node (parse-tags (rest ast)))))))
+
+(defn find-close-tag-for [tokens tag-name]
+  (let [[a b c & rest-tokens] tokens]
+    (if (and (= (:token a) :open-tag)
+             (string? (:token b))
+             (= (:token c) :close-tag))
+      [{:type :tag
+        :body b}
+       rest-tokens]
+      (throw (Exception. (str "parsing error after " a))))))
+
+(defn tag-is? [tag-name node]
+  (= (:tag-name node) tag-name))
+
+(defn interpret-tags [ast context]
+  (lazy-seq
+   (when-let [node (first ast)]
+     (if (= :tag (:type node))
+       (let [end-tag-name (valid-tag? (:tag-name node))]
+         (if-not (or (nil? end-tag-name)
+                     (= end-tag-name :inline))
+           (let [[body end-node rest-ast] (partition-by
+                                           (partial tag-is? end-tag-name)
+                                           ast)
+                 body (conj (vec body) end-node)]
+             (let [[s new-context] (template-tag (:tag-name node) body context)]
+               (concat (parse s new-context)
+                       (interpret-tags rest-ast new-context))))
+           (let [[s new-context] (template-tag (:tag-name node) [node] context)]
+             (concat (parse s new-context)
+                     (interpret-tags (rest ast) new-context)))))
+       (cons node (interpret-tags (rest ast) context))))))

 (defn parse-filters [ast context]
   (lazy-seq
@@ -186,14 +221,17 @@
           (do
             (.append sb (:token (:body node)))
             (recur (rest ast)))
-          (throw (Exception. "there should only be AST nodes of type :string")))
+          (throw (Exception.
+                  (str "there should only be AST nodes of type :string, got: "
+                       node))))
         (str sb)))))

 (defn parse [s context]
   (-> s
       lex
       ast
-      (parse-tags context)
+      parse-tags
+      (interpret-tags context)
       (parse-filters context)))

 (def render (comp realize parse))


added be called

added be called

--- src/babel/english/lexicon.clj
+++ src/babel/english/lexicon.clj
@@ -116,6 +116,28 @@
                                   :3plur "were able to"}}
                  :synsem {:cat :verb
                           :sem {:pred :be-able-to}}}
+
+   "be called" {:synsem {:cat :verb
+                         :sem {:pred :mancare}}
+                :english {:future "be called"
+                          :participle "being called"
+                          :conditional "be called"
+                          :imperfect {:1sing "was being called"
+                                      :2sing "were being called"
+                                      :3sing "was being called"
+                                      :1plur "were being called"
+                                      :2plur "were being called"
+                                      :3plur "were being called"}
+                          :past {:english "was called"
+                                 :2sing "were called"
+                                 :2plur "were called"
+                                 :3plur "were called"}
+                          :present {:1sing "am called"
+                                    :2sing "are called"
+                                    :3sing "is called"
+                                    :1plur "are called"
+                                    :2plur "are called"
+                                    :3plur "are called"}}}

    "be missed" {:synsem {:cat :verb
                          :sem {:pred :mancare}}


Remove unecessary reread

Remove unecessary reread

--- src/cljs/koeeoadi/components/palette.cljs
+++ src/cljs/koeeoadi/components/palette.cljs
@@ -62,10 +62,10 @@
           {:keys [hex-temp]} (om/get-state this)
           active? (= id (:color/id active-color))]
       (dom/div #js {:className (str "color color-editable" (when active? " color-active") (when-not hex " color-missing") " color-" id)
-                    :onClick   #(om/transact! this
+                    :onClick   #(om/transact! (om/class->any reconciler Palette)
                                   `[(palette-widget/update
                                       {:palette-widget/active-color [:colors/by-id ~id]
-                                       :palette-widget/face-classes-by-color-type ~(util/faces-to-colorize list id)}) :palette])
+                                       :palette-widget/face-classes-by-color-type ~(util/faces-to-colorize list id)})])
                     :style     (when (or hex-temp hex) #js {:backgroundColor (or hex-temp hex)})}
         (dom/button #js {:className "color-remove"
                          :onClick   #(color-remove this color)}


Fix compatibility with upcoming changes on buddy-sign.

--- src/clojure/buddy/auth/backends/token.clj
+++ src/clojure/buddy/auth/backends/token.clj
@@ -14,7 +14,8 @@

 (ns buddy.auth.backends.token
   (:require [buddy.auth.protocols :as proto]
-            [buddy.sign.jws :refer [unsign]]
+            [buddy.sign.jws :as jws]
+            [slingshot.slingshot :refer [try+]]
             [ring.util.response :refer [get-header response?]]))

 (defn- handle-unauthorized-default [request]
@@ -29,13 +30,18 @@
            (second)))

 (defn jws-backend
-  [{:keys [secret unauthorized-handler max-age token-name] :or {token-name "Token"}}]
+  [{:keys [secret unauthorized-handler options token-name]
+    :or {token-name "Token"}}]
   (reify
     proto/IAuthentication
     (parse [_ request]
       (parse-authorization-header request token-name))
     (authenticate [_ request data]
-      (assoc request :identity (unsign data secret {:max-age max-age})))
+      (try+
+        (assoc request :identity (jws/unsign data secret options))
+        (catch Object e
+          request)))
+

     proto/IAuthorization
     (handle-unauthorized [_ request metadata]


Added support for concept id lookups (i.e., /search/concepts/XXX).

--- src/cmr_edsc_stubs/data/fake_response.clj
+++ src/cmr_edsc_stubs/data/fake_response.clj
@@ -27,6 +27,11 @@
   (let [svcs [(data-sources/get-ges-disc-airx3std-opendap-service [:json :edn])]
         ids (gen-ids "GES_DISC" "S000" svcs)]
     (zipmap ids svcs)))
+
+(defn get-all-metadata
+  []
+  (merge (get-ges-disc-variables-map)
+         (get-ges-disc-services-map)))

 (defn make-metadata
   ([concept-type concept-id]
@@ -134,10 +139,17 @@
   (get-umm-json-ges-disc-airx3std-type params
                                        (get-ges-disc-services-map)
                                        make-service-metadata))
+(defn get-umm-json-concept
+  [concept-id]
+  (json/generate-string
+    ((get-all-metadata) concept-id)))

 (defn handle-prototype-request
-  [path-w-extension params headers query-string]
-  (case path-w-extension
-    "collections" (get-umm-json-ges-disc-airx3std-collection)
-    "variables" (get-umm-json-ges-disc-airx3std-variables params)
-    "services" (get-umm-json-ges-disc-airx3std-services params)))
+  ([path-w-extension params headers]
+    (handle-prototype-request path-w-extension params headers ""))
+  ([path-w-extension params headers query-string]
+    (case path-w-extension
+      "collections" (get-umm-json-ges-disc-airx3std-collection)
+      "variables" (get-umm-json-ges-disc-airx3std-variables params)
+      "services" (get-umm-json-ges-disc-airx3std-services params)
+      (get-umm-json-concept path-w-extension))))


seems like assoc is faster than merge

seems like assoc is faster than merge

--- src/com/billpiel/mem_tracer/profiling.clj
+++ src/com/billpiel/mem_tracer/profiling.clj
@@ -29,7 +29,7 @@
                                                          1.0))]
                               (-> metrics
                                   (dissoc :arg-set)
-                                  (merge {:gross-time-avg (/ gross-time-sum
+                                  (assoc :gross-time-avg (/ gross-time-sum
                                                              call-count
                                                              1.0)
                                           :net-time-avg  (/ (:net-time-sum metrics)
@@ -38,7 +38,7 @@
                                           :arg-cardinality arg-cardinality
                                           :repeat-arg-pct repeat-arg-pct
                                           :gross-of-repeats (* gross-time-sum
-                                                               repeat-arg-pct)}))))
+                                                               repeat-arg-pct)))))
                           fn-ms))

 (defn get-fn-metrics
@@ -66,12 +66,12 @@
                        (map (comp :gross-time :profiling))
                        (apply +))
         net-time (- gross-time kids-time)]
-    (merge tree
-           {:children children
-            :profiling {:gross-time gross-time
-                        :net-time net-time
-                        :kids-time kids-time
-                        :arg-set #{(:args tree)}}})))
+    (assoc tree
+           :children children
+           :profiling {:gross-time gross-time
+                       :net-time net-time
+                       :kids-time kids-time
+                       :arg-set #{(:args tree)}})))

 (defn add-metrics-to-rec
   [rec]


Removes reference to normalize-iso-19115-precisions

--- umm-spec-lib/src/cmr/umm_spec/test/expected_conversion.clj
+++ umm-spec-lib/src/cmr/umm_spec/test/expected_conversion.clj
@@ -389,7 +389,6 @@
   (->> temporal-extents
        (propagate-first :PrecisionOfSeconds)
        (propagate-first :TemporalRangeType)
-       normalize-iso-19115-precisions
        (split-temporals :RangeDateTimes)
        (split-temporals :SingleDateTimes)
        sort-by-date-type-iso))


handle situation when the xml in a vcproj file is messed up

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

--- buildscripts/buildcheck/src/buildcheck/core.clj
+++ buildscripts/buildcheck/src/buildcheck/core.clj
@@ -113,7 +113,9 @@
   (second (re-find #"mmgr_dal_(.*?).dll" (.getName file))))

 (defn project-name [vcproj-file]
-  (-> vcproj-file clojure.xml/parse :attrs :Name))
+  (try
+    (-> vcproj-file clojure.xml/parse :attrs :Name)
+    (catch Exception e (println vcproj-file))))

 (defn bin-dir [bits]
   (File. micromanager
@@ -131,6 +133,7 @@
         project-names (map project-name (filter #(not (.. % getAbsolutePath (contains "_ATTIC")))
                                           (device-vcproj-files)))]
     (sort (clojure.set/difference (set project-names)
+                                  #{nil}
                                   (set dll-names)
                                   (do-not-build)
                                   helper-vcprojs))))


Really fix error in build check script.

Really fix error in build check script.

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

--- buildscripts/buildcheck/src/buildcheck/core.clj
+++ buildscripts/buildcheck/src/buildcheck/core.clj
@@ -174,7 +174,7 @@
         (report-segment "Missing .vcproj files" missing-vcproj-files)
         (report-segment "Uncompiled device adapters (Win32)" (missing-device-adapters 32))
         (report-segment "Uncompiled device adapters (x64)" (missing-device-adapters 64))
-        (report-segment "Missing device links" (missing-links))
+        (report-segment "Missing device links" missing-links)
         (report-segment "Missing device pages" (missing-device-pages))))))

 (defn make-full-report [send?]


Viewport implementation

Viewport implementation

--- src/clj/brutha/view.clj
+++ src/clj/brutha/view.clj
@@ -0,0 +1,46 @@
+(ns brutha.view
+  (:require [brutha.geo :as geo]))
+
+(defprotocol IViewport
+  (-bounds [v])
+  (-project [v p])
+  (-scale [v p])
+  (-visible? [v p]))
+
+(defn viewport? [v]
+  (satisfies? IViewport v))
+
+(defn bounds [v]
+  (-bounds [v]))
+
+(defn project [v p]
+  (-project v p))
+
+(defn scale [v p]
+  (-scale v p))
+
+(defn visible? [v p]
+  (-visible? v p))
+
+(defrecord Viewport [real internal]
+  IViewport
+  (-bounds [_]
+    real)
+  (-visible? [_ p]
+    (geo/inside? p internal))
+  (-scale [_ p]
+    (let [i (geo/dims internal)
+          r (geo/dims real)]
+      (->> i
+           geo/p-inv
+           (geo/dot r)
+           (geo/dot p))))
+  (-project [v p]
+    (let [p' (-scale v p)
+          tl (geo/top-left real)]
+      (geo/p+ p' tl))))
+
+(defn viewport [r i]
+  {:pre [(geo/box? r)
+         (geo/box? i)]}
+  (->Viewport r i))


Typo in modis.

Typo in modis.

--- src/clj/forma/modis.clj
+++ src/clj/forma/modis.clj
@@ -1,7 +1,7 @@
 (ns forma.modis)

 ;; From the [user's guide](http://goo.gl/uoi8p) to MODIS product MCD45
-;; (burned area):"The MODIS data are re-projected using an equiareal
+;; (burned area): "The MODIS data are re-projected using an equiareal
 ;; sinusoidal projection, defined on a sphere of radius 6371007.181 m,
 ;; and with the Greenwich meridian as the central meridian of the
 ;; projection." The full MODIS grid has 18 vertical and 36 horizontal


missing docstrings

missing docstrings

--- src/cljs/cljs/core.cljs
+++ src/cljs/cljs/core.cljs
@@ -38,13 +38,63 @@
   "Set *print-fn* to f."
   [f] (set! *print-fn* f))

-(def ^:dynamic *flush-on-newline* true)
-(def ^:dynamic *print-newline* true)
-(def ^:dynamic *print-readably* true)
-(def ^:dynamic *print-meta* false)
-(def ^:dynamic *print-dup* false)
-(def ^:dynamic *print-length* nil)
-(def ^:dynamic *print-level* nil)
+(def
+  ^{:dynamic true
+    :doc "When set to true, output will be flushed whenever a newline is printed.
+
+  Defaults to true."}
+  *flush-on-newline* true)
+
+(def
+  ^{:dynamic true
+    :doc "When set to logical false will drop newlines from printing calls.
+  This is to work around the implicit newlines emitted by standard JavaScript
+  console objects."}
+  *print-newline* true)
+
+(def
+  ^{:dynamic true
+    :doc "When set to logical false, strings and characters will be printed with
+  non-alphanumeric characters converted to the appropriate escape sequences.
+
+  Defaults to true"}
+  *print-readably* true)
+
+(def
+  ^{:dynamic true
+    :doc "If set to logical true, when printing an object, its metadata will also
+  be printed in a form that can be read back by the reader.
+
+  Defaults to false."}
+  *print-meta* false)
+
+(def
+  ^{:dynamic true
+    :doc "When set to logical true, objects will be printed in a way that preserves
+  their type when read in later.
+
+  Defaults to false."}
+  *print-dup* false)
+
+(def
+  ^{:dynamic true
+    :doc "When set to logical true, objects will be printed in a way that preserves
+  their type when read in later.
+
+  Defaults to false."}
+  *print-length* nil)
+
+(def
+  ^{:dynamic true
+    :doc "*print-level* controls how many levels deep the printer will
+  print nested objects. If it is bound to logical false, there is no
+  limit. Otherwise, it must be bound to an integer indicating the maximum
+  level to print. Each argument to print is at level 0; if an argument is a
+  collection, its items are at level 1; and so on. If an object is a
+  collection and is at a level greater than or equal to the value bound to
+  *print-level*, the printer prints '#' to represent it. The root binding
+  is nil indicating no limit."}
+  *print-level* nil)

 (defonce ^:dynamic *loaded-libs* nil)


Toggle condensed by setting class and rearranging top-level elem

* Better layout, but slower

* Need to work on keeping the element in the same position in the
window by scrolling. May require adding extra vertical space at the
bottom of the page.

--- src/cljs_formatter.cljs
+++ src/cljs_formatter.cljs
@@ -96,7 +96,6 @@
 (def next-state rest)

 (defn arrange-keyval! [state elem container]
-  (d/add-class! elem "arranged")
   (let [[key separator val] (d/children elem)]
     (arrange-element! state key container)
     (arrange-element! state val container)
@@ -139,32 +138,15 @@
     (d/set-styles! elem {:width (str (+ (width contents)
                                         (width opener)
                                         (width closer))
-                                      "px")})))
+                                     "px")})))

 (defn remove-all-styles! [elem]
   ;; remove-attr! doesn't always work
   (d/set-attr! elem :style "")
-  (d/remove-class! elem "condensed")
-  (d/remove-class! elem "arranged")
   (doseq [child (d/children elem)]
     (remove-all-styles! child)))

-(defn arrange-element! [state elem container]
-  (remove-all-styles! elem)
-  (d/set-styles! elem {:white-space "pre"})
-  (d/remove-class! elem "condensed")
-  (when (overflow? elem container)
-    (cond
-     (d/has-class? elem "collection")
-     (arrange-collection! state elem container)
-     (d/has-class? elem "keyval")
-     (arrange-keyval! state elem container))))
-
-(defn arrange! [elem container]
-  (arrange-element! initial-arrange-state elem container))
-
 (defn condense-collection! [elem container]
-  (d/add-class! elem "condensed")
   (let [[opener contents closer] (d/children elem)
         w (- (max-inline-width elem container)
              (* 2 (+ (width opener) (width closer))))]
@@ -176,13 +158,20 @@
                              :overflow "hidden"
                              :text-overflow "ellipsis"})))

-(defn condense! [elem container]
+(defn arrange-element! [state elem container]
   (remove-all-styles! elem)
   (d/set-styles! elem {:white-space "pre"})
-  (d/remove-class! elem "arranged")
   (when (overflow? elem container)
-    (when (d/has-class? elem "collection")
-      (condense-collection! elem container))))
+    (cond
+     (d/has-class? elem "collection")
+     (if (d/has-class? elem "condensed")
+       (condense-collection! elem container)
+       (arrange-collection! state elem container))
+     (d/has-class? elem "keyval")
+     (arrange-keyval! state elem container))))
+
+(defn arrange! [elem container]
+  (arrange-element! initial-arrange-state elem container))

 (defn find-arranged-parent [elem container]
   (cond (= container elem)
@@ -194,24 +183,22 @@
         :else
           (recur (.-parentNode elem) container)))

-(defn toggle! [elem container]
-  (cond (d/has-class? elem "condensed")
-        (arrange! elem container)
-        (d/has-class? elem "arranged")
-        (do (condense! elem (find-arranged-parent (.-parentNode elem)
-                                                  container))
-            (d/set-styles! elem {:display "block"}))))
+(defn toggle! [target-elem arranged-elem container]
+  (if (d/has-class? target-elem "condensed")
+    (d/remove-class! target-elem "condensed")
+    (d/add-class! target-elem "condensed"))
+  (arrange! arranged-elem container))

 (defn set-toggle-on-click! [elem container]
   (events/listen (d/single-node elem) "click"
                  (fn [event]
-                   (loop [elem (.-target event)]
-                     (when elem
-                       (if (and (gdom/isElement elem)
-                                (d/has-class? elem "collection")
-                                (or (d/has-class? elem "condensed")
-                                    (d/has-class? elem "arranged")))
+                   (loop [t (.-target event)]
+                     (when t
+                       (if (and (gdom/isElement t)
+                                (d/has-class? t "collection")
+                                (or (d/has-class? t "condensed")
+                                    (d/has-class? t "arranged")))
                          (do (.stopPropagation event)
                              (.preventDefault event)
-                             (toggle! elem container))
-                         (recur (.-parentNode elem))))))))
+                             (toggle! t elem container))
+                         (recur (.-parentNode t))))))))


Adapt socket constructor implementation to socket types changes.

--- src/clojure/nanomsg.clj
+++ src/clojure/nanomsg.clj
@@ -133,14 +133,14 @@
 (defn socket
   "Geiven a socket type, create a new instance
   of corresponding socket."
-  ([^clojure.lang.Keyword socktype] (socket socktype {}))
-  ([^clojure.lang.Keyword socktype opts]
-   {:pre [(supported-sockets socktype)]}
-   (let [cls        (-> socktype supported-sockets)
-         instance   (.newInstance cls)
-         conn       (if (:async opts)
-                      (->AsyncConnection instance (AsyncSocket. instance))
-                      (->Connection instance))]
+  ([^Keyword socktype] (socket socktype {}))
+  ([^Keyword socktype opts]
+   {:pre [(contains? *supported-sockets* socktype)]}
+   (let [factory (get *supported-sockets* socktype)
+         socket (factory)
+         conn (if (:async opts)
+                (async-socket socket (AsyncSocket. socket))
+                (blocking-socket socket))]
      (cond
        (:bind opts) (bind! conn (:bind opts))
        (:connect opts) (connect! conn (:connect opts)))


Trying Clojuredocs style.

Trying Clojuredocs style.


When github gives us nil instead of a real value, provide defaults instead of crashing.

--- src/circle/workers/github.clj
+++ src/circle/workers/github.clj
@@ -108,11 +108,47 @@
   [username reponame github-access-token]
   (trepos/create-hook username reponame "web" {:url "www.circleci.com/hooks/github"} {:oauth_token github-access-token}))

+(def default-repo-map  {
+   :url "https//api.github.com/repos/octocat/Hello-World"
+   :html_url "https//github.com/octocat/Hello-World"
+   :clone_url "https//github.com/octocat/Hello-World.git"
+   :git_url "git//github.com/octocat/Hello-World.git"
+   :ssh_url "git@github.comoctocat/Hello-World.git"
+   :svn_url "https//svn.github.com/octocat/Hello-World"
+   :owner { :login "octocat"
+             :id 1
+             :avatar_url "https//github.com/images/error/octocat_happy.gif"
+             :gravatar_id "somehexcode"
+             :url "https//api.github.com/users/octocat"}
+   :name "Hello-World"
+   :description "No description provided"
+   :homepage "https//github.com"
+   :language "unknown"
+   :private false
+   :fork false
+   :forks 0
+   :watchers 0
+   :size 1
+   :master_branch "master"
+   :open_issues 0
+   :pushed_at "1970-01-01T00:00:00Z"
+   :created_at "1970-01-01T00:00:00Z"})
+
 (defn all-repos
   "Returns all repos the current user can access. Use this over tentacles.repos/repos, because this will return repos belonging to organizations as well"
   [github-access-token]
   (let [normal-repos (future (trepos/repos {:oauth_token github-access-token}))
         orgs (future (torgs/orgs {:oauth_token github-access-token}))
         org-repos (doall (map (fn [o]
-                                (future (torgs/repos (-> o :login) {:oauth_token github-access-token}))) @orgs))]
-    (concat @normal-repos (mapcat deref org-repos))))+                                (future (torgs/repos (-> o :login) {:oauth_token github-access-token}))) @orgs))
+        all (concat @normal-repos (mapcat deref org-repos))
+        all (map
+             (fn [repo]
+               (merge-with ;; don't overwrite the defaults with nil
+                (fn [first second]
+                  (if (nil? second)
+                    first
+                    second))
+                default-repo-map repo))
+             all)]
+    all))


Fixes to supervise-downloads

Fixes to supervise-downloads

--- src/clj/elephantdb/loader.clj
+++ src/clj/elephantdb/loader.clj
@@ -78,13 +78,19 @@
 (defn supervise-downloads [amount-domains max-kbs]
   (loop []
     (when (< @finished-loaders amount-domains)
-      (do
-        (when (>= @downloaded-kb max-kbs)
+      (log-message "Supervising downloads - "
+                   "Finished: " @finished-loaders
+                   ", waiting for: " (- amount-domains @finished-loaders))
+      (Thread/sleep 1000)
+      (if (>= @downloaded-kb max-kbs)
+        (do
           (reset! do-download false)
           (reset! downloaded-kb 0)
-          (Thread/sleep 1000)
-          (reset! do-download true))
-        (recur)))))
+          (recur))
+        (do
+          (reset! do-download true)
+          (reset! downloaded-kb 0)
+          (recur))))))

 (defn download-supervisor [amount-domains max-kbs]
   (reset! finished-loaders 0)


changed constructors for FireTuple.

changed constructors for FireTuple.

--- src/clj/forma/source/fire.clj
+++ src/clj/forma/source/fire.clj
@@ -46,7 +46,7 @@
   (fn [c t] (and (> t 330)
                 (> c 50))))

-(defn tupleize
+(defn fire-tuple
   [t-above-330 c-above-50 both-preds count]
   (FireTuple. t-above-330 c-above-50 both-preds count))

@@ -58,7 +58,7 @@
       ((c/juxt #'conf-above-50 #'per-day) ?conf :> ?conf-50 ?count)
       (fires-above-330 ?kelvin :> ?temp-330)
       (both-preds ?conf ?kelvin :> ?both-preds)
-      (tupleize ?temp-330 ?conf-50 ?both-preds ?count :> ?tuple)))
+      (fire-tuple ?temp-330 ?conf-50 ?both-preds ?count :> ?tuple)))

 ;; ## Fire Queries

@@ -97,15 +97,15 @@
 (defn add-fires
   "Adds together two FireTuple objects."
   [t1 t2]
-  (tupleize (+ (.temp330 t1) (.temp330 t2))
-            (+ (.conf50 t1) (.conf50 t2))
-            (+ (.bothPreds t1) (.bothPreds t2))
-            (+ (.count t1) (.count t2))))
+  (fire-tuple (+ (.temp330 t1) (.temp330 t2))
+              (+ (.conf50 t1) (.conf50 t2))
+              (+ (.bothPreds t1) (.bothPreds t2))
+              (+ (.count t1) (.count t2))))

 ;; Combines various fire tuples into one.
 (defaggregateop comb
-  ([] (FireTuple. 0 0 0 0))
+  ([] (fire-tuple 0 0 0 0))
   ([state tuple] (add-fires state tuple))
   ([state] [state]))

@@ -132,7 +132,7 @@
 (defmapop [running-fire-sum [start end]]
   "Special case of `running-sum` for `FireTuple` thrift objects."
   [tseries]
-  (let [empty (FireTuple. 0 0 0 0)]
+  (let [empty (fire-tuple 0 0 0 0)]
     (->> tseries
          (running-sum [] empty add-fires)
          (mk-ts start end))))
@@ -143,7 +143,7 @@
   (let [start (datetime->period t-res start)
         end (datetime->period t-res end)
         length (inc (- end start))
-        mk-fire-tseries (p/vals->sparsevec start length (FireTuple. 0 0 0 0))]
+        mk-fire-tseries (p/vals->sparsevec start length (fire-tuple 0 0 0 0))]
     (<- [?dataset ?m-res ?t-res ?tilestring ?sample ?line ?ct-series]
         (src ?dataset ?m-res ?t-res ?tilestring ?tperiod ?sample ?line ?tuple)
         (mk-fire-tseries ?tperiod ?tuple :> _ ?tseries)


change Career Fair to use card targeting

--- src/clj/game/cards-events.clj
+++ src/clj/game/cards-events.clj
@@ -45,8 +45,8 @@
                                                  (all-installed state :runner)))))}

    "Career Fair"
-   {:prompt "Choose a Resource to install"
-    :choices (req (filter #(#{"Resource"} (:type %)) (:hand runner)))
+   {:prompt "Choose a resource to install from your Grip"
+    :choices {:req #(and (= (:type %) "Resource") (= (:zone %) [:hand]))}
     :effect  (effect (install-cost-bonus [:credit -3]) (runner-install target))}

    "Code Siphon"


check-badges cron task

check-badges cron task

--- src/clj/salava/badge/cron.clj
+++ src/clj/salava/badge/cron.clj
@@ -47,15 +47,13 @@
       (jdbc/with-db-transaction [t-con db-conn]
         (jdbc/execute! t-con ["UPDATE badge SET remote_url = ? WHERE id = ? AND remote_url IS NULL"
                               (remote-url factory-url (:body asr)) (:badge_id user-badge)])
-        (jdbc/execute! t-con ["UPDATE badge SET issuer_verified = ? WHERE id = ?"
+        (jdbc/execute! t-con ["UPDATE badge SET issuer_verified = ? WHERE id = ? AND remote_url IS NOT NULL"
                               (if (issuer-verified? factory-url (:body asr))
                                 1
-                                0) (:badge_id user-badge)])
-        (jdbc/execute! t-con ["UPDATE user_badge SET last_checked = UNIX_TIMESTAMP() WHERE id = ?"
-                              (:id user-badge)])))))
+                                0) (:badge_id user-badge)])))))

 (defn- check-badges [db-conn factory-url]
-  (log/info "salava.badge.cron/check-badges: started working")
+  (log/info "check-badges: started working")
   (let [time-limit (+ (System/currentTimeMillis) (* 15 60 1000))
         sql "SELECT id, badge_id, assertion_url FROM user_badge
             WHERE assertion_url IS NOT NULL
@@ -68,11 +66,13 @@
           (try
             (log/debug "check-badges: working on id " (:id user-badge))
             (check-badge db-conn factory-url user-badge)
+            (jdbc/execute! db-conn ["UPDATE user_badge SET last_checked = UNIX_TIMESTAMP() WHERE id = ?"
+                              (:id user-badge)])
             (catch Throwable ex
               (log/error "check-badges failed")
               (log/error (.toString ex)))))
         (try (Thread/sleep 1000) (catch InterruptedException _)))))
-  (log/info "salava.badge.cron/check-badges: done"))
+  (log/info "check-badges: done"))

 ;;;


Four new functions: get-calendar-for-week, get-year, get-week, and get-day-of-week

--- src/clj_calendar/calendar.clj
+++ src/clj_calendar/calendar.clj
@@ -18,6 +18,30 @@
     []
     (java.util.Calendar/getInstance))

+(defn get-calendar-for-week
+    "Gets a calendar for given year and week."
+    [year week]
+    (let [cal (get-calendar)]
+        (.clear cal)
+        (.set cal java.util.Calendar/WEEK_OF_YEAR week)
+        (.set cal java.util.Calendar/YEAR year)
+        cal))
+
+(defn get-year
+    "Returns the year for the current date."
+    [calendar]
+    (.get calendar java.util.Calendar/YEAR))
+
+(defn get-week
+    "Returns week number within the current year."
+    [calendar]
+    (.get calendar java.util.Calendar/WEEK_OF_YEAR))
+
+(defn get-day-of-week
+    "Returns day of week for given date."
+    [calendar]
+    (.get calendar java.util.Calendar/DAY_OF_WEEK))
+
 (defn format-date-using-desired-format
     "Format given date using desired format, for example 'yyyy-MM-dd' etc."
     [calendar desired-format]


Add default values for scale band fix #30

--- src/clj_simple_chart/band.clj
+++ src/clj_simple_chart/band.clj
@@ -13,6 +13,10 @@
     padding-inner :padding-inner
     padding-outer :padding-outer
     align         :align
+    :or {rng [0 1]
+         padding-inner 0
+         padding-outer 0
+         align 0.5}
     :as           all}]
   (let [start (first rng)
         stop (second rng)


main site allow form to handle non-google values

--- src/cljs/ontheway/modern.cljs
+++ src/cljs/ontheway/modern.cljs
@@ -1,4 +1,5 @@
 (ns ontheway.modern
+  (:use [clojure.string :only [trim join]])
   (:use-macros [dommy.macros :only [deftemplate sel1 sel]])
   (:require-macros [cljs.core.async.macros :refer [go]])
   (:require [cljs-http.client :as http]
@@ -27,14 +28,24 @@
     (events/listen el type
       (fn [e] (put! out e)))
     out))
-
+
+(defn empty-string? [s]
+  (-> s
+      trim
+      empty?))
+
 (defn from-query []
   (if-let [node (.getPlace autocompleteFrom)]
     (.-formatted_address node)
-    (str my-lat "," my-lng)))
+    (let [form-val (.-value (dom/getElement "directions-from"))]
+      (if (empty-string? form-val)
+        (str my-lat "," my-lng)
+        form-val))))

 (defn to-query []
-  (-> autocompleteTo .getPlace .-formatted_address))
+  (if-let [node (.getPlace autocompleteTo)]
+    (.-formatted_address node)
+    (.-value (dom/getElement "directions-to"))))

 (defn remove-explanation-text []
   (.remove (dom/getElement "explanation")))
@@ -150,7 +161,7 @@

 (defn mk-uri [base-uri query-params]
   (str base-uri "?"
-       (clojure.string/join "&"
+       (join "&"
              (map (fn [[k v]] (str k "=" (url-encode v))) query-params))))

 (defn proxy-url [url]