Re: ANN metrics-clojure 2.6.0 is released
Congratulations, I look forward to using this, upgrading to 3.1 is great and the features on the release notes (really nice to have clear, concise release notes) will make using it much better. On Monday, November 30, 2015 at 10:30:10 AM UTC-8, Michael Klishin wrote: > > metrics-clojure is a Clojure interface to the DropWizard Metrics > library. > > Release notes: > > https://github.com/sjl/metrics-clojure/blob/master/ChangeLog.md#changes-between-250-and-260 > -- > MK > > http://github.com/michaelklishin > http://twitter.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: Using cookies with clj-http.client
I don't see any problem with your code. Try to add :debug true to both of those maps and look at the output. Ensure that for both URLs share exact same hostname and protocol http/https. Look at the Set-Cookie header in the POST response and ensure that the path matches the url in the GET. On Sunday, November 8, 2015 at 8:15:17 PM UTC-8, Mike wrote: > > Hello, > > I have a web site that uses cookies for authentication. You logon to a > specific URL with your username and password using a POST (which I have > working; I get a 200 status back) which should create a cookie; then you > use the cookie for all future access to the web site. > > I have all of this working on a Windows client using PowerShell. I'm > trying to expand my horizons and start using Clojure for my projects. So > I'm trying to take my working PowerShell script and re-implement it in > Clojure. > > I read the section in the *clj-http.client* documentation about using a > cookie store and I thought I did it correctly. Here's what I did: > > (require '[clj-http.client :as client]) > > (def my-cs (clj-http.cookies/cookie-store)) > (client/post login-URL {:body post-data > :cookie-store my-cs}) > (client/get customer-list-URL {:cookie-store my-cs}) > > I was hoping to get a cookie shoved into *my-cs* and then be able to use > it in future accesses. The *client/post* call gets a 200 status back, > but when I try to look at *my-cs* it is *nil*. What am I doing wrong? > TIA! > -- 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.
usage of "and"
I am reading Clojure Applied, which I am enjoying. One code snippet is puzzling for me, can someone please explain why the authors used: (and (pos? cnt) instead of just (pos? cnt) ? Or to go further, (pos? (item @inventory)) The best I could think is that there used to be a check for two things: 1) that the entry was present in the map AND 2) the value for the entry was positive. But maybe there is some idiomatic use of "and" that I don't know about. The inventory atom is a map whose key is a keyword like :milk and the value is a count representing how many are left. (defn in-stock? "check if an item is in stock" [item] (let [cnt (item @inventory)] (and (pos? cnt Excerpt From: Ben Vandgrift, Alex Miller. “Clojure Applied P1.” iBooks. -- 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.
every? expected behavior
Hi, I am new to Clojure, so please forgive me if this does not make sense. I was surprised to find out in the REPL that every? returns true if you pass in an empty or nil collection. user= (every? #(= 77 %) nil) true user= (every? #(= 77 %) '()) true I looked at the source for every? and it made sense to me why this happens given that every? is recursive and the termination condition is when coll runs out of items to process. Would it make more sense to define every? with a loop, or is the caller expected to know better than to call it with nil? Thanks, --jeff (defn every2? Returns true if (pred x) is logical true for every x in coll, else false. {:tag Boolean :added 1.0 :static true} [pred coll] (if (empty? coll) false (loop [c coll] (cond (nil? (seq c)) true (pred (first c)) (recur (next c)) :else false -- 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: every? expected behavior
Thanks to all for the nice explanations. I understand the reasoning. On Tuesday, April 8, 2014 1:53:44 AM UTC-7, Colin Yates wrote: Depends who is doing the expecting as to whether that behaviour is correct. Formal logicians, mathematicians, computer scientists etc. would respond sure, it is vacously true. For almost everybody else it feels wrong but is then true when you think about it a bit. I would suggest the question you are trying to ask is (and (not (empty? nil)) (every? #(= 77 %) nil)). For more info check out http://en.wikipedia.org/wiki/Vacuous_truth. On Tuesday, 8 April 2014 07:08:56 UTC+1, Jeff Mad wrote: Hi, I am new to Clojure, so please forgive me if this does not make sense. I was surprised to find out in the REPL that every? returns true if you pass in an empty or nil collection. user= (every? #(= 77 %) nil) true user= (every? #(= 77 %) '()) true I looked at the source for every? and it made sense to me why this happens given that every? is recursive and the termination condition is when coll runs out of items to process. Would it make more sense to define every? with a loop, or is the caller expected to know better than to call it with nil? Thanks, --jeff (defn every2? Returns true if (pred x) is logical true for every x in coll, else false. {:tag Boolean :added 1.0 :static true} [pred coll] (if (empty? coll) false (loop [c coll] (cond (nil? (seq c)) true (pred (first c)) (recur (next c)) :else false -- 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.