The reason the thread-per-connection approach is nice is because it
correctly propagates backpressure. If we're copying data from a source to
a sink (let's say reading it in from the network and writing to a file),
it's possible that the production of data may outstrip the consumption. If
This is not a full example, but I ran into the same issue when building an
app for the Clojure Cup not too long ago. The general approach I used is
this:
- create the Compojure routes in a function with the components I need
as parameters
- declare the web server itself (I used
This is something that should be configurable extendable in core.async
really... but given how long it took to have this possibility with agents I
am not holding my breath (not to mention it was never even considered for
c.c/future).
On Tuesday, October 7, 2014 8:48:23 PM UTC+2, Brian Guthrie
One way how to handle this elegantly in Java is to add support for
java.nio.channels.SelectableChannel in core.async buffer. That way you
could select on any combination of core.async channels and io
resources, waiting for core.async channels to free and resources to
have data ready.
Jozef
On
1, Extract the app out of the Webserver record into its own var.
2, Add to the Webserver record an additional argument called handler.
2, Put the component in a separate namespace.
3, Initialize your component with the app var.
OR, use system, which does all of the above for you.
I posted a working example in the system repo:
https://github.com/danielsz/system/tree/master/example
On Tuesday, October 7, 2014 2:33:33 PM UTC+3, JPatrick Davenport wrote:
Hello,
I'm trying to create a web app. I'm having the damnest time trying to
figure out how to layer my application.
Hello everybody,
I noticed a demand for examples in how to put together a web app with the
reloaded approach (Stuart Sierra's components).
For this reason, I've published an example project in the system library.
https://github.com/danielsz/system/tree/master/example
Enjoy.
Please let me
I felt the Austin pain. Then I discovered figwheel. In one fell swoop, it
solved all aforementioned problems.
Live coding with Emacs has never been more joyful.
https://github.com/bhauman/lein-figwheel
On Tuesday, October 7, 2014 7:21:19 PM UTC+3, g vim wrote:
On 11/04/2014 09:17, Colin Yates
Hello guys,
I'm trying to create small lein plugin
(https://github.com/Gonzih/lein-feeds2imap/blob/master/src/leiningen/feeds2imap.clj)
that should use library underneath that uses log4j via
clojure.tools.logging. But I don't see logging output when I call plugin. I
tried to configure it in
Check out https://github.com/halgari/com.tbaldridge.hermod for an
interesting take on this.
On Wednesday, October 8, 2014 1:17:11 AM UTC-4, Sun Ning wrote:
BTW, is there any network based core.async channel available now?
On 10/08/2014 04:36 AM, adrian...@mail.yu.edu javascript: wrote:
I wasn't aware of hermod, that's interesting. I would still characterize
its approach to backpressure as broken, though, since when the queues get
full it silently drops messages on the ground. In fairness, this is very
clearly documented, so it's less pernicious than some of the other cases
out
Very nice! looks like there are some css issues with output display for
example, (map inc [1 2 3 4]) doesn't output on a single line, and seems to
shift a little bit from time to time.
With a little more polishing this could be fantastic teaching tool for
intro to clojure workshops and
Hi Arnout,
This is interesting, but may be a lot less useful than you think without
filling in all the other methods that a normal map has. For instance, you
cannot do an equality check with another map (no use of
clojure.lang.MapEquivalence or implementation of equals and equiv), nor use
it
Thanks!
kl. 02:17:45 UTC+2 onsdag 8. oktober 2014 skrev adrian...@mail.yu.edu
følgende:
*output
On Tuesday, October 7, 2014 8:17:34 PM UTC-4, adrian...@mail.yu.edu wrote:
You need to flush the input stream after printing. Call
(clojure.core/flush) to do so.
On Tuesday, October 7, 2014
If you want to handle multiple TCP connections and async channels in one
thread, you need a way how to block on both connections (wait for new input
to arrive) and channels (wait for a free space in a buffer). Blocking only
on connections will get you a busy loop if channels are full. If you
Here is the finished Yatzy, in case anyone is interested:
https://github.com/Jovlang/catzy/blob/master/src/catzy/core.clj
kl. 19:05:50 UTC+2 onsdag 8. oktober 2014 skrev Johannes Langøy følgende:
Thanks!
kl. 02:17:45 UTC+2 onsdag 8. oktober 2014 skrev adrian...@mail.yu.edu
følgende:
The documentation for Manifold can explain the API better than I can here.
The point where that interacts with Netty w.r.t. backpressure is here:
https://github.com/ztellman/aleph/blob/0.4.0/src/aleph/netty.clj#L109.
Here the stream represents data coming off the wire, and if the put onto
the
Sorry, didn't cover converse case. That's handled by the ChannelSink
directly underneath. Note that each write returns a Netty ChannelFuture
representing completion of the write, which is transformed into a Manifold
deferred. Any time a Manifold put returns an unrealized deferred, that
creates
The Stuart Sierra's talk about Component has short bit about using it with
ring, at around 32:24 https://www.youtube.com/watch?v=13cmHf_kt-Q#t=1944.
Idea is that you'll wrap your basic routes with a middleware which will
assoc components to every request.
Difference to the other approach
Reading Joy of Clojure, section 5.1.2, I'm hoping someone here can help me
understand the following:
* `clojure.core/seq` returns a seq or a sequence? Likewise for `map`
and `filter`.
* What is the difference between a seq and a sequence?
* A seq may possibly be lazy, but vectors and
The 2014 State of Clojure survey is now available! This year's edition is
broken into 2 parts - one for anyone who uses any Clojure dialect and a
second specifically for ClojureScript users.
http://blog.cognitect.com/blog/2014/10/3/2014-state-of-clojure-clojurescript-survey
From a community
Thank you! Using put! callback to control backpressure is a very elegant
solution. BTW there always has to be blocking somewhere. Netty uses
selector to block at [1] and .setAutoRead causes respective channel to
deregister itself from a selector [2], until put! completes.
Regarding the other
Yes, I didn't mean to imply that there are no blocking operations anywhere,
only that nothing in the worker threads (where the put! occurs) will block,
and that backpressure isn't exerted by causing an active thread to hang.
As to the second point, I'm not sure why you'd think that. These aren't
Hi everyone,
One can use into-edn [1] to convert from Java objects to EDN structures.
Is there a way to convert EDN structures to their original Java objects?
Regards,
Timur
[1] https://github.com/thebusby/into-edn
--
You received this message because you are subscribed to the Google
I'm sure you can, but you would need to implement your own custom methods
to do it, using :readers or :default options in edn/read / edn/read-string
It would very much depend on the format of the outputted EDN as to which
approach to take.
Mark
On 9 October 2014 07:12, Timur
Hi Zach,
Thank you for checking out the library. You were right, some interfaces
were missing and some methods had not been implemented. Though this was
documented, they were limitations that could be fixed.
*So, I'd like to announce version 0.2.0.*
This version does implement all the
It was just my ignorance of manifold's concepts :). I was thinking in terms
of I have this thread which should connect these channels to those
sockets, when to do what. Manifold's async approach with its connectable
streams and deferreds with callbacks seems to abstract away such
bookkeeping.
This solution (creating the routes in a function and passing components
into the function) seems to be the best solution. Other solutions all
require defining the routes a prior, which may be the root of the problems,
because some handlers may depend on functions generated by components in
the
Thanks for putting that together, Dylan. Looking forward to seeing what
you're building. :)
Olli, please feel free to reach out to me (email, Twitter, GitHub issue,
whatever) if you have any questions. Thanks for trying it out!
On Tue, Oct 7, 2014 at 12:05 PM, Dylan Butman dbut...@gmail.com
you can read Programming Clojure 2nd, which explains very clearly.
--
tao.zhou2009
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)
On Thursday, October 9, 2014 at 2:39 AM, John Gabriele wrote:
Reading Joy of Clojure, section 5.1.2, I'm hoping someone here can help me
understand the
The words seq and sequence can be used interchangeably.
The map and filter functions return seqs.
Yes, a seq may be lazy, but vectors and lists cannot.
seqable means any data structure that can be turned into a seq using the
seq function. This includes the Clojure collections, but also strings,
On Friday, September 26, 2014 11:09:55 AM UTC-4, Nelson Morris wrote:
Clojars has become a critical part of the clojure ecosystem. As a small
sample, it hosts artifacts for:
* Web development - ring, compojure, hoplon, hiccup, enlive, friend,
immutant
* Tooling - lein templates/plugins,
This is pretty nifty:
user= (require '[rmap.core :as rmap])
nil
user= (def fibs (rmap/rmap FIBS {:a 0 :b 1 :next (- FIBS (update-in [:a]
(constantly (:b FIBS))) (update-in [:b] (constantly (+ (:b FIBS) (:a
FIBS)}))
#'user/fibs
user= (defn fib [n] (loop [fibs fibs n n] (if (zero? n) (:a fibs)
This is great. A little buggy, but that's to be expected :)
I really appreciate the ability to hop onilne and test the behavior of
little bits of code without waiting for a local repl to start up!
On Tuesday, October 7, 2014 3:00:08 PM UTC-4, Lauri Hartikka wrote:
A web based clojure
I just did this for the first time last week. Run VisualVM, it gives you a
list of running VMs. Select one. Hit the button to start collecting profiling
data. Execute some code in the REPL. Eventually it will finish, and you'll have
a big stack of profiling data. It won't go down to the
Thanks, James!
What still throws me off is that the JoC book points out a symmetry that I
wanted to better grasp. It first notes that:
* `(first []) ;= nil` and
* `(rest []) ;= ()`
and then goes on to say:
* Clojure functions that promise to return sequences, such as `map` and
On Monday, October 6, 2014 9:36:59 AM UTC-4, edbond wrote:
Add one more chan, external ready.
Put :ok there to let producer generate new value.
producer:
- read from external ready
- generate value
- put into outgoing chan
client:
- contact external server, put in external ready if ok
On Wednesday, October 8, 2014 9:20:31 PM UTC-4, Skottk wrote:
I just did this for the first time last week. Run VisualVM, it gives you
a list of running VMs. Select one. Hit the button to start collecting
profiling data. Execute some code in the REPL. Eventually it will finish,
and you'll
On Wednesday, October 8, 2014 8:16:38 PM UTC-4, James Reeves wrote:
The words seq and sequence can be used interchangeably.
The map and filter functions return seqs.
Yes, a seq may be lazy, but vectors and lists cannot.
seqable means any data structure that can be turned into a seq using
Thanks for the survey!
I have a couple of suggestions/questions:
For domains, there are no categories for scientific or other research
applications. For example, I mainly use Clojure for writing agent-based
models for academic research. Would a set of categories in this area be
usedful?
On Wed, Oct 8, 2014 at 10:55 PM, John Gabriele jmg3...@gmail.com wrote:
* (when calling `seq` on a coll) ...In either case, if the collection
is empty, `seq` returns nil and never an empty sequence. Functions that
promise to return seqs (not sequences), such as `next`, work the same way.
I
41 matches
Mail list logo