Re: ANN qarth 0.1.0, an OAuth library

2014-07-25 Thread Robin Heggelund Hansen
I was just looking for a OAuth library, this looks great! kl. 19:15:11 UTC+2 torsdag 24. juli 2014 skrev Mike Thvedt følgende: Qarth is a simple interface to OAuth. Qarth's goal is to fix the problem of Ring/Compojure and/or Friend apps reinventing the wheel for OAuth. Qarth features

Re: subtle om + core.async problems

2014-07-25 Thread Daniel Kersten
You could simplify your fix code a small bit by using go-loop and when, like this: (go-loop [] (let [[v ch] (alts! [dump-chan (om/get-state owner :exit-chan)])] (when (= ch dump-chan) (.log js/console dumping state:) (.log js/console (pr-str (om/get-state owner)))

Re: Is this behavior with recur and pre/post a bug?

2014-07-25 Thread Bob Hutchison
On Jul 25, 2014, at 12:27 AM, Michael O'Keefe michael.p.oke...@gmail.com wrote: Andy, good advice and I agree. Thanks. I'll think on it then. Would you want one of your users going though this kind of thought process: I won't file a ticked because I don't think it can be fixed? It's a bug,

Re: ANN qarth 0.1.0, an OAuth library

2014-07-25 Thread Plínio Balduino
Hi, Fred I never used Friend and I don't have parameters to compare so, why Qarth? I didn't get the Qarth's goal is to fix the problem of Ring/Compojure and/or Friend apps reinventing the wheel for OAuth. explanation. Regards Plínio On Fri, Jul 25, 2014 at 3:47 AM, Robin Heggelund Hansen

proxying PersistentHash to allow key-val and (reverse key)-val mapping

2014-07-25 Thread Geoff Little
I'm attempting to proxy PersistentHashmap so that getting an existing key or its reverse returns the same value. Here's the code that I have (defn sym-key-hash-map [] (proxy [clojure.lang.PersistentHashMap] [nil 0 nil false nil] (valAt [key] (or (proxy-super valAt key)

Re: Is Korma still a good current choice for DB backend?

2014-07-25 Thread Scott Nielsen
On Jul 24, 2014, at 7: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

Re: Is Korma still a good current choice for DB backend?

2014-07-25 Thread Jason Coffin
Tony Tam writes: 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. This guide will help you setup connection pooling. It is general enough to be applied to anything that requires

Re: How to control evaluation of code with cider

2014-07-25 Thread Timothy Washington
On Wed, Jul 23, 2014 at 10:08 PM, Brent Millare brent.mill...@gmail.com wrote: I forgot to include in the snippet, that I would do something like (def live-repl-client (cljs.repl/channel-repl repl-env)) When you say channel-repl/cider-function, do you mean user/live-repl-client? Yes,

Re: Is Korma still a good current choice for DB backend?

2014-07-25 Thread Jason Coffin
Jason Coffin writes: This guide will help you setup connection pooling. It is general enough to be applied to anything that requires a db spec. And you will notice it that it isn't too difficult to setup. Bah, I forgot to link to the guide! Haha, here it is:

Re: Is this behavior with recur and pre/post a bug?

2014-07-25 Thread Andy Fingerhut
Sorry, I forgot the following disclaimer: I am in no way an official voice for what will or will not be changed in Clojure in the future. I am merely an interested observer of what has changed in Clojure in the past. I've created and edited some tickets, written some Clojure patches, some of

Re: Is this behavior with recur and pre/post a bug?

2014-07-25 Thread Steve Miner
I will call it a bug. It's definitely surprising to the user, and therefore worthy of a ticket. On first glance, it seems that the fix isn't too hard. In core.clj where the macro fn is redefined, we just need to wrap the section that handles the post condition either with a loop* or a fn* so

Re: Is this behavior with recur and pre/post a bug?

2014-07-25 Thread Michael O'Keefe
Thanks Bob, Steve, and Andy. I was trying to get logged into JIRA to file the bug report but I seem to be having a heck of a time -- I have a CA and am signed up at dev.clojure.org but when I try to log into JIRA, it gives me a nice System Error saying user should not be null!. I've run out

Re: Is this behavior with recur and pre/post a bug?

2014-07-25 Thread adrian . medina
I do not believe this should be considered a bug. Recur is a special form that rebinds the bindings at the point of recursion with new values. It does not return a value. It does not get evaluated in the normal sense of the word. You cannot type check a value on a valueless expression. Just

Re: Is this behavior with recur and pre/post a bug?

2014-07-25 Thread Ambrose Bonnaire-Sergeant
Now that Steve mentions it, I have fixed this kind of issue in my own defn macros. IIRC adding an inner loop form did the trick. Thanks, Ambrose On Fri, Jul 25, 2014 at 10:35 PM, adrian.med...@mail.yu.edu wrote: I do not believe this should be considered a bug. Recur is a special form that

Re: Leiningen resource-paths

2014-07-25 Thread Yura Perov
Dear Thomas Heller, Dear Laurent Petit, I don't quite understand the issue against using the way I described. We just did not want to have an additional dependency of Maven. For example, Maven should be independentally installed on Windows. My suggestion then: instead of storing the jar

Re: Is this behavior with recur and pre/post a bug?

2014-07-25 Thread Steve Miner
Ticket CLJ-1475 with my patch. http://dev.clojure.org/jira/browse/CLJ-1475 -- 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

Re: Is this behavior with recur and pre/post a bug?

2014-07-25 Thread Michael O'Keefe
Adrian, thanks for your input on whether this is a bug or not. Your viewpoint may yet prove to be the accepted one but I still felt like the original way I wrote the function should have meant: check pre-conditions function runs check final return to caller. In that sense, it feels like my

defprotocol's :on-interface directive

2014-07-25 Thread Tassilo Horn
Hi all, in the JIRA issue http://dev.clojure.org/jira/browse/CLJ-308?focusedCommentId=35149page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-35149 Brandon Bloom mentioned that instead of extending a protocol upon existing interfaces using `extend` (or

Re: Is this behavior with recur and pre/post a bug?

2014-07-25 Thread adrian . medina
I hear what you're saying. Given that recur is a special form, there exists a closed set of exceptions to be worked around like this even theoretically, so I could see the argument for having this patch accepted and not opening pandora's box. On Friday, July 25, 2014 11:36:36 AM UTC-4,

Re: Leiningen resource-paths

2014-07-25 Thread Shantanu Kumar
For our project we have decided to depend on Maven and require user to install Maven and execute these several commands to add jars to the local repository. You could probably have a script that uses lein-localrepo (to install all dependencies in one go) if you don't want to install

Re: [ANN] Gorilla REPL 0.3.1

2014-07-25 Thread Paul Mooser
I've made gorilla-repl part of my normal workflow recently, and I've been enjoying great results. With this new version, I'm having trouble loading documents using the normal ctrl-g ctrl-l method. When I hit return after typing the path into the load dialog, it simply closes with no feedback

Re: [ANN] Gorilla REPL 0.3.1

2014-07-25 Thread Jony Hudson
Hi Paul, glad you're finding it useful! As for the problem: I think it's a good example of why I should stick to science and not dabble in UI design :-) The idea is that the text-box simply filters the list of options below it - it doesn't allow you to type in an arbitrary path. I'm guessing

Re: [ANN] Gorilla REPL 0.3.1

2014-07-25 Thread Paul Mooser
Ah, this makes sense. I renamed my worksheets, and it finds them fine. I didn't understand that it was supposed to be showing me a filtered list, since what I was doing worked in a previous version. So, is there now no way to create a worksheet in a subdirectory of the project? I normally

destructure command line arguments

2014-07-25 Thread emptya45
Hi, I have a main function: (defn -main [ args] (let [{:keys [graph filepath title]} args] (cond (= graph response) (graph-response filepath title) (= graph requests) (graph-request filepath) (= graph throughput) (graph-throughput filepath Which I can invoke with this

Re: subtle om + core.async problems

2014-07-25 Thread Alexander K. Hudek
Could you describe your mixin a bit more? We’ve just written an om component and macro to help clean up go-blocks in cases like these. Several of our components take channels as input from parent components to allow for more sophisticated communication. We’ll post a link to this manager

Re: destructure command line arguments

2014-07-25 Thread Tassilo Horn
empty...@gmail.com writes: Hi! I have a main function: (defn -main [ args] (let [{:keys [graph filepath title]} args] (cond (= graph response) (graph-response filepath title) (= graph requests) (graph-request filepath) (= graph throughput) (graph-throughput

Re: ANN qarth 0.1.0, an OAuth library

2014-07-25 Thread Mike Thvedt
Hi Plínio, Thanks for the question. I considered writing Ring handlers for Qarth, but since most people would either use Friend or have custom Ring handlers anyway, the advantage was unclear. However, Qarth was written s.t. a small set of auth-related methods can be adapted to any OAuth

ANN: ClojureScript 0.0-2277

2014-07-25 Thread David Nolen
ClojureScript, the Clojure compiler that emits JavaScript source code. README and source code: https://github.com/clojure/clojurescript New release version: 0.0-2277 Leiningen dependency information: [org.clojure/clojurescript 0.0-2277] The main reason behind this release is fixing a

Re: subtle om + core.async problems

2014-07-25 Thread Daniel Kersten
The way I use mixins is really simple and might be a bit too specific to how I currently use channels I plan to explore the idea more, but haven't had the time yet. I'm sure you can build much more sophisticated abstractions. I don't have the code in front of me right now, but the basic idea is

Re: timbre logging, java libs

2014-07-25 Thread Hugo Duncan
craft.br...@gmail.com writes: Is there any good way to use timbre in a project with java libs, e.g. c3p0, that use java logging APIs? You might want to look at: http://ptaoussanis.github.io/timbre/taoensso.timbre.tools.logging.html

Could I get some feedback on this function?

2014-07-25 Thread Christopher Elwell
New to Clojure, how is this function that I wrote? Any suggestions for improvement; is it too complicated? It filters a sequence, leaving only the first occurrence of each item in the seq that has a matching prefix (get-form-id-without-timestamp gets just the id prefix). (defn

Re: Could I get some feedback on this function?

2014-07-25 Thread boz
I'm no Clojure guru, but why not just use set? http://grimoire.arrdem.com/1.6.0/clojure.core/set/ But you want to get rid of the timestamp. Using map is probably right for that. So I think this is more idiomatic... (defn only-keep-unique-ids [ids] (set (map #(get-form-id-without-timestamp %)

Re: Could I get some feedback on this function?

2014-07-25 Thread Ben Wolfson
On Fri, Jul 25, 2014 at 3:09 PM, boz b...@cox.net wrote: I'm no Clojure guru, but why not just use set? http://grimoire.arrdem.com/1.6.0/clojure.core/set/ But you want to get rid of the timestamp. Using map is probably right for that. So I think this is more idiomatic... (defn

Re: Is this behavior with recur and pre/post a bug?

2014-07-25 Thread Steve Miner
My first patch was buggy with destructured args so I had to withdraw it. While working on a better patch, I came up against a related issue: Should the :pre conditions apply to every recur call. I'm saying no. The :pre conditions should be checked just once on the initial function call and

Re: proxying PersistentHash to allow key-val and (reverse key)-val mapping

2014-07-25 Thread Geoff Little
bump! On Thursday, July 24, 2014 9:52:48 PM UTC-4, Geoff Little wrote: I'm attempting to proxy PersistentHashmap so that getting an existing key or its reverse returns the same value. Here's the code that I have (defn sym-key-hash-map [] (proxy [clojure.lang.PersistentHashMap] [nil 0

Re: Is this behavior with recur and pre/post a bug?

2014-07-25 Thread Ambrose Bonnaire-Sergeant
Yes :pre should apply to every recur, like usual without :post. user= ((fn [a] {:pre [(number? a)]} (recur 'a)) 1) AssertionError Assert failed: (number? a) user/eval5376/fn--5377 (form-init687485383035947214.clj:1) That probably means that if :post is present, the preconditions should be moved

Re: proxying PersistentHash to allow key-val and (reverse key)-val mapping

2014-07-25 Thread Ambrose Bonnaire-Sergeant
Hi Geoff, You probably want a sorted-map-by: user= (sorted-map-by (fn [a b] (or (when (every? coll? [a b]) (when (= a (reverse b)) 0)) -1)) [1 2] 42 [2 1] 42) {[1 2] 42} Thanks, Ambrose On Fri, Jul 25, 2014 at 9:52 AM, Geoff Little fifos...@gmail.com wrote: I'm attempting to proxy

Re: proxying PersistentHash to allow key-val and (reverse key)-val mapping

2014-07-25 Thread Geoff Little
Thanks so much Ambrose! I know that function is simple, but I don't understand how it provides the functionality I'm after. Do you mind explaining what's going on? I'm playing with it now in my repl. Thanks!! On Friday, July 25, 2014 6:48:06 PM UTC-4, Ambrose Bonnaire-Sergeant wrote: Hi

Re: proxying PersistentHash to allow key-val and (reverse key)-val mapping

2014-07-25 Thread Ambrose Bonnaire-Sergeant
The function basically returns 0 if the keys are equivalent, or -1 otherwise. It satisfies a comparator, see http://docs.oracle.com/javase/7/docs/api/java/util/Comparator.html#compare(T,%20T) Thanks, Ambrose On Sat, Jul 26, 2014 at 7:52 AM, Geoff Little fifos...@gmail.com wrote: Thanks so

Re: proxying PersistentHash to allow key-val and (reverse key)-val mapping

2014-07-25 Thread Geoff Little
Is this comparator called when get is called? How does this allow calling get on the reverse of a valid key? Geoff On Friday, July 25, 2014 7:58:47 PM UTC-4, Ambrose Bonnaire-Sergeant wrote: The function basically returns 0 if the keys are equivalent, or -1 otherwise. It satisfies a

Re: proxying PersistentHash to allow key-val and (reverse key)-val mapping

2014-07-25 Thread Ambrose Bonnaire-Sergeant
Right, it doesn't. user= (get (sorted-map-by (fn [a b] (or (when (every? coll? [a b]) (when (= a (reverse b)) 0)) -1)) [1 2] 42 [2 1] 42) [2 1]) 42 user= (get (sorted-map-by (fn [a b] (or (when (every? coll? [a b]) (when (= a (reverse b)) 0)) -1)) [1 2] 42 [2 1] 42) [1 2]) nil Sorry about that.

Re: Could I get some feedback on this function?

2014-07-25 Thread Ben Wolfson
I'd probably write this like so, fwiw (parameterized by the transformation function): user (defn only-keep-unique-ids [id-transform ids] (map first (vals (group-by id-transform ids #'user/only-keep-unique-ids user (only-keep-unique-ids (partial take 2) [aaa baa xsdf aa3 ba4 azx aa4

Re: Could I get some feedback on this function?

2014-07-25 Thread Paul L. Snyder
On Fri, 25 Jul 2014, Christopher Elwell wrote: New to Clojure, how is this function that I wrote? Any suggestions for improvement; is it too complicated? 'filter' is a great tool to reach for in many cases, but (as you found) it's not ideal if you need your test predicate to change as it

[ANN: cassius 0.1.14] - Cassandra as a Big Nested Map

2014-07-25 Thread zcaudate
I'm happy to announce that the team at MyPost (https://*digitalmailbox* .com.au/) has decided to release a library that we have been working on for the past couple of months. https://github.com/MyPost/cassius Apparently its `also only the second release of open source software by a public

Help Getting Sente to Work

2014-07-25 Thread Timothy Washington
Hi all, I'm using [com.taoensso/sente 0.15.1 https://github.com/ptaoussanis/sente], and having trouble connecting the client to the server. I'm sure it's something simple, but not obvious, as this is taken directly from the examples on sente's github page. Anyone seen and fixed the error in

Re: Help Getting Sente to Work

2014-07-25 Thread Daniel Kersten
My server looks like this and its been working for me for the past few months without issue: (defroutes ws-routes (GET /cmd/chsk req (ring-ajax-get-or-ws-handshake req)) (POST /cmd/chsk req (ring-ajax-postreq))) (defn run [ [routes]] (let [site

[ANN] nginx-clojure v0.2.4 released

2014-07-25 Thread Yuexiang Zhang
Nginx-Clojure https://github.com/nginx-clojure/nginx-clojure is a Nginx module for embedding Clojure / Java / Groovy programs, typically those Ring based handlers. Release 0.2.4 contains important updates 1. New Feature: Support Groovy - another dynamic jvm language (issue #34) 2. Fix