What’s the best way to browse all lein templates?
There are 1860 lein templates on clojars as of this writing. Is there a sane way to view them and group them by category? I’m looking for a handful of templates to consider for my next project. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Best way to include dev-only functions?
I’d like to have a namespace loaded with dev-only versions of some functions. Is there a better way than using environ with ‘require’ and ’ns-resolve’ to do this? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Adding http header to SOAP request
If anyone has used clj-soap, it has built-in SOAP auth, IIUC. I need to call an endpoint that is expecting custom http authentication headers as well. Has anyone else done this before? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: spec key aliasing or different specs for same keyword
Yes, the namespacing is great, so I have no issue with that. I would just rather use snake-case in Clojure than camel-case. Since the payload has 'resultCount' I'd like to map that to a spec named result-count instead. I think I figured out part of the answer: (s/def :my/result int?) (s/def :your/result pos-int?) (s/def ::test-spec-1 (s/keys :req-un [:my/result])) (s/def ::test-spec-2 (s/keys :req-un [:your/result])) I see here that I can have an unqualified keyword as part of a qualified spec name. I think that's what I want. On Thursday, December 28, 2017 at 12:26:59 PM UTC-5, adrian...@mail.yu.edu wrote: > > Avoiding global name collision is the reason why specs are named with > namespace-qualified keywords. I am confused by your last sentence though. > Do you mean Clojure namespaces or the namespace component of the keyword > itself? There is no requirement in clojure.spec that the namespace of the > specs you def be coupled to the Clojure namespace they happen to be defined > in. If you are actually asking about how to write specs for unqualified > keys in a map there is a built-in facility to do that as well: > clojure.spec.alpha/keys has a :req-un and :opt-un argument. > > On Thursday, December 28, 2017 at 11:28:18 AM UTC-5, Jonathon McKitrick > wrote: >> >> I have one spec question covering two scenarios. >> >> 1. Suppose I want to spec a payload from a third-party API that has the >> keyword ':resultCount' in it. Does that mean my specs for that item must >> have the same name? >> >> 2. Supposed I have a few payloads from that API and each has a keyword >> ':result' but the spec for each will be different. Other than using an >> entirely different namespace, how can I map the :result keyword to >> different specs? >> >> Thanks! >> > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
spec key aliasing or different specs for same keyword
I have one spec question covering two scenarios. 1. Suppose I want to spec a payload from a third-party API that has the keyword ':resultCount' in it. Does that mean my specs for that item must have the same name? 2. Supposed I have a few payloads from that API and each has a keyword ':result' but the spec for each will be different. Other than using an entirely different namespace, how can I map the :result keyword to different specs? Thanks! -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Transducers eduction vs sequence
Ah, ok. I guess I was thrown off because evaluating sequence and eduction results both produce output at the REPL, but only sequence can be output as JSON at the REPL. On Friday, December 22, 2017 at 1:46:59 PM UTC-5, Sean Corfield wrote: > > Their respective docstrings give a hint here: > > > > Sequence – “returns a lazy sequence”. > > Eduction – “returns a reducible/iterable …”. > > > > (type (sequence identity [1 2 3])) => clojure.lang.LazySeq > > (type (eduction identity [1 2 3])) => clojure.core.Eduction > > > > If you look at that cheshire.generate/generate function -- > https://github.com/dakrone/cheshire/blob/master/src/cheshire/generate.clj#L116-L152 > > – you’ll see it is a large cond on the type of its argument and that it > supports clojure.lang.ISeq (which clojure.lang.LazySeq implements) but does > not support any of the types that clojure.core.Eduction has behind it. > > > > If you wrap your eduction call in a seq call, I expect it will work: > > > > (type (seq (eduction identity [1 2 3]))) => clojure.lang.LazySeq > > > > Sean Corfield -- (970) FOR-SEAN -- (904) 302-SEAN > An Architect's View -- http://corfield.org/ > > "If you're not annoying somebody, you're not really alive." > -- Margaret Atwood > > > -- > *From:* clo...@googlegroups.com <clo...@googlegroups.com > > on behalf of Jonathon McKitrick <jmcki...@gmail.com > > > *Sent:* Friday, December 22, 2017 6:32:54 AM > *To:* Clojure > *Subject:* Transducers eduction vs sequence > > I have a `get-summary` function that builds stats and returns them as a > web service. Under the hood, it calls quite a few map, group-by, filter, > etc. functions. > > I’m experimenting with transducers, and `sequence xform` does the trick > most of the time. But I want to understand `eduction` use cases. In most > cases, `eduction` seems to be a drop-in replacement. But in a few cases, > I’m seeing this error: > > JsonGenerationException Cannot JSON encode object of class: class > clojure.core.Eduction: clojure.core.Eduction@31accd87 > cheshire.generate/generate (generate.clj:152) > > So there’s something I’m missing about my understanding of `sequence` > versus `eduction`. Can someone shine some light on it? > > Thanks! > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clo...@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+u...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+u...@googlegroups.com . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Transducers eduction vs sequence
I have a `get-summary` function that builds stats and returns them as a web service. Under the hood, it calls quite a few map, group-by, filter, etc. functions. I’m experimenting with transducers, and `sequence xform` does the trick most of the time. But I want to understand `eduction` use cases. In most cases, `eduction` seems to be a drop-in replacement. But in a few cases, I’m seeing this error: JsonGenerationException Cannot JSON encode object of class: class clojure.core.Eduction: clojure.core.Eduction@31accd87 cheshire.generate/generate (generate.clj:152) So there’s something I’m missing about my understanding of `sequence` versus `eduction`. Can someone shine some light on it? Thanks! -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: spec for different http responses
Perfect. I'm still learning my way around, so I overlooked the obvious. Thanks! On Monday, December 18, 2017 at 9:36:14 AM UTC-5, Alex Miller wrote: > > Yes, I think multispec is one option, or just s/or of course (when > conformed, that will give you a tag telling you which one it is, which > might be useful). The other consideration is that the multispec is based on > a multimethod so it can be externally extended later rather than by > modifying an existing spec. But maybe that's unimportant for you. > > On Monday, December 18, 2017 at 8:19:13 AM UTC-6, Jonathon McKitrick wrote: >> >> I'm really diving into spec now, and I'd like to have a spec that covers >> successful http responses, but also allows me to conform different body >> content. >> >> For example, in one case I just expect raw html, but in another, JSON >> with a specific structure. >> >> Are spec multimethods the correct way to do this, or are there other >> options? >> >> I considered have different 'body' specs with names that make sense, but >> since the spec name must match the key name, the specs all have to be >> 'body', correct? >> > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
spec for different http responses
I'm really diving into spec now, and I'd like to have a spec that covers successful http responses, but also allows me to conform different body content. For example, in one case I just expect raw html, but in another, JSON with a specific structure. Are spec multimethods the correct way to do this, or are there other options? I considered have different 'body' specs with names that make sense, but since the spec name must match the key name, the specs all have to be 'body', correct? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Good examples of spec use for review?
Are there any relatively simple projects out there that illustrate the best practices for clojure.spec? I’d like to see namespacing guidelines, generative testing, and instrumentation on tests that can of course be disabled or completely elided in production. thanks! -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Namespace question and request for project with non-trivial use of clojure.spec
I've run into some odd namespace issues with clojure.spec, and I'm sure it's because I'm doing something wrong. I have this in my ns declaration: [foo.schema :as schema] However: foo.main> (s/valid? :foo.schema/email "f...@bar.com") true foo.main> (s/valid? :schema/email "f...@bar.com") Exception Unable to resolve spec: :schema/email clojure.spec/reg-resolve! (spec.clj:68) foo.main> It would also be useful if I knew of a non-trival project I could view that uses clojure.spec across namespaces, but without being SO complex that the basics are obscured. Does anyone know of or have an example? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Converting json to work with clojure.spec
Ah, I see that now. That being said, I see the benefits in moving to namespace qualified keys. Currently, I'm returning structures directly in Compojure handlers, and the JSON conversion is implicitly handled. I checked Cheshire and didn't immediately see a way to generate namespaced keys. What's the best way to do this? On Saturday, November 19, 2016 at 9:23:32 AM UTC-5, Alex Miller wrote: > > s/keys has :req-un and :opt-un alternatives for un-qualified keys. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Converting json to work with clojure.spec
A good chunk of my API consists of returning Yesql directly as the body of the response. But clojure.spec wants namespaced keywords. Is there a simple way to wrap my json responses to make them conform to this requirement? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Protocols for persistence - not sure about a few cases
I'm beginning a foray into protocols after coming from the Common Lisp world of multimethods. I'm using them initially to implement a consistent load/save API over the DB layer. It's pretty simple to have a Saveable protocol to save one object, because the first argument is a Record of the type I am saving. But since protocols dispatch on the first argument, how do you define a Loadable protocol that loads an object or handles a collection of objects? For example, if I want to load an object by idx, the first argument is not a Record, but an integer, or perhaps an arbitrary field to used in a query. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Using OAuth2 to call one web app from another
Right! But what's the easiest way to do the initial handshake with the public/private bits to *get* the token? On Monday, June 20, 2016 at 8:13:49 PM UTC-4, Denis Laprise wrote: > > You can pass the OAuth token in the request options if you're using > httpkit or clj-http (both use the :oauth-token parameter). > > > On Monday, June 20, 2016 at 4:30:32 PM UTC-7, Jonathon McKitrick wrote: >> >> I'm looking for the simplest way possible to get OAuth2 working so I can >> call an API which has recently switched from username/password to OAuth2. >> >> Any suggestions? Most of what I've found so far is server implemenation, >> rather than web app to web app. >> >> -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Using OAuth2 to call one web app from another
I'm looking for the simplest way possible to get OAuth2 working so I can call an API which has recently switched from username/password to OAuth2. Any suggestions? Most of what I've found so far is server implemenation, rather than web app to web app. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Simple memory usage tuning for clojure
I can't quite tell if it's free for personal use, or will quit working in 15 days without a paid upgrade On Tuesday, May 3, 2016 at 2:24:20 PM UTC-4, tbc++ wrote: > > YourKit has the ability to take memory snapshots then analyze those > snapshots to find retention paths. So it'll help you see things like "500MB > of data is held by this single reference". > > Getting up-to-speed on YourKit isn't bad if you're familiar with > profilers. If not...maybe try learning it anyways, it's a good skill to > have. > > On Tue, May 3, 2016 at 12:20 PM, Jonathon McKitrick <jmcki...@gmail.com > > wrote: > >> I have some time constraints, and need to figure out why an import script >> is hogging so much memory and crapping out on Heroku. >> >> What tools would you recommend that would (a) give useful information for >> tuning and (b) have a short learning curve? >> >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To post to this group, send email to clo...@googlegroups.com >> >> Note that posts from new members are moderated - please be patient with >> your first post. >> To unsubscribe from this group, send email to >> clojure+u...@googlegroups.com >> For more options, visit this group at >> http://groups.google.com/group/clojure?hl=en >> --- >> You received this message because you are subscribed to the Google Groups >> "Clojure" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to clojure+u...@googlegroups.com . >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > “One of the main causes of the fall of the Roman Empire was that–lacking > zero–they had no way to indicate successful termination of their C > programs.” > (Robert Firth) > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Simple memory usage tuning for clojure
I have some time constraints, and need to figure out why an import script is hogging so much memory and crapping out on Heroku. What tools would you recommend that would (a) give useful information for tuning and (b) have a short learning curve? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
HTTP basic auth for some pages but not all
I'm using [ring-basic-authentication "1.0.5"] as my auth library for a quick app I need to get up and running. The only catch is I need some routes to be protected, and others public. And I'm not getting it to work with something simple like this: (cc/defroutes (cc/routes pub-routes (auth/wrap-require-auth app-routes authenticate "Sorry" {:body "Denied"}))) I'm sure I'm missing something simple, but I'm running out of time -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Practical ways to deal with 'bag-of-properties' syndrome, AKA dynamic typing?
I've read the recent comments on 'the end of dynamic languages' and I'm curious what ways you have found for dealing with one of the issues I've heard mentioned frequently: when libraries (or functions in general) pass maps around as arguments or return values, how to go about finding out exactly what those maps contains without slogging through source code. Any suggestions? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Suggestions on staying up to date with Clojure
What list of blogs, websites, and/or feeds would you suggest for someone who does not work with Clojure full time that will maximize exposure to advancements in the language, tools, and techniques and give the 'biggest bang for the buck' regarding time investment? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Testing concurrency/async features with clojure.test
If I have code in a go block or a future call, what is the best way to automate test coverage of that code? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: How to email PDF attachments
Carlo, you were right. It works perfectly! Thanks On Thursday, September 24, 2015 at 9:25:24 PM UTC-4, Carlo wrote: > > I don't know anything about your PDF/email problem, but I was under the > impression that you could use the local filesystem in Heroku, but that you > can't rely on it for persistance. > > https://devcenter.heroku.com/articles/dynos#ephemeral-filesystem > > So, if you had a solution that was "write to disk, then add file as an > attachment to an email" that could work on Heroku. > > On 25 September 2015 at 10:13, Jonathon McKitrick <jmcki...@gmail.com > > wrote: > >> I'm using clj-pdf to great success to stream a generated PDF when >> requested by URL, and postal to send email. >> >> I now need to output the PDF to an attachment in the email itself, and >> this needs to be Heroku-capable (no local filesystem). >> >> Has anyone done something similar, or any of the pieces? >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To post to this group, send email to clo...@googlegroups.com >> >> Note that posts from new members are moderated - please be patient with >> your first post. >> To unsubscribe from this group, send email to >> clojure+u...@googlegroups.com >> For more options, visit this group at >> http://groups.google.com/group/clojure?hl=en >> --- >> You received this message because you are subscribed to the Google Groups >> "Clojure" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to clojure+u...@googlegroups.com . >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
How to email PDF attachments
I'm using clj-pdf to great success to stream a generated PDF when requested by URL, and postal to send email. I now need to output the PDF to an attachment in the email itself, and this needs to be Heroku-capable (no local filesystem). Has anyone done something similar, or any of the pieces? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Compojure character encoding
I have a web app that apparently cannot consume UTF-8 encoding. Can compojure generate responses in latin-1 encoding? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Compojure character encoding
Thanks, James. To clarify, Compojure has no problems serving the JSON content. But the SBCL common lisp app and a third-party app (Klipfolio) both are choking on the output. I was able to fix the SBCL app by telling Babel to use latin-1 encoding, but I need another solution for the output to Klipfolio. It's probably a knowledge gap on my part of correct use of encodings, and I just haven't found the 'correct' solution yet. On Wednesday, June 24, 2015 at 9:23:36 AM UTC-4, James Reeves wrote: Yes, you can return a full response map with the desired encoding: (GET / [] {:status 200 :headers {Content-Type text/html; charset=ISO-8859-1} :body Hello World}) Or use the ring.util.response namespace: (GET / [] (- (resp/response Hello World) (resp/charset ISO-8859-1))) Or write some middleware to change the charset globally: (defn text-response? [response] (some- (resp/get-header response Content-Type) (.startsWith text/))) (defn wrap-charset [handler charset] (fn [request] (let [response (handler request)] (if (text-response? response) (resp/charset response ISO-8859-1) response However, it's odd that you can't consume UTF-8 encoding. Are you sure that's the problem? - James On 24 June 2015 at 14:47, Jonathon McKitrick jmcki...@gmail.com javascript: wrote: I have a web app that apparently cannot consume UTF-8 encoding. Can compojure generate responses in latin-1 encoding? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.com javascript: Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com javascript:. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Adding a simple hook to lein build process without writing a plugin
I'd like my build and/or deployment process to suck in the output of `git describe` for use as a build version in the app. What's the simplest way to do that without writing a leiningen plugin? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: How to add headers to a clojure.java.io/resource response
I'll give that a shot, thanks! On Wednesday, May 27, 2015 at 8:12:10 AM UTC-4, James Reeves wrote: Oh, my apologies. You also need to pass the request map to the render method. (- (io/resource public/html/confirm.html) (cr/render request) (resp/header Cache-Control no-cache, no-store)) You could also write it as: (- (resp/resource-response public/html/confirm.html) (resp/content-type text/html; charset=utf-8) (resp/header Cache-Control no-cache, no-store)) Or write some middleware: (defn wrap-cache-control [handler cache-control] (fn [request] (some- (handler request) (resp/header Cache-Control cache-control - James On 27 May 2015 at 13:01, Jonathon McKitrick jmcki...@gmail.com javascript: wrote: Hmm. I tried this: (- (io/resource public/html/confirm.html) (cr/render) (resp/header Cache-Control no-cache, no-store)) and got this: Exception in thread main java.lang.IllegalArgumentException: No single method: render of interface: compojure.response.Renderable found for function: render of protocol: Renderable, compiling:(pts/server.clj:483:14) On Tuesday, May 26, 2015 at 8:43:21 AM UTC-4, James Reeves wrote: Compojure uses the compojure.response/render protocol method to turn values like URLs into Ring responses. So you could write: (- (io/resource public/html/confirm.html) (compojure.response/render) (response/header X-Foo Bar)) Or you could use some middleware, if the header is standard across your application. Or since you know that you're delivering a HTML file, you could also write: (- (response/resource-response public/html/confirm.html) (response/content-type text/html; charset=utf-8) (response/header X-Foo Bar)) That should result in the same thing, as the only thing Compojure does that Ring doesn't is try to make an educated guess about the content type. - James On 26 May 2015 at 13:22, Jonathon McKitrick jmcki...@gmail.com wrote: I have a GET route returning the result of this: (io/resource public/html/confirm.html) but I need to add Cache-Control headers. Since the `resource` function returns a java.net.URL object, how can I add headers? The normal Ring way with ring.util.response/header only operates on a Ring response. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.com javascript: Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com javascript:. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: How to add headers to a clojure.java.io/resource response
Hmm. I tried this: (- (io/resource public/html/confirm.html) (cr/render) (resp/header Cache-Control no-cache, no-store)) and got this: Exception in thread main java.lang.IllegalArgumentException: No single method: render of interface: compojure.response.Renderable found for function: render of protocol: Renderable, compiling:(pts/server.clj:483:14) On Tuesday, May 26, 2015 at 8:43:21 AM UTC-4, James Reeves wrote: Compojure uses the compojure.response/render protocol method to turn values like URLs into Ring responses. So you could write: (- (io/resource public/html/confirm.html) (compojure.response/render) (response/header X-Foo Bar)) Or you could use some middleware, if the header is standard across your application. Or since you know that you're delivering a HTML file, you could also write: (- (response/resource-response public/html/confirm.html) (response/content-type text/html; charset=utf-8) (response/header X-Foo Bar)) That should result in the same thing, as the only thing Compojure does that Ring doesn't is try to make an educated guess about the content type. - James On 26 May 2015 at 13:22, Jonathon McKitrick jmcki...@gmail.com javascript: wrote: I have a GET route returning the result of this: (io/resource public/html/confirm.html) but I need to add Cache-Control headers. Since the `resource` function returns a java.net.URL object, how can I add headers? The normal Ring way with ring.util.response/header only operates on a Ring response. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.com javascript: Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com javascript:. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
How to add headers to a clojure.java.io/resource response
I have a GET route returning the result of this: (io/resource public/html/confirm.html) but I need to add Cache-Control headers. Since the `resource` function returns a java.net.URL object, how can I add headers? The normal Ring way with ring.util.response/header only operates on a Ring response. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Question about Clojure codebase
What would you say is the most complex, hard-to-grok code in Clojure codebase? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Friend workflow for JWT
Here's my workflow: (defn workflow-jwt-signed [ {:keys [credential-fn] :as jwt-config}] (fn [{{:strs [authorization]} :headers :as request}] (when (and authorization (re-matches #\s*Bearer\s+(.+) authorization)) (println Found auth authorization) (if-let [claims (try (- (re-matches #\s*Bearer\s+(.+) authorization) second pts/get-jwt-token-from-string (get-in [:claims])) (catch Exception e (println Invalid Authorization header for JWT auth: authorization) #_(.printStackTrace e)))] (if-let [user-record ((cemerick.friend.util/gets :credential-fn jwt-config (::friend/auth-config request)) ^{::friend/workflow :jwt} claims)] (workflows/make-auth user-record {::friend/redirect-on-auth? false ::friend/ensure-session false}) (http-jwt-deny request)) {:status 400 :body Malformed Authorization header for JWT authentication.} But here's the problem: when the AJAX call protected by this workflow fails because the user is not logged in, it returns a login page. I want it to return nil or something similar. Does anyone know how to force such behavior when authentication fails? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [ANN] Clojure Applied: From Practice to Practitioner
Will we be notified as new content is added so we can update our electronic versions? On Monday, April 13, 2015 at 10:01:04 AM UTC-4, Alex Miller wrote: The errata form is for technical errors, typos, and suggestions. If you have broader questions or items for discussion, there is also a forum available: https://forums.pragprog.com/forums/352 Probably better to use either of those than this group. Thanks... On Monday, April 13, 2015 at 8:28:46 AM UTC-5, Nando Breiter wrote: Alex, Would you also like general feedback at the pragprog.com http://www.google.com/url?q=http%3A%2F%2Fpragprog.comsa=Dsntz=1usg=AFQjCNH42NqPrlF1xg8KTzx39DMWO2I5Xw url? Or is that better here? Aria Media Sagl Via Rompada 40 6987 Caslano Switzerland +41 (0)91 600 9601 +41 (0)76 303 4477 cell skype: ariamedia On Mon, Apr 13, 2015 at 3:16 PM, Alex Miller al...@puredanger.com wrote: Thanks Mohit! There was a bug around this that I had fixed at one point, perhaps I didn't get that change applied. BTW, for future bugs on the book, it's best to file them here so we can track them: https://pragprog.com/titles/vmclojeco/errata Alex On Sunday, April 12, 2015 at 1:28:03 AM UTC-5, Mohit Thatte wrote: Alex I read the preview chapters, great read so far. Looking forward to the whole book. There seems to be a small error in the Value Based Dispatch section on page 8, where the comments don't match the code. oz and lb seem to be flipped! (defmulti convert Convert quantity from unit1 to unit2, matching on [unit1 unit2] (fn [unit1 unit2 quantity] [unit1 unit2])) ;; lb to oz (defmethod convert [:lb :oz] [_ _ oz] (* oz 16)) ;; oz to lb (defmethod convert [:oz :lb] [_ _ lb] (/ lb 16)) Cheers, Mohit On Saturday, April 11, 2015 at 6:35:05 AM UTC+5:30, Alex Miller wrote: Great to hear! -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Has anyone seen this error while running lein-cloverage?
Here's a test in question: (deftest reports (testing PDF schedule (testing by api call (let [req (request :get /schedule.pdf)] (mocking [pts.reports/get-schedule-pdf] (app req); line 1035 (verify-call-times-for pts.reports/get-schedule-pdf 1)) The tests pass, but when run with lein-cloverage, I get this error. ERROR in (reports) (core_deftype.clj:544) Uncaught exception, not in assertion. expected: nil actual: java.lang.IllegalArgumentException: No implementation of method: :route-matches of protocol: #'clout.core/Route found for class: clojure.lang.PersistentArrayMap at clojure.core$_cache_protocol_fn.invoke (core_deftype.clj:544) clout.core$eval15857$fn__15858$G__15848__15865.invoke (core.clj:39) compojure.core$if_context$fn__16124.invoke (core.clj:188) compojure.core$routing$fn__16062.invoke (core.clj:127) clojure.core$some.invoke (core.clj:2515) compojure.core$routing.doInvoke (core.clj:127) clojure.lang.RestFn.applyTo (RestFn.java:139) clojure.core$apply.invoke (core.clj:626) compojure.core$routes$fn__16066.invoke (core.clj:132) pts.server_test$fn__28317$fn__28318$fn__28319.invoke (server_test.clj:1035) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: ANN: ClojureScript 0.0-3115
The cljsjs issue is fixed! On Monday, March 16, 2015 at 7:03:00 PM UTC-4, David Nolen wrote: And cut 0.0-3123 based on feedback from releases earlier today. One fix addresses redundant information in the dependency graph when compiling, the other fixes an issue when using advanced optimizations and :cache-analysis true. David On Mon, Mar 16, 2015 at 7:11 AM, David Nolen dnolen...@gmail.com wrote: ClojureScript, the Clojure compiler that emits JavaScript source code. README and source code: https://github.com/clojure/clojurescript New release version: 0.0-3115 Leiningen dependency information: [org.clojure/clojurescript 0.0-3115] This release is a bugfix release addressing several long outstanding issues as well as a number of problems that cropped up around improved REPLs and compile times. As usual feedback welcome! ## 0.0-3115 ### Enhancements * CLJS-806: support ^:const * CLJS-1115: Reusable repl-bootstrap! fn ### Changes * CLJS-667: validate extend-type and extend-protocol shape * CLJS-1112: :repl-requires option for REPL evaluation environment * CLJS-: browser REPL should have no side effects until -setup ### Fixes * CLJS-1085: Allow to pass test environment to cljs.test/run-all-tests * CLJS-867: extend-type with Object methods requires multi-arity style definition * CLJS-1118: cljs.repl/doc support for protocols * CLJS-889: re-pattern works on strings containing \u2028 or \u2029 * CLJS-109: Compiler errors/warnings should be displayed when cljs namespace 'package' names start with an unacceptable javascript symbol * CLJS-891: Defs in parent namespaces clash with child namespaces with the same name? * CLJS-813: Warn about reserved JS keyword usage in namespace names * CLJS-876: merged sourcemap doesn't account for output-wrapper * CLJS-1062: Incorrect deftype/defrecord definition leads to complex error messages * CLJS-1120: analyze-deps does not appear to work when analyzing analysis caches * CLJS-1119: constant table emission logic is incorrect * CLJS-977: implement IKVReduce in Subvec * CLJS-1117: Dependencies in JARs don't use cached analysis * CLJS-689: js/-Infinity munges to _Infinity * CLJS-1114: browser REPL script loading race condition * CLJS-1110: cljs.closure/watch needs to print errors to *err* * CLJS-1101 cljs.test might throw when trying to detect file-and-line * CLJS-1090: macros imported from clojure.core missing docs * CLJS-1108: :modules :output-to needs to create directories * CLJS-1095: UUID to implement IComparable * CLJS-1096: Update js/Date -equiv and -compare semantics based on Date.valueOf() value * CLJS-1102 clojure.test should print column number of exception when available -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: ANN: ClojureScript 0.0-3115
I just tried a build with this version, and I'm getting this error in my CLJS test suite, which does not happen with 0.0-2985. Compiling ClojureScript. Compiling resources/public/js/unit-test.js from [src/cljs test/cljs]... Successfully compiled resources/public/js/unit-test.js in 17.483 seconds. Compiling resources/public/js/main.js from [src/cljs]... Successfully compiled resources/public/js/main.js in 14.543 seconds. Running ClojureScript test: unit-test Error: goog.require could not find: cljsjs.react resources/public/js/unit-test.js:19683 resources/public/js/unit-test.js:55237 ERROR: cemerick.cljs.test was not required. You can resolve this issue by ensuring [cemerick.cljs.test] appears in the :require clause of your test suite namespaces. Also make sure that your build has actually included any test files. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Conditional dependency question
That did the trick, thanks! On Friday, March 6, 2015 at 11:30:42 AM UTC-5, Moritz Ulrich wrote: You need to use `ns-resolve' to resolve the actual vars you want to use. Here's a snippet from one of our projects which shows the approach: ```clojure (defn ws-repl [] (require 'cemerick.piggieback 'weasel.repl.websocket) (let [cljs-repl (ns-resolve 'cemerick.piggieback 'cljs-repl) repl-env (ns-resolve 'weasel.repl.websocket 'repl-env)] (cljs-repl :repl-env (repl-env :ip 0.0.0.0 :port 9009 :working-dir resources/public/out ``` Jonathon McKitrick jmcki...@gmail.com javascript: writes: I'm using environ and lein-environ to pick up dev settings, such as enabling weasel/piggieback in development. In my server module, I'm running this code in -main: (when (env :dev?) (println DEV) (require 'pts.dev) (pts.dev/browser-repl)) But pts.dev still throws a class not found exception. However, after the project has loaded and begins execution, I'm able to run that snippet successfully. What's the trick to getting pts.dev into the namespace conditionally? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.com javascript: Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com javascript:. For more options, visit https://groups.google.com/d/optout. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Has anyone seen this error with weasel/piggieback?
Can't change/establish root binding of: *cljs-repl-options* with set when evaluating (piggieback/cljs-repl :repl-env (weasel/repl-env :ip 0.0.0.0 :port 9001)) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Diagnosing a figwheel error
I decided to ditch piggieback/weasel and try figwheel, and though it starts without errors, I get 'Page not found' when visiting localhost:3449. What's the best way to track down the cause? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Diagnosing a cljsbuild error
Any thoughts as to why `lein cljsbuild test` would generate an error like this? Invalid :test-command, contains non-string value: [phantomjs :runner resources/es5-shim.js resources/public/js/test.js] -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Diagnosing a cljsbuild error
I'm sure that's related, but the tests don't run without it. I went back to a working project.clj and started over, and it works now, but I'm trying to understand the cause of the error to begin with. On Saturday, March 7, 2015 at 4:13:56 PM UTC-5, Akiva Schoen wrote: Could it be because of the :runner keyword you have in the vector? On Sat, Mar 7, 2015 at 2:20 PM Jonathon McKitrick jmcki...@gmail.com javascript: wrote: Any thoughts as to why `lein cljsbuild test` would generate an error like this? Invalid :test-command, contains non-string value: [phantomjs :runner resources/es5-shim.js resources/public/js/test.js] -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.com javascript: Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com javascript:. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Conditional dependency question
I'm using environ and lein-environ to pick up dev settings, such as enabling weasel/piggieback in development. In my server module, I'm running this code in -main: (when (env :dev?) (println DEV) (require 'pts.dev) (pts.dev/browser-repl)) But pts.dev still throws a class not found exception. However, after the project has loaded and begins execution, I'm able to run that snippet successfully. What's the trick to getting pts.dev into the namespace conditionally? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
When to use metadata
Is there a rule of thumb or set of use cases when metadata is a more elegant solution than simply adding more entries to a map or record? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: How to handle refactoring with TDD and mocking/stubbing
Akos, that is exactly the kind of problem I'm talking about! Right down to the detail about stopping work and returning to the project later, and seeing all the tests pass! -- Jonathon McKitrick On Tue, Jan 6, 2015 at 3:22 AM, Akos Gyimesi a...@gyim.hu wrote: On Sat, Jan 3, 2015, at 02:46 AM, Brian Marick wrote: I use TDD and mocking/stubbing (conjure) to test each layer of my code. The problem is when I change the function signature and the tests do not break, because the mocks/stubs do not know when their argument lists no longer agree with the underlying function they are mocking. Is there a way to catch this? Short of a test suite that eschews stubbing in favor of full setup/teardown of DB data for each test? Could you give an example? I use mocks fairly heavily, and I don't seem to have this problem. Perhaps it's because I change the tests before the code? Although the subject changed a little bit, I would be still interested in your approach to refactoring if there is heavy use of mocking. Let me give you an example: Let's say I am writing a login form, trying to use the top-down approach you described. My approach could be the following: (unfinished check-pw) (fact login-form succeeds if user enters the correct password (login-form-success? {:username admin :password secret}) = true (provided (db/get-user admin) = (contains (:password my-secret-hash)) (check-pw my-secret-hash secret) = true)) (defn login-form-success? [user-input] (let [user (db/get-user (:username user-input))] (check-pw (:password user) (:password user-input Then I finish the check-pw function and everything works. Now, later that day I decide that I pass the whole user object to the check-pw function. Maybe I want to use the user ID as a salt, or maybe I just want to leave the possibility for checking password expiration, etc. So I modify the test and the implementation of check-pw so that the first parameter is the user object, not the password hash. Suddenly my co-worker comes to me saying hey, I need you on a meeting right now! I close my laptop, and an hour later I think where were we?... I run all the tests, and they all pass, so I commit. Except... I forgot to modify all the invocations of check-pw in both the test and the implementation. Every test pass, so I have no way of finding out the problem without careful code review or by examining the stack traces from the live code. While this bug is easy to catch, what if my function is mocked in several places, and I fail to rewrite all of them properly? Do you have any advice on what you would have done differently here to avoid this bug? Regards, Akos -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to a topic in the Google Groups Clojure group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojure/T8fIW27kDYE/unsubscribe. To unsubscribe from this group and all its topics, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
How to handle refactoring with TDD and mocking/stubbing
I use TDD and mocking/stubbing (conjure) to test each layer of my code. The problem is when I change the function signature and the tests do not break, because the mocks/stubs do not know when their argument lists no longer agree with the underlying function they are mocking. Is there a way to catch this? Short of a test suite that eschews stubbing in favor of full setup/teardown of DB data for each test? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: core.async go-loop questions
Well, my goal is to start a go-loop (if possible) at the root level of the code that simply parks and waits for a group of emails to be sent. When that happens, it would wake up and broadcast the result of the send operation via web socket back to the browser. I'd like to avoid starting that loop every time I send the emails, and I was under the impression that could be done with a go-loop, which would park until the channel had values to consume. But you are saying that might be 'unhealthy'? -- Jonathon McKitrick On Sat, Dec 20, 2014 at 10:56 PM, Chris Freeman cwfree...@gmail.com wrote: I'm a little uncertain exactly what your code is trying to do, but I believe you're trying to notify a bunch of connections after your speaker notification emails are sent. In which case, I'd do something like this: (defn send-notifications [] (try (mailer/send-speaker-confirmation-notification 1 http://localhost;) true (catch Exception e (println (.getMessage e)) false))) (defn test-mailer [] (let [done (async/thread-call send-notifications)] (when-let [status (async/! done)] (doseq [chan @connections] (async/! chan (pr-str Done status)) I've replaced the string Success with an explicit true and added an explicit false. I'd prefer if send-speaker-confirmation-notification returned a truthy value, but I don't know that it does. In your original, the doseq call was done in a separate thread. If you'd still like that, wrap the when-let in a async/go call, as followings: (defn test-mailer [] (let [done (async/thread-call send-notifications)] (async/go (when-let [status (async/! done)] (doseq [chan @connections] (async/! chan (pr-str Done status))) But if you do, keep in mind that the main thread will end before the other two threads do, and that's probably unhealthy. Chris On Sat, Dec 20, 2014 at 9:17 PM, Jonathon McKitrick jmckitr...@gmail.com wrote: I'd like to implement a thread that will send an email, then send a response via websocket to the client when the send completes. (defn my-wait-loop [] (async/go-loop [status (async/! @mailer-status)] (if status (do (println Ready to send status) (doseq [chan @connections] (println Channel chan) (send! chan (pr-str Done status))) (recur (async/! @mailer-status))) (println Go away (defn test-mailer [] ;;(my-wait-loop) (reset! mailer-status (async/thread (try (mailer/send-speaker-confirmation-notification 1 http://localhost;) (catch Exception e (println (.getMessage e Success))) I would like to have the go-loop inside my-wait-loop run at all times, waiting for mailer-status to have a value. But I believe that can never happen, since the go-loop is waiting on an empty channel, and the reset! with the mailer will replace the channel with a new one after the emails are sent. Is there a batter way to do this, without needing to call my-wait-loop before the email thread is dispatched? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to a topic in the Google Groups Clojure group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojure/f9J_CBPoc5U/unsubscribe. To unsubscribe from this group and all its topics, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr
core.async go-loop questions
I'd like to implement a thread that will send an email, then send a response via websocket to the client when the send completes. (defn my-wait-loop [] (async/go-loop [status (async/! @mailer-status)] (if status (do (println Ready to send status) (doseq [chan @connections] (println Channel chan) (send! chan (pr-str Done status))) (recur (async/! @mailer-status))) (println Go away (defn test-mailer [] ;;(my-wait-loop) (reset! mailer-status (async/thread (try (mailer/send-speaker-confirmation-notification 1 http://localhost;) (catch Exception e (println (.getMessage e Success))) I would like to have the go-loop inside my-wait-loop run at all times, waiting for mailer-status to have a value. But I believe that can never happen, since the go-loop is waiting on an empty channel, and the reset! with the mailer will replace the channel with a new one after the emails are sent. Is there a batter way to do this, without needing to call my-wait-loop before the email thread is dispatched? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Lein feature to check for updates in dependencies?
I thought for sure I saw this feature, but I can't find it. Isn't there a way to scan for possible updates to dependencies in a project? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Optimizing lein profile for Heroku deployment
I'm able to deploy my project, but 'lein repl' constantly times out. Yet this profile still loads all dependencies for 'lein repl'. Is there a way to prevent this? {:user {:dependencies [[pjstadig/humane-test-output 0.6.0] [ring-mock 0.1.5] [org.clojars.runa/conjure 2.1.3]] :plugins [[lein-ring 0.8.10] [lein-cloverage 1.0.2] [cider/cider-nrepl 0.7.0] [com.cemerick/clojurescript.test 0.3.1]] :injections [(require 'pjstadig.humane-test-output) (pjstadig.humane-test-output/activate!)]} :test {:dependencies [[pjstadig/humane-test-output 0.6.0] [ring-mock 0.1.5] [org.clojars.runa/conjure 2.1.3]] :plugins [[lein-ring 0.8.10] [lein-cloverage 1.0.2] [cider/cider-nrepl 0.7.0] [com.cemerick/clojurescript.test 0.3.1]] :injections [(require 'pjstadig.humane-test-output) (pjstadig.humane-test-output/activate!)]}} -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Cannot get Friend to work (login or unauthorized handler)
So here's what I discovered: If I wrap ONLY the www-routes in Friend and remove api-routes entirely, it works. So far, I've tried several combinations of route, handler/api, handler/site and friend and I get incorrect results, most often a null page. Any ideas on how to wrap both handler/api and handler/site routes in Friend? On Wednesday, August 6, 2014 1:30:45 PM UTC-4, Gary Verhaegen wrote: I just checked, with the given code, after I switch the order of middlewares, a POST to /login gives me a 302 redirect to /login?login_failed=Y while a POST with the correct credentials gives me a 303 to /. I'm sorry I cannot explain why, however. On Wednesday, 6 August 2014, Gary Verhaegen gary.ve...@gmail.com javascript: wrote: I was wrong, sorry. Looking at the code for c.f.workflows/interactive-form, you can indeed see where it intercepts a POST request to the provided :login-uri (lines 84-85 on current master). Which means I have absolutely no idea why it gives you a 404, except maybe if it is related to the other point about the order of middlewares. Sorry for the confusion. On Wednesday, 6 August 2014, Jonathon McKitrick jmckitr...@gmail.com wrote: I'm confused. None of the examples shown implemented the login POST handler. The docs implied it was already part of the middleware: From https://github.com/cemerick/friend : The example above defines a single workflow — one supporting the POSTing of :username and :password parameters to (by default) /login — which will discover the specified :credential-fn and use it to validate submitted credentials. -- Jonathon McKitrick On Wed, Aug 6, 2014 at 10:46 AM, Gary Verhaegen gary.verhae...@gmail.com wrote: 1. No, you have to provide it (as a non-protected route, obviously). 2. The order in which you apply the handler/site and friend/authenticate middlewares is reversed: friend needs the session (and others), so it should come after (or rather within) the handler/site to work properly (in execution order). On Wednesday, 6 August 2014, Jonathon McKitrick jmckitr...@gmail.com wrote: First, the code: (ns pts.server (:use [compojure.core]) (:require [ring.adapter.jetty :as jetty] [ring.util.response :as response] [compojure.handler :as handler] [compojure.route :as route] [cemerick.friend :as friend] (cemerick.friend [workflows :as workflows] [credentials :as creds]))) (defroutes www-routes (GET /locked [] (friend/authorize #{::admin} Admin only)) (GET /home [] (response/file-response home.html {:root resources/public})) (GET /login [] (response/file-response login.html {:root resources/public})) (GET / [] (response/redirect index.html)) (route/resources /) (route/not-found Not Found)) (def app (handler/site www-routes)) (def users {root {:username root :password (creds/hash-bcrypt toor) :roles #{::admin}}}) (def secure-app (- app (friend/authenticate {:unauthorized-handler #(response/status (response/response NO) 401) :credential-fn (partial creds/bcrypt-credential-fn users) :workflows [(workflows/interactive-form)]}))) (defn -main [ args] (let [port (Integer/parseInt (get (System/getenv) PORT 3000))] (jetty/run-jetty secure-app {:port port :join? false}))) It's dead simple, but 2 major things are not working. 1. The POST to /login to submit the login form gives a 404 Not Found. Isn't the POST handler part of the friend/authenticate middleware? 2. Attempts to access the /locked URL throw an exception and a stacktrace, rather than calling the unauthorized handler: throw+: {:cemerick.friend/required-roles #{:pts.server/admin}, :cemerick.friend/exprs [Admin only], :cemerick.friend/type :unauthorized, :cemerick.friend/identity nil} What am I doing wrong here? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from
Re: Cannot get Friend to work (login or unauthorized handler)
I think it's sequencing. I'm going to try swapping the routes for api and site. On Thursday, August 7, 2014 7:19:33 AM UTC-4, Jonathon McKitrick wrote: So here's what I discovered: If I wrap ONLY the www-routes in Friend and remove api-routes entirely, it works. So far, I've tried several combinations of route, handler/api, handler/site and friend and I get incorrect results, most often a null page. Any ideas on how to wrap both handler/api and handler/site routes in Friend? On Wednesday, August 6, 2014 1:30:45 PM UTC-4, Gary Verhaegen wrote: I just checked, with the given code, after I switch the order of middlewares, a POST to /login gives me a 302 redirect to /login?login_failed=Y while a POST with the correct credentials gives me a 303 to /. I'm sorry I cannot explain why, however. On Wednesday, 6 August 2014, Gary Verhaegen gary.ve...@gmail.com wrote: I was wrong, sorry. Looking at the code for c.f.workflows/interactive-form, you can indeed see where it intercepts a POST request to the provided :login-uri (lines 84-85 on current master). Which means I have absolutely no idea why it gives you a 404, except maybe if it is related to the other point about the order of middlewares. Sorry for the confusion. On Wednesday, 6 August 2014, Jonathon McKitrick jmckitr...@gmail.com wrote: I'm confused. None of the examples shown implemented the login POST handler. The docs implied it was already part of the middleware: From https://github.com/cemerick/friend : The example above defines a single workflow — one supporting the POSTing of :username and :password parameters to (by default) /login — which will discover the specified :credential-fn and use it to validate submitted credentials. -- Jonathon McKitrick On Wed, Aug 6, 2014 at 10:46 AM, Gary Verhaegen gary.verhae...@gmail.com wrote: 1. No, you have to provide it (as a non-protected route, obviously). 2. The order in which you apply the handler/site and friend/authenticate middlewares is reversed: friend needs the session (and others), so it should come after (or rather within) the handler/site to work properly (in execution order). On Wednesday, 6 August 2014, Jonathon McKitrick jmckitr...@gmail.com wrote: First, the code: (ns pts.server (:use [compojure.core]) (:require [ring.adapter.jetty :as jetty] [ring.util.response :as response] [compojure.handler :as handler] [compojure.route :as route] [cemerick.friend :as friend] (cemerick.friend [workflows :as workflows] [credentials :as creds]))) (defroutes www-routes (GET /locked [] (friend/authorize #{::admin} Admin only)) (GET /home [] (response/file-response home.html {:root resources/public})) (GET /login [] (response/file-response login.html {:root resources/public})) (GET / [] (response/redirect index.html)) (route/resources /) (route/not-found Not Found)) (def app (handler/site www-routes)) (def users {root {:username root :password (creds/hash-bcrypt toor) :roles #{::admin}}}) (def secure-app (- app (friend/authenticate {:unauthorized-handler #(response/status (response/response NO) 401) :credential-fn (partial creds/bcrypt-credential-fn users) :workflows [(workflows/interactive-form)]}))) (defn -main [ args] (let [port (Integer/parseInt (get (System/getenv) PORT 3000))] (jetty/run-jetty secure-app {:port port :join? false}))) It's dead simple, but 2 major things are not working. 1. The POST to /login to submit the login form gives a 404 Not Found. Isn't the POST handler part of the friend/authenticate middleware? 2. Attempts to access the /locked URL throw an exception and a stacktrace, rather than calling the unauthorized handler: throw+: {:cemerick.friend/required-roles #{:pts.server/admin}, :cemerick.friend/exprs [Admin only], :cemerick.friend/type :unauthorized, :cemerick.friend/identity nil} What am I doing wrong here? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post
Compojure routing of www and api content
I'm serving up some html and js content, and using handler/site for that. I have a separate handler/api group of routes under the /api context. If I include the api routes before the site routes, the site works fine. If the www routes come first, the api calls fail, probably because the (route/resources /) at the end of the site routes catches that call and returns null. OTOH, if I try to use friend with the api routes, it breaks the friend wrapping of the www calls. (defroutes api-routes (context /api [] . (route/not-found ERROR))) (defroutes www-routes (GET /admin req (friend/authorize #{::admin} Admin only)) (GET /authorized req (friend/authorize #{::user} Users only)) (GET /home [] (response/file-response home.html {:root resources/public})) (GET /login [] (response/file-response login.html {:root resources/public})) (friend/logout (ANY /logout req (response/redirect /))) (GET / [] (response/redirect index.html)) (route/resources /) (route/not-found Not Found)) (def app (routes (- www-routes (friend/authenticate {;:allow-anon? true ;;:login-uri /login.html ;:default-landing-uri / ;:redirect-on-auth? /home ;:unauthorized-handler #(response/status (response/response NO) 401) ;:login-failure-handler #(response/response OOPS) :credential-fn (partial creds/bcrypt-credential-fn users) :workflows [(workflows/interactive-form)]}) ;;(wrap-resource public) ;wrap-content-type ;wrap-not-modified ;;wrap-reload handler/site) (- api-routes handler/api ;;wrap-reload wrap-restful-format))) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Compojure routing of www and api content
Right, I tried removing that as well, and Friend still fails, and the api routes fail as well. -- Jonathon McKitrick On Thu, Aug 7, 2014 at 2:54 PM, James Reeves ja...@booleanknot.com wrote: Compojure routes are checked in order until one matches. You've set up your www-routes to match all possible routes, as you have a catch-all not-found route at the bottom. - James On 7 August 2014 13:17, Jonathon McKitrick jmckitr...@gmail.com wrote: I'm serving up some html and js content, and using handler/site for that. I have a separate handler/api group of routes under the /api context. If I include the api routes before the site routes, the site works fine. If the www routes come first, the api calls fail, probably because the (route/resources /) at the end of the site routes catches that call and returns null. OTOH, if I try to use friend with the api routes, it breaks the friend wrapping of the www calls. (defroutes api-routes (context /api [] . (route/not-found ERROR))) (defroutes www-routes (GET /admin req (friend/authorize #{::admin} Admin only)) (GET /authorized req (friend/authorize #{::user} Users only)) (GET /home [] (response/file-response home.html {:root resources/public})) (GET /login [] (response/file-response login.html {:root resources/public})) (friend/logout (ANY /logout req (response/redirect /))) (GET / [] (response/redirect index.html)) (route/resources /) (route/not-found Not Found)) (def app (routes (- www-routes (friend/authenticate {;:allow-anon? true ;;:login-uri /login.html ;:default-landing-uri / ;:redirect-on-auth? /home ;:unauthorized-handler #(response/status (response/response NO) 401) ;:login-failure-handler #(response/response OOPS) :credential-fn (partial creds/bcrypt-credential-fn users) :workflows [(workflows/interactive-form)]}) ;;(wrap-resource public) ;wrap-content-type ;wrap-not-modified ;;wrap-reload handler/site) (- api-routes handler/api ;;wrap-reload wrap-restful-format))) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to a topic in the Google Groups Clojure group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojure/A-qRAftd6XY/unsubscribe. To unsubscribe from this group and all its topics, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Compojure routing of www and api content
Let me clarify. I removed the 'not-found' route and the api calls all return an empty response. -- Jonathon McKitrick On Thu, Aug 7, 2014 at 3:14 PM, Jonathon McKitrick jmckitr...@gmail.com wrote: Right, I tried removing that as well, and Friend still fails, and the api routes fail as well. -- Jonathon McKitrick On Thu, Aug 7, 2014 at 2:54 PM, James Reeves ja...@booleanknot.com wrote: Compojure routes are checked in order until one matches. You've set up your www-routes to match all possible routes, as you have a catch-all not-found route at the bottom. - James On 7 August 2014 13:17, Jonathon McKitrick jmckitr...@gmail.com wrote: I'm serving up some html and js content, and using handler/site for that. I have a separate handler/api group of routes under the /api context. If I include the api routes before the site routes, the site works fine. If the www routes come first, the api calls fail, probably because the (route/resources /) at the end of the site routes catches that call and returns null. OTOH, if I try to use friend with the api routes, it breaks the friend wrapping of the www calls. (defroutes api-routes (context /api [] . (route/not-found ERROR))) (defroutes www-routes (GET /admin req (friend/authorize #{::admin} Admin only)) (GET /authorized req (friend/authorize #{::user} Users only)) (GET /home [] (response/file-response home.html {:root resources/public})) (GET /login [] (response/file-response login.html {:root resources/public})) (friend/logout (ANY /logout req (response/redirect /))) (GET / [] (response/redirect index.html)) (route/resources /) (route/not-found Not Found)) (def app (routes (- www-routes (friend/authenticate {;:allow-anon? true ;;:login-uri /login.html ;:default-landing-uri / ;:redirect-on-auth? /home ;:unauthorized-handler #(response/status (response/response NO) 401) ;:login-failure-handler #(response/response OOPS) :credential-fn (partial creds/bcrypt-credential-fn users) :workflows [(workflows/interactive-form)]}) ;;(wrap-resource public) ;wrap-content-type ;wrap-not-modified ;;wrap-reload handler/site) (- api-routes handler/api ;;wrap-reload wrap-restful-format))) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to a topic in the Google Groups Clojure group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojure/A-qRAftd6XY/unsubscribe. To unsubscribe from this group and all its topics, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Cannot get Friend to work (login or unauthorized handler)
First, the code: (ns pts.server (:use [compojure.core]) (:require [ring.adapter.jetty :as jetty] [ring.util.response :as response] [compojure.handler :as handler] [compojure.route :as route] [cemerick.friend :as friend] (cemerick.friend [workflows :as workflows] [credentials :as creds]))) (defroutes www-routes (GET /locked [] (friend/authorize #{::admin} Admin only)) (GET /home [] (response/file-response home.html {:root resources/public})) (GET /login [] (response/file-response login.html {:root resources/public})) (GET / [] (response/redirect index.html)) (route/resources /) (route/not-found Not Found)) (def app (handler/site www-routes)) (def users {root {:username root :password (creds/hash-bcrypt toor) :roles #{::admin}}}) (def secure-app (- app (friend/authenticate {:unauthorized-handler #(response/status (response/response NO) 401) :credential-fn (partial creds/bcrypt-credential-fn users) :workflows [(workflows/interactive-form)]}))) (defn -main [ args] (let [port (Integer/parseInt (get (System/getenv) PORT 3000))] (jetty/run-jetty secure-app {:port port :join? false}))) It's dead simple, but 2 major things are not working. 1. The POST to /login to submit the login form gives a 404 Not Found. Isn't the POST handler part of the friend/authenticate middleware? 2. Attempts to access the /locked URL throw an exception and a stacktrace, rather than calling the unauthorized handler: throw+: {:cemerick.friend/required-roles #{:pts.server/admin}, :cemerick.friend/exprs [Admin only], :cemerick.friend/type :unauthorized, :cemerick.friend/identity nil} What am I doing wrong here? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Cannot get Friend to work (login or unauthorized handler)
I'm confused. None of the examples shown implemented the login POST handler. The docs implied it was already part of the middleware: From https://github.com/cemerick/friend : The example above defines a single workflow -- one supporting the POSTing of :username and :password parameters to (by default) /login -- which will discover the specified :credential-fn and use it to validate submitted credentials. -- Jonathon McKitrick On Wed, Aug 6, 2014 at 10:46 AM, Gary Verhaegen gary.verhae...@gmail.com wrote: 1. No, you have to provide it (as a non-protected route, obviously). 2. The order in which you apply the handler/site and friend/authenticate middlewares is reversed: friend needs the session (and others), so it should come after (or rather within) the handler/site to work properly (in execution order). On Wednesday, 6 August 2014, Jonathon McKitrick jmckitr...@gmail.com wrote: First, the code: (ns pts.server (:use [compojure.core]) (:require [ring.adapter.jetty :as jetty] [ring.util.response :as response] [compojure.handler :as handler] [compojure.route :as route] [cemerick.friend :as friend] (cemerick.friend [workflows :as workflows] [credentials :as creds]))) (defroutes www-routes (GET /locked [] (friend/authorize #{::admin} Admin only)) (GET /home [] (response/file-response home.html {:root resources/public})) (GET /login [] (response/file-response login.html {:root resources/public})) (GET / [] (response/redirect index.html)) (route/resources /) (route/not-found Not Found)) (def app (handler/site www-routes)) (def users {root {:username root :password (creds/hash-bcrypt toor) :roles #{::admin}}}) (def secure-app (- app (friend/authenticate {:unauthorized-handler #(response/status (response/response NO) 401) :credential-fn (partial creds/bcrypt-credential-fn users) :workflows [(workflows/interactive-form)]}))) (defn -main [ args] (let [port (Integer/parseInt (get (System/getenv) PORT 3000))] (jetty/run-jetty secure-app {:port port :join? false}))) It's dead simple, but 2 major things are not working. 1. The POST to /login to submit the login form gives a 404 Not Found. Isn't the POST handler part of the friend/authenticate middleware? 2. Attempts to access the /locked URL throw an exception and a stacktrace, rather than calling the unauthorized handler: throw+: {:cemerick.friend/required-roles #{:pts.server/admin}, :cemerick.friend/exprs [Admin only], :cemerick.friend/type :unauthorized, :cemerick.friend/identity nil} What am I doing wrong here? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to a topic in the Google Groups Clojure group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojure/yk32Imtd5u8/unsubscribe. To unsubscribe from this group and all its topics, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Friend authentication with static files
I'm working on a singe-page web app, and each page comes from a file in public rather than being generated by a compojure route/handler. I use (wrap-resource public) to do this, and it works fine. How can I wrap this type of handler in Friend authentication? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Clojure on Cloudbees versus Heroku?
I've deployed a few apps to Heroku, but I'm always looking for new options with better pricing or features. Is there any reason Cloudbees might be better for Clojure apps than Heroku? If the big selling point of Cloudbees is Jenkins, I don't think that benefits Clojure projects, right? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Clojure on Cloudbees versus Heroku?
Did you deploy clojure apps? On Wednesday, July 30, 2014, Mark Engelberg mark.engelb...@gmail.com wrote: My experience is that Cloudbees' free tier works better than Heroku's and is somewhat easier to deploy (with cloudbees you just upload a war file that you've built on your machine, whereas on Heroku, you are checking files into git which are built server-side, and if the build doesn't quite work properly on their machine but it does work on yours, it can be difficult to track down what's going on). I believe that Heroku's lowest cost priced tier is cheaper than Cloudbees', but it has been a while since I've compared the two. On Wed, Jul 30, 2014 at 4:40 AM, Jonathon McKitrick jmckitr...@gmail.com javascript:_e(%7B%7D,'cvml','jmckitr...@gmail.com'); wrote: I've deployed a few apps to Heroku, but I'm always looking for new options with better pricing or features. Is there any reason Cloudbees might be better for Clojure apps than Heroku? If the big selling point of Cloudbees is Jenkins, I don't think that benefits Clojure projects, right? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com javascript:_e(%7B%7D,'cvml','clojure@googlegroups.com'); Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com javascript:_e(%7B%7D,'cvml','clojure%2bunsubscr...@googlegroups.com'); For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com javascript:_e(%7B%7D,'cvml','clojure%2bunsubscr...@googlegroups.com');. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com javascript:_e(%7B%7D,'cvml','clojure@googlegroups.com'); Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com javascript:_e(%7B%7D,'cvml','clojure%2bunsubscr...@googlegroups.com'); For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to a topic in the Google Groups Clojure group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojure/k_bOLXXCAn8/unsubscribe. To unsubscribe from this group and all its topics, send an email to clojure+unsubscr...@googlegroups.com javascript:_e(%7B%7D,'cvml','clojure%2bunsubscr...@googlegroups.com');. For more options, visit https://groups.google.com/d/optout. -- -- Jonathon McKitrick -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Is Korma still a good current choice for DB backend?
That's a handy feature, which I got running on my own to save a lot of connection time in a batch process. But it's probably easy enough to get running on your own. -- Jonathon McKitrick On Thu, Jul 24, 2014 at 9:23 PM, Tony Tam ttasteri...@gmail.com wrote: I've been using korma in a side-project for a while and it behaves well. There sure are a bunch of PRs on their github that could be merged, not sure what's up with that. One problem I ran into last week was that I got some conflicts when trying to upgrade the versions of some dependencies. One benefit of using korma is that it uses a connection/statement pooling library underneath (in this case c3p0), something that I don't think yesql/honeysql do. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to a topic in the Google Groups Clojure group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojure/rDyYHfC01RQ/unsubscribe. To unsubscribe from this group and all its topics, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Is Korma still a good current choice for DB backend?
Development and support seem to have slowed down. Are there newer or better choices out there with momentum right now? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Is Korma still a good current choice for DB backend?
I liked the no-fuss integration of relationships for the particular project I'm working on. I could live without it, but it would greatly simplify the code on server side. On Tuesday, July 22, 2014 8:29:13 AM UTC-4, Michael Klishin wrote: On 22 July 2014 at 16:10:31, Jonathon McKitrick (jmcki...@gmail.com javascript:) wrote: Development and support seem to have slowed down. Are there newer or better choices out there with momentum right now? Just use clojure.jdbc or clojure.java.jdbc with a validation library (Validateur, Schema, Bouncer, etc). There is no rush to use the newest hotness in the Clojure community so Korma should work OK if that's what you want. -- @michaelklishin, github.com/michaelklishin -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Is Korma still a good current choice for DB backend?
I'll keep that in mind when I decide to learn MongoDB. :-) On Tuesday, July 22, 2014 8:25:16 AM UTC-4, Robin Heggelund Hansen wrote: Don't know about SQL-based solutions, but Monger (MongoDB bindings) just released a 2.0 update and is great! kl. 14:10:16 UTC+2 tirsdag 22. juli 2014 skrev Jonathon McKitrick følgende: Development and support seem to have slowed down. Are there newer or better choices out there with momentum right now? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Is Korma still a good current choice for DB backend?
I'm sold. I don't know what I was thing, lol. I used straight SQL for the last 3 projects, so why change now? -- Jonathon McKitrick On Tue, Jul 22, 2014 at 7:42 PM, Nick Jones whatsyourproblemkazan...@gmail.com wrote: Agreed, any lib that just lets me use raw sql for queries gets the + 1. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to a topic in the Google Groups Clojure group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojure/rDyYHfC01RQ/unsubscribe. To unsubscribe from this group and all its topics, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Database schema Heroku and Node-Webkit
I'm developing an app that will initially run on Heroku, but will eventually migrate to a Node-Webkit app. What would you suggest is the simplest way to create and maintain a schema that would work well on both a Heroku app (with PostGres) and a Node-Webkit app (perhaps Sqlite or another alternative) ? I considered using raw SQL then using Lobos analyze mode to extract a schema, then use that for multiple back ends, but that might be more work that needed. Any suggestions? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Ring mock with GET parameters
I'm using ring.mock.request to test an API. POST parameters work fine, but for GET requests, the parameters are not where Compojure expects to find them. Here is the relevant part of the handler: (GET /outlines [speaker :as r] (println (str Request r)) (println (str Param ' speaker ')) ) Here is the test using the mock request: (let [req (request :get /api/outlines {:speaker Test Speaker 1})] (is (= expected-outlines (api-routes req Here is the value of the request and the 'speaker' parameter in the handler: Request {:remote-addr localhost, :scheme :http, :context /api, :request-method :get, :query-string speaker=Test+Speaker+1, :route-params {}, :path-info /outlines, :uri /api/outlines, :server-name localhost, :params {}, :headers {host localhost}, :server-port 80} Param '' The mock library apparently puts the GET params into query-string, so Compojure does not see them. Is there a way to work around this without changing ring.mock.request? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Ring mock with GET parameters
Hmm, except I don't have any issues when accessing it via an http client. Only with the mock. On Saturday, July 12, 2014 6:24:28 PM UTC-4, James Reeves wrote: You need to make sure your handler has the wrap-params middleware applied to it in order for it to accept query parameters. - James On 12 July 2014 20:41, Jonathon McKitrick jmcki...@gmail.com javascript: wrote: I'm using ring.mock.request to test an API. POST parameters work fine, but for GET requests, the parameters are not where Compojure expects to find them. Here is the relevant part of the handler: (GET /outlines [speaker :as r] (println (str Request r)) (println (str Param ' speaker ')) ) Here is the test using the mock request: (let [req (request :get /api/outlines {:speaker Test Speaker 1})] (is (= expected-outlines (api-routes req Here is the value of the request and the 'speaker' parameter in the handler: Request {:remote-addr localhost, :scheme :http, :context /api, :request-method :get, :query-string speaker=Test+Speaker+1, :route-params {}, :path-info /outlines, :uri /api/outlines, :server-name localhost, :params {}, :headers {host localhost}, :server-port 80} Param '' The mock library apparently puts the GET params into query-string, so Compojure does not see them. Is there a way to work around this without changing ring.mock.request? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.com javascript: Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com javascript:. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Ring mock with GET parameters
Here's my handler setup: (def app (routes (- (handler/api api-routes) (wrap-params) (wrap-restful-format) (wrap-reload)) (- (handler/site www-routes) (wrap-resource public) (wrap-content-type) (wrap-reload On Saturday, July 12, 2014 7:42:53 PM UTC-4, Jonathon McKitrick wrote: Hmm, except I don't have any issues when accessing it via an http client. Only with the mock. On Saturday, July 12, 2014 6:24:28 PM UTC-4, James Reeves wrote: You need to make sure your handler has the wrap-params middleware applied to it in order for it to accept query parameters. - James On 12 July 2014 20:41, Jonathon McKitrick jmcki...@gmail.com wrote: I'm using ring.mock.request to test an API. POST parameters work fine, but for GET requests, the parameters are not where Compojure expects to find them. Here is the relevant part of the handler: (GET /outlines [speaker :as r] (println (str Request r)) (println (str Param ' speaker ')) ) Here is the test using the mock request: (let [req (request :get /api/outlines {:speaker Test Speaker 1})] (is (= expected-outlines (api-routes req Here is the value of the request and the 'speaker' parameter in the handler: Request {:remote-addr localhost, :scheme :http, :context /api, :request-method :get, :query-string speaker=Test+Speaker+1, :route-params {}, :path-info /outlines, :uri /api/outlines, :server-name localhost, :params {}, :headers {host localhost}, :server-port 80} Param '' The mock library apparently puts the GET params into query-string, so Compojure does not see them. Is there a way to work around this without changing ring.mock.request? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Ring mock with GET parameters
Sorry, I just got it... I needed to use 'app' in the test, not 'api-routes.' On Saturday, July 12, 2014 7:42:53 PM UTC-4, Jonathon McKitrick wrote: Hmm, except I don't have any issues when accessing it via an http client. Only with the mock. On Saturday, July 12, 2014 6:24:28 PM UTC-4, James Reeves wrote: You need to make sure your handler has the wrap-params middleware applied to it in order for it to accept query parameters. - James On 12 July 2014 20:41, Jonathon McKitrick jmcki...@gmail.com wrote: I'm using ring.mock.request to test an API. POST parameters work fine, but for GET requests, the parameters are not where Compojure expects to find them. Here is the relevant part of the handler: (GET /outlines [speaker :as r] (println (str Request r)) (println (str Param ' speaker ')) ) Here is the test using the mock request: (let [req (request :get /api/outlines {:speaker Test Speaker 1})] (is (= expected-outlines (api-routes req Here is the value of the request and the 'speaker' parameter in the handler: Request {:remote-addr localhost, :scheme :http, :context /api, :request-method :get, :query-string speaker=Test+Speaker+1, :route-params {}, :path-info /outlines, :uri /api/outlines, :server-name localhost, :params {}, :headers {host localhost}, :server-port 80} Param '' The mock library apparently puts the GET params into query-string, so Compojure does not see them. Is there a way to work around this without changing ring.mock.request? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Client side tools for Clojure web app (back end questions as well, especially Pedestal)
My new project is coming along nicely already. I'm currently using XHR calls to populate atoms on the client side, which are then automatically rendered into the DOM via Reagent components. It's wonderful, so far. -- Jonathon McKitrick On Tue, Jul 8, 2014 at 3:37 PM, Ahmad Hammad a.f.ham...@gmail.com wrote: Brendan, could you please elaborate on how you handled client/server communication with a project using Reagent/Om? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to a topic in the Google Groups Clojure group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojure/dhQW_uE7pDY/unsubscribe. To unsubscribe from this group and all its topics, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Routes for both WWW and API
Think I got it: (def app (routes (- (handler/api (routes api-routes )) (wrap-restful-response) (wrap-reload)) (- (handler/site (routes www-routes (route/not-found Not Found))) (wrap-reload) ; dev only (wrap-resource public On Saturday, June 28, 2014 2:25:57 PM UTC-4, Jonathon McKitrick wrote: I'd like my app to server the WWW content as well as the API for the client to call. How can I used different middleware with each? Here's what I have so far: (def app (- (handler/site (routes www-routes api-routes ;; Should this replace the line below? ;;(wrap-file public ) (route/resources /) (route/not-found Not Found))) ;; Can we just wrap API handlers? (wrap-restful-response))) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Routes for both WWW and API
I'd like my app to server the WWW content as well as the API for the client to call. How can I used different middleware with each? Here's what I have so far: (def app (- (handler/site (routes www-routes api-routes ;; Should this replace the line below? ;;(wrap-file public ) (route/resources /) (route/not-found Not Found))) ;; Can we just wrap API handlers? (wrap-restful-response))) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Client side tools for Clojure web app (back end questions as well, especially Pedestal)
I'm starting on a new Clojure app, and have been really intrigued by Pedestal. But it seems to present a new conceptual model to get my head around. I'm not sure the benefits would be worth the effort for apps that do not fit the problem Pedestal is trying to solve. That said, I'm open to anything. I would really like something that makes the mundane CRUD tasks easier, and a responsive front end with data binding and DOM manipulation. I'm strongly leaning toward AngularJS, but I'm not sure if I should learn the native version, or the ClojureScript, or a different ClojureScript specific framework/library altogether. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Need HTTP Client not to verify cert on Heroku
I'm getting this error in a web service call on Heroku with Clojure: SSLPeerUnverifiedException javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated Has anyone figured out how to disable peer authentication with clj-http? I'm running clj-http 0.7.6 -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Breaking out of doseq
I'm iterating a map (regex - function) and I'd like to call FUNCTION with the result of re-groups after a match for REGEX is found. I also want to exit the sequence, returning the results of FUNCTION. In common lisp, I would use return-from, but how would this be done in clojure? -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Breaking out of doseq
Ah, maybe recursion is the answer! On Wednesday, November 27, 2013 9:26:21 AM UTC-5, Jonathon McKitrick wrote: I'm iterating a map (regex - function) and I'd like to call FUNCTION with the result of re-groups after a match for REGEX is found. I also want to exit the sequence, returning the results of FUNCTION. In common lisp, I would use return-from, but how would this be done in clojure? -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Breaking out of doseq
To clarify what I'm trying to do, I have a map of regexes, and after iterating them, when one matches (the order of the regexes is significant) I want exactly one result returned by applying the looked up function to the string. After that regex matches, no more matches should be attempted. What is the 'reduced' function? On Wednesday, November 27, 2013 9:26:21 AM UTC-5, Jonathon McKitrick wrote: I'm iterating a map (regex - function) and I'd like to call FUNCTION with the result of re-groups after a match for REGEX is found. I also want to exit the sequence, returning the results of FUNCTION. In common lisp, I would use return-from, but how would this be done in clojure? -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Are there any GUI based Clojure apps out there?
I'd be interested in seeing some client-side apps with a GUI, if there are any. 'Ants' is a good demo, but I'm looking for something a little more. ;-) -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Heroku Clojure scheduled tasks versus worker threads
You are correct, I meant to say 'worker process type' as opposed to 'web process type'. So, the question then, is what would be the difference between a heroku scheduled command (which I currently am running, wakes up, does some work, etc) and a 'worker process' type? Does the latter need a job queue set up? Does it run constantly, checking that queue and consuming work items from it? On Monday, June 17, 2013 11:04:04 PM UTC-4, danneu wrote: Heroku cron jobs and workers are prorated like dynos. They run in their own processes. So does booting into heroku bash or heroku console. Workers generally consume a queue. I'm not sure what you mean by worker thread though. Workers don't run in a thread, and you can launch plain old threads whenever you want to in your Clojure code. Heroku isn't going to bill you for threads. Perhaps I've misunderstood. On Monday, June 17, 2013 7:27:21 PM UTC-5, Jonathon McKitrick wrote: How would you sum up the differences? Does the worker thread simply run all the time? Wouldn't that run up the dyno usage? -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Heroku Clojure scheduled tasks versus worker threads
How would you sum up the differences? Does the worker thread simply run all the time? Wouldn't that run up the dyno usage? -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Clojure performance measuring
Does it help profile SQL calls as well? -- Jonathon McKitrick On Sun, May 12, 2013 at 8:30 AM, Kelker Ryan theinter...@yandex.com wrote: Try VisualVM. https://visualvm.java.net/ Here's a screenshot of the memory usage monitor https://visualvm.java.net/images/monitor.jpg 12.05.2013, 16:55, Stuart Sierra the.stuart.sie...@gmail.com: We've found YourKit (a commercial product) to be helpful. -S On Sunday, May 12, 2013 2:46:52 AM UTC+10, Jonathon McKitrick wrote: If I cannot get New Relic to work, I'm going to stick to my development platform for initial optimization and memory troubleshooting. What tools do you recommend for profiling memory under Clojure? I didn't have much luck with VisualVM, since my Mac is a bit dated at this point, but I'd be willing to try again with a decent tutorial. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to a topic in the Google Groups Clojure group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojure/7g_w_LAKpzg/unsubscribe?hl=en. To unsubscribe from this group and all its topics, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
FTP with Clojure on Heroku
I did some googling today, and didn't find much specifically for Clojure, and most of what I did find was a bit stale. Has anyone had any success accepting FTP uploads in Clojure on Heroku? -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Clojure performance measuring
If I cannot get New Relic to work, I'm going to stick to my development platform for initial optimization and memory troubleshooting. What tools do you recommend for profiling memory under Clojure? I didn't have much luck with VisualVM, since my Mac is a bit dated at this point, but I'd be willing to try again with a decent tutorial. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
New Relic installation on Heroku
I followed these directions to install New Relic on my Heroku app: http://www.rafael-chacon.com/post/19069499949/new-relic-clojure-heroku-easy-steps-integration I added my license key to the yml file, and restarted the app. It's a simple app, with an import run from the CLI and an export as JSON web services. I ran a few of both to trigger the New Relic agent. At least I hoped so. Though my New Relic account page located my app, it said no data was being received. I thought this was an out-of-the-box setup. Any ideas on what I can check to see what's going wrong? I checked for log files, and found none created so far for New Relic. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: New Relic installation on Heroku
I should add... when the idle dyno spins up, I *do* see that in the instance chart on New Relic. But none of the other stats show any activity. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: New Relic installation on Heroku
That's a good suggestion. I made that change, and there definitely was a different because the heroku log said New Relic agent was already running because it had been specified in the JVM_OPTS. So I removed it from there, restarted, but no change in the New Relic reports. I even tried running without trampoline, but not success. I'm still seeing the 'instances' chart updated, but nothing else. On Wednesday, May 8, 2013 9:12:31 AM UTC-4, Leonardo Borges wrote: Are you using lein with lein trampoline? If so, your app is running on a separate JVM, so you need to add this to your project.clj: :jvm-opts [-javaagent:newrelic/newrelic.jar] That was the bit missing for me. Hope this helps. Cheers, Leonardo Borges www.leonardoborges.com On Wed, May 8, 2013 at 11:09 PM, Jonathon McKitrick jmcki...@gmail.comjavascript: wrote: I should add... when the idle dyno spins up, I *do* see that in the instance chart on New Relic. But none of the other stats show any activity. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.comjavascript: Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: New Relic installation on Heroku
It's currently called 'relic-app'. -- Jonathon McKitrick On Wed, May 8, 2013 at 12:52 PM, Phil Hagelberg p...@hagelb.org wrote: Jonathon McKitrick writes: That's a good suggestion. I made that change, and there definitely was a different because the heroku log said New Relic agent was already running because it had been specified in the JVM_OPTS. So I removed it from there, restarted, but no change in the New Relic reports. I even tried running without trampoline, but not success. I'm still seeing the 'instances' chart updated, but nothing else. If you send me your app name off the list I can take a look at this. -Phil -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Test strategy
I guess the challenge is that the parsing and generating of the structures from JSON descends to several layers of functions, and the database object is created and inserted/updated at the lowest level. I've tried a bulk insert after accumulating records into a higher level function, but sometimes I need to query for an item previously inserted, so I'm back to inserting each item as created. The challenge is decoupling object creation from insertion without breaking the nested process approach. On Friday, April 19, 2013 9:59:18 AM UTC-7, Chris Ford wrote: I'm a little unclear as to what your specific challenge is. I understand you're trying to test fns that take a map produced by the JSON parser, and extract specific fields. Would it be sufficient to just create literal maps to fake the output of the JSON parser, use those as inputs to your extraction fns, and then just compare the output to what you expected? If the issue is that the extraction isn't done by top-level fns, and thus is hard to test, perhaps you could just make them top-level fns? Cheers, Chris On 19 April 2013 15:14, Jonathon McKitrick jmcki...@gmail.comjavascript: wrote: As a relatively new Clojure user, I have a relatively simple app which parses a complex JSON structure into a database. I have test code which verifies all the basic database functions, but I'm not sure how best to exercise all the parsing code. The JSON parser is built-in, and most of my code is navigating each structure, picking out fields of interest to build the objects for the database. What would be a good strategy for tests that would exercise this intermediate layer of the app, between the JSON and the database, where the heart of the app logic actually lies? -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.comjavascript: Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Test strategy
As a relatively new Clojure user, I have a relatively simple app which parses a complex JSON structure into a database. I have test code which verifies all the basic database functions, but I'm not sure how best to exercise all the parsing code. The JSON parser is built-in, and most of my code is navigating each structure, picking out fields of interest to build the objects for the database. What would be a good strategy for tests that would exercise this intermediate layer of the app, between the JSON and the database, where the heart of the app logic actually lies? -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Inserting multiple rows with clj-jdbc
Does insert-records with a collection of records have any performance advantage over calling insert-values for each row? Is it only a question of network latency? -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Building/inserting multiple records
I'm sorry, I misspoke. I meant *update* multiple records. On Saturday, February 16, 2013 1:54:11 AM UTC-5, Feng Shen wrote: Is it easy (and immutable) to build a collection of records to insert? I've been told CONJ is a good start. map maybe be helpful: (map (fn [d] return-map-of-records) datasets) Does the clojure jdbc interface support insertion of multiple records? I haven't seen such a function yet. clojure.java.jdbc/insert-records On Saturday, February 16, 2013 11:30:08 AM UTC+8, Jonathon McKitrick wrote: I'm iterating a large dataset and inserting a record for each row. After working in a Salesforce environment, I'm thinking it would be better to build a collection of records and insert them in one fell swoop. 1. Is it easy (and immutable) to build a collection of records to insert? I've been told CONJ is a good start. 2. Does the clojure jdbc interface support insertion of multiple records? I haven't seen such a function yet. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Looping and accumulation
On Thursday, February 14, 2013 7:44:18 PM UTC-5, Stephen Compall wrote: On Feb 14, 2013 6:11 PM, Jonathon McKitrick jmcki...@gmail.comjavascript: wrote: I have a loop over a function that is accumulating a list of database keys for later use. But it is primarily doing other processing and returning a collection of processed/filtered records. As you come from Common Lisp, where all standard library sequences are strict, I think it will be more interesting for you to write a version of your function that can work on infinite lists of records. The point is laziness, not that the function will ever receive an infinite seq, but this is a good way to think about it. Consider that several library functions, like map, filter, iterate, and take-while are all lazy-friendly. I think that's my biggest challenge so far: thinking in terms of lazy sequences, and especially generating my own. I'm so used to just building a list and traversing it -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Reusing parameters in a MAP function
I'd like turn an array of maps into a map of maps, extracting a unique id from each map as the key. (into {} (map #([(:id %) %]) map-array) was my first attempt, but I'm not sure the syntax would work anyway. However, the first question (and obvious error cause) is how to repeat MAP-ARRAY twice inside the lambda expression without writing a new FN. Or am I going down the wrong path here? -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Reusing parameters in a MAP function
Beautiful. I haven't gotten to juxt and identity yet, and this works brilliantly On Friday, February 15, 2013 7:58:09 PM UTC-5, Sean Corfield wrote: (into {} (map (juxt :id identity) map-array)) ;; the first thing that comes to mind On Fri, Feb 15, 2013 at 4:55 PM, Jonathon McKitrick jmcki...@gmail.com javascript: wrote: I'd like turn an array of maps into a map of maps, extracting a unique id from each map as the key. (into {} (map #([(:id %) %]) map-array) was my first attempt, but I'm not sure the syntax would work anyway. However, the first question (and obvious error cause) is how to repeat MAP-ARRAY twice inside the lambda expression without writing a new FN. Or am I going down the wrong path here? -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.comjavascript: Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Reusing parameters in a MAP function
Sorry, I should add I haven't gotten to them in my migration studies yet... common lisp to clojure is a longer road than appears. ;-) On Friday, February 15, 2013 8:28:26 PM UTC-5, Jonathon McKitrick wrote: Beautiful. I haven't gotten to juxt and identity yet, and this works brilliantly On Friday, February 15, 2013 7:58:09 PM UTC-5, Sean Corfield wrote: (into {} (map (juxt :id identity) map-array)) ;; the first thing that comes to mind On Fri, Feb 15, 2013 at 4:55 PM, Jonathon McKitrick jmcki...@gmail.com wrote: I'd like turn an array of maps into a map of maps, extracting a unique id from each map as the key. (into {} (map #([(:id %) %]) map-array) was my first attempt, but I'm not sure the syntax would work anyway. However, the first question (and obvious error cause) is how to repeat MAP-ARRAY twice inside the lambda expression without writing a new FN. Or am I going down the wrong path here? -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Looping and accumulation
So it looks like this might be perfect for what I need. I need to track a hash of the key fields of inserted db records so I can skip duplicates without db access. On Thursday, February 14, 2013 7:35:20 PM UTC-5, Luc wrote: Look at the first example here: http://clojuredocs.org/clojure_core/clojure.core/transient It should inspire you. Transient structures make this kind of loop run faster but as you lay out your first iteration just toss this aside (and the xxx! version of conj and cie). Luc P. I have a loop over a function that is accumulating a list of database keys for later use. But it is primarily doing other processing and returning a collection of processed/filtered records. I'd normally just PUSH the ids and records onto a list in Common Lisp, or even LOOP... COLLECT into 2 lists. In the Clojure way, how would I build this auxiliary list without using a mutable collection? Would it make sense to return a map or some other structure from the processing function that would contain both the processed record as well as any id of interest? I could accumulate this result, then filter the map into 2 collections - one of processed records and the other a subset of id's of interest. But that seems kludgy commingling the results like that. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.comjavascript: Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- Softaddictslprefo...@softaddicts.ca javascript: sent by ibisMail from my ipad! -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Building/inserting multiple records
I'm iterating a large dataset and inserting a record for each row. After working in a Salesforce environment, I'm thinking it would be better to build a collection of records and insert them in one fell swoop. 1. Is it easy (and immutable) to build a collection of records to insert? I've been told CONJ is a good start. 2. Does the clojure jdbc interface support insertion of multiple records? I haven't seen such a function yet. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Looping and accumulation
I have a loop over a function that is accumulating a list of database keys for later use. But it is primarily doing other processing and returning a collection of processed/filtered records. I'd normally just PUSH the ids and records onto a list in Common Lisp, or even LOOP... COLLECT into 2 lists. In the Clojure way, how would I build this auxiliary list without using a mutable collection? Would it make sense to return a map or some other structure from the processing function that would contain both the processed record as well as any id of interest? I could accumulate this result, then filter the map into 2 collections - one of processed records and the other a subset of id's of interest. But that seems kludgy commingling the results like that. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Understanding sequences
I have 3 arrays, and need to process one element of each array as a triplet. So [1 3 5] [2 4 6] [10 20 30] needs to produce [1 2 10] [3 4 20] [5 6 30] In Common Lisp, I would just use LOOP. What's the correct Clojure way? -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Understanding sequences
Yes, both work. Sorry, I've been staring at non-working code too long tonight. ;-) On Wednesday, February 13, 2013 10:49:58 PM UTC-5, Jonathon McKitrick wrote: I have 3 arrays, and need to process one element of each array as a triplet. So [1 3 5] [2 4 6] [10 20 30] needs to produce [1 2 10] [3 4 20] [5 6 30] In Common Lisp, I would just use LOOP. What's the correct Clojure way? -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.