Re: Clojure Performance For Expensive Algorithms
On Fri, Feb 22, 2013 at 7:47 PM, Korny Sietsma ko...@sietsma.com wrote: Isn't that always the way, though? Build your program in a powerful, expressive language, then profile it, find the critical parts, and optimise them - where possible in the same language, and where that's too ugly/painful, drop down a layer to a lower level language. I'd be curious to hear some opinions on this from the Scala community. I have only been limited by Clojure's performance on one particular program where it was truly necessary to drop down to Java, for the most part performance has been good enough that it has been a non-issue for me. But for those who regularly need to write high-performance code, isn't that supposed to be Scala's sweet spot? The promise of Scala is that it allows you to do a reasonable amount of high-level functional coding while also making it convenient to write mutable, Java-like performance code using the same language with the same semantics. If there are any members of this list who straddle the two worlds of Clojure and Scala, I'd be interested in knowing whether Scala delivers on that promise of being able to write both high-level and performant low-level code, and how much of a difference this makes in practice versus Clojure's approach of expecting the programmer to drop down to Java for the best performance. -- -- 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 For Expensive Algorithms
I tend to think clojure is in a similar position - fast enough for the vast majority of things (ymmv of course - depending on what your domain is) and if you meet a situation like this where optimising the clojure becomes too ugly, you can drop down to Java (or indeed C!) Not quite, I'd say. In Java, and I bet it wasn't very different with C in the '80s, the most natural way to solve a problem is already the most performant, or at least within 50% of that. If you ever need to optimize, it means you are doing something very, very critical indeed, and probably involving native system resources in a way not idiomatically supported by Java's abstractions. In Clojure this is nohwere close to being true. Idiomatic Clojure is concise, expressive, and *slow.* Not 50% slower; not 100% slower; more like 100 *times* slower. Optimized Clojure is like a completely different language. Have you ever experienced the culture shock of opening core.clj? On the other hand, have you ever studied String.java or ArrayList.java? No surprises there; just the basic Java you write every day. On the other hand, an attitude that you are nevertheless likely to encounter on this grous is It's not Clojure; it's you. Clojure already has all you need to achieve native performance. If that's not what you are seeing, don't blame it on Clojure. Many posters feel put down by that kind of attitude and the worst part it, it really isn't their fault. -- -- 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 For Expensive Algorithms
From my (admittedly limited) experience with Scala, yes, you can freely use reassignable local vars and write pretty much the same loops as in Java, but on the other hand there are many non-obvious performance pitfalls (like simply using the built-in *for comprehension*) and the optimized library code is a heavy mess. With Clojure, you open core.clj and stand a good chance of learning something; with Scala, you just stare in total confusion. I'd be curious to hear some opinions on this from the Scala community. I have only been limited by Clojure's performance on one particular program where it was truly necessary to drop down to Java, for the most part performance has been good enough that it has been a non-issue for me. But for those who regularly need to write high-performance code, isn't that supposed to be Scala's sweet spot? The promise of Scala is that it allows you to do a reasonable amount of high-level functional coding while also making it convenient to write mutable, Java-like performance code using the same language with the same semantics. If there are any members of this list who straddle the two worlds of Clojure and Scala, I'd be interested in knowing whether Scala delivers on that promise of being able to write both high-level and performant low-level code, and how much of a difference this makes in practice versus Clojure's approach of expecting the programmer to drop down to Java for the best performance. -- -- 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.
protocol granularity
Hi everyone, I'm facing a little problem when extending protocols in a mix of inheriting and implementing classes...Let me explain: stanford-corenlp defines a top level interface called Annotator (with a single 'annotatate' method signature'). It also defines a class called AnnotationPipeline which implements Annotator and a class StanfordCoreNLP which extends AnnotationPipeline and is essentially the main entry point for the library...Under this class (in the hierarchy), one can find all the concrete implementations of several 'Annotators'. Now the problem is this: All these Annotators are not pipelines (or workflows) they are single components in a sense, but they do implement Annotator as does AnnotationPipeline. I need to extend my own protocol IWorkflow to AnnotationPipeline and my own 'IComponent' to all the single-Annotators without having them satisfy IWorkflow. It is fine if AnnotationPipeline satisfies IComponent and NOT the other way round (components satisfying IWorkflow). Mybest attempt was this: (defn extend-stanford-core A single fn to extend to all stanford-corenlp modules (or 'annotators' as they call them). [] (extend-type edu.stanford.nlp.pipeline.AnnotationPipeline IWorkflow (deploy [this ^String text] (.annotate this text)) (appendComponent [this co] (.addAnnotator this (reify edu.stanford.nlp.pipeline.Annotator (annotate [this annotation] (run co annotation) ) (extend-type edu.stanford.nlp.pipeline.StanfordCoreNLP IComponent (run [this ^String text] (let [ann (edu.stanford.nlp.pipeline.Annotation. text)] (.annotate this ann) ann))) ) However, as I said, a stanfordNLP consumer will most likely use the StanfordCoreNLP class to create the single-annotators...Consequently, his 'components' will also satisfy IWorkflow (because StanfordCoreNLP inherits from AnnotationPipeline), which is not desirable... any thoughts? Jim -- -- 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.
creating code stubs to use inside an extend-protocol form
I seem to be unable to quote a form and then repeatedly pass it inside the extend-protocol macro...something like this: (def ^:private co-stub '(run [this ^String text] (let [ann (edu.stanford.nlp.pipeline.Annotation. text)] (.annotate this ann) ann))) (extend-protocol IComponent edu.stanford.nlp.pipeline.POSTaggerAnnotator co-stub edu.stanford.nlp.pipeline.PTBTokenizerAnnotator co-stub edu.stanford.nlp.pipeline.WordsToSentencesAnnotator co-stub edu.stanford.nlp.pipeline.CleanXmlAnnotator co-stub edu.stanford.nlp.pipeline.MorphaAnnotator co-stub edu.stanford.nlp.pipeline.NERCombinerAnnotatorco-stub edu.stanford.nlp.pipeline.RegexNERAnnotator co-stub edu.stanford.nlp.pipeline.TrueCaseAnnotator co-stub edu.stanford.nlp.pipeline.ParserAnnotator co-stub edu.stanford.nlp.pipeline.DeterministicCorefAnnotator co-stub ) neither quoted version nor the back-quoted version work...The former throws : ClassCastException clojure.lang.PersistentList cannot be cast to java.lang.Class clojure.core/implements? (core_deftype.clj:512) and the latter throws: ClassCastException clojure.lang.Cons cannot be cast to java.lang.Class clojure.core/implements? (core_deftype.clj:512) any macro-gurus around? Jim -- -- 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 For Expensive Algorithms
Lisp programmers know the value of everything and the cost of nothing ;) On Saturday, February 23, 2013, Marko Topolnik wrote: I tend to think clojure is in a similar position - fast enough for the vast majority of things (ymmv of course - depending on what your domain is) and if you meet a situation like this where optimising the clojure becomes too ugly, you can drop down to Java (or indeed C!) Not quite, I'd say. In Java, and I bet it wasn't very different with C in the '80s, the most natural way to solve a problem is already the most performant, or at least within 50% of that. If you ever need to optimize, it means you are doing something very, very critical indeed, and probably involving native system resources in a way not idiomatically supported by Java's abstractions. In Clojure this is nohwere close to being true. Idiomatic Clojure is concise, expressive, and *slow.* Not 50% slower; not 100% slower; more like 100 *times* slower. Optimized Clojure is like a completely different language. Have you ever experienced the culture shock of opening core.clj? On the other hand, have you ever studied String.java or ArrayList.java? No surprises there; just the basic Java you write every day. On the other hand, an attitude that you are nevertheless likely to encounter on this grous is It's not Clojure; it's you. Clojure already has all you need to achieve native performance. If that's not what you are seeing, don't blame it on Clojure. Many posters feel put down by that kind of attitude and the worst part it, it really isn't their fault. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.comjavascript:_e({}, '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({}, '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({}, 'cvml', 'clojure%2bunsubscr...@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.
datomic + clojure + clojurescript examples
My fellow Clojurians, I am having a trouble hunting down an example of the above stack for clojure applications. Can anyone point me in the right direction? Thanks Ray -- -- 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: nREPL + Emacs: How to get new definitions to load reliably?
Hi Karl, I've added an experimental feature in tools.namespace 0.2.3-SNAPSHOT which tries to recover the namespace configuration in your REPL after an error during reload. What that hopefully means is you can call `refresh` as you normally would even after an error. Updated docs herehttps://github.com/clojure/tools.namespace/blob/6723baff2c17e5ad9dde6024f4e35fe81bb0361a/README.md#handling-errors To get it in Leiningen: :dependencies [[org.clojure/tools.namespace 0.2.3-SNAPSHOT]] :repositories {sonatype-oss-public https://oss.sonatype.org/content/groups/public/} Let me know if that helps. Thanks, -S On Thu, Feb 21, 2013 at 3:23 PM, Karl Smeltzer karl.smelt...@gmail.comwrote: Thanks for that helper function. I suppose that's as close as I'll get for the time being. On Thu, Feb 21, 2013 at 6:03 AM, Stuart Sierra the.stuart.sie...@gmail.com wrote: For what it's worth, I tried using tools.namespace but if I (refresh) code that doesn't compile, then suddenly the refresh symbol is out of scope and I'm back to square one. You can still recover from this: just call 'refresh' by its fully-qualified name: (clojure.tools.namespace.repl/refresh) I use a (hackish) Emacs helper function to do this in nREPL: http://bit.ly/WUqLE4 -S -- -- 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 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 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 For Expensive Algorithms
:) On the other hand, the Common Lisp movement of the '80s was brimming with the can-do attitude of achieving native performance. From Steele, Gabriel, *The Evolution of Lisp*: the two strongest voices—Steele and Gabriel—were feeling their oats over their ability to write a powerful compiler to foil the complexities of Common Lisp. One often heard them, and later Moon, remark that a “sufficiently smart compiler” could solve a particular problem. Pretty soon the core group was quoting this “SSC” argument regularly. On Saturday, February 23, 2013 3:26:24 PM UTC+1, David Nolen wrote: Lisp programmers know the value of everything and the cost of nothing ;) On Saturday, February 23, 2013, Marko Topolnik wrote: In Clojure this is nohwere close to being true. Idiomatic Clojure is concise, expressive, and *slow.* Not 50% slower; not 100% slower; more like 100 *times* slower. Optimized Clojure is like a completely different language. Have you ever experienced the culture shock of opening core.clj? On the other hand, have you ever studied String.java or ArrayList.java? No surprises there; just the basic Java you write every day. -- -- 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: Redefinition of datatypes
Hi Ambrose, I would try to help diagnose this, but I can't even try to compile core.typed in its present state because of dependencies: core.typed declares a dependency on analyze 0.3.1-SNAPSHOThttps://github.com/clojure/core.typed/blob/78d09859cee78967e9dd0ee7d74e0f52bd3be6f1/project.clj#L3, which I cannot find anywhere, including the sourcehttps://github.com/frenchy64/analyzeon GitHub. Even if we fix that, there are larger issues with releasing core.typed as a contrib library. The Maven-based builds on build.clojure.org do not include Clojars.org in their list of repositories. All of the contrib libraries released so far have no dependencies other than Clojure itself. There has been an *implicit* policy that contrib libraries may not have external dependencies, on which Rich has the final say. Furthermore, according to the policy of the Maven Central Repositoryhttp://search.maven.org/, we cannot deploy anything which depends on third-party repositories. Therefore we cannot deploy core.typed to the Central Repository unless all its dependencies are also deployed there. I will do whatever I can to help you get core.typed up and running on build.clojure.org, but these are the constraints we have to work in. Feel free to contact me off-list if you have additional questions. Thanks, -S On Friday, February 22, 2013 2:26:31 AM UTC-5, Ambrose Bonnaire-Sergeant wrote: Hi, I don't understand why this `assert` fails when the namespace is compiled with `compile`. It seems like the datatype A is being compiled twice. (ns mvn-test.core) (deftype A []) (assert (= (class (A.)) (class ((fn [] (A.)) user= (compile 'mvn-test.core) CompilerException java.lang.AssertionError: Assert failed: (= (class (A.)) (class ((fn [] (A.), compiling:(core.clj:5:1) Here is the project.clj: (defproject mvn-test 0.0.1-SNAPSHOT :source-paths [src/main/clojure] :dependencies [[org.clojure/clojure 1.5.0-RC16]]) I found this behaviour was the root cause of why `mvn test` fails in core.typed, while `lein test` works perfectly. Any pointers would be appreciated. Thanks, Ambrose -- -- 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: Redefinition of datatypes
Hi Stuart, Sorry about that, I just changed it to analyze 0.3.0, which is on Clojars. Try pulling again. As for dependencies: - the Trammel dep could be refactored to use core.contracts - I'm happy to offer analyze as a contrib project if needed. It's crucial to core.typed. - other deps can be deleted easily. Thanks, Ambrose On Sun, Feb 24, 2013 at 12:35 AM, Stuart Sierra the.stuart.sie...@gmail.com wrote: Hi Ambrose, I would try to help diagnose this, but I can't even try to compile core.typed in its present state because of dependencies: core.typed declares a dependency on analyze 0.3.1-SNAPSHOThttps://github.com/clojure/core.typed/blob/78d09859cee78967e9dd0ee7d74e0f52bd3be6f1/project.clj#L3, which I cannot find anywhere, including the sourcehttps://github.com/frenchy64/analyzeon GitHub. Even if we fix that, there are larger issues with releasing core.typed as a contrib library. The Maven-based builds on build.clojure.org do not include Clojars.org in their list of repositories. All of the contrib libraries released so far have no dependencies other than Clojure itself. There has been an *implicit* policy that contrib libraries may not have external dependencies, on which Rich has the final say. Furthermore, according to the policy of the Maven Central Repositoryhttp://search.maven.org/, we cannot deploy anything which depends on third-party repositories. Therefore we cannot deploy core.typed to the Central Repository unless all its dependencies are also deployed there. I will do whatever I can to help you get core.typed up and running on build.clojure.org, but these are the constraints we have to work in. Feel free to contact me off-list if you have additional questions. Thanks, -S On Friday, February 22, 2013 2:26:31 AM UTC-5, Ambrose Bonnaire-Sergeant wrote: Hi, I don't understand why this `assert` fails when the namespace is compiled with `compile`. It seems like the datatype A is being compiled twice. (ns mvn-test.core) (deftype A []) (assert (= (class (A.)) (class ((fn [] (A.)) user= (compile 'mvn-test.core) CompilerException java.lang.AssertionError: Assert failed: (= (class (A.)) (class ((fn [] (A.), compiling:(core.clj:5:1) Here is the project.clj: (defproject mvn-test 0.0.1-SNAPSHOT :source-paths [src/main/clojure] :dependencies [[org.clojure/clojure 1.5.0-RC16]]) I found this behaviour was the root cause of why `mvn test` fails in core.typed, while `lein test` works perfectly. Any pointers would be appreciated. Thanks, Ambrose -- -- 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 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: A Working nrepl-ritz Setup?
Hello, I managed to get nrepl-ritz going, but I'm experiencing the following annoying things: 1. When I switched on M-x nrepl-ritz-break-on-exception, I'm unable to disable it. When I called the command with a prefix(by default M--), it is still in action. Is there a way to disable it? Otherwise, I'll need to spend another 20-30s to re-initialize the repl and reload the work I'm doing 2. This is not a serious problem but somehow a little annoying: I cannot enable ac-nrepl with ritz on. Otherwise, it will hang forever (unless I kill emacs). Is there a possible way to integrate it with ac-nrepl? Or is there any better alternatives? PS. I do miss slime fuzzy complete when I program common lisp though. Also, can nrepl by default make completions on Java methods? I can only find it possible in ac-nrepl. Any help would be appreciated. Bruce Li 2013/1/20 fb friedrich.boe...@gmail.com On Windows, I had to put the profiles.clj in the Windows home directory C:\Users\%user name%\AppData\Roaming, where also .emacs.d reesides (see also https://github.com/pallet/ritz/issues/28#issuecomment-12460118). -fb Am Mittwoch, 5. Dezember 2012 18:24:20 UTC+1 schrieb Hugo Duncan: Timothy Washington twas...@gmail.com writes: 1) I start from an empty *~/.emacs.d/* 2) I then populate init.el from the example in ritz/nreplhttps://github.com/**pallet/ritz/tree/develop/nreplhttps://github.com/pallet/ritz/tree/develop/nrepl ** 3) I open a lein project and run `*M-x nrepl-ritz-jack-in*` **) The error I get back is: *error in process sentinel: Could not start nREPL server: 'ritz-nrepl' is not a task. See 'lein help'.* This is actually a lein message, and it is saying that the lein-ritz plugin is not in the :plugins vector of a lein profile. There is an example of setting this up in ~/.lein/profiles.clj on the page you linked. HTH, Hugo -- 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 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: Redefinition of datatypes
On Feb 23, 2013, at 11:35 AM, Stuart Sierra wrote: Furthermore, according to the policy of the Maven Central Repository, we cannot deploy anything which depends on third-party repositories. Therefore we cannot deploy core.typed to the Central Repository unless all its dependencies are also deployed there. Straying further off-topic, but: FWIW, unless they've changed the verification of POMs being promoted recently, that's not so. The official guide to OSS deployment only says it's strongly discouraged (https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide), and links to blog posts that indicate that Sonatype is (was?) planning on rewriting POMs to remove external repository definitions, but tons of artifacts in central still contain them, e.g.: http://repo1.maven.org/maven2/org/openid4java/openid4java-nodeps/0.9.6/openid4java-nodeps-0.9.6.pom (…which refers to a now-defunct Guice repository, thus highlighting the rationale for the proposed no-external-repositories policy.) Cheers, - Chas -- -- 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 For Expensive Algorithms
Stack analysis is quite a brittle mechanism, as far as I'm aware of. As soon as you pass the object to any method, even if private, the object will not be stack-allocated. The way Clojure code is typically written, and the way it is compiled, some method call will almost certainly get involved. On Saturday, February 23, 2013 9:14:12 PM UTC+1, Nicolas Oury wrote: On Fri, Feb 22, 2013 at 8:01 PM, Marko Topolnik marko.t...@gmail.comjavascript: wrote: Forgot to mention another hugely important factor: heap-allocated objects spell disaster for CPU cachelines. With today's architectures the difference between a cache hit and a cache miss is like the difference between catching your bus to work and having to walk instead. In our example I would have to be careful to reuse the same deftype instance for all inner loop runs, but then I'd need even more code to make sure the values are reset before entering. The result would be messy, brittle code with higher-level logic scattered between all the housekeeping constructs. Wouldn't the object be stack allocated by escape analysis? -- -- 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: Can't type-hint a def with ^objects
2013/2/24 Marko Topolnik marko.topol...@gmail.com Is this behavior specified? It certainly doesn't make sense from a language user perspective. ^doubles can be used to avoid boxing on the hot code path, what would you gain with ^objects? -- 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/groups/opt_out.
Re: Can't type-hint a def with ^objects
Actually, ^doubles can be used for two separate things, one of which applies to ^objects as well: avoid reflection and avoid boxing/unboxing. I do need to avoid reflection. On Saturday, February 23, 2013 10:00:58 PM UTC+1, Michael Klishin wrote: 2013/2/24 Marko Topolnik marko.t...@gmail.com javascript: Is this behavior specified? It certainly doesn't make sense from a language user perspective. ^doubles can be used to avoid boxing on the hot code path, what would you gain with ^objects? -- 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/groups/opt_out.
[ANN] edn-java 0.4.0 a library to read and write edn data
I'm happy to report that edn-java is now available on Maven Central. What is edn-java? - Edn-java is a Java library for reading and writing edn data. It has no dependencies other than Java 1.6.x or later. A more detailed description, including usage examples is available here: http://edn-java.bpsm.us What is edn? Edn is an extensible data notation used used by Datomic and other applications as a data transfer format. It supports a rich set of built-in elements, and the definition of extension elements in terms of the others. edn is a system for the conveyance of values. It is not a type system, and has no schemas. Edn is suitable for streaming and interactive applications since there is no enclosing element at the top level. (Paraphrased form https://github.com/edn-format/edn) Where can I get edn-java? - Edn-java is licensed under the Eclipse Public License 1.0. Sources are on github: https://github.com/bpsm/edn-java Patches issues welcomed! Maven coordinates are: dependency groupIdus.bpsm/groupId artifactIdedn-java/artifactId version0.4.0/version /dependency Caveats --- The Parser seems pretty solid (for 0.4.0). I use it in production. I don't anticipate breaking API changes there. Printing support is not as far along as parsing. It appears to work correctly, but does not pretty print. Printing APIs may change. -- -- 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.
How does clj-http work regarding https?
This might be a dumb How does the Internet work kind of question. I have been asked to pull data from Omniture, using the Omniture API. I thought this would take me an hour, but I've been working on this for 3 days now. I keep getting authentication errors. I became curious about exactly what code was sending to Omniture, so I downloaded Charles, the network debugging tool: http://www.charlesproxy.com/ I am using clj-http to make the POST. The post is suppose to be https. This is the thing that surprises me: If I use http then I can see all the headers in Charles, and they all look correct. But if I use https (which is what I need to use) then there are no headers that I can see in Charles. Is that because Charles does not want to show me a bunch of encrypted garbage? Or is clj-http not adding in the headers with https? Maybe I need a special setting to get clj-http to correctly send to https? (I have not been able to find any such setting.) This is the code where I use clj-http (here I call http-client): (defn omniture-call-api [url-with-queue-method api-payload headers] (timbre/spy :debug return value of omniture-call-api (try+ (http-client/post url-with-queue-method {:body api-payload :headers {X-Api-Version 2 X-WSSE headers} :content-type :json :socket-timeout 4000 :conn-timeout 4000 :accept :json :client-params {http.protocol.allow-circular-redirects false http.useragent clj-http}}) (catch Object o (println (pp/pprint o)) The url is: https://api2.omniture.com/admin/1.3/rest/?method=Report.QueueRanked At first I assumed this was a problem with Omniture's code. I have asked several question on the Developer forum at Omniture, but no one there could help me (Adobe has apparently cut most of the developer support since Adobe bought Omniture in 2009). However, I am now wondering if maybe I am doing this POST incorrectly. I am puzzled by something else as well: I call this function once, yet Charles shows 4 calls being made to Omniture, and my own code, when it prints data to the terminal, seems to show many requests being made. Why would that be? Again, if I change the URL so it uses http then in Charles I can see all the headers that suppose to be in this line of code: X-WSSE headers and the headers look correct (I posted them to the developer forums at Omniture and the one guy from Omniture who gave it a look felt there was nothing terribly amiss -- but he couldn't rule anything out.) But If I change the URL to use https, then I see no headers in Charles. Why is that? lawrence -- -- 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: Can't type-hint a def with ^objects
2013/2/24 Marko Topolnik marko.topol...@gmail.com I do need to avoid reflection. Then use ^[Ljava.lang.Object; and friends, it works just fine. -- 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/groups/opt_out.
Re: Can't type-hint a def with ^objects
Thank you, I'm using it and it does work. However, there is presumably a good reason for the existence of the ^objects annotation, so the question remains whether this is a) specified behavior and b) the way it is planned to stay. On Saturday, February 23, 2013 10:32:31 PM UTC+1, Michael Klishin wrote: 2013/2/24 Marko Topolnik marko.t...@gmail.com javascript: I do need to avoid reflection. Then use ^[Ljava.lang.Object; and friends, it works just fine. -- 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/groups/opt_out.
Re: How does clj-http work regarding https?
When I turn on: :debug true :debug-body true I get all that follows. Which mostly looks right, I guess. But why don't I see the headers in Charles? I'll go back to assuming this is a problem with Omniture, but I would be grateful if anyone could glance over this output and tell me if anything looks amiss. I took out the username and password but otherwise left in all the details. {:scheme :https, :http-url https://api2.omniture.com/admin/1.3/rest/? method=Report.QueueOvertime, :conn-timeout 4000, :debug-body true, :request-method :post, :query-string method=Report.QueueOvertime, :content-type :json, :uri /admin/1.3/rest/, :server-name api2.omniture.com, :headers {accept-encoding gzip, deflate, accept application/json, content-type application/json, x-api-version 2, x-wsse UsernameToken Username=\xxx\, PasswordDigest=\xxx\, Nonce= \Y2FiOGM3YjAxY2QyY2YwMTdmZTY2YTIzNzNjNzU2OWI=\, Created= \2013-02-23T16:40:14Z}, :socket-timeout 4000, :debug true, :body-type org.apache.http.entity.StringEntity, :server-port nil, :character-encoding UTF-8, :client-params {http.useragent clj-http, http.protocol.allow-circular-redirects false}, :body {\reportDescription\ : { \reportSuiteID\ : \timeoutny\, \dateFrom\ : \2013-02-01\, \dateTo\ : \2013-02-12\, \dateGranularity\ : \hourly\, \metrics\ : [ { \id\ : \pageViews\ }, { \id\ : \visits\ } ], \validate\:\true\ } }, :user-info nil} HttpRequest: {:requestLine #BasicRequestLine POST https://api2.omniture.com/admin/1.3/rest/?method=Report.QueueOvertime HTTP/1.1, :protocolVersion #HttpVersion HTTP/1.1, :params #BasicHttpParams org.apache.http.params.BasicHttpParams@47b0081, :method POST, :entity #StringEntity org.apache.http.entity.StringEntity@117eb1bd, :class org.apache.http.client.methods.HttpPost, :allHeaders [#BasicHeader Connection: close, #BasicHeader accept-encoding: gzip, deflate, #BasicHeader accept: application/json, #BasicHeader content-type: application/json, #BasicHeader x-api-version: 2, #BasicHeader x-wsse: UsernameToken Username=xxx, PasswordDigest=xxx, Nonce=Y2FiOGM3YjAxY2QyY2YwMTdmZTY2YTIzNzNjNzU2OWI=, Created=2013-02-23T16:40:14Z], :aborted false, :URI #URI https://api2.omniture.com/admin/1.3/rest/?method=Report.QueueOvertime} Sadly, Omniture doesn't offer any support service, so I am not able to contact them directly and get any help from them. (They have support contracts that cost many thousands of dollars, but my company would not be interested in that kind of expense.) {:trace-redirects [https://api2.omniture.com/admin/1.3/rest/? method=Report.QueueOvertime], :request-time 1064, :status 401, :headers {date Sat, 23 Feb 2013 21:40:15 GMT, server Omniture AWS/2.0.0, www-authenticate WSSE realm=\Omniture REST Api\, profile=\UsernameToken\, xserver www336, content-length 46, content-type application/json, connection close}, :body {\error\:\Unable to validate authentication.\}} nil Request: org.apache.http.entity.StringEntity On Feb 23, 4:18 pm, larry google groups lawrencecloj...@gmail.com wrote: This might be a dumb How does the Internet work kind of question. I have been asked to pull data from Omniture, using the Omniture API. I thought this would take me an hour, but I've been working on this for 3 days now. I keep getting authentication errors. I became curious about exactly what code was sending to Omniture, so I downloaded Charles, the network debugging tool: http://www.charlesproxy.com/ I am using clj-http to make the POST. The post is suppose to be https. This is the thing that surprises me: If I use http then I can see all the headers in Charles, and they all look correct. But if I use https (which is what I need to use) then there are no headers that I can see in Charles. Is that because Charles does not want to show me a bunch of encrypted garbage? Or is clj-http not adding in the headers with https? Maybe I need a special setting to get clj-http to correctly send to https? (I have not been able to find any such setting.) This is the code where I use clj-http (here I call http-client): (defn omniture-call-api [url-with-queue-method api-payload headers] (timbre/spy :debug return value of omniture-call-api (try+ (http-client/post url-with-queue-method {:body api-payload :headers {X-Api-Version 2
Re: Clojure Performance For Expensive Algorithms
Just wanted to say I am getting a lot out of this discussion. -- -- 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: How does clj-http work regarding https?
Try adding :insecure? true to the map. Charles dynamically generates a cert pretending to be the target host when acting as an ssl proxy, and clj-http probably has to be told to accept it. On Sat, Feb 23, 2013 at 4:18 PM, larry google groups lawrencecloj...@gmail.com wrote: This might be a dumb How does the Internet work kind of question. I have been asked to pull data from Omniture, using the Omniture API. I thought this would take me an hour, but I've been working on this for 3 days now. I keep getting authentication errors. I became curious about exactly what code was sending to Omniture, so I downloaded Charles, the network debugging tool: http://www.charlesproxy.com/ I am using clj-http to make the POST. The post is suppose to be https. This is the thing that surprises me: If I use http then I can see all the headers in Charles, and they all look correct. But if I use https (which is what I need to use) then there are no headers that I can see in Charles. Is that because Charles does not want to show me a bunch of encrypted garbage? Or is clj-http not adding in the headers with https? Maybe I need a special setting to get clj-http to correctly send to https? (I have not been able to find any such setting.) This is the code where I use clj-http (here I call http-client): (defn omniture-call-api [url-with-queue-method api-payload headers] (timbre/spy :debug return value of omniture-call-api (try+ (http-client/post url-with-queue-method {:body api-payload :headers {X-Api-Version 2 X-WSSE headers} :content-type :json :socket-timeout 4000 :conn-timeout 4000 :accept :json :client-params {http.protocol.allow-circular-redirects false http.useragent clj-http}}) (catch Object o (println (pp/pprint o)) The url is: https://api2.omniture.com/admin/1.3/rest/?method=Report.QueueRanked At first I assumed this was a problem with Omniture's code. I have asked several question on the Developer forum at Omniture, but no one there could help me (Adobe has apparently cut most of the developer support since Adobe bought Omniture in 2009). However, I am now wondering if maybe I am doing this POST incorrectly. I am puzzled by something else as well: I call this function once, yet Charles shows 4 calls being made to Omniture, and my own code, when it prints data to the terminal, seems to show many requests being made. Why would that be? Again, if I change the URL so it uses http then in Charles I can see all the headers that suppose to be in this line of code: X-WSSE headers and the headers look correct (I posted them to the developer forums at Omniture and the one guy from Omniture who gave it a look felt there was nothing terribly amiss -- but he couldn't rule anything out.) But If I change the URL to use https, then I see no headers in Charles. Why is that? lawrence -- -- 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 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: How does clj-http work regarding https?
Try adding :insecure? true to the map. Charles dynamically generates a cert pretending to be the target host when acting as an ssl proxy, and clj-http probably has to be told to accept it. Okay, I've done so, but I don't think I understand what you are telling me. Are you saying that clj-http won't send its POST if it feels the cert is false? Charles has consistently said, in each report, SSL Proxying not enabled for this host: enable in Proxy Settings, SSL locations And I've made the change you suggested, but I still see that message. On Feb 23, 5:24 pm, Jonah Benton jo...@jonah.com wrote: Try adding :insecure? true to the map. Charles dynamically generates a cert pretending to be the target host when acting as an ssl proxy, and clj-http probably has to be told to accept it. On Sat, Feb 23, 2013 at 4:18 PM, larry google groups lawrencecloj...@gmail.com wrote: This might be a dumb How does the Internet work kind of question. I have been asked to pull data from Omniture, using the Omniture API. I thought this would take me an hour, but I've been working on this for 3 days now. I keep getting authentication errors. I became curious about exactly what code was sending to Omniture, so I downloaded Charles, the network debugging tool: http://www.charlesproxy.com/ I am using clj-http to make the POST. The post is suppose to be https. This is the thing that surprises me: If I use http then I can see all the headers in Charles, and they all look correct. But if I use https (which is what I need to use) then there are no headers that I can see in Charles. Is that because Charles does not want to show me a bunch of encrypted garbage? Or is clj-http not adding in the headers with https? Maybe I need a special setting to get clj-http to correctly send to https? (I have not been able to find any such setting.) This is the code where I use clj-http (here I call http-client): (defn omniture-call-api [url-with-queue-method api-payload headers] (timbre/spy :debug return value of omniture-call-api (try+ (http-client/post url-with-queue-method {:body api-payload :headers {X-Api-Version 2 X-WSSE headers} :content-type :json :socket-timeout 4000 :conn-timeout 4000 :accept :json :client-params {http.protocol.allow-circular-redirects false http.useragent clj-http}}) (catch Object o (println (pp/pprint o)) The url is: https://api2.omniture.com/admin/1.3/rest/?method=Report.QueueRanked At first I assumed this was a problem with Omniture's code. I have asked several question on the Developer forum at Omniture, but no one there could help me (Adobe has apparently cut most of the developer support since Adobe bought Omniture in 2009). However, I am now wondering if maybe I am doing this POST incorrectly. I am puzzled by something else as well: I call this function once, yet Charles shows 4 calls being made to Omniture, and my own code, when it prints data to the terminal, seems to show many requests being made. Why would that be? Again, if I change the URL so it uses http then in Charles I can see all the headers that suppose to be in this line of code: X-WSSE headers and the headers look correct (I posted them to the developer forums at Omniture and the one guy from Omniture who gave it a look felt there was nothing terribly amiss -- but he couldn't rule anything out.) But If I change the URL to use https, then I see no headers in Charles. Why is that? lawrence -- -- 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, visithttps://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
functions as return values
In Clojure, if I have a function call that asks for return of a function, for example user ((fn [a] (fn [b] (+ (inc a) (* b b 5) I get the function name #user$eval4164$fn__4165$fn__4166 user$eval4164$fn__4165$fn__4166@29770daa But what I would like to get is an expression that defines this function, for example (fn [b] (+ 6 (* b b))) Is there some way that I can suppress the evaluation of this expression? --Larry -- -- 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: How does clj-http work regarding https?
Any idea why a single call to clj-http/post causes 4 transactions to appear in Charles? On Feb 23, 5:47 pm, larry google groups lawrencecloj...@gmail.com wrote: Try adding :insecure? true to the map. Charles dynamically generates a cert pretending to be the target host when acting as an ssl proxy, and clj-http probably has to be told to accept it. Okay, I've done so, but I don't think I understand what you are telling me. Are you saying that clj-http won't send its POST if it feels the cert is false? Charles has consistently said, in each report, SSL Proxying not enabled for this host: enable in Proxy Settings, SSL locations And I've made the change you suggested, but I still see that message. On Feb 23, 5:24 pm, Jonah Benton jo...@jonah.com wrote: Try adding :insecure? true to the map. Charles dynamically generates a cert pretending to be the target host when acting as an ssl proxy, and clj-http probably has to be told to accept it. On Sat, Feb 23, 2013 at 4:18 PM, larry google groups lawrencecloj...@gmail.com wrote: This might be a dumb How does the Internet work kind of question. I have been asked to pull data from Omniture, using the Omniture API. I thought this would take me an hour, but I've been working on this for 3 days now. I keep getting authentication errors. I became curious about exactly what code was sending to Omniture, so I downloaded Charles, the network debugging tool: http://www.charlesproxy.com/ I am using clj-http to make the POST. The post is suppose to be https. This is the thing that surprises me: If I use http then I can see all the headers in Charles, and they all look correct. But if I use https (which is what I need to use) then there are no headers that I can see in Charles. Is that because Charles does not want to show me a bunch of encrypted garbage? Or is clj-http not adding in the headers with https? Maybe I need a special setting to get clj-http to correctly send to https? (I have not been able to find any such setting.) This is the code where I use clj-http (here I call http-client): (defn omniture-call-api [url-with-queue-method api-payload headers] (timbre/spy :debug return value of omniture-call-api (try+ (http-client/post url-with-queue-method {:body api-payload :headers {X-Api-Version 2 X-WSSE headers} :content-type :json :socket-timeout 4000 :conn-timeout 4000 :accept :json :client-params {http.protocol.allow-circular-redirects false http.useragent clj-http}}) (catch Object o (println (pp/pprint o)) The url is: https://api2.omniture.com/admin/1.3/rest/?method=Report.QueueRanked At first I assumed this was a problem with Omniture's code. I have asked several question on the Developer forum at Omniture, but no one there could help me (Adobe has apparently cut most of the developer support since Adobe bought Omniture in 2009). However, I am now wondering if maybe I am doing this POST incorrectly. I am puzzled by something else as well: I call this function once, yet Charles shows 4 calls being made to Omniture, and my own code, when it prints data to the terminal, seems to show many requests being made. Why would that be? Again, if I change the URL so it uses http then in Charles I can see all the headers that suppose to be in this line of code: X-WSSE headers and the headers look correct (I posted them to the developer forums at Omniture and the one guy from Omniture who gave it a look felt there was nothing terribly amiss -- but he couldn't rule anything out.) But If I change the URL to use https, then I see no headers in Charles. Why is that? lawrence -- -- 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, visithttps://groups.google.com/groups/opt_out. -- -- You received this message because you are subscribed to the
Re: How does clj-http work regarding https?
Ok- so in Charles, you'll need to do that, tell it to ssl proxy the domain api2.omniture.com Described in a little more detail here: http://www.charlesproxy.com/documentation/proxying/ssl-proxying/ On Sat, Feb 23, 2013 at 5:47 PM, larry google groups lawrencecloj...@gmail.com wrote: Try adding :insecure? true to the map. Charles dynamically generates a cert pretending to be the target host when acting as an ssl proxy, and clj-http probably has to be told to accept it. Okay, I've done so, but I don't think I understand what you are telling me. Are you saying that clj-http won't send its POST if it feels the cert is false? Charles has consistently said, in each report, SSL Proxying not enabled for this host: enable in Proxy Settings, SSL locations And I've made the change you suggested, but I still see that message. On Feb 23, 5:24 pm, Jonah Benton jo...@jonah.com wrote: Try adding :insecure? true to the map. Charles dynamically generates a cert pretending to be the target host when acting as an ssl proxy, and clj-http probably has to be told to accept it. On Sat, Feb 23, 2013 at 4:18 PM, larry google groups lawrencecloj...@gmail.com wrote: This might be a dumb How does the Internet work kind of question. I have been asked to pull data from Omniture, using the Omniture API. I thought this would take me an hour, but I've been working on this for 3 days now. I keep getting authentication errors. I became curious about exactly what code was sending to Omniture, so I downloaded Charles, the network debugging tool: http://www.charlesproxy.com/ I am using clj-http to make the POST. The post is suppose to be https. This is the thing that surprises me: If I use http then I can see all the headers in Charles, and they all look correct. But if I use https (which is what I need to use) then there are no headers that I can see in Charles. Is that because Charles does not want to show me a bunch of encrypted garbage? Or is clj-http not adding in the headers with https? Maybe I need a special setting to get clj-http to correctly send to https? (I have not been able to find any such setting.) This is the code where I use clj-http (here I call http-client): (defn omniture-call-api [url-with-queue-method api-payload headers] (timbre/spy :debug return value of omniture-call-api (try+ (http-client/post url-with-queue-method {:body api-payload :headers {X-Api-Version 2 X-WSSE headers} :content-type :json :socket-timeout 4000 :conn-timeout 4000 :accept :json :client-params {http.protocol.allow-circular-redirects false http.useragent clj-http}}) (catch Object o (println (pp/pprint o)) The url is: https://api2.omniture.com/admin/1.3/rest/?method=Report.QueueRanked At first I assumed this was a problem with Omniture's code. I have asked several question on the Developer forum at Omniture, but no one there could help me (Adobe has apparently cut most of the developer support since Adobe bought Omniture in 2009). However, I am now wondering if maybe I am doing this POST incorrectly. I am puzzled by something else as well: I call this function once, yet Charles shows 4 calls being made to Omniture, and my own code, when it prints data to the terminal, seems to show many requests being made. Why would that be? Again, if I change the URL so it uses http then in Charles I can see all the headers that suppose to be in this line of code: X-WSSE headers and the headers look correct (I posted them to the developer forums at Omniture and the one guy from Omniture who gave it a look felt there was nothing terribly amiss -- but he couldn't rule anything out.) But If I change the URL to use https, then I see no headers in Charles. Why is that? lawrence -- -- 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
Re: How does clj-http work regarding https?
Very likely it's the automatic retry logic: ;; Apache's http client automatically retries on IOExceptions, if you;; would like to handle these retries yourself, you can specify a;; :retry-handler. Return true to retry, false to stop trying:(client/post http://example.org; {:multipart [[title Foo] [Content/type text/plain] [file (clojure.java.io/file /tmp/missing-file)]] :retry-handler (fn [ex try-count http-context] (println Got: ex) (if ( try-count 4) false true))}) from https://github.com/dakrone/clj-http On Sat, Feb 23, 2013 at 5:57 PM, larry google groups lawrencecloj...@gmail.com wrote: Any idea why a single call to clj-http/post causes 4 transactions to appear in Charles? On Feb 23, 5:47 pm, larry google groups lawrencecloj...@gmail.com wrote: Try adding :insecure? true to the map. Charles dynamically generates a cert pretending to be the target host when acting as an ssl proxy, and clj-http probably has to be told to accept it. Okay, I've done so, but I don't think I understand what you are telling me. Are you saying that clj-http won't send its POST if it feels the cert is false? Charles has consistently said, in each report, SSL Proxying not enabled for this host: enable in Proxy Settings, SSL locations And I've made the change you suggested, but I still see that message. On Feb 23, 5:24 pm, Jonah Benton jo...@jonah.com wrote: Try adding :insecure? true to the map. Charles dynamically generates a cert pretending to be the target host when acting as an ssl proxy, and clj-http probably has to be told to accept it. On Sat, Feb 23, 2013 at 4:18 PM, larry google groups lawrencecloj...@gmail.com wrote: This might be a dumb How does the Internet work kind of question. I have been asked to pull data from Omniture, using the Omniture API. I thought this would take me an hour, but I've been working on this for 3 days now. I keep getting authentication errors. I became curious about exactly what code was sending to Omniture, so I downloaded Charles, the network debugging tool: http://www.charlesproxy.com/ I am using clj-http to make the POST. The post is suppose to be https. This is the thing that surprises me: If I use http then I can see all the headers in Charles, and they all look correct. But if I use https (which is what I need to use) then there are no headers that I can see in Charles. Is that because Charles does not want to show me a bunch of encrypted garbage? Or is clj-http not adding in the headers with https? Maybe I need a special setting to get clj-http to correctly send to https? (I have not been able to find any such setting.) This is the code where I use clj-http (here I call http-client): (defn omniture-call-api [url-with-queue-method api-payload headers] (timbre/spy :debug return value of omniture-call-api (try+ (http-client/post url-with-queue-method {:body api-payload :headers {X-Api-Version 2 X-WSSE headers} :content-type :json :socket-timeout 4000 :conn-timeout 4000 :accept :json :client-params {http.protocol.allow-circular-redirects false http.useragent clj-http}}) (catch Object o (println (pp/pprint o)) The url is: https://api2.omniture.com/admin/1.3/rest/?method=Report.QueueRanked At first I assumed this was a problem with Omniture's code. I have asked several question on the Developer forum at Omniture, but no one there could help me (Adobe has apparently cut most of the developer support since Adobe bought Omniture in 2009). However, I am now wondering if maybe I am doing this POST incorrectly. I am puzzled by something else as well: I call this function once, yet Charles shows 4 calls being made to Omniture, and my own code, when it prints data to the terminal, seems to show many requests being made. Why would that be? Again, if I change the URL so it uses http then in Charles I can see all the headers that suppose to be in this line of code: X-WSSE headers and the headers look correct (I posted them to the developer forums at Omniture and the one guy from Omniture who gave it a look felt there was nothing terribly amiss --
Re: How does clj-http work regarding https?
Very likely it's the automatic retry logic: Thank you for that. One mystery solved. I wonder why it retries? The ping reaches Omniture, I get back a 401 error. Maybe it retries on any 4xx error? On Feb 23, 6:30 pm, Jonah Benton jo...@jonah.com wrote: Very likely it's the automatic retry logic: ;; Apache's http client automatically retries on IOExceptions, if you;; would like to handle these retries yourself, you can specify a;; :retry-handler. Return true to retry, false to stop trying:(client/post http://example.org; {:multipart [[title Foo] [Content/type text/plain] [file (clojure.java.io/file /tmp/missing-file)]] :retry-handler (fn [ex try-count http-context] (println Got: ex) (if ( try-count 4) false true))}) from https://github.com/dakrone/clj-http On Sat, Feb 23, 2013 at 5:57 PM, larry google groups lawrencecloj...@gmail.com wrote: Any idea why a single call to clj-http/post causes 4 transactions to appear in Charles? On Feb 23, 5:47 pm, larry google groups lawrencecloj...@gmail.com wrote: Try adding :insecure? true to the map. Charles dynamically generates a cert pretending to be the target host when acting as an ssl proxy, and clj-http probably has to be told to accept it. Okay, I've done so, but I don't think I understand what you are telling me. Are you saying that clj-http won't send its POST if it feels the cert is false? Charles has consistently said, in each report, SSL Proxying not enabled for this host: enable in Proxy Settings, SSL locations And I've made the change you suggested, but I still see that message. On Feb 23, 5:24 pm, Jonah Benton jo...@jonah.com wrote: Try adding :insecure? true to the map. Charles dynamically generates a cert pretending to be the target host when acting as an ssl proxy, and clj-http probably has to be told to accept it. On Sat, Feb 23, 2013 at 4:18 PM, larry google groups lawrencecloj...@gmail.com wrote: This might be a dumb How does the Internet work kind of question. I have been asked to pull data from Omniture, using the Omniture API. I thought this would take me an hour, but I've been working on this for 3 days now. I keep getting authentication errors. I became curious about exactly what code was sending to Omniture, so I downloaded Charles, the network debugging tool: http://www.charlesproxy.com/ I am using clj-http to make the POST. The post is suppose to be https. This is the thing that surprises me: If I use http then I can see all the headers in Charles, and they all look correct. But if I use https (which is what I need to use) then there are no headers that I can see in Charles. Is that because Charles does not want to show me a bunch of encrypted garbage? Or is clj-http not adding in the headers with https? Maybe I need a special setting to get clj-http to correctly send to https? (I have not been able to find any such setting.) This is the code where I use clj-http (here I call http-client): (defn omniture-call-api [url-with-queue-method api-payload headers] (timbre/spy :debug return value of omniture-call-api (try+ (http-client/post url-with-queue-method {:body api-payload :headers {X-Api-Version 2 X-WSSE headers} :content-type :json :socket-timeout 4000 :conn-timeout 4000 :accept :json :client-params {http.protocol.allow-circular-redirects false http.useragent clj-http}}) (catch Object o (println (pp/pprint o)) The url is: https://api2.omniture.com/admin/1.3/rest/?method=Report.QueueRanked At first I assumed this was a problem with Omniture's code. I have asked several question on the Developer forum at Omniture, but no one there could help me (Adobe has apparently cut most of the developer support since Adobe bought Omniture in 2009). However, I am now wondering if maybe I am doing this POST incorrectly. I am puzzled by something else as well: I call this function once, yet Charles shows 4 calls being made to Omniture, and my own code, when it prints data to the terminal, seems to show many requests being made. Why would that be? Again, if I change the
Re: How does clj-http work regarding https?
Described in a little more detail here: http://www.charlesproxy.com/documentation/proxying/ssl-proxying/ Thank you, that is a huge help. I am finding it is a real headache to use several new technologies, all at once. On Feb 23, 6:28 pm, Jonah Benton jo...@jonah.com wrote: Ok- so in Charles, you'll need to do that, tell it to ssl proxy the domain api2.omniture.com Described in a little more detail here: http://www.charlesproxy.com/documentation/proxying/ssl-proxying/ On Sat, Feb 23, 2013 at 5:47 PM, larry google groups lawrencecloj...@gmail.com wrote: Try adding :insecure? true to the map. Charles dynamically generates a cert pretending to be the target host when acting as an ssl proxy, and clj-http probably has to be told to accept it. Okay, I've done so, but I don't think I understand what you are telling me. Are you saying that clj-http won't send its POST if it feels the cert is false? Charles has consistently said, in each report, SSL Proxying not enabled for this host: enable in Proxy Settings, SSL locations And I've made the change you suggested, but I still see that message. On Feb 23, 5:24 pm, Jonah Benton jo...@jonah.com wrote: Try adding :insecure? true to the map. Charles dynamically generates a cert pretending to be the target host when acting as an ssl proxy, and clj-http probably has to be told to accept it. On Sat, Feb 23, 2013 at 4:18 PM, larry google groups lawrencecloj...@gmail.com wrote: This might be a dumb How does the Internet work kind of question. I have been asked to pull data from Omniture, using the Omniture API. I thought this would take me an hour, but I've been working on this for 3 days now. I keep getting authentication errors. I became curious about exactly what code was sending to Omniture, so I downloaded Charles, the network debugging tool: http://www.charlesproxy.com/ I am using clj-http to make the POST. The post is suppose to be https. This is the thing that surprises me: If I use http then I can see all the headers in Charles, and they all look correct. But if I use https (which is what I need to use) then there are no headers that I can see in Charles. Is that because Charles does not want to show me a bunch of encrypted garbage? Or is clj-http not adding in the headers with https? Maybe I need a special setting to get clj-http to correctly send to https? (I have not been able to find any such setting.) This is the code where I use clj-http (here I call http-client): (defn omniture-call-api [url-with-queue-method api-payload headers] (timbre/spy :debug return value of omniture-call-api (try+ (http-client/post url-with-queue-method {:body api-payload :headers {X-Api-Version 2 X-WSSE headers} :content-type :json :socket-timeout 4000 :conn-timeout 4000 :accept :json :client-params {http.protocol.allow-circular-redirects false http.useragent clj-http}}) (catch Object o (println (pp/pprint o)) The url is: https://api2.omniture.com/admin/1.3/rest/?method=Report.QueueRanked At first I assumed this was a problem with Omniture's code. I have asked several question on the Developer forum at Omniture, but no one there could help me (Adobe has apparently cut most of the developer support since Adobe bought Omniture in 2009). However, I am now wondering if maybe I am doing this POST incorrectly. I am puzzled by something else as well: I call this function once, yet Charles shows 4 calls being made to Omniture, and my own code, when it prints data to the terminal, seems to show many requests being made. Why would that be? Again, if I change the URL so it uses http then in Charles I can see all the headers that suppose to be in this line of code: X-WSSE headers and the headers look correct (I posted them to the developer forums at Omniture and the one guy from Omniture who gave it a look felt there was nothing terribly amiss -- but he couldn't rule anything out.) But If I change the URL to use https, then I see no headers in Charles. Why is that? lawrence -- -- 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
Re: How does clj-http work regarding https?
;; Apache's http client automatically retries on IOExceptions, I guess clj-http swallows the exception? It seems strange that it doesn't bubble up to my code. But then I don't know Java so I probably miss some of the etiquette about when a library should catch its own exceptions. On Feb 23, 6:52 pm, larry google groups lawrencecloj...@gmail.com wrote: Described in a little more detail here: http://www.charlesproxy.com/documentation/proxying/ssl-proxying/ Thank you, that is a huge help. I am finding it is a real headache to use several new technologies, all at once. On Feb 23, 6:28 pm, Jonah Benton jo...@jonah.com wrote: Ok- so in Charles, you'll need to do that, tell it to ssl proxy the domain api2.omniture.com Described in a little more detail here: http://www.charlesproxy.com/documentation/proxying/ssl-proxying/ On Sat, Feb 23, 2013 at 5:47 PM, larry google groups lawrencecloj...@gmail.com wrote: Try adding :insecure? true to the map. Charles dynamically generates a cert pretending to be the target host when acting as an ssl proxy, and clj-http probably has to be told to accept it. Okay, I've done so, but I don't think I understand what you are telling me. Are you saying that clj-http won't send its POST if it feels the cert is false? Charles has consistently said, in each report, SSL Proxying not enabled for this host: enable in Proxy Settings, SSL locations And I've made the change you suggested, but I still see that message. On Feb 23, 5:24 pm, Jonah Benton jo...@jonah.com wrote: Try adding :insecure? true to the map. Charles dynamically generates a cert pretending to be the target host when acting as an ssl proxy, and clj-http probably has to be told to accept it. On Sat, Feb 23, 2013 at 4:18 PM, larry google groups lawrencecloj...@gmail.com wrote: This might be a dumb How does the Internet work kind of question. I have been asked to pull data from Omniture, using the Omniture API. I thought this would take me an hour, but I've been working on this for 3 days now. I keep getting authentication errors. I became curious about exactly what code was sending to Omniture, so I downloaded Charles, the network debugging tool: http://www.charlesproxy.com/ I am using clj-http to make the POST. The post is suppose to be https. This is the thing that surprises me: If I use http then I can see all the headers in Charles, and they all look correct. But if I use https (which is what I need to use) then there are no headers that I can see in Charles. Is that because Charles does not want to show me a bunch of encrypted garbage? Or is clj-http not adding in the headers with https? Maybe I need a special setting to get clj-http to correctly send to https? (I have not been able to find any such setting.) This is the code where I use clj-http (here I call http-client): (defn omniture-call-api [url-with-queue-method api-payload headers] (timbre/spy :debug return value of omniture-call-api (try+ (http-client/post url-with-queue-method {:body api-payload :headers {X-Api-Version 2 X-WSSE headers} :content-type :json :socket-timeout 4000 :conn-timeout 4000 :accept :json :client-params {http.protocol.allow-circular-redirects false http.useragent clj-http}}) (catch Object o (println (pp/pprint o)) The url is: https://api2.omniture.com/admin/1.3/rest/?method=Report.QueueRanked At first I assumed this was a problem with Omniture's code. I have asked several question on the Developer forum at Omniture, but no one there could help me (Adobe has apparently cut most of the developer support since Adobe bought Omniture in 2009). However, I am now wondering if maybe I am doing this POST incorrectly. I am puzzled by something else as well: I call this function once, yet Charles shows 4 calls being made to Omniture, and my own code, when it prints data to the terminal, seems to show many requests being made. Why would that be? Again, if I change the URL so it uses http then in Charles I can see all the headers that suppose to be in this line of code: X-WSSE headers and the headers look correct (I posted them to the developer forums at Omniture and the one guy from Omniture who gave it a look felt there was nothing terribly amiss -- but he couldn't rule anything out.)
Re: Clojure Performance For Expensive Algorithms
This may be slightly off topic, but your longest contiguous common subsequence problem sounds like the longest common substring problem. Your code uses the dynamic programming solution, which is O(M*N), but there are O(M+N) algorithms that might be faster depending on the length and alphabet of your input sequences. On Monday, February 18, 2013 11:16:51 PM UTC-5, Geo wrote: Hello, I am cross-posting my Clojure question from StackOverflow. I am trying to get an algorithm in Clojure to match Java speed and managed to get the performance to within one order of magnitude and wondering if more is possible. The full question is here: http://stackoverflow.com/questions/14949705/clojure-performance-for-expensive-algorithms Thank you. -- -- 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: How does clj-http work regarding https?
It won't retry on http-level errors; those semantics are up to the application. It should only retry connection-layer problems. So there must have been something funny happening either between the client and Charles, or between Charles and Omniture. On Sat, Feb 23, 2013 at 6:50 PM, larry google groups lawrencecloj...@gmail.com wrote: Very likely it's the automatic retry logic: Thank you for that. One mystery solved. I wonder why it retries? The ping reaches Omniture, I get back a 401 error. Maybe it retries on any 4xx error? On Feb 23, 6:30 pm, Jonah Benton jo...@jonah.com wrote: Very likely it's the automatic retry logic: ;; Apache's http client automatically retries on IOExceptions, if you;; would like to handle these retries yourself, you can specify a;; :retry-handler. Return true to retry, false to stop trying:(client/post http://example.org; {:multipart [[title Foo] [Content/type text/plain] [file (clojure.java.io/file /tmp/missing-file)]] :retry-handler (fn [ex try-count http-context] (println Got: ex) (if ( try-count 4) false true))}) from https://github.com/dakrone/clj-http On Sat, Feb 23, 2013 at 5:57 PM, larry google groups lawrencecloj...@gmail.com wrote: Any idea why a single call to clj-http/post causes 4 transactions to appear in Charles? On Feb 23, 5:47 pm, larry google groups lawrencecloj...@gmail.com wrote: Try adding :insecure? true to the map. Charles dynamically generates a cert pretending to be the target host when acting as an ssl proxy, and clj-http probably has to be told to accept it. Okay, I've done so, but I don't think I understand what you are telling me. Are you saying that clj-http won't send its POST if it feels the cert is false? Charles has consistently said, in each report, SSL Proxying not enabled for this host: enable in Proxy Settings, SSL locations And I've made the change you suggested, but I still see that message. On Feb 23, 5:24 pm, Jonah Benton jo...@jonah.com wrote: Try adding :insecure? true to the map. Charles dynamically generates a cert pretending to be the target host when acting as an ssl proxy, and clj-http probably has to be told to accept it. On Sat, Feb 23, 2013 at 4:18 PM, larry google groups lawrencecloj...@gmail.com wrote: This might be a dumb How does the Internet work kind of question. I have been asked to pull data from Omniture, using the Omniture API. I thought this would take me an hour, but I've been working on this for 3 days now. I keep getting authentication errors. I became curious about exactly what code was sending to Omniture, so I downloaded Charles, the network debugging tool: http://www.charlesproxy.com/ I am using clj-http to make the POST. The post is suppose to be https. This is the thing that surprises me: If I use http then I can see all the headers in Charles, and they all look correct. But if I use https (which is what I need to use) then there are no headers that I can see in Charles. Is that because Charles does not want to show me a bunch of encrypted garbage? Or is clj-http not adding in the headers with https? Maybe I need a special setting to get clj-http to correctly send to https? (I have not been able to find any such setting.) This is the code where I use clj-http (here I call http-client): (defn omniture-call-api [url-with-queue-method api-payload headers] (timbre/spy :debug return value of omniture-call-api (try+ (http-client/post url-with-queue-method {:body api-payload :headers {X-Api-Version 2 X-WSSE headers} :content-type :json :socket-timeout 4000 :conn-timeout 4000 :accept :json :client-params {http.protocol.allow-circular-redirects false http.useragent clj-http}}) (catch Object o (println (pp/pprint o)) The url is: https://api2.omniture.com/admin/1.3/rest/?method=Report.QueueRanked At first I assumed this was a problem with Omniture's code. I have asked several question on the Developer forum at Omniture, but no one there could help me (Adobe has apparently
Re: How does clj-http work regarding https?
If you cut Charles out of the picture and just send your payload directly to Omniture over https, how does Omniture respond? On Sat, Feb 23, 2013 at 6:52 PM, larry google groups lawrencecloj...@gmail.com wrote: Described in a little more detail here: http://www.charlesproxy.com/documentation/proxying/ssl-proxying/ Thank you, that is a huge help. I am finding it is a real headache to use several new technologies, all at once. On Feb 23, 6:28 pm, Jonah Benton jo...@jonah.com wrote: Ok- so in Charles, you'll need to do that, tell it to ssl proxy the domain api2.omniture.com Described in a little more detail here: http://www.charlesproxy.com/documentation/proxying/ssl-proxying/ On Sat, Feb 23, 2013 at 5:47 PM, larry google groups lawrencecloj...@gmail.com wrote: Try adding :insecure? true to the map. Charles dynamically generates a cert pretending to be the target host when acting as an ssl proxy, and clj-http probably has to be told to accept it. Okay, I've done so, but I don't think I understand what you are telling me. Are you saying that clj-http won't send its POST if it feels the cert is false? Charles has consistently said, in each report, SSL Proxying not enabled for this host: enable in Proxy Settings, SSL locations And I've made the change you suggested, but I still see that message. On Feb 23, 5:24 pm, Jonah Benton jo...@jonah.com wrote: Try adding :insecure? true to the map. Charles dynamically generates a cert pretending to be the target host when acting as an ssl proxy, and clj-http probably has to be told to accept it. On Sat, Feb 23, 2013 at 4:18 PM, larry google groups lawrencecloj...@gmail.com wrote: This might be a dumb How does the Internet work kind of question. I have been asked to pull data from Omniture, using the Omniture API. I thought this would take me an hour, but I've been working on this for 3 days now. I keep getting authentication errors. I became curious about exactly what code was sending to Omniture, so I downloaded Charles, the network debugging tool: http://www.charlesproxy.com/ I am using clj-http to make the POST. The post is suppose to be https. This is the thing that surprises me: If I use http then I can see all the headers in Charles, and they all look correct. But if I use https (which is what I need to use) then there are no headers that I can see in Charles. Is that because Charles does not want to show me a bunch of encrypted garbage? Or is clj-http not adding in the headers with https? Maybe I need a special setting to get clj-http to correctly send to https? (I have not been able to find any such setting.) This is the code where I use clj-http (here I call http-client): (defn omniture-call-api [url-with-queue-method api-payload headers] (timbre/spy :debug return value of omniture-call-api (try+ (http-client/post url-with-queue-method {:body api-payload :headers {X-Api-Version 2 X-WSSE headers} :content-type :json :socket-timeout 4000 :conn-timeout 4000 :accept :json :client-params {http.protocol.allow-circular-redirects false http.useragent clj-http}}) (catch Object o (println (pp/pprint o)) The url is: https://api2.omniture.com/admin/1.3/rest/?method=Report.QueueRanked At first I assumed this was a problem with Omniture's code. I have asked several question on the Developer forum at Omniture, but no one there could help me (Adobe has apparently cut most of the developer support since Adobe bought Omniture in 2009). However, I am now wondering if maybe I am doing this POST incorrectly. I am puzzled by something else as well: I call this function once, yet Charles shows 4 calls being made to Omniture, and my own code, when it prints data to the terminal, seems to show many requests being made. Why would that be? Again, if I change the URL so it uses http then in Charles I can see all the headers that suppose to be in this line of code: X-WSSE headers and the headers look correct (I posted them to the developer forums at Omniture and the one guy from Omniture who gave it a look felt there was nothing terribly amiss -- but he couldn't rule anything out.) But If I change the URL to use https, then I see no headers in
Re: Clojure Performance For Expensive Algorithms
It is in fact the longest common substring problem, but applied to words in a text rather than characters in a string, hence the algorithm operates on arrays of strings. I am aware of the O(M+N) algorithm, but it involves suffix trees with which I am unfamiliar and don't want to spend the time investigating right now. The DP solution works today and I want to focus on other parts of the project :) Also the size of the alphabet in this case is the set of all words in a particular language, most commonly English. I am not sure what the implications of that are for the performance of the suffix tree algo. On Saturday, February 23, 2013 7:54:01 PM UTC-5, Leif wrote: This may be slightly off topic, but your longest contiguous common subsequence problem sounds like the longest common substring problem. Your code uses the dynamic programming solution, which is O(M*N), but there are O(M+N) algorithms that might be faster depending on the length and alphabet of your input sequences. On Monday, February 18, 2013 11:16:51 PM UTC-5, Geo wrote: Hello, I am cross-posting my Clojure question from StackOverflow. I am trying to get an algorithm in Clojure to match Java speed and managed to get the performance to within one order of magnitude and wondering if more is possible. The full question is here: http://stackoverflow.com/questions/14949705/clojure-performance-for-expensive-algorithms Thank you. On Monday, February 18, 2013 11:16:51 PM UTC-5, Geo wrote: Hello, I am cross-posting my Clojure question from StackOverflow. I am trying to get an algorithm in Clojure to match Java speed and managed to get the performance to within one order of magnitude and wondering if more is possible. The full question is here: http://stackoverflow.com/questions/14949705/clojure-performance-for-expensive-algorithms Thank you. -- -- 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: nREPL + Emacs: How to get new definitions to load reliably?
I've added an experimental feature in tools.namespace 0.2.3-SNAPSHOT which tries to recover the namespace configuration in your REPL after an error during reload. What that hopefully means is you can call `refresh` as you normally would even after an error. I really appreciate you working on this feature! It does indeed resolve my difficulties and I'll be using it for all my projects (and recommending it to others) going forward. 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/groups/opt_out.
Re: functions as return values
I am afraid I didn't ask my question clearly. Michael's solution would give as output (fn [b] (+ (inc a) (* b b))) What I want as output is (fn [b] (+ 6 (* b b))) ... where those expressions within the inner-lambda scope (of the original nested-lambda expression) that can be evaluated by the binding of the outer-lambda parameter -- that is, the expressions a and (inc a) -- have been fixed with their values, but what is then output is the resulting Clojure function definition determined by the unevaluatable remainder of the inner-lambda scope. It occurs to me that whether what I am asking for is possible at all depends on how closures are realized within Clojure, but I think that there would be a way of realizing them in terms of source code rather than compiled code -- and that this source code wouldn't be compiled until values for their open variables become available. --Larry On 2/23/13 5:50 PM, Michael Klishin wrote: 2013/2/24 Larry Travis tra...@cs.wisc.edu mailto:tra...@cs.wisc.edu Is there some way that I can suppress the evaluation of this expression? ((fn [a] '(fn [b] (+ (inc a) (* b b 5) -- MK On 2/23/13 4:50 PM, Larry Travis wrote: In Clojure, if I have a function call that asks for return of a function, for example user ((fn [a] (fn [b] (+ (inc a) (* b b 5) I get the function name #user$eval4164$fn__4165$fn__4166 user$eval4164$fn__4165$fn__4166@29770daa But what I would like to get is an expression that defines this function, for example (fn [b] (+ 6 (* b b))) Is there some way that I can suppress the evaluation of this expression? --Larry -- -- 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: functions as return values
= ((fn [a] (backtick/template (fn [b] (+ ~(inc a) (* b b))) ) ) 5) (fn [b] (+ 6 (* b b))) https://github.com/brandonbloom/backtick = (eval ((fn [a] (backtick/template (fn [b] (+ ~(inc a) (* b b))) ) ) 5)) #funxions$eval3145$fn__3146 util.funxions$eval3145$fn__3146@4a7c5889 = ((eval ((fn [a] (backtick/template (fn [b] (+ ~(inc a) (* b b))) ) ) 5)) 2) 10 On Sunday, February 24, 2013 4:23:41 AM UTC+1, Larry Travis wrote: I am afraid I didn't ask my question clearly. Michael's solution would give as output (fn [b] (+ (inc a) (* b b))) What I want as output is (fn [b] (+ 6 (* b b))) ... where those expressions within the inner-lambda scope (of the original nested-lambda expression) that can be evaluated by the binding of the outer-lambda parameter -- that is, the expressions a and (inc a) -- have been fixed with their values, but what is then output is the resulting Clojure function definition determined by the unevaluatable remainder of the inner-lambda scope. It occurs to me that whether what I am asking for is possible at all depends on how closures are realized within Clojure, but I think that there would be a way of realizing them in terms of source code rather than compiled code -- and that this source code wouldn't be compiled until values for their open variables become available. --Larry On 2/23/13 5:50 PM, Michael Klishin wrote: 2013/2/24 Larry Travis tra...@cs.wisc.edu javascript: Is there some way that I can suppress the evaluation of this expression? ((fn [a] '(fn [b] (+ (inc a) (* b b 5) -- MK On 2/23/13 4:50 PM, Larry Travis wrote: In Clojure, if I have a function call that asks for return of a function, for example user ((fn [a] (fn [b] (+ (inc a) (* b b 5) I get the function name #user$eval4164$fn__4165$fn__4166 user$eval4164$fn__4165$fn__4166@29770daa But what I would like to get is an expression that defines this function, for example (fn [b] (+ 6 (* b b))) Is there some way that I can suppress the evaluation of this expression? --Larry -- -- 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.
suggest to have defn/new/throw/etc.. allow evaluating ...maybe?
= *(defn (symbol (str a b)) [x] x)* IllegalArgumentException First argument to defn must be a symbol clojure.core/defn (core.clj:277) maybe allow ~ like this: =* (defn ~(symbol (str a b)) [x] x)* IllegalArgumentException First argument to defn must be a symbol clojure.core/defn (core.clj:277) to act like this: = *(eval (backtick/template (defn ~(symbol (str a b)) [x] x)))* #'util.funxions/ab I know you'll want to suggest something like this instead: = *(defmacro dedefn [zsym] `(defn ~(eval zsym) [x#] x#))* #'util.funxions/dedefn = *(dedefn (symbol (str a b)))* #'util.funxions/ab which is almost good, except if you want to place extra checks on the input like so: = *(defmacro dedefn [zsym] (let [z (eval zsym) _ (assert (symbol? z)) ] `(defn ~z [x#] x#) ) )* #'util.funxions/dedefn = *(dedefn (symbol (str a b)))* #'util.funxions/ab = *(dedefn (str a b))* AssertionError Assert failed: (symbol? z) util.funxions/dedefn (NO_SOURCE_FILE:3) it works but you cannot test them since they happen at compile time, ie. = *(clojure.test/is (thrown? AssertionError (dedefn (str a b* CompilerException java.lang.AssertionError: Assert failed: (symbol? z), compiling:(NO_SOURCE_PATH:1:42) = *(clojure.test/is (thrown? AssertionError (throw (new AssertionError* #AssertionError java.lang.AssertionError = *(clojure.test/is (thrown? AssertionError 1))* FAIL in clojure.lang.PersistentList$EmptyList@1 (NO_SOURCE_FILE:1) expected: (thrown? AssertionError 1) actual: nil nil I guess there's no way to get rid of that eval that's happening there outside of the ` in the macro, and it kinda makes sense to be that way. I have a feeling there's a workaround to be able to catch the exception but I haven't explored it yet... Any thoughts? -- Please correct me if I'm wrong or incomplete, even if you think I'll subconsciously hate 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.
Re: creating code stubs to use inside an extend-protocol form
(defprotocol XmlNode (as-xml [this])) (defrecord User [^Integer id ^String name ^java.util.Date dob]) (def a '(as-xml [this] (str this))) (eval (backtick/template (extend-protocol XmlNode Integer ~a ))) I've no experience with these, so that's off the top of my head... backtick is https://github.com/brandonbloom/backtick or maybe like this: (defprotocol XmlNode (as-xml [this])) (defrecord User [^Integer id ^String name ^java.util.Date dob]) (def a '(as-xml [this] (str this))) (defmacro x [wha] `(extend-protocol XmlNode Integer ~(eval wha) ) ) (x a) On Saturday, February 23, 2013 1:03:02 PM UTC+1, Jim foo.bar wrote: I seem to be unable to quote a form and then repeatedly pass it inside the extend-protocol macro...something like this: (def ^:private co-stub '(run [this ^String text] (let [ann (edu.stanford.nlp.pipeline.Annotation. text)] (.annotate this ann) ann))) (extend-protocol IComponent edu.stanford.nlp.pipeline.POSTaggerAnnotator co-stub edu.stanford.nlp.pipeline.PTBTokenizerAnnotator co-stub edu.stanford.nlp.pipeline.WordsToSentencesAnnotator co-stub edu.stanford.nlp.pipeline.CleanXmlAnnotator co-stub edu.stanford.nlp.pipeline.MorphaAnnotator co-stub edu.stanford.nlp.pipeline.NERCombinerAnnotatorco-stub edu.stanford.nlp.pipeline.RegexNERAnnotator co-stub edu.stanford.nlp.pipeline.TrueCaseAnnotator co-stub edu.stanford.nlp.pipeline.ParserAnnotator co-stub edu.stanford.nlp.pipeline.DeterministicCorefAnnotator co-stub ) neither quoted version nor the back-quoted version work...The former throws : ClassCastException clojure.lang.PersistentList cannot be cast to java.lang.Class clojure.core/implements? (core_deftype.clj:512) seems to me that extend-protocol expects a class there or a list and the latter throws: ClassCastException clojure.lang.Cons cannot be cast to java.lang.Class clojure.core/implements? (core_deftype.clj:512) any macro-gurus around? Jim -- -- 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.