Re: Compojure does not augment response map

2016-02-24 Thread Torsten Uhlmann
Got it, makes sense. Thanks, Gary! -- 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

Re: Compojure does not augment response map

2016-02-24 Thread Gary Verhaegen
My understanding is that compojure concerns itself mostly with routing and does not try (anymore?) to handle response maps. Concerning ring.util.response, I think these functions are meant to be threaded: (-> (not-found "oh noes") (content-type "text")) On Wedn

Re: Compojure does not augment response map

2016-02-24 Thread Torsten Uhlmann
Thanks Gary! I haven't touched the middleware stack for a while, and I only found out about this thing when testing my routes for security. But, if response maps are supposed to be left alone, how is ring.util.response supposed to work, for instance the "not-found" function:

Re: Compojure does not augment response map

2016-02-24 Thread Gary Verhaegen
eriencing a strange behavior in my app. I'm not sure if that's > because of a version update or something I broke... > > The Compojure version used is 1.4.0 > > In the past a response like this would usually work: > > {:status 404 > :headers {} > :body "N

Compojure does not augment response map

2016-02-24 Thread Torsten Uhlmann
Hi, I'm experiencing a strange behavior in my app. I'm not sure if that's because of a version update or something I broke... The Compojure version used is 1.4.0 In the past a response like this would usually work: {:status 404 :headers {} :body "Not authorized&

Re: java.lang.IllegalArgumentException: Parameter declaration make-response should be a vector

2016-01-10 Thread James Elliott
Ah, but it actually does make sense now! > Exception in thread "main" java.lang.IllegalArgumentException: Parameter declaration make-response should be a vector, compiling:(server.clj:1:1) The compiler is complaining about finding "(make-response"… where it was

Re: java.lang.IllegalArgumentException: Parameter declaration make-response should be a vector

2016-01-10 Thread Laws
Ah, finally found it: (defn get-stop-response (make-response "No company specified" "Session ended" true)) I am surprised that the error was for "make-response" and not "get-stop-response". It is "get-stop-response" where I forgot the param

Re: java.lang.IllegalArgumentException: Parameter declaration make-response should be a vector

2016-01-10 Thread Laws
The implication, as I read it, is that there is some place where I do something like this: response-in-amazon-format (make-response company-name outputSpeech-text false)] In some other function, and the compiler feels that I am defining a new arity for that other function? But then I

Re: java.lang.IllegalArgumentException: Parameter declaration make-response should be a vector

2016-01-10 Thread Laws
; I have a file called server.clj which includes this at the top in its >> namespace declaration: >> >> (ns salesvoice.server >> (:require >> [salesvoice.query :as query] >> >> >> In query.clj, I have this: >> >> >> (defn make-re

Re: java.lang.IllegalArgumentException: Parameter declaration make-response should be a vector

2016-01-10 Thread Jony Hudson
> In query.clj, I have this: > > > (defn make-response > [company-name outputSpeech-text] > {"version" "1.0" >"sessionAttributes" { > "company-name" company-name >

Re: java.lang.IllegalArgumentException: Parameter declaration make-response should be a vector

2016-01-09 Thread James Elliott
lesvoice.server > (:require >[salesvoice.query :as query] > > > In query.clj, I have this: > > > (defn make-response > [company-name outputSpeech-text] > {"version" "1.0" >"sessionAttributes" { >

Re: java.lang.IllegalArgumentException: Parameter declaration make-response should be a vector

2016-01-09 Thread Laws
und, and re-typing > it, without seeing what the real error is. > > I have a file called server.clj which includes this at the top in its > namespace declaration: > > (ns salesvoice.server > (:require >[salesvoice.query :as query] > > > In query.clj, I have t

Re: java.lang.IllegalArgumentException: Parameter declaration make-response should be a vector

2016-01-09 Thread Laws
ch includes this at the top in its > namespace declaration: > > (ns salesvoice.server > (:require >[salesvoice.query :as query] > > > In query.clj, I have this: > > > (defn make-response > [company-name outputSpeech-text] > {"version&qu

java.lang.IllegalArgumentException: Parameter declaration make-response should be a vector

2016-01-09 Thread Laws
y.clj, I have this: (defn make-response [company-name outputSpeech-text] {"version" "1.0" "sessionAttributes" { "company-name" company-name "user-id" "user-id"

Unable to get a response from my server, after re-architecting to get away from global vars

2015-06-12 Thread Lawrence Krubner
te/resources "/") (route/not-found "Page not found. Check the http verb that you used (GET, POST, PUT, DELETE) and make sure you put a collection name in the URL, and possibly also a document ID. Also, all requests should go to an URL that starts with /v0.2")) ap

Re: How to add headers to a clojure.java.io/resource response

2015-05-27 Thread Jonathon McKitrick
quest) > (resp/header "Cache-Control" "no-cache, no-store")) > > You could also write it as: > > (-> (resp/resource-response "public/html/confirm.html) > (resp/content-type "text/html; charset=utf-8") > (resp/heade

Re: How to add headers to a clojure.java.io/resource response

2015-05-27 Thread James Reeves
Oh, my apologies. You also need to pass the request map to the render method. (-> (io/resource "public/html/confirm.html") (cr/render request) (resp/header "Cache-Control" "no-cache, no-store")) You could also write it as: (->

Re: How to add headers to a clojure.java.io/resource response

2015-05-27 Thread Jonathon McKitrick
es like URLs into Ring responses. So you could write: > > (-> (io/resource "public/html/confirm.html") > (compojure.response/render) > (response/header "X-Foo" "Bar")) > > Or you could use some middleware, if the header is standard ac

Re: How to add headers to a clojure.java.io/resource response

2015-05-26 Thread James Reeves
Compojure uses the compojure.response/render protocol method to turn values like URLs into Ring responses. So you could write: (-> (io/resource "public/html/confirm.html") (compojure.response/render) (response/header "X-Foo" "Bar")) Or you

How to add headers to a clojure.java.io/resource response

2015-05-26 Thread Jonathon McKitrick
on a Ring response. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from th

Re: How do I create streaming XML response?

2015-04-20 Thread Marc Schneider
Thank you for your answer, Nelson. I was near to your solution. Thank you for reminding me to flush the writer. Now I detected the real problem in my application: I did not use the jetty adapter but the http-kit <http://www.http-kit.org> server. http-kit buffers whole response bod

Re: How do I create streaming XML response?

2015-04-20 Thread Nelson Morris
. Additionally, we'll need to `flush` at the end in order to make sure this intermediate writer is not buffering any data before `piped-input-stream` closes the OutputStream. All together, a ring response could be generated like: ``` (response/response (ring-io/piped-input-stream #(-&

Re: How do I create streaming XML response?

2015-04-20 Thread Herwig Hochleitner
The way enlive does it, is to create a lazy sequence of strings. A response body such as that can be immediately be used by ring. However, I don't know from the top of my head how to generate it from data.xml.​ I'll be glad to get some input on that, otherwise I'll think about this

How do I create streaming XML response?

2015-04-20 Thread Marc Schneider
I am writing an application that reads some data from a database and need to transform that data to XML. That XML should be streamed as a response to a web request. The code for creating the XML elements is already working. I am using clojure.data.xml for that and it works very nice. My

Re: Measure HTTP response times

2014-05-06 Thread François Rey
You may want to check timbre and/or The Grinder , the latter being a full-featured java tool that supports scenario scripting in clojure . -- You received this message because you are subscribed to the Google Grou

Measure HTTP response times

2014-05-06 Thread emptya45
Hi, I am developing a primitive web load test tool using a HTTP client and STM. I wondered if there was a Clojure library I could use that would give me individual HTTP response times? Many Thanks Paul -- You received this message because you are subscribed to the Google Groups "Cl

Re: ANN: ring-http-response, ring-Swagger, ring-swagger-ui & compojure-api

2014-02-16 Thread Gary Trakhman
bunch of small > utilities for Ring-based web api development. Here they are: > > *1) ring-http-response *(https://github.com/metosin/ring-http-response) > > Real http status codes for Ring - ported from Spray[1]. There is a > response function for most of the http-statuses available (ok

ANN: ring-http-response, ring-Swagger, ring-swagger-ui & compojure-api

2014-02-16 Thread Tommi Reiman
Hi all. We here at Metosin have been developing and using a bunch of small utilities for Ring-based web api development. Here they are: *1) ring-http-response *(https://github.com/metosin/ring-http-response) Real http status codes for Ring - ported from Spray[1]. There is a response function

[ANN] Cartridge 1.0.0 -- HTTP response recording and playback for clj-http

2013-12-20 Thread David Leatherman
Hi all, I'm happy to announce the release of Cartridge, an HTTP request recording and playback library well suited for testing HTTP client calls when the server is unavailable. This project is in active use at Sonian and was built to help test clients of HTTP services when the server is unavailab

Re: Setting content type in a resouce response

2013-04-19 Thread Josh Kamau
ml without me explicitly setting it. > > Also, did you mean ring.util.response ( > http://ring-clojure.github.io/ring/ring.util.response.html) rather than > ring.util.resource (which doesn't exist as far as I know)? > > For a very vanilla example which explicitly sets Content-Type, ta

Re: Setting content type in a resouce response

2013-04-18 Thread David Della Costa
hich explicitly sets Content-Type, take a look at this. Let's say we had a plain file-response (note again that this is giving me text/html, but anyways...): (defn handler [request] (resource-response "index.html" {:root "public"})) If we wanted to explicitly set it as

Setting content type in a resouce response

2013-04-18 Thread Josh Kamau
Hi there ; Please help. How do i set the ContentType header in a (ring.util.resouce/resource-response ) ? I am serving html file and its being served as plain text. Josh -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to

Re: Long response time after a clojure process was inactive for some time

2012-12-15 Thread Stefan Ring
On Thursday, December 13, 2012 8:21:09 PM UTC+1, Trastabuga wrote: > > A while ago I created a small web site based on Clojure. I noticed that > when there was no requests to the site for some period of time (a few > hours) it may take up to 20-30 seconds to process an incoming request. > I am wo

Long response time after a clojure process was inactive for some time

2012-12-13 Thread Trastabuga
A while ago I created a small web site based on Clojure. I noticed that when there was no requests to the site for some period of time (a few hours) it may take up to 20-30 seconds to process an incoming request. I only thought that it has something to do with a particular web framework, but rec

[OT] Khan Academy's computer science platform and Bret Victor's response

2012-10-25 Thread Raju Bitter
Bret Victor has been mentioned before on this list, here's another interesting article he wrote: http://worrydream.com/LearnableProgramming/ > Here's a trick question: How do we get people to understand programming? > Khan Academy recently launched an online environment for learning to program. >

Re: Embed clojurescript literals in server response

2012-04-24 Thread Evan Mezeske
> > Basically, I want to see what's possible. If someone's done the research > on how to do it this way, I'd like to see it. There's a different trade-off > being made with each method. > If you're looking for an example, the clojurescript browser REPL dynamically compiles forms and sends them

Re: Embed clojurescript literals in server response

2012-04-24 Thread Brent Millare
> > > $(function() {my_cljs_ns.initialize('data');}); > > > Today I coded up a method. Currently I'm creating divs of a class that is invisible. Then I just use some node searcher to grab the content then call read-string on it. Seems easier to do then inserting the javascript function cal

Re: Embed clojurescript literals in server response

2012-04-24 Thread Evan Mezeske
> > I would like to evaluate other methods which may involve: > -parsing hidden strings in the html code > The way that I've been doing this, for better or worse, has been to insert a Javascript function call into the HTML output by my server, like: $(function() {my_cljs_ns.initialize('data'

Re: Embed clojurescript literals in server response

2012-04-24 Thread Brent Millare
fetch uses goog.net.XhrIo under the hood, which has the disadvantage of making an additional request. My question is regarding on the initial request which includes the javascript, how can I send clojurescript literals, or is the best way to just parse existing clojurescript text embedded as ma

Re: Embed clojurescript literals in server response

2012-04-23 Thread kovas boguta
If you are using clojure on the backend, I'd look into https://github.com/ibdknox/fetch , it really simplifies things. It is possible to send compiled clojurescript data, though its harder to get up and running with that, and if you are only sending data (as opposed to functions) , it might not be

Embed clojurescript literals in server response

2012-04-23 Thread Brent Millare
I have some dynamically generated data that needs to be sent to the clojurescript code running on the page. Now I know there already exists the URL which can have query data (accessed via (. js/window -location) but has the disadvantage of requiring to be read in by the reader), and goog.net.Xh

Re: noir response

2012-04-13 Thread Mark Rathwell
See [1] for this morning's response to a very similar question ;) There is also a group for Noir-specific questions at [2]. [1] https://groups.google.com/forum/#!msg/clj-noir/mT8L2hnMnNg/jRJ2UdOqKuQJ [2] https://groups.google.com/forum/#!forum/clj-noir On Fri, Apr 13, 2012 at 11:10 AM,

noir response

2012-04-13 Thread Rups
Hi... I am using a noir, I like to download a file on click event. I have a file object in binary formate. How i write code for response for download file in its original formate. -- You received this message because you are subscribed to the Google Groups "Cl

Re: noir response

2012-04-13 Thread Rups
pe f) data) )) On Fri, Apr 13, 2012 at 6:56 PM, Rups wrote: > Hi... > >I am using a noir, >I like to download a file on click event. >I have a file object in binary formate. > How i write code for response for download file in its original > fo

Response to Being a Coder and 10 000 hours.

2011-12-26 Thread algo-lord
Check out The Dunning Kruger Effect to really see people have incorrect opinions of themselves -- 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

Re: Response

2010-07-18 Thread Jeffrey Schwab
On 7/17/10 4:43 PM, Isaac Hodes wrote: Apologies in advance if this is somewhat OT in a Clojure group. double convolve(double *xs, double *is, double *ys){ int i,j; for(i=0; i How are you getting the size of the collections from the pointers, and why are you checking the lengths on ever

Re: Response

2010-07-18 Thread Michael Gardner
On Jul 17, 2010, at 9:46 PM, Isaac Hodes wrote: > I did check out your response: it's rather fast on my machine. it's > not really functional, though, as you use the `let` macro as a way of > procedurally executing a lot of functions. This isn't bad at all, but > you

Re: Response

2010-07-18 Thread Isaac Hodes
d go with C. But I'd like to do this in Clojure! @Carson: I did check out your response: it's rather fast on my machine. it's not really functional, though, as you use the `let` macro as a way of procedurally executing a lot of functions. This isn't bad at all, but you're

Re: Response

2010-07-17 Thread Carson
Hi Per, woh, take it easy. I don't claim to be an expert. Thanks for showing me that though. It certainly didn't seem right at first, but I had trouble figuring out the laziness in clojure, me being new to it. Anyway, have a good weekend! Carson On Jul 17, 10:02 pm, Per Vognsen wrote: > How a

Re: Response

2010-07-17 Thread Per Vognsen
On Sun, Jul 18, 2010 at 11:32 AM, Carson wrote: > I guess different people see things differently.  I actually didn't > understand the intent of the imperative version, even though it takes > less lines I guess.  There's quite a few things called convolution. > My naive implementation was function

Re: Response

2010-07-17 Thread Carson
Thanks David. On Jul 17, 4:58 pm, David Nolen wrote: > I tried this, it runs in about the same amount of time as it did for you. > > On Sat, Jul 17, 2010 at 7:17 PM, Carson wrote: > > Hi David, > > Would appreciate if you could try out my attempt at this [1] on your > > machine.  My machine ain'

Re: Response

2010-07-17 Thread Carson
I guess different people see things differently. I actually didn't understand the intent of the imperative version, even though it takes less lines I guess. There's quite a few things called convolution. My naive implementation was functional and pretty fast. Turns out it can be even faster with

Re: Response

2010-07-17 Thread Frederick Polgardy
I think it really doesn't get any clearer than this in terms of intent. While I was adept at calculus-level math 20 years ago, I've forgotten the little I knew of matrices. This is the first algorithm that has communicated by visual inspection (to me) exactly what a convolution is. -Fred -- Sc

Re: Response

2010-07-17 Thread Carson
Have you taken a look at my attempt at a solution (on the other/ original thread)? https://groups.google.com/group/clojure/tree/browse_frm/thread/ee4169bc292ab572/6d03461efde166ad?rnum=11&_done=%2Fgroup%2Fclojure%2Fbrowse_frm%2Fthread%2Fee4169bc292ab572%3F#doc_6d03461efde166ad I don't know if it

Re: Response

2010-07-17 Thread Frederick Polgardy
This example is beside the point of the original question. It uses mutable arrays. It's very much dropping to the Java level. Am I missing something? -Fred -- Science answers questions; philosophy questions answers. On Jul 17, 2010, at 6:04 PM, David Nolen wrote: > (defn ^{:static true} convol

Re: Response

2010-07-17 Thread j-g-faustus
On 17 Jul, 22:43, Isaac Hodes wrote: > It's just a shame, it seems to me, that there is such a nice way to > represent the procedure in Python or even C, yet Clojure (or any Lisp > really) struggles to idiomatically answer this question of > convolution. I'll have to disagree with the conclusion.

Re: Response

2010-07-17 Thread David Nolen
I tried this, it runs in about the same amount of time as it did for you. On Sat, Jul 17, 2010 at 7:17 PM, Carson wrote: > Hi David, > Would appreciate if you could try out my attempt at this [1] on your > machine. My machine ain't as fast as yours apparently... > > [1] > > https://groups.googl

Re: Response

2010-07-17 Thread Carson
Hi David, Would appreciate if you could try out my attempt at this [1] on your machine. My machine ain't as fast as yours apparently... [1] https://groups.google.com/group/clojure/tree/browse_frm/thread/ee4169bc292ab572/6d03461efde166ad?rnum=11&_done=%2Fgroup%2Fclojure%2Fbrowse_frm%2Fthread%2Fee4

Re: Response

2010-07-17 Thread Michael Gardner
On Jul 17, 2010, at 3:43 PM, Isaac Hodes wrote: > It's just a shame, it seems to me, that there is such a nice way to > represent the procedure in Python or even C, yet Clojure (or any Lisp > really) struggles to idiomatically answer this question of > convolution. No, it's pretty easy to do conv

Re: Response

2010-07-17 Thread David Nolen
(defn ^{:static true} convolve ^doubles [^doubles xs ^doubles is] (let [xlen (count xs) ilen (count is) ys (double-array (dec (+ xlen ilen)))] (dotimes [p xlen] (dotimes [q ilen] (let [n (+ p q), x (aget xs p), i (aget is q), y (aget ys n)] (aset ys n

Response

2010-07-17 Thread Isaac Hodes
Thanks everyone for the input! I've also got some nice replies on Stack Overflow – there's some sort of a discussion there as well. I thought I'd add my voice to the crowd. First off, purely imperative C is fairly elegant itself. I've made it a simple function (along with the Python version on the