finished first draft of quick tour

finished first draft of quick tour

--- src/tutorial/untangled_tutorial/A_Quick_Tour.cljs
+++ src/tutorial/untangled_tutorial/A_Quick_Tour.cljs
@@ -9,6 +9,8 @@
             [untangled.client.mutations :as m]
             [untangled.client.logging :as log]
             [untangled.client.data-fetch :as df]))
+
+(defn increment-counter [counter] (update counter :counter/n inc))

 (defui ^:once Counter
   static uc/InitialAppState
@@ -32,13 +34,12 @@
 (def ui-counter (om/factory Counter {:keyfn :counter/id}))

 (defmethod m/mutate 'counter/inc [{:keys [state] :as env} k {:keys [id] :as params}]
-  {:remote true
-   :action (fn [] (swap! state update-in [:counter/by-id id :counter/n] inc))})
+  {;:remote true
+   :action (fn [] (swap! state update-in [:counter/by-id id] increment-counter))})

 (defmethod m/mutate 'add-counters-to-panel [{:keys [state] :as env} k {:keys [id] :as params}]
   {:action (fn []
              (let [ident-list (get @state :all-counters)]
-               (js/console.log :idents ident-list :state @state)
                (swap! state update-in [:panels/by-kw :counter] assoc :counters ident-list)))})

 (defui ^:once CounterPanel
@@ -52,9 +53,12 @@
   Object
   (render [this]
     (let [{:keys [counters]} (om/props this)
-          click-callback (fn [id] (om/transact! this `[(counter/inc {:id ~id}) :counter-sum]))]
+          click-callback (fn [id] (om/transact! this
+                                                `[(counter/inc {:id ~id}) :counter-sum]))]
       (dom/div nil
-        (dom/style nil ".counter { width: 400px; padding-bottom: 20px; } button { margin-left: 10px; }")
+        ; embedded style: kind of silly in a real app, but doable
+        (dom/style nil ".counter { width: 400px; padding-bottom: 20px; }
+                        button { margin-left: 10px; }")
         (map #(ui-counter (om/computed % {:onClick click-callback})) counters)))))

 (def ui-counter-panel (om/factory CounterPanel))
@@ -129,14 +133,14 @@
   (send [this edn ok err]
     (let [resp (server {} edn)]
       ; simulates a network delay:
-      (js/setTimeout #(ok resp) 300)))
+      (js/setTimeout #(ok resp) 700)))
   (start [this app]
     (assoc this :complete-app app)))

 (defcard-doc
   "# Quick Tour

-  Untangled is meant to be as simple as possible, but as Rich would tell you:
+  Untangled is meant to be as simple as possible, but as Rich Hickey would tell you:
   simple does not mean easy. Fortunately, hard vs. easy is something you can fix just by learning.

   Om Next (the lower layer of Untangled) takes a very progressive approach
@@ -145,10 +149,10 @@

   In this quick tour our intention is to show you a full-stack Untangled
   application. We hope that as you read this Quick Start you will
-  start to comprehend how simple the resulting structure is:
+  start to comprehend how *simple* the resulting structure is:

   - No controllers are needed, ever.
-  - Networking becomes completely transparent.
+  - Networking becomes mostly transparent, and gives a synchronous reasoning model (by default)
   - Server and client code structure are identical. In fact, this tour leverages this fact to simulate server code in
   the browser that is identical to what you'd *put* on the server.
   - The reasoning at the UI layer can be completely local.
@@ -162,17 +166,316 @@
   many cases Untangled is required to 'make a call' about how to do something. When it does, our documentation tries to
   discuss the relative merits and costs.

-  ##
-
-
+  The name 'Untangled' is *not* meant to be a commentary on Om Next, but instead on the general state of web
+  development circa 2016. Om Next and Untangled are two layers of a solution that makes things
+  simpler for you.
+
+  ## Om Next Components can use Stock React components
+
+  The first major strength is that Om Next integrates with stock React components. So, if you already
+  understand React you already have a head start. If you know nothing of React, you should eventually
+  read more about it. For now, we'll cover everything you need to know.
+
+  ## The Rendering Model
+
+  Untangled recommends you treat the UI as a pure function that, given the state of the application 'right now',
+  can be re-rendered on each frame (change of state).
+
+  ```
+  App state -> render -> DOM
+  ```
+
+  This is a key part of the simplification: You don't have to worry how to keep bits of UI up-to-date.
+
+  There is a key difference that users of other frameworks might miss here: not only do you *not* have to figure out
+  the complexities of keeping the DOM up to date: there is no mutation or hidden local state to trip you up.
+  As you move from state to state (a sequence of app states, each of which is itself immutable) you can pretend
+  as if render re-creates the entire DOM. This means you can test and reason about your UI in isolation from all
+  other logic!
+
+  ## Core Model Concepts
+
+  Untangled uses a very simple (default Om Next) database format for the application state in the browser. Basically
+  this format is a normalized graph database made of maps and vectors. Anything you show on the UI is structured into
+  this database, and can be queried to create arbitrary UI trees for display.
+
+  A given item in this database can be shown in as many places on the UI as makes sense. The fact that the database
+  is *normalized* means that changing the item once in the database will result in all displayed versions being
+  refreshed easily.
+
+  The model manipulation thus maintains the desired local reasoning model (to entries in database tables). You write
+  functions that know how to manipulate specific 'kinds' of things in the database, and think nothing of the UI.
+
+  For example, say we have a counter that we'd like to represent with this data structure:
+
+  ```
+  { :counter/id 1 :counter/n 22 }
+  ```
+
+  We can write simple functions to manipulate counters:
+
+  "
+  (dc/mkdn-pprint-source increment-counter)
+  "
+
+  and think about that counter as a complete abstract thing (and write clojure specs for it, etc.).
+
+  The Untangled database table for counters looks something like this:
+
+  ```
+  { :counter/by-id { 1 { :counter/id 1 :counter/n 1 }
+                     2 { :counter/id 2 :counter/n 9 }
+                     ...}}
+  ```
+
+  A table is just an entry in the database that, by convention, includes a namespace and name to indicate the kind of
+  thing in the table and how it is indexed. The value of the table is just a map whose keys are the IDs, and values
+  are the entries.
+
+  The general app state is held in a top-level atom. So, updating any object in the database generally takes the
+  form:
+
+  ```
+  (swap! state update-in [:table/key id] operation)
+  ```
+
+  or in our example case:
+
+  ```
+  (swap! state update-in [:counter/by-id 1] increment-counter)
+  ```
+
+  NOTE: You still need to know *where* to put this code.
+
+  ## Mutations as Abstract Transactions
+
+  In Untangled, you don't do model twiddling on the UI. There is a clear separation of concerns for several good
+  reasons:
+
+  - It generally pays not to mix your low-level logic with UI.
+  - The concept of an abstract mutation can isolate the UI from networking, server interactions, and async thinking.
+  - Abstract mutations give nice auditing and comprehension on both client and server.
+
+  The main UI entry point to affecting a change is the `om/transact!` function. This function lets you submit
+  an abstract sequence of modifications that you'd like to make, and isolates the UI author from the details of
+  implementing that model/remote behavior.
+
+  The concrete artifacts you'll see in Untangled code are the invocation of the `transact!`, and the implementation
+  of the operations listed in the transaction:
+
+  ```
+  (om/transact! this `[(counter/increment {:id ~id})])
+  ```
+
+  in the above transaction, we must use Clojure syntax quoting so that we can list an abstract muation (looks like
+  a function call, but is not) and parameters that themselves are derived from the environment (in this case
+  an id).
+
+  The concrete implementation of the mutation on the model side looks like this:
+
+  ```
+  (defmethod m/mutate 'counter/inc [{:keys [state] :as env} k {:keys [id] :as params}]
+    { :action
+        (fn []
+          (swap! state update-in [:counter/by-id id] increment-counter))})
+  ```
+
+  This looks a little hairy at first until you notice the primary guts are just what we talked about earlier in
+  the model manipulation: it's just an update-in.
+
+  The wrapping is a pretty consistent pattern: the app state and parameters are passed into a multimethod, which is
+  dispatched on the symbol mentioned in the `transact!`. The basics are:
+
+  - You key on a symbol instead of writing a function with that symbol name
+  - You return a map
+  - The `:action` key indicates a function to run as an optimistic update to the browser database
+
+  When you want to interact with a server, you need merely change it to:
+
+  ```
+  (defmethod m/mutate 'counter/inc [{:keys [state] :as env} k {:keys [id] :as params}]
+    { :remote true ; <---- this is all!!!
+      :action
+        (fn []
+          (swap! state update-in [:counter/by-id id] increment-counter))})
+  ```
+
+  and then write a similar function on the server that has an `:action` to affect the change on the server!
+
+  At first this seems like a bit of overkill on the boilerplate until you realize that there are a number of things
+  being handled here:
+
+  - Local optimistic updates
+  - Automatically plumbed server interactions
+  - Use of the same symbol for the operation on the client and server
+  - Operations in the UI and on the server are identical in appearance
+  - Consistent implementation of model interactions on the client and server
+  - The operations 'on the wire' read like abstract function calls, and lead to easy auditing and reasoning, or
+  even easy-to-implement CQRS architectures.
+
+  ## An Example
+
+  Let's write a simple application that shows counters that can be incremented. Each counter has an ID and a value (n).
+
+  ### Making a Counter component
+
+  Here's the Untangled implementation of that UI component:

   "
   (dc/mkdn-pprint-source Counter)
+  "
+
+  It looks a bit like a `defrecord` implementing protocols. Here is a description of the parts:
+
+  - InitialAppState : Represents how to make an instance of the counter in the browser database. Parameters are supported
+  for making more than one on the UI. This function should return a map that matches the properties asked for in the query.
+  - IQuery : Represents what data is needed for the UI. In this case, a list of properties that exist (keys of the
+  map that represents counters in the database). Note we can tune this up/down depending on the needs of the UI. Counters
+  could have labels, owners, purposes, etc.
+  - Ident : Represents the table/ID of the database data for the component. This is a function that, given an example
+  of a counter, will return a vector that has two elements: the table and the ID of the entry. This is used
+  to assist in auto-normalization of the browser database.
+  - Object/render : This is the (pure) function that outputs what a Counter should look like on the DOM
+
+  The incoming data from the database comes in via `om/props`, and things like callbacks come in via a mechanism known
+  as the 'computed' data (e.g. stuff that isn't in the database, but is generated by the UI, such as callbacks).
+
+  A `defui` generates a React Component. In order to render an instance of a Counter, we must make an element
+  factory:
+  "
   (dc/mkdn-pprint-source ui-counter)
+  "
+  If more than one of something can appear in the UI as siblings, you must specify a `:keyfn` that helps React
+  distinguish the DOM elements. You can ignore that for now.
+
+  The most important point is that you can reason about `Counter` in a totally local way.
+
+  ### Combining Counters into a Panel
+
+  Lets assume we want to display some arbitrary number of counters together in a panel. We can encode that (and the
+  element factory) as:
+  "
   (dc/mkdn-pprint-source CounterPanel)
-  (dc/mkdn-pprint-source ui-counter-panel))
-
-(defcard SampleApp
+  (dc/mkdn-pprint-source ui-counter-panel)
+  "
+  Note the mirroring again between the initial state and the query. The initial state provides an initial model
+  of what should be in the database, and the query indicates which bits of that state are required for the
+  current component.
+
+  In this case the query contains a map, which is the query syntax for a JOIN. You can read this query as
+  'Query for :counters, which is a JOIN on Counter'. Note that since initial state is setting up a vector
+  of counters, the implied result will be a to-many JOIN. The cardinality of JOINS is derived from the structure
+  of the actual database, NOT the query.
+
+  Again, the Ident just says where the state for these goes in the database (the table and ID).
+
+  The render is very similar to Counter. Assume the queried data will appear in props, pull it out, and
+  then render it. Note the use of `ui-counter`, which is the DOM element factory for `Counter`.
+
+  Finally, the callback is interesting. The counter has the 'Increment' button, but we've connected that from the
+  counter UI back through to an implementation of a callback via 'computed' properties. This is a common pattern. In
+  this simple example the callback structure was added to demonstrate what it looks like, not because we actually
+  needed it (the `transact!` could have been placed in Counter).
+
+  The implementation of the `counter/inc` mutation was shown earlier.
+
+  There are many important points to make here, but we would like to stress the fact that the UI has no idea
+  how counters are implemented, if that logic includes server interactions, etc. There is no callback madness
+  around processing the results. There is no XhrIO mixed into the UI, nor a controller you have to write to
+  accomplish anything.
+
+  A simple pattern of updating an abstraction in a database is all you need.
+
+  There is one exception: That weird inclusion of `:counter-sum` in the transaction. We'll explain that shortly.
+
+  ### Adding the Panel to a Root element
+
+  Untangled UI (and DOM UI in general) forms a tree. All trees must eventually have a root.
+
+  The UI composition (and the composition of queries and initial state) must continue to your UI Root. So, in our case
+  our root looks like this:
+
+  "
+  (dc/mkdn-pprint-source Root)
+  "
+
+  The initial state is a composition from the nested panel, as is the query. We add in two additional things here:
+
+  - `:ui/loading-data` is a special key, available at the root, that is true when data is loading over the network
+  - We compose in another component we've yet to discuss (which sums all counters). We'll talk more about that shortly
+
+  There should be no surprises here. It is the same pattern all over again, except Root does not need an `Ident`, since
+  it need not live in a database table. The data for root can just be a standalone map entry (as can other things...there
+  is no rule that absolutely everything lives in tables. Top-level entries for other data structures are also useful).
+
+  ### Starting up the App
+
+  Normally you create an Untangled application and mount it on a DIV in your real HTML DOM. Since we're in devcards
+  we have a helper to do that, and it accepts the same basic parameters as `make-untangled-app`, but mounts it on a
+  devcard:
+
+  ```
+  (defcard SampleApp
+     (untangled-app Root
+                    :started-callback (fn [{:keys [reconciler] :as app}]
+                                        (log/info \"Application (re)started\")
+                                        (df/load-data reconciler [{:all-counters (om/get-query Counter)}]
+                                                      :post-mutation 'add-counters-to-panel))
+                    :networking (map->MockNetwork {}))
+         {})
+  ```
+
+  In this quick tour we're faking the networking so you can easily explore what the server and client look like in a
+  single file.
+
+  The `:started-callback` is triggered as the application loads. This is where you can use Untagled's networking layer
+  to pre-fetch data from the server. In our case, we want to get all of the counters. Note that we can (and should) use UI
+  queries. This triggers auto-normalization of the response. The `:post-mutation` is triggered after the load, and
+  can modify the database to construct various views of the loaded data. In our case, it moves the counters onto
+  the panel:
+
+  ```
+  (defmethod m/mutate 'add-counters-to-panel [{:keys [state] :as env} k {:keys [id] :as params}]
+    {:action (fn []
+               (let [ident-list (get @state :all-counters)]
+                 (swap! state update-in [:panels/by-kw :counter] assoc :counters ident-list)))})
+  ```
+
+  You'll need to understand a bit more about the structure of the database to completely understand this code, but you
+  see it is really quite simple: pull `:all-counters` from the database, and put them on the panel according to the
+  (known via Ident) location of the panel data in the database.
+
+  ### Server Implementation
+
+  We're representing our server database as an in-RAM atom:
+
+  "
+  (dc/mkdn-pprint-source server-state)
+  "
+
+  #### Server Queries
+
+  To respond to the `:all-counters` query, we simply write a function that returns the correct data and hook it into
+  the server engine. In real server code this is commonly done with a multimethod (your choice). The take-away here
+  is that you write very little 'plumbing'...just the logic to get the data, and return it in a map with a
+  `:value` key:
+
+  "
+  (dc/mkdn-pprint-source read-handler)
+  "
+  #### Server Mutations
+
+  We mentioned earlier that turning a client mutation into something that also happens on the server is as simple as
+  adding a `:remote true` to the response of the mutation function.
+
+  The server code is equally trivial (again, in a real server you'd typically use a multimethod):
+  "
+  (dc/mkdn-pprint-source write-handler))
+
+(defcard FinalResult
+         "Below is the final result of the above application, complete with faked server interactions (we use
+         setTimeout to fake network latency). If you reload this page and jump to the bottom, you'll see the initial
+         server loading."
          (untangled-app Root
                         :started-callback (fn [{:keys [reconciler] :as app}]
                                             (log/info "Application (re)started")
@@ -180,3 +483,35 @@
                                                           :post-mutation 'add-counters-to-panel))
                         :networking (map->MockNetwork {}))
          {})
+
+(defcard-doc
+  "### The Grand Total
+
+  You'll notice that there is a part of the UI that is tracking the grand total of the counters. This component shows
+  a few more interesting features: Rendering derived values, querying entire tables, and refreshing derived UI.
+
+  This is the implementation of the counter UI:
+  "
+  (dc/mkdn-pprint-source CounterSum)
+  "
+  The query is interesting. Queries are vectors of things you want. When one of those things is a two-element vector
+  it knows you want an entry in a table (e.g. [:counter/by-id 3]). If you use the special symbol `'_`, then you're asking
+  for an entire top-level entry (in this case a whole table).
+
+  Thus we can easily use that to calculate our desired UI.
+
+  However, it turns out that we have a problem: Nothing in Untangled or Om Next will trigger this component to refresh
+  when an individual counter changes! The mutations are abstract, and even though you can imagine that the UI refresh is
+  a pure function that recreates the DOM, it is in fact optimized to only refresh the bits that have changed. Since the
+  data that changed wasn't a counter, Om Next will short-circuit the sum for efficiency.
+
+  This is the point of the earlier mysterious `:counter-sum` in the `transact!`. Any keyword that appears in a transaction
+  will cause Om to re-render any component that queried for that property (in our case the Root UI component). These
+  are called 'follow-on reads', to imply that 'anything that reads the given property should be asked to re-read it
+  (and implicitly, this means it will re-render if the value has changed)'.
+
+  You can, of course, play with the source code of this example in the devcards.
+
+  We certainly hope you will continue reading into the deatils of all of these features. You should start with
+  [next chapter](#!/untangled_tutorial.B_UI) on UI.
+  ")


Remove vestigial reqs from hours-open validation

--- src/vip/data_processor/validation/v5/hours_open.clj
+++ src/vip/data_processor/validation/v5/hours_open.clj
@@ -1,7 +1,5 @@
 (ns vip.data-processor.validation.v5.hours-open
-  (:require [korma.core :as korma]
-            [vip.data-processor.db.postgres :as postgres]
-            [vip.data-processor.validation.v5.util :as util]))
+  (:require [vip.data-processor.validation.v5.util :as util]))

 (defn valid-time-with-zone? [time]
   (re-matches


Add resources route

Add resources route

--- src/clj/rumahsewa141/handler.clj
+++ src/clj/rumahsewa141/handler.clj
@@ -34,10 +34,11 @@
         (wrap-routes middleware/wrap-csrf)
         (wrap-routes middleware/wrap-formats)
         (wrap-routes middleware/wrap-admin-only))
+    (route/resources "/")
     (route/not-found
-      (:body
-        (error-page {:status 404
-                     :title "page not found"})))))
+     (:body
+      (error-page {:status 404
+                   :title "page not found"})))))

 (defn app [] (middleware/wrap-base #'app-routes))


Typo on :physicalprocessorcount

Typo on :physicalprocessorcount

--- src/clj/runbld/facts/facter2.clj
+++ src/clj/runbld/facts/facter2.clj
@@ -15,7 +15,7 @@
     (-> (.facts x) :processorcount))

   (cpus-physical [x]
-    (-> (.facts x) :processorphysicalcount))
+    (-> (.facts x) :physicalprocessorcount))

   (facter-provider [x]
     "facter")


New functions move-is-checkmate?, empty-squares.

--- src/clojure/clj_chess/board.cljc
+++ src/clojure/clj_chess/board.cljc
@@ -152,6 +152,11 @@
   "Tests whether the board position is checkmate."
   [board]
   (.isMate board))
+
+(defn move-is-checkmate?
+  "Tests whether the move is a mate in one."
+  [board move]
+  (checkmate? (do-move board move)))

 (defn immediate-draw?
   "Tests whether the board position is an immediate draw."
@@ -549,6 +554,11 @@
      ([board color] (.piecesOfColor board color))))

 #?(:clj
+   (defn empty-squares
+     "The set of all empty squares on the board."
+     [board] (.emptySquares board)))
+
+#?(:clj
    (defn pawn-squares
      "The set of squares containing pawns of the given color."
      [board color]


Improve the output of debug middleware

Improve the output of debug middleware

--- src/re_frame/middleware.cljs
+++ src/re_frame/middleware.cljs
@@ -35,9 +35,10 @@
     [db v]
     (if (satisfies? IReactiveAtom db)
       (str "re-frame: \"debug\" middleware used without prior \"pure\"."))
-    (warn "handler: " v)    ;; XXX don't use warn
-    (let [new-db  (handler db v)]
-      (warn "handler: " (data/diff db new-db))   ;; XXX don't use warn
+    (warn "event: " v)    ;; XXX don't use warn
+    (let [new-db  (handler db v)
+          diff    (data/diff db new-db)]
+      (warn "it was: "  (first diff)  "\nis now: " (second diff))    ;; XXX don't use warn
       new-db)))


CMR-1380 Updates gml test to use :as instead of :refer :all

--- spatial-lib/test/cmr/spatial/test/encoding/gml.clj
+++ spatial-lib/test/cmr/spatial/test/encoding/gml.clj
@@ -6,7 +6,7 @@
             [clojure.test.check.clojure-test :refer :all]
             [clojure.test.check.properties :refer :all]
             [cmr.common.xml :as cx]
-            [cmr.spatial.encoding.gml :refer :all]
+            [cmr.spatial.encoding.gml :as gml]
             [cmr.spatial.line-string :as line]
             [cmr.spatial.point :as p]
             [cmr.spatial.polygon :as poly]
@@ -44,41 +44,41 @@

 (deftest test-parse-lat-lon-string
   (testing "one point"
-    (is (= (parse-lat-lon-string "9 10")
+    (is (= (gml/parse-lat-lon-string "9 10")
            [(p/point 10 9 true)])))
   (testing "multiple points"
-    (is (= (parse-lat-lon-string "2 1.03 -4 3")
+    (is (= (gml/parse-lat-lon-string "2 1.03 -4 3")
            [(p/point 1.03 2 true) (p/point 3 -4 true)]))))

 (deftest test-decode-point
   (testing "decoding points from GML"
     (is (= (p/point -110.45 45.256)
-           (decode (cx/element-at-path (x/parse-str gml-xml) [:Point]))))))
+           (gml/decode (cx/element-at-path (x/parse-str gml-xml) [:Point]))))))

 (deftest test-decode-line-string
   (testing "decoding GML line strings"
     (is (= (line/ords->line-string :cartesian -110.45 45.256, -109.48 46.46, -109.86 43.84, -109.2 45.8)
-           (decode (cx/element-at-path (x/parse-str gml-xml) [:LineString]))))))
+           (gml/decode (cx/element-at-path (x/parse-str gml-xml) [:LineString]))))))

 (deftest test-decode-polygon
   (testing "decoding GML polygons"
     (is (= (poly/polygon [(rr/ords->ring :cartesian -110.45 45.256, -109.48 46.46, -109.86 43.84, -110.45 45.256)])
-           (decode (cx/element-at-path (x/parse-str gml-xml) [:Polygon]))))))
+           (gml/decode (cx/element-at-path (x/parse-str gml-xml) [:Polygon]))))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Property-Based Tests

 (defspec check-gml-point-round-trip 100
   (for-all [p spatial-gen/points]
-    (let [element (-> (encode p) emit-gml-str x/parse-str)]
-      (= p (decode element)))))
+    (let [element (-> (gml/encode p) emit-gml-str x/parse-str)]
+      (= p (gml/decode element)))))

 (defspec check-gml-line-string-round-trip 100
   (for-all [l spatial-gen/cartesian-lines]
-    (let [element (-> (encode l) emit-gml-str x/parse-str)]
-      (= l (decode element)))))
+    (let [element (-> (gml/encode l) emit-gml-str x/parse-str)]
+      (= l (gml/decode element)))))

 (defspec check-gml-polygon-round-trip 100
   (for-all [polygon spatial-gen/cartesian-polygons-with-holes]
-    (let [element (-> (encode polygon) emit-gml-str x/parse-str)]
-      (= (:points polygon) (:points (decode element))))))
+    (let [element (-> (gml/encode polygon) emit-gml-str x/parse-str)]
+      (= (:points polygon) (:points (gml/decode element))))))


Remove autocancel-builds LD flag

Remove autocancel-builds LD flag

--- src-cljs/frontend/components/project_settings.cljs
+++ src-cljs/frontend/components/project_settings.cljs
@@ -608,14 +608,12 @@
                             :blurb [:p
                                     "By default, we will build all the commits for this project. Once turned on, we will only build branches "
                                     "that have associated pull requests open. Note: For your default branch, we will always build all commits."]})
-            ;; TODO remove the LD flag once shipped
-            (when (feature/enabled? :autocancel-builds)
-              (describe-flag {:flag :autocancel-builds
-                              :title "Auto-cancel redundant builds"
-                              :blurb [:p
-                                      "With the exception of your default branch, we will automatically cancel any queued or running builds on "
-                                      "a branch when a newer build is triggered on that same branch. This feature will only apply to builds "
-                                      "triggered by pushes to GitHub."]}))
+            (describe-flag {:flag :autocancel-builds
+                            :title "Auto-cancel redundant builds"
+                            :blurb [:p
+                                    "With the exception of your default branch, we will automatically cancel any queued or running builds on "
+                                    "a branch when a newer build is triggered on that same branch. This feature will only apply to builds "
+                                    "triggered by pushes to GitHub."]})
             (describe-flag {:flag :osx-code-signing-enabled
                             :title "Code Signing Support"
                             :blurb [:p


[boot] Add boot-lein

[boot] Add boot-lein

--- .boot/profile.boot
+++ .boot/profile.boot
@@ -6,3 +6,8 @@
 (swap! boot.repl/*default-middleware* conj
        'cider.nrepl/cider-middleware
        'refactor-nrepl.middleware/wrap-refactor)
+
+;; for boot in IntelliJ
+(set-env! :dependencies '[[sparkfund/boot-lein "0.4.0"]])
+;; boot-lein: `boot write-project-clj` task directly accessible
+(require '[sparkfund.boot-lein :refer [write-project-clj]])


(SERVER-1142) Initial refactor of route tree

This commit is an initial refactoring of the v3 route tree into ruby and
clojure routes to facilitate future separation.

--- src/clj/puppetlabs/services/master/master_core.clj
+++ src/clj/puppetlabs/services/master/master_core.clj
@@ -374,7 +374,7 @@
   [request-handler jruby-service get-code-content-fn]
   (let [environment-class-handler (environment-class-handler jruby-service)
         static-file-content-handler (static-file-content-request-handler get-code-content-fn)]
-    (comidi/routes
+    (let [ruby-routes (comidi/routes
      (comidi/GET ["/node/" [#".*" :rest]] request
                  (request-handler request))
      (comidi/GET ["/file_content/" [#".*" :rest]] request
@@ -405,12 +405,13 @@
      (comidi/GET "/environments" request
                  (request-handler request))
      (comidi/GET ["/status/" [#".*" :rest]] request
-                 (request-handler request))
-
+                       (request-handler request)))
+          clojure-routes (comidi/routes
      (comidi/GET ["/environment_classes" [#".*" :rest]] request
                  (environment-class-handler request))
      (comidi/GET ["/static_file_content/" [#".*" :rest]] request
-                 (static-file-content-handler request)))))
+                       (static-file-content-handler request)))]
+      (comidi/context "/v3" ruby-routes clojure-routes))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Lifecycle Helper Functions
@@ -463,10 +464,9 @@
   "Creates all of the web routes for the master."
   [request-handler jruby-service get-code-content-fn]
   (comidi/routes
-    (comidi/context "/v3"
                     (v3-routes request-handler
                                jruby-service
-                               get-code-content-fn))))
+              get-code-content-fn)))

 (schema/defn ^:always-validate
   wrap-middleware :- IFn


Don't start any sequences until all sequences have been loaded.

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

--- acqEngine/src/org/micromanager/acq_engine.clj
+++ acqEngine/src/org/micromanager/acq_engine.clj
@@ -211,16 +211,15 @@
         (device-best-effort shutter
           (core setShutterOpen false))))))

-(defn arm-property-sequences [property-sequences]
+(defn load-property-sequences [property-sequences]
   (let [new-seq (not= property-sequences @active-property-sequences)]
     (doseq [[[d p] s] property-sequences]
       (log "property sequence:" (seq (str-vector s)))
       (when new-seq
-        (core loadPropertySequence d p (str-vector s)))
-      (core startPropertySequence d p))
+        (core loadPropertySequence d p (str-vector s))))
     (reset! active-property-sequences property-sequences)))

-(defn arm-slice-sequence [slice-sequence]
+(defn load-slice-sequence [slice-sequence]
   (when slice-sequence
     (let [z (core getFocusDevice)
           delta-z (- (@state :reference-z-position)
@@ -230,15 +229,23 @@
       (log "adjusted-slices: " adjusted-slices ";" "reference-z-position" (@state :reference-z-position))
       (when new-seq
         (core loadStageSequence z (double-vector adjusted-slices)))
-      (core startStageSequence z)
       (reset! active-slice-sequence [z adjusted-slices])
       adjusted-slices)))
+
+(defn start-property-sequences [property-sequences]
+  (doseq [[[d p] _] property-sequences]
+    (core startPropertySequence d p)))
+
+(defn start-slice-sequence []
+  (core startStageSequence (core getFocusDevice)))

 (defn init-burst [length trigger-sequence]
   (core setAutoShutter (@state :init-auto-shutter))
   (println "autoshutter:" (core getAutoShutter))
-  (arm-property-sequences (:properties trigger-sequence))
-  (let [absolute-slices (arm-slice-sequence (:slices trigger-sequence))]
+  (load-property-sequences (:properties trigger-sequence))
+  (let [absolute-slices (load-slice-sequence (:slices trigger-sequence))]
+    (start-property-sequences (:properties trigger-sequence))
+    (start-slice-sequence)
     (swap! state assoc :burst-init-time (elapsed-time @state))
     (core startSequenceAcquisition length 0 true)
     (swap! state assoc-in [:last-positions (core getFocusDevice)]


:versioned? flag for models

:versioned? flag for models

--- src/er_cassandra/model/types.clj
+++ src/er_cassandra/model/types.clj
@@ -48,14 +48,16 @@
    (s/optional-key :unique-key-tables) [LookupTableSchema]
    (s/optional-key :secondary-tables) [TableSchema]
    (s/optional-key :lookup-key-tables) [LookupTableSchema]
-   (s/optional-key :callbacks) CallbacksSchema})
+   (s/optional-key :callbacks) CallbacksSchema
+   (s/optional-key :versioned?) s/Bool})

 (s/defrecord Model
     [primary-table :- TableSchema
      unique-key-tables :- [LookupTableSchema]
      secondary-tables :- [TableSchema]
      lookup-key-tables :- [LookupTableSchema]
-     callbacks :- CallbacksSchema])
+     callbacks :- CallbacksSchema
+     versioned? :- s/Bool])

 (defn ^:private force-key-seq
   [table]


Fix lint error

Fix lint error

--- backend/test/akvo/lumen/fixtures.clj
+++ backend/test/akvo/lumen/fixtures.clj
@@ -48,7 +48,7 @@
   (let [c (tu/start-config)]
     (try
       (tu/seed c)
-      (lumen-migrate/migrate c false)
+      (lumen-migrate/migrate c)
       (binding [*tenant-conn* (p/connection (:akvo.lumen.component.tenant-manager *system*)
                                             (-> c :akvo.lumen.migrate :seed :tenants first :label))]
         (f))


oh, somebody already made an error class!

--- src-cljs/frontend/components/integrations.cljs
+++ src-cljs/frontend/components/integrations.cljs
@@ -189,7 +189,7 @@
                (common/icon :times)]]

              (when error
-               [:div.content.make.error
+               [:div.slack-form-error
                 error])]))]))))

 (defn slack-hooks [app owner]


Don't close standard input

Don't close standard input

--- src/sparql_to_csv/sparql.clj
+++ src/sparql_to_csv/sparql.clj
@@ -127,10 +127,17 @@

 (defn piped-query
   "Run the query from `template` with each line of input provided as template parameters."
-  [{::spec/keys [input input-delimiter]
-    :as params}
-   template]
-  (with-open [reader (io/reader input)]
+  ([{::spec/keys [input]
+     :as params}
+    template]
+   (if (= input *in*)
+     (piped-query params template (io/reader input)) ; Don't close standard input
+     (with-open [reader (io/reader input)]
+       (piped-query params template reader))))
+  ([{::spec/keys [input-delimiter]
+     :as params}
+    template
+    reader]
     (let [lines (csv/read-csv reader :separator input-delimiter)
           head (first lines)
           header (map keyword head)]


MV drop/create library fn

MV drop/create library fn


bug fix started should be set only when not present and in running state

--- cimi-resources/src/com/sixsq/slipstream/ssclj/resources/job/utils.clj
+++ cimi-resources/src/com/sixsq/slipstream/ssclj/resources/job/utils.clj
@@ -71,7 +71,8 @@
 (defn job-cond->edition
   [{:keys [statusMessage state started] :as job}]
   (cond-> job
-          (= state state-running) (assoc :started (u/unparse-timestamp-datetime (time/now)))
+          (and (not started)
+               (= state state-running)) (assoc :started (u/unparse-timestamp-datetime (time/now)))
           true (dissoc :priority)
           statusMessage (update-timeOfStatusChange)
           (is-final-state? job) (assoc :progress 100


Change and expand sift task

Change and expand sift task

- Sift now operates on all files in the fileset, not just output files.

- Changed the short option for --add-source to -A from -a.

- Added -a/--to-asset, -s/--to-source, -r/--to-resource options to move
  files in the fileset between the various categories.

--- boot/core/src/boot/task/built_in.clj
+++ boot/core/src/boot/task/built_in.clj
@@ -244,15 +244,22 @@
         (-> fileset (core/add-resource tgt) core/commit!))))))

 (core/deftask sift
-  "Filter the output fileset, matching paths against regexes.
-
-  The include and exclude options specify sets of regular expressions that will
-  be used to filter the fileset.
+  "Transform the fileset, matching paths against regexes.
+
+  The --include and --exclude options specify sets of regular expressions that
+  will be used to filter the fileset.

-  The move option applies a find/replace transformation on all paths in the
-  output fileset."
-
-  [a add-source         bool        "Add all input files to output fileset."
+  The --move option applies a find/replace transformation on all paths in the
+  output fileset.
+
+  The --to-asset, --to-resource, and --to-source options move matching paths
+  to the corresponding section of the fileset. This can be used to make source
+  files into resource files, for example, etc."
+
+  [A add-source         bool        "Add all input files to output fileset."
+   a to-asset REGEX     #{regex}    "The set of regexes of paths to move to assets."
+   r to-resource REGEX  #{regex}    "The set of regexes of paths to move to resources."
+   s to-source REGEX    #{regex}    "The set of regexes of paths to move to sources."
    m move MATCH:REPLACE {regex str} "The map of regex to replacement path strings."
    i include REGEX      #{regex}    "The set of regexes that paths must match."
    x exclude REGEX      #{regex}    "The set of regexes that paths must not match."]
@@ -265,11 +272,16 @@
                        (let [from-path (core/tmppath %2)
                              to-path   (mvpath from-path move)]
                          (core/mv %1 from-path to-path)))
+          findany #(reduce (fn [xs x] (or (re-find x %2) xs)) false %1)
+          match?  #(and %1 (findany %1 (core/tmppath %2)))
+          to-src  #(if-not (match? to-source   %2) %1 (core/mv-source   %1 [%2]))
+          to-rsc  #(if-not (match? to-resource %2) %1 (core/mv-resource %1 [%2]))
+          to-ast  #(if-not (match? to-asset    %2) %1 (core/mv-asset    %1 [%2]))
           remover #(if (keep? (io/file (core/tmppath %2))) %1 (core/rm %1 [%2]))
           addsrcs #(if-not add-source % (core/mv-resource % (core/input-files %)))]
       (util/info "Sifting output files...\n")
       (-> (addsrcs fileset)
-          (core/fileset-reduce core/output-files remover mover)
+          (core/fileset-reduce core/ls remover to-src to-rsc to-ast mover)
           core/commit!))))

 (core/deftask add-repo


associate hostnames in caught exceptions

--- src/vignette/http/routes.clj
+++ src/vignette/http/routes.clj
@@ -92,7 +92,7 @@
       (catch [:type :convert-error] e
         (let [message (:message &throw-context)
               thumb-map (:thumb-map e) ; if present, we'll try to thumbnail the error response
-              context (dissoc e :type :thumb-map)]
+              context (assoc (dissoc e :type :thumb-map) :host hostname)]
           (log/warn message
                     (merge {:path (:uri request)
                             :query (:query-string request)}


Alert if fig wheel used

Alert if fig wheel used

used for debugging

--- srcfig/coilsfig/mainfig.cljs
+++ srcfig/coilsfig/mainfig.cljs
@@ -5,6 +5,7 @@
   )

+(.log js/console (str "(use-figwheel): " (use-figwheel)))
 (if (use-figwheel)
   (fw/start { :on-jsload (fn []
                            (touch [:ui])


finish clojure version

finish clojure version

--- Perfect-Squares/PS.clj
+++ Perfect-Squares/PS.clj
@@ -1,7 +1,23 @@
 ;;; Using the better solution in README
+;;; A lot side effect operation LOL

 (defn numSquares [num]
-  (if (< num 2) num)
   (let [lst (atom #{})
-        toCheck (atom #{})]
-    ()))
+        toCheck (atom #{num})
+        i (atom 0)]
+    (while (< (* @i @i) num)
+      (do (swap! i inc)
+          (swap! lst conj (* @i @i))))
+    ;(println @lst)
+    (loop [Check @toCheck
+           cnt 1]
+      ;(println Check)
+      (cond (or (contains? Check 0) (empty? Check)) 0
+            (->> (clojure.set/intersection Check @lst) empty? not) cnt
+            :else
+            (recur (set (for [x Check y @lst :when (< y x)]
+                          (- x y)))
+                   (inc cnt))))))
+
+(numSquares 12) ;3 => 4 + 4 + 4
+(numSquares 13) ;2 => 4 + 9


[#3145] Revert change

[#3145] Revert change

https://github.com/akvo/akvo-lumen/pull/3146/commits/882c25d828d6b8805fffb2dd8afe67b6eeee4e37

--- backend/test/akvo/lumen/lib/transformation_test.clj
+++ backend/test/akvo/lumen/lib/transformation_test.clj
@@ -956,7 +956,7 @@
         apply-transformation (partial async-tx-apply {:tenant-conn *tenant-conn*} origin-dataset-id)
         tx                   (gen-transformation "core/merge-datasets"
                                                  {::transformation.merge-datasets.source.s/aggregationDirection "DESC"
-                                                  ::transformation.merge-datasets.source.s/mergeColumns         ["c2" "c3" "c4"]}
+                                                  ::transformation.merge-datasets.source.s/mergeColumns         ["c4" "c3" "c2"]}
                                                  [:source :aggregationColumn] nil
                                                  [:target :mergeColumn] "c1"
                                                  [:source :mergeColumn] "c1"


Forgot one

Forgot one

--- web/src/immutant/web.clj
+++ web/src/immutant/web.clj
@@ -77,11 +77,11 @@
    switch of dispatching them to the worker thread pool, at the
    risk of refusing client requests under load.

-   Inside WildFly, the :host, :port, and :dispatch? options are
-   ignored, since all handlers are mounted as servlets contained within
-   WildFly's own Undertow instance. Further, all invocations of `run`
-   must be within the initialization function for your application,
-   i.e. your `-main`."
+   Inside WildFly, the :host, :port, :configuration, and :dispatch?
+   options are ignored, since all handlers are mounted as servlets
+   contained within WildFly's own Undertow instance. Further, all
+   invocations of `run` must be within the initialization function for
+   your application, i.e. your `-main`."
   [handler & options]
   (let [options (-> options
                   kwargs-or-map->map


Remove unnecessary log

Remove unnecessary log

--- jar-async/src/slipstream/async/collector.clj
+++ jar-async/src/slipstream/async/collector.clj
@@ -58,13 +58,12 @@
   (let [ch (chan 1)]
     (go
       (let [[v c] (alts! [ch (timeout timeout-collect)])]
-        (if (nil? v)
+        (when (nil? v)
           (log/log-error
             "Timeout collecting vms for user "
             (.getName user)
             " on cloud "
-            (.getConnectorInstanceName connector))
-          (log/log-info (str "executed collect request for " (.getName user) " and " (.getConnectorInstanceName connector))))))
+            (.getConnectorInstanceName connector)))))
     (go (>! ch (Collector/collect user connector)))))

 (defn update-metric!


Add navbar to default layout

Add navbar to default layout

--- template/layouts/default.clj
+++ template/layouts/default.clj
@@ -18,14 +18,37 @@
          :title (:title site)
          :type  "application/atom+xml"}]

- (css ["/css/prettify.css" (:css site ())])
- (css {:media "only screen and (max-device-width:480px)"} (:device-css site))]
+ (css [(:css site ())])
+ #_(css {:media "only screen and (max-device-width:480px)"} (:device-css site))]
 ; /head

 [:body
-
+   ;navbar
  (container
-  contents
+  [:nav.navbar.navbar-default {:role "navigation"}
+    [:div.navbar-header
+      [:button.navbar-toggle {:type "button"
+                              :data-toggle "collapse"
+                              :data-target ".navbar-ex1-collapse"}
+        [:span.sr-only "Toggle navigation"]
+        [:span.icon-bar]
+        [:span.icon-bar]
+        [:span.icon-bar]]
+      [:a.navbar-brand {:href "#"}
+                       "Pance's Blog"]]
+    [:div.collapse.navbar-collapse.navbar-ex1-collapse
+      [:ul.nav.navbar-nav
+        [:li.active
+          [:a {:href "#"} "Linksomewhere"]]
+        [:li
+          [:a {:href "#"} "Anotherlink"]]]
+      [:ul.nav.navbar-nav.navbar-right
+        [:li
+          [:a {:href "#"} "Linkhere"]]
+        [:li
+          [:a {:href "#"} "Anotherlink"]]]]
+   ]
+   contents

   (footer
     (link (str "@" (:twitter site)) (str "http://twitter.com/" (:twitter site)))


[n.compliment] Fix minor formatting issue

--- src/clojure/neko/compliment/ui_widgets_and_attributes.clj
+++ src/clojure/neko/compliment/ui_widgets_and_attributes.clj
@@ -73,7 +73,7 @@
             (attributes kw)
             (->> (attributes kw)
                  (map doc/get-trait-doc)
-                 (interpose "\n")
+                 (interpose "\n\n")
                  string/join)))))

 ;; ## Source definition


Added org.clojure/data.json

Added org.clojure/data.json

--- lein/profiles.clj
+++ lein/profiles.clj
@@ -3,5 +3,6 @@
     [lein-swank "1.4.4"]
     [clj-ns-browser "1.3.0"]
     [marmaduke/commons-math-3 "3"]
+    [org.clojure/data.json "0.2.0"]
 ]}}


Fix fn that loads cards from local storage

--- src/cljs/decktouch/card-data.cljs
+++ src/cljs/decktouch/card-data.cljs
@@ -4,10 +4,8 @@
   "Get the list of cards from localStorage, or [] if it is empty"
   (let [key "card-list"
         list (.getItem js/localStorage key)]
-    (do
-      (.log js/console key list)
-      (if (undefined? list)
-        []
-        (.parse (js/JSON))))))
+    (if (undefined? list)
+      []
+      (map (fn [n] {:name n}) (js->clj (.parse js/JSON list))))))

-(def cards [])+(def cards (get-card-list-from-storage))


Fix to display the abilities of cards hosted on others.

--- src/cljs/netrunner/gameboard.cljs
+++ src/cljs/netrunner/gameboard.cljs
@@ -90,7 +90,7 @@
                      (when (:installed card)
                        (handle-abilities card owner))
                      (send-command "play" {:card card}))
-            ("rig" "current") (handle-abilities card owner)
+            ("rig" "current" "onhost") (handle-abilities card owner)
             nil)
           (case (first zone)
             "hand" (case type


Extract a button-display function for devcards

--- src-cljs/frontend/components/pieces/button.cljs
+++ src-cljs/frontend/components/pieces/button.cljs
@@ -104,6 +104,15 @@

 (dc/do
+  (defn button-display [columns]
+    (html
+     [:div {:style {:display "flex"}}
+      (for [column columns]
+        [:div.primary {:style {:margin-right "2em"}}
+         (for [button column]
+           [:div {:style {:margin-bottom "1em"}}
+            button])])]))
+
   (defcard buttons
     "A **button** represents an action a user can take. A button's label should
     be an action—that is, an imperative verb. Clicking the button initiates that
@@ -130,73 +139,55 @@
     use in table rows, card headers, and anywhere vertical space is at a
     premium."

-    (html
-     [:div {:style {:display "flex"}}
-
-      ;; Primary buttons
-      [:div.primary {:style {:margin-right "2em"}}
-       [:div {:style {:margin-bottom "1em"}}
-        (button {:kind :primary
-                 :on-click #(js/alert "Clicked!")}
-                "Primary")]
-       [:div {:style {:margin-bottom "1em"}}
-        (button {:disabled? true
-                 :kind :primary
-                 :on-click #(js/alert "Clicked!")}
-                "Primary Disabled")]
-       [:div {:style {:margin-bottom "1em"}}
-        (button {:kind :primary
-                 :size :medium
-                 :on-click #(js/alert "Clicked!")}
-                "Primary Medium")]]
+    (button-display
+     [;; Primary buttons
+      [(button {:kind :primary
+                :on-click #(js/alert "Clicked!")}
+               "Primary")
+       (button {:disabled? true
+                :kind :primary
+                :on-click #(js/alert "Clicked!")}
+               "Primary Disabled")
+       (button {:kind :primary
+                :size :medium
+                :on-click #(js/alert "Clicked!")}
+               "Primary Medium")]

       ;; Secondary buttons
-      [:div.secondary {:style {:margin-right "2em"}}
-       [:div {:style {:margin-bottom "1em"}}
-        (button {:on-click #(js/alert "Clicked!")}
-                "Secondary")]
-       [:div {:style {:margin-bottom "1em"}}
-        (button {:disabled? true
-                 :on-click #(js/alert "Clicked!")}
-                "Secondary Disabled")]
-       [:div {:style {:margin-bottom "1em"}}
-        (button {:size :medium
-                 :on-click #(js/alert "Clicked!")}
-                "Secondary Medium")]]
+      [(button {:on-click #(js/alert "Clicked!")}
+               "Secondary")
+       (button {:disabled? true
+                :on-click #(js/alert "Clicked!")}
+               "Secondary Disabled")
+       (button {:size :medium
+                :on-click #(js/alert "Clicked!")}
+               "Secondary Medium")]

       ;; Danger buttons
-      [:div.danger {:style {:margin-right "2em"}}
-       [:div {:style {:margin-bottom "1em"}}
-        (button {:kind :danger
-                 :on-click #(js/alert "Clicked!")}
-                "Danger")]
-       [:div {:style {:margin-bottom "1em"}}
-        (button {:disabled? true
-                 :kind :danger
-                 :on-click #(js/alert "Clicked!")}
-                "Danger Disabled")]
-       [:div {:style {:margin-bottom "1em"}}
-        (button {:kind :danger
-                 :size :medium
-                 :on-click #(js/alert "Clicked!")}
-                "Danger Medium")]]
+      [(button {:kind :danger
+                :on-click #(js/alert "Clicked!")}
+               "Danger")
+       (button {:disabled? true
+                :kind :danger
+                :on-click #(js/alert "Clicked!")}
+               "Danger Disabled")
+       (button {:kind :danger
+                :size :medium
+                :on-click #(js/alert "Clicked!")}
+               "Danger Medium")]

       ;; Flat buttons
-      [:div.flat {:style {:margin-right "2em"}}
-       [:div {:style {:margin-bottom "1em"}}
-        (button {:kind :flat
-                 :on-click #(js/alert "Clicked!")}
-                "Flat")]
-       [:div {:style {:margin-bottom "1em"}}
-        (button {:disabled? true
-                 :kind :flat
-                 :on-click #(js/alert "Clicked!")}
-                "Flat Disabled")]
-       [:div {:style {:margin-bottom "1em"}}
-        (button {:kind :flat
-                 :size :medium
-                 :on-click #(js/alert "Clicked!")}
-                "Flat Medium")]]]))
+      [(button {:kind :flat
+                :on-click #(js/alert "Clicked!")}
+               "Flat")
+       (button {:disabled? true
+                :kind :flat
+                :on-click #(js/alert "Clicked!")}
+               "Flat Disabled")
+       (button {:kind :flat
+                :size :medium
+                :on-click #(js/alert "Clicked!")}
+               "Flat Medium")]]))

   (defcard icon-buttons
     "When horizontal space is at a premium, use an **icon button**. These square
@@ -207,18 +198,14 @@
     Icon buttons are only styled as secondary buttons, and should only be used
     where a secondary button would be appropriate."

-    (html
-     [:div {:style {:display "flex"}}
-      [:div.icon {:style {:margin-right "2em"}}
-       [:div {:style {:margin-bottom "1em"}}
-        (icon {:label "Icon"
-               :on-click #(js/alert "Clicked!")}
-              [:i.octicon.octicon-repo-forked])]
-       [:div {:style {:margin-bottom "1em"}}
-        (icon {:label "Icon Disabled"
-               :disabled? true
-               :on-click #(js/alert "Clicked!")}
-              [:i.octicon.octicon-repo-forked])]]]))
+    (button-display
+     [[(icon {:label "Icon"
+              :on-click #(js/alert "Clicked!")}
+             [:i.octicon.octicon-repo-forked])]
+      [(icon {:label "Icon Disabled"
+              :disabled? true
+              :on-click #(js/alert "Clicked!")}
+             [:i.octicon.octicon-repo-forked])]]))

   (defcard link-buttons
     "A **link-button** looks like a button, but is actually a link.
@@ -235,51 +222,37 @@
     appropriate label for a link-button; neither would \"View Build #5\".
     Instead, \"Build #5\" should be a normal link."

-    (html
-     [:div {:style {:display "flex"}}
-
-      ;; Primary link buttons
-      [:div {:style {:margin-right "2em"}}
-       [:div {:style {:margin-bottom "1em"}}
-        (link {:kind :primary
-               :href "#"}
-              "Primary Link")]
-       [:div {:style {:margin-bottom "1em"}}
-        (link {:kind :primary
-               :href "#"
-               :size :medium}
-              "Medium Primary Link")]]
+    (button-display
+     [;; Primary link buttons
+      [(link {:kind :primary
+              :href "#"}
+             "Primary Link")
+       (link {:kind :primary
+              :href "#"
+              :size :medium}
+             "Medium Primary Link")]

       ;; Secondary link buttons
-      [:div {:style {:margin-right "2em"}}
-       [:div {:style {:margin-bottom "1em"}}
-        (link {:href "#"}
-              "Secondary Link")]
-       [:div {:style {:margin-bottom "1em"}}
-        (link {:href "#"
-               :size :medium}
-              "Medium Secondary Link")]]
+      [(link {:href "#"}
+             "Secondary Link")
+       (link {:href "#"
+              :size :medium}
+             "Medium Secondary Link")]

       ;; Danger link buttons
-      [:div {:style {:margin-right "2em"}}
-       [:div {:style {:margin-bottom "1em"}}
-        (link {:kind :danger
-               :href "#"}
-              "Danger Link")]
-       [:div {:style {:margin-bottom "1em"}}
-        (link {:kind :danger
-               :href "#"
-               :size :medium}
-              "Medium Danger Link")]]
+      [(link {:kind :danger
+              :href "#"}
+             "Danger Link")
+       (link {:kind :danger
+              :href "#"
+              :size :medium}
+             "Medium Danger Link")]

       ;; Flat buttons
-      [:div {:style {:margin-right "2em"}}
-       [:div {:style {:margin-bottom "1em"}}
-        (link {:kind :flat
-               :href "#"}
-              "Flat Link")]
-       [:div {:style {:margin-bottom "1em"}}
-        (link {:kind :flat
-               :href "#"
-               :size :medium}
-              "Medium Flat Link")]]])))
+      [(link {:kind :flat
+              :href "#"}
+             "Flat Link")
+       (link {:kind :flat
+              :href "#"
+              :size :medium}
+             "Medium Flat Link")]])))


missed create-user

missed create-user

--- src/ads/helpers.clj
+++ src/ads/helpers.clj
@@ -13,6 +13,8 @@
       nil)
     )
   )
+(defn create-user [login password]
+  )

 (defn is-authenticated? [req]
   (if (get-in req [:session :identity :login] nil)


winning

winning

--- src/advent/core.clj
+++ src/advent/core.clj
@@ -218,10 +218,13 @@
   [circuit-input]
   (map-values (parse-circuit-data-into-map (str/split (slurp circuit-input) #"\n")) single-values-to-keywords))

-(defn parse-int [i]
+(defn parse-int-if-possible
+  "returns the integer of i if possible, otherwise returns i"
+  [i]
   (try
     (Integer. i)
-    (catch Exception e i)))
+    (catch Exception e
+      i)))

 (defn find-signal
   "returns the value of signal (keyword) within a circuit (map)
@@ -230,9 +233,9 @@
   (if (integer? (signal circuit))
     (signal circuit)
     (case (count (signal circuit))
-      2 ((let [value (parse-int (last (signal circuit)))]
+      2 (let [value (parse-int-if-possible (last (signal circuit)))]
            (if (number? value)
              (bit-not-unsigned value)
-             value
-            )))
+             (bit-not-unsigned (find-signal (keyword value) circuit))
+            ))
       3 (println "got three here"))))


Renamed servlet function to http-servlet

--- lib/compojure/http/http.clj
+++ lib/compojure/http/http.clj
@@ -199,7 +199,7 @@

 ;;;; Servlet ;;;;

-(defn servlet
+(defn http-servlet
   "Create a servlet from a list of resources."
   [& resources]
   (proxy [HttpServlet] []
@@ -212,4 +212,4 @@
 (defmacro defservlet
   "Shortcut for (def name (servlet resources))"
   [name & resources]
-  `(def ~name (servlet ~@resources)))
+  `(def ~name (http-servlet ~@resources)))


Removed nonsense test

Removed nonsense test

--- test/clojenium/core_test.clj
+++ test/clojenium/core_test.clj
@@ -2,6 +2,4 @@
   (:require [clojure.test :refer :all]
             [clojenium.core :refer :all]))

-(deftest a-test
-  (testing "FIXME, I fail."
-    (is (= 0 1))))
+


slow tests

slow tests

--- test/euler/euler021_test.clj
+++ test/euler/euler021_test.clj
@@ -10,8 +10,8 @@
   (fact "Problem 22"
     (p022) => 871198282)

-  (fact "Problem 23"
-    (p023) =future=> 4179871) ;; too slow - makes cloverage abort
+  ; (fact "Problem 23"
+  ;   (p023) =future=> 4179871) ;; too slow - makes cloverage abort

   (fact "Problem 24"
     (p024) => '(2 7 8 3 9 1 5 4 6 0))


fix possible overflow error

fix possible overflow error

--- src-cljs/frontend/utils.cljs
+++ src-cljs/frontend/utils.cljs
@@ -345,6 +345,7 @@
   [m top-max]
   (loop [top-map (sorted-map)
          bottom-map (sorted-map)
+         ;; `nil` is a valid key here BE CAREFUL
          ks (keys m)
          remaining top-max]
     (if (seq ks)
@@ -357,5 +358,6 @@
                  (assoc bottom-map k bottom)
                  bottom-map)
                (rest ks)
-               (- remaining (count top))))
+               (max (- remaining (count top))
+                    0)))
       [top-map bottom-map])))


a little reorg

a little reorg

--- src-cljs/jasons-game/ui.cljs
+++ src-cljs/jasons-game/ui.cljs
@@ -48,9 +48,9 @@
   (set-text-box! [:div "x:" [:span.highlight x] ", y:" [:span.highlight y]]))

-;; Sketch
+;; Draw

-(defn draw
+(defn draw-thing
   "Lookup and apply styles for named object, translate origin to given coordinate, and draw using supplied function"
   [name x y f]
   (s/push-style)
@@ -72,10 +72,10 @@
 (defn draw-cursor
   "Draws a cursor at the specified coordinate"
   [x y]
-  (draw :cursor x y
-        (fn []
-          (s/line (- cursor-size) 0, cursor-size 0)
-          (s/line 0 (- cursor-size), 0 cursor-size))))
+  (draw-thing :cursor x y
+              (fn []
+                (s/line (- cursor-size) 0, cursor-size 0)
+                (s/line 0 (- cursor-size), 0 cursor-size))))

 (def speech-balloon-properties {:offset 10
                                 :point-width 20
@@ -86,30 +86,30 @@
   (let [p speech-balloon-properties
         balloon-width (+ (s/text-width speech) 40)
         balloon-height (+ (s/text-ascent) (s/text-descent) 40)]
-    (draw :speech-balloon x y
-          (fn []
-            (s/translate (- (/ balloon-width 2))
-                         (- (+ (p :offset) (p :point-height) balloon-height)))
-
-            (shape [[0 0]
-                    [balloon-width 0]
-                    [balloon-width balloon-height]
-                    [(+ (/ balloon-width 2) (p :point-width)) balloon-height]
-                    [(/ balloon-width 2) (+ balloon-height (p :point-height))]
-                    [(/ balloon-width 2) balloon-height]
-                    [0 balloon-height]])
-
-            (set-style :words)
-            (s/text speech 20 (+ 20 (s/text-ascent)))))))
+    (draw-thing :speech-balloon x y
+                (fn []
+                  (s/translate (- (/ balloon-width 2))
+                               (- (+ (p :offset) (p :point-height) balloon-height)))
+
+                  (shape [[0 0]
+                          [balloon-width 0]
+                          [balloon-width balloon-height]
+                          [(+ (/ balloon-width 2) (p :point-width)) balloon-height]
+                          [(/ balloon-width 2) (+ balloon-height (p :point-height))]
+                          [(/ balloon-width 2) balloon-height]
+                          [0 balloon-height]])
+
+                  (set-style :words)
+                  (s/text speech 20 (+ 20 (s/text-ascent)))))))

 (def person-radius 100)
 (defn draw-person
   "Draws a person at the specified coordinate"
   [x y]
-  (draw :person x y
-        (fn []
-          (s/ellipse 0 0 person-radius person-radius)
-          (draw-speech-balloon "How are you" 0 (- (/ person-radius 2))))))
+  (draw-thing :person x y
+              (fn []
+                (s/ellipse 0 0 person-radius person-radius)
+                (draw-speech-balloon "How are you" 0 (- (/ person-radius 2))))))

 (def images {})

@@ -129,29 +129,29 @@
                                         ; can't call s/load-image here because we're not in the dynamic scope for the *processing* binding
                                         (def images (assoc images id response)))})))  ; so just store the base64 image data in the map

+;; Sketch
+
+(defn setup []
+  (s/size (.-innerWidth js/window) (.-innerHeight js/window))
+  (s/text-font (s/create-font "Arial" 32)))
+
+(defn draw []
+  (let [mx (s/mouse-x), my (s/mouse-y)]
+    (s/background 100)
+
+    (draw-person mx my)
+
+    (s/push-matrix)
+    (s/scale 2.0)
+    (if-let [img (load-image "logo-color-255x75.png")]
+      (s/image img 100 100))
+    (s/pop-matrix)
+
+    (draw-cursor mx my)
+
+    (show-coords mx my)))
+
 (defn init []
-  (js/Processing.
-    (sel1 :#stage)
-    (s/sketch-init {:setup (fn []
-                             (s/size (.-innerWidth js/window) (.-innerHeight js/window))
-                             (s/text-font (s/create-font "Arial" 32)))
-
-                    :draw (fn []
-                            (let [mx (s/mouse-x), my (s/mouse-y)]
-                              (s/background 100)
-
-                              (draw-person mx my)
-
-                              (s/push-matrix)
-                              (s/scale 2.0)
-                              (if-let [img (load-image "logo-color-255x75.png")]
-                                (s/image img 100 100))
-                              (s/pop-matrix)
-
-                              (draw-cursor mx my)
-
-                              (show-coords mx my)))}))
-
-  ; Use of "localhost" will only work for local development.
-  ; Change the port to match the :repl-listen-port.
+  (js/Processing. (sel1 :#stage) (s/sketch-init {:setup setup
+                                                 :draw draw}))
   (repl/connect "http://localhost:9000/repl"))


kill tests for funcs that do not exist anymore


Whitespace

Whitespace


:bug: Typo: land must be lang

:bug: Typo: land must be lang

--- frontend/src/uxbox/main/data/users.cljs
+++ frontend/src/uxbox/main/data/users.cljs
@@ -49,7 +49,7 @@
     ptk/UpdateEvent
     (update [_ state]
       (assoc state :profile (cond-> data
-                              (nil? (:land data)) (assoc :lang cfg/default-language)
+                              (nil? (:lang data)) (assoc :lang cfg/default-language)
                               (nil? (:theme data)) (assoc :theme cfg/default-theme))))

     ptk/EffectEvent


Two tests added into format-date module: format-date-existence and format-current-date

--- test/zg/format_date_test.clj
+++ test/zg/format_date_test.clj
@@ -23,3 +23,18 @@
     [function-name]
     (clojure.test/function? function-name))

+;
+; Tests for various functions existence
+;
+
+(deftest test-format-date-existence
+    "Check that the zg.format-date/format-date definition exists."
+    (testing "if the zg.format-date/format-date definition exists."
+        (is (callable? 'zg.format-date/format-date))))
+
+
+(deftest test-format-current-date-existence
+    "Check that the zg.format-date/format-current-date definition exists."
+    (testing "if the zg.format-date/format-current-date definition exists."
+        (is (callable? 'zg.format-date/format-current-date))))
+


Fix paired read R2 pattern; add support for paired no replicate processing

--- src/aerobio/htseq/paired.clj
+++ src/aerobio/htseq/paired.clj
@@ -33,6 +33,7 @@
    [aerial.utils.io :refer [letio] :as io]
    [aerial.bio.utils.files :as bufiles]

+   [aerobio.pgmgraph :as pg]
    [aerobio.params :as pams]])

@@ -88,7 +89,7 @@
         sampdir (fs/join sampbase samp)
         R1fqs (fs/glob (fs/join sampdir "*R1.fastq.gz"))
         fastqdir (fs/join expoutdir eid (pams/get-params :fastq-dirname))
-        fpattern (re-pattern (str "^" samp "*_R2_*.fastq.gz"))
+        fpattern (re-pattern (str "^" samp "_*_R2_*.fastq.gz"))
         R2infqs (fs/re-directory-files fastqdir fpattern)]
     (doseq [R2-infq R2infqs]
       (doseq [R1fq R1fqs]
@@ -96,6 +97,19 @@
           (println (apply format "%s -> %s : %s"
                           (map fs/basename [R2-infq R1fq R2-otfq])))
           (demuxR2 R1fq R2-infq R2-otfq))))))
+
+
+(defn demux-R2-samp-no-replicates [eid samp]
+  (let [expoutdir (pams/get-params :scratch-base)
+        sampbase (fs/join expoutdir eid "Samples")
+        sampdir (fs/join sampbase samp)
+        R1fqs (fs/glob (fs/join sampdir "*R1.fastq.gz"))
+        fastqdir (fs/join expoutdir eid (pams/get-params :fastq-dirname))
+        fpattern (re-pattern (str "^" samp "_*_R2_*.fastq.gz"))
+        R2infq (first (fs/re-directory-files fastqdir fpattern))]
+    (doseq [R2-otfq (mapv R2fq-name R1fqs)]
+      (pg/ln "-s" R2infq R2-otfq))))
+


add makepkg command launch

add makepkg command launch

--- src/aurman/core.clj
+++ src/aurman/core.clj
@@ -3,7 +3,7 @@
   (:use aurman.api)
   (:require [me.raynes.fs :as fs]
             [me.raynes.fs.compression :as compr])
-  (:use [clojure.java.shell :only [sh]]))
+  (:use [clojure.java.shell :only [sh with-sh-dir]]))

 (def pkg-dir "/tmp")

@@ -35,25 +35,35 @@
   [filename filepath outdir]
   (let [target (str outdir
                     "/"
-                    (clojure.string/replace filename #"\.gz$" ""))]
+                    (clojure.string/replace filename #"\.gz$" ""))
+        makepkg-dir (clojure.string/replace target #"\.tar$" "")]
     (println "Extracting " filepath "into" target)
     (compr/gunzip filepath target)
     (println "Extracting " target "into" outdir)
     (compr/untar target outdir)
     (println "Deleting " target)
     (fs/delete target)
+
 ))

 (defn install
   [pkg]
   (do
-    (println pkg)
+    ;(println pkg)
     (let [[f bytes] (get-pkg pkg)
            filepath (str pkg-dir "/" f)
            target (clojure.string/replace filepath #"\.tar\.gz$" "/")]
       (println filepath)
       (save-file filepath bytes)
-      (extract f filepath pkg-dir))))
+      (extract f filepath pkg-dir)
+      (let [{error :err
+             out :out
+             exit :exit} (sh
+                          "makepkg" "--noconfirm" "-s"
+                          :dir target)]
+        (if (= exit 1)
+          (println error)
+          (println out))))))

 (defn aur-search
   [query]
@@ -63,13 +73,15 @@
   [idquery]
   (if (number? (read-string idquery))
     (println (get-info idquery))
-    (let [results (-> idquery aur-search results->ip-map)
-          id  (do (print "Enter the Package ID to install : ")
-                  (read-string (read-line)))]
-      (if (contains? results id)
-        (install (get results id))
-        (println "Package ID not found!"))
-      )))
+    (let [results (-> idquery aur-search results->ip-map)]
+      (if (not-empty results)
+        (let [id  (do (print "Enter the Package ID to install : ")
+                      (flush)
+                      (read-string (read-line)))]
+          (if (contains? results id)
+            (install (get results id))
+            (println "Package ID not found!"))))
+       )))

 (defn -main
   "


Forgot match/any

Forgot match/any

--- src/aurora/ast.cljs
+++ src/aurora/ast.cljs
@@ -49,9 +49,13 @@
   (check (= :constant (:type x))
          (data! (:data x))))

+(defn match-any! [x]
+  (check (= :match/any) (:type x)))
+
 (defn pattern! [x]
   (check
    (cond
+    (= :match/any (:type x) (match-any! x))
     (number? x) true
     (string? x) true
     (= :tag (:type x)) (tag! x)


couple of updates

couple of updates

--- src/clj/just_married/api.clj
+++ src/clj/just_married/api.clj
@@ -17,8 +17,6 @@
             [ring.adapter.jetty :as jetty]
             [just-married.language :refer [detect-language]]
             [just-married.shared :refer [available-languages]]
-            [compojure.core :refer [defroutes GET POST]]
-            [environ.core :refer [env]]
             [just-married
              [settings :as settings]
              [pages :as pages]
@@ -82,9 +80,10 @@
       (assoc :session (dissoc session :identity))))

 (defn enter-page
-  [request]
+  [request & {:keys [redirect-to]}]
   (let [language (get-language request)]
-    (render-page :initial {:language language})))
+    (render-page :initial {:language language
+                           :redirect-to redirect-to})))

 (defn main-page
   [request]
@@ -118,8 +117,7 @@

 (defroutes app-routes
   (GET "/" request (enter-page request))
-  (GET "/rvsp" request (render-page :initial {:language :en
-                                              :redirect-to "rvsp"}))
+  (GET "/rvsp" request (enter-page request :redirect-to "rvsp"))
   (POST "/notify" request (notify request))
   ;; do a redirect adding the extra information
   (GET "/main" request (main-page request))


sort out the layout again

sort out the layout again

--- src/clj/just_married/css.clj
+++ src/clj/just_married/css.clj
@@ -97,20 +97,20 @@
 (def main-page
   [[:.container (:desktop grid-config)]

-   [:.countdown {:grid-column 1
+   [:.countdown {:grid-column "span 2"
                  :grid-row 1
                  :color (:marsala COLOR-PALLETTE)
                  :font-weight "bold"
                  :font-family (:alex-brush FONT-FAMILIES)
                  :font-size "x-large"}]

-   [:.story {:grid-column 2
-             :grid-row 1}]
+   ;; [:.story {:grid-column 2
+   ;;           :grid-row 1}]

    [:.find-us {:grid-column 1
                :grid-row 2}]

-   [:.timeline {:grid-column 2
+   [:.timeline {:grid-column 1
                 :grid-row 2}]

    [:blockquote:before {:color (:quote-border-left COLOR-PALLETTE)