Re: what do you think about this code?

2014-12-08 Thread Philip Schwarz
and solve iteratively. That's not to say I and others don't use TDD in Clojure dev, but just that it's also quite common to do a lot of this kind of development in the repl. - you're grouping your side-effecting code w/the code that generates the diamond data structure here: https

Re: what do you think about this code?

2014-12-08 Thread Philip Schwarz
not to say I and others don't use TDD in Clojure dev, but just that it's also quite common to do a lot of this kind of development in the repl. - you're grouping your side-effecting code w/the code that generates the diamond data structure here: https://gist.github.com/ddellacosta

Re: what do you think about this code?

2014-12-08 Thread Philip Schwarz
-driven process may be more common for working through a problem like this--i.e. something you can wrap your head around as a whole and solve iteratively. That's not to say I and others don't use TDD in Clojure dev, but just that it's also quite common to do a lot of this kind

Re: what do you think about this code?

2014-12-08 Thread Leif
please review my first solution to the diamond kata [1] and tear it to bits: let me know all the ways in which YOU would improve the code. I am not so interested in a better algorithm for solving the kata. I am learning Clojure and what I want to know is what YOU would do to make the code more

Re: what do you think about this code?

2014-12-07 Thread Philip Schwarz
a repl-driven process may be more common for working through a problem like this--i.e. something you can wrap your head around as a whole and solve iteratively. That's not to say I and others don't use TDD in Clojure dev, but just that it's also quite common to do a lot of this kind

Re: what do you think about this code?

2014-12-07 Thread Philip Schwarz
please review my first solution to the diamond kata [1] and tear it to bits: let me know all the ways in which YOU would improve the code. I am not so interested in a better algorithm for solving the kata. I am learning Clojure and what I want to know is what YOU would do to make the code more

what do you think about this code?

2014-12-06 Thread Philip Schwarz
Hello, can you please review my first solution to the diamond kata [1] and tear it to bits: let me know all the ways in which YOU would improve the code. I am not so interested in a better algorithm for solving the kata. I am learning Clojure and what I want to know is what YOU would do

Re: what do you think about this code?

2014-12-06 Thread David Della Costa
you linked to), but I think a repl-driven process may be more common for working through a problem like this--i.e. something you can wrap your head around as a whole and solve iteratively. That's not to say I and others don't use TDD in Clojure dev, but just that it's also quite common to do a lot

Re: what do you think about this code?

2014-12-06 Thread Colin Yates
in a better algorithm for solving the kata. I am learning Clojure and what I want to know is what YOU would do to make the code more readable/understandable/maintainable, or just to make it follow Clojure idioms and/or conventions that YOU find effective, or to follow a coding style that YOU find

Re: what do you think about this code?

2014-12-06 Thread David Della Costa
. That's not to say I and others don't use TDD in Clojure dev, but just that it's also quite common to do a lot of this kind of development in the repl. - you're grouping your side-effecting code w/the code that generates the diamond data structure here: https://gist.github.com/ddellacosta

Re: more colloquial do x n times

2014-12-04 Thread Chris Freeman
of tweets, organized by hashtag, in a CouchDB db. I'm doing some initial explorations of my data, and was curious about which hashtags show up together in tweets. I want to do a NSA-style hops kind of algorithm--get all the hashtags that show up in the same tweets as hashtags that show up

more colloquial do x n times

2014-12-03 Thread Sam Raker
I've got a decent-sized corpus of tweets, organized by hashtag, in a CouchDB db. I'm doing some initial explorations of my data, and was curious about which hashtags show up together in tweets. I want to do a NSA-style hops kind of algorithm--get all the hashtags that show up in the same

Re: more colloquial do x n times

2014-12-03 Thread Sam Raker
EDIT On Wednesday, December 3, 2014 10:45:33 PM UTC-5, Sam Raker wrote: I've got a decent-sized corpus of tweets, organized by hashtag, in a CouchDB db. I'm doing some initial explorations of my data, and was curious about which hashtags show up together in tweets. I want to do a NSA-style

Re: How do you refer to a previous value of a var, within a loop/recur?

2014-11-24 Thread Plínio Balduino
Hi Dan Please accept my two cents. I prefer the indentation; it makes more sense to me. No, he didn't misunderstand, sorry. Anyway, Batsov's Style Guide is an awesome resource, even though you won't follow the items ipsis literis, is good to understand how to work and think in the 'Clojure

Re: How do you refer to a previous value of a var, within a loop/recur?

2014-11-24 Thread Dan Campbell
Thanks for the input, Plinio. If the community jumps to the conclusion that I'm arrogant, because I like to work in style that's clear works for me, then I won't be surprised if they don't offer assistance in the future. From my point of view, as long as they receive my contributions or

Re: How do you refer to a previous value of a var, within a loop/recur?

2014-11-24 Thread Gary Verhaegen
Yeah, I think the I'll transliterate everything before anyone else sees it part of your message was maybe not clear enough. Of course we don't care what you do when you're working alone and just for yourself. On Monday, 24 November 2014, Dan Campbell dcwhat...@gmail.com wrote: Thanks

Re: How do you refer to a previous value of a var, within a loop/recur?

2014-11-24 Thread Dan Campbell
. Of course we don't care what you do when you're working alone and just for yourself. On Monday, 24 November 2014, Dan Campbell dcwhat...@gmail.com wrote: Thanks for the input, Plinio. If the community jumps to the conclusion that I'm arrogant, because I like to work in style that's clear

How do you refer to a previous value of a var, within a loop/recur?

2014-11-23 Thread Dan Campbell
Hi, I have to loop through a string, consecutively replacing substrings with single characters, one substring at a time. Each time through the loop, I need to use a cond to check that the length of the last replaced string, is shorter than the length of the previous replaced string. So, as

Re: How do you refer to a previous value of a var, within a loop/recur?

2014-11-23 Thread James Reeves
Well, first of all, it would *really* help if you formatted your code, because currently your code is almost impossible to read. Let's format it first: (defn simplify-string [original substring replacement] (let [simplified (str/replace original substring replacement)]

Re: How do you refer to a previous value of a var, within a loop/recur?

2014-11-23 Thread Dan Campbell
Yep, sure enough, works like a gem, thanks. I had originally tried reduce, but wasn't able to get it to work, in this context. reduce-kv would have saved a lot of time, on previous code. Sorry about the formatting, James. I structure my code differently than the standard Clojure format,

Re: How do you refer to a previous value of a var, within a loop/recur?

2014-11-23 Thread James Reeves
I'd strongly suggest following standard Clojure formatting, otherwise you're going to run into problems. If you use your own custom formatting that only you can read easily, then people are going to find it very difficult to help or collaborate with you. Deliberately putting up barriers to

Re: How do you refer to a previous value of a var, within a loop/recur?

2014-11-23 Thread Sean Corfield
Dan, I’m with James here. Your code as presented is really hard to read for folks used to the standard Clojure style - the strange layout of parentheses is very distracting. The use of underscore instead of hyphen is also a bit jarring. I’m guessing your background is C/C++/Java and you think

Re: How do you refer to a previous value of a var, within a loop/recur?

2014-11-23 Thread Dan Campbell
, doesn't reflect my intended indentation style for lisp code. It looks like some reformatting took place. As I agreed with James, if asking for assistance, I'll reformat the code first, to match the standard Clojure style. Similarly, if I'm able to help someone else, I'll do so, in a style

Re: How do you refer to a previous value of a var, within a loop/recur?

2014-11-23 Thread Sean Corfield
On Nov 23, 2014, at 2:41 PM, Dan Campbell dcwhat...@gmail.com wrote: Sorry man, but I'm not willing to change my personal coding style. It's not a matter of getting used to Clojure. I'm not an expert on it yet, but I've been studying and working with it, for a little over a year. I prefer

Re: How do you refer to a previous value of a var, within a loop/recur?

2014-11-23 Thread Dan Campbell
As long as you’re prepared to be told this every time you show your code to people, that’s up to you. I think you misunderstood the response. On Sun, Nov 23, 2014 at 5:49 PM, Sean Corfield s...@corfield.org wrote: On Nov 23, 2014, at 2:41 PM, Dan Campbell dcwhat...@gmail.com wrote: Sorry

Re: If code is data why do we use text editors?

2014-11-18 Thread Phillip Lord
that structure all of the time. With Clojure: (println hello of course, does not obey the structural requirements of the clojure language. So, then, how do I type this? Which I might want to, until I have finished. The question is not about structured/unstructured representation. My text editor

Re: If code is data why do we use text editors?

2014-11-17 Thread Thomas Huber
are not code. They are source and include many things a lot of which do not obey the syntactic rules of the language. Comments and indentation are the most obvious ones. Second, reason is that not only do you need a special tool for editing, you need a special tool for diffing as well

Re: If code is data why do we use text editors?

2014-11-17 Thread Thomas Huber
programs using a bare text editor. Maybe this idea is not new? What do you think? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.com javascript: Note that posts from new members are moderated

Re: If code is data why do we use text editors?

2014-11-17 Thread janpaulbultmann
simply program using any text editor. You need a special tool. But we have that anyway (syntax highlighting, paredit etc.). Nobody programs using a bare text editor. Maybe this idea is not new? What do you think? -- You received this message because you are subscribed to the Google

Re: If code is data why do we use text editors?

2014-11-17 Thread Fluid Dynamics
that no autoindent/pprinter could do a fully general good job. -- 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

Re: If code is data why do we use text editors?

2014-11-17 Thread Raoul Duke
Code is data, and sometimes the best way to format that data for human readability is sufficiently ad-hoc that no autoindent/pprinter could do a fully general good job. +1 there should therefore be a region annotation that tells IDEs to leave it the hell alone when the user invokes reindent

Re: If code is data why do we use text editors?

2014-11-17 Thread janpaulbultmann
in the source, see gorilla-repl or mathematica notebooks. Code is data, and sometimes the best way to format that data for human readability is sufficiently ad-hoc that no autoindent/pprinter could do a fully general good job. These ad-hoc things might make the code astheatically pleasing, but hard

Re: If code is data why do we use text editors?

2014-11-17 Thread Colin Fleming
for it to Cursive, though. On 18 November 2014 12:02, Raoul Duke rao...@gmail.com wrote: Code is data, and sometimes the best way to format that data for human readability is sufficiently ad-hoc that no autoindent/pprinter could do a fully general good job. +1 there should therefore

Re: If code is data why do we use text editors?

2014-11-16 Thread Angel Java Lopez
Loosely related, but interesting http://blog.interfacevision.com/design/design-visual-progarmming-languages-snapshots/ Angel Java Lopez @ajlopez On Sun, Nov 16, 2014 at 4:11 AM, Colin Fleming colin.mailingl...@gmail.com wrote: Hi Mike, Actually, I haven't - I probably should spend more

Re: If code is data why do we use text editors?

2014-11-15 Thread Johannes
Perhaps a look at subtext (http://www.subtext-lang.org/demo1.html) could be interesting. Johannes -- 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

Re: If code is data why do we use text editors?

2014-11-15 Thread Mike Haney
Colin - I'm just curious if you have any experience with Jetbrains MPS? I was into it pretty heavily before I got into Clojure, and I've thought a lot about how to add support for Clojure to it (would be pretty straightforward, actually), but haven't had the time to pursue it or the conviction

Re: If code is data why do we use text editors?

2014-11-15 Thread Colin Fleming
Hi Mike, Actually, I haven't - I probably should spend more time investigating it, there are bound to be some interesting ideas. If you have thoughts about aspects of it that might be useful, I'd be very interested in hearing about them either on or off list (co...@colinfleming.net). On 16

If code is data why do we use text editors?

2014-11-14 Thread Thomas Huber
any text editor. You need a special tool. But we have that anyway (syntax highlighting, paredit etc.). Nobody programs using a bare text editor. Maybe this idea is not new? What do you think? -- You received this message because you are subscribed to the Google Groups Clojure group. To post

Re: If code is data why do we use text editors?

2014-11-14 Thread Simon Brooke
that anyway (syntax highlighting, paredit etc.). Nobody programs using a bare text editor. Maybe this idea is not new? What do you think? -- 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

Re: If code is data why do we use text editors?

2014-11-14 Thread Erlis Vidal
This is an interesting topic, and I think this applies to most of the programming languages not just Clojure. I'm still waiting the day where we finally abandon the idea that the file is the minimal point of change, by this I mean that today we do changes on files when actually what we

Re: If code is data why do we use text editors?

2014-11-14 Thread atucker
a special tool. But we have that anyway (syntax highlighting, paredit etc.). Nobody programs using a bare text editor. Maybe this idea is not new? What do you think? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send

Re: If code is data why do we use text editors?

2014-11-14 Thread Christopher Small
programs using a bare text editor. Maybe this idea is not new? What do you think? -- 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

Re: If code is data why do we use text editors?

2014-11-14 Thread Jan-Paul Bultmann
. The drawback is you can’t simply program using any text editor. You need a special tool. But we have that anyway (syntax highlighting, paredit etc.). Nobody programs using a bare text editor. Maybe this idea is not new? What do you think? -- You received this message because you are subscribed

Re: If code is data why do we use text editors?

2014-11-14 Thread Phillip Lord
I can think of several reasons. First and most important, code is data, but source files are not code. They are source and include many things a lot of which do not obey the syntactic rules of the language. Comments and indentation are the most obvious ones. Second, reason is that not only do

Re: If code is data why do we use text editors?

2014-11-14 Thread Max Kreminski
think of several reasons. First and most important, code is data, but source files are not code. They are source and include many things a lot of which do not obey the syntactic rules of the language. Comments and indentation are the most obvious ones. Second, reason is that not only do

Re: If code is data why do we use text editors?

2014-11-14 Thread Raoul Duke
http://en.wikipedia.org/wiki/Intentional_programming -- 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.

Re: If code is data why do we use text editors?

2014-11-14 Thread Daniel Orias
suppose, in that case, one could link the functions to be used to the data that is in its domain. There's a variation on type safety. Some people do program with a bare text editor. For what one gives up, a bare text editor does encourages keeping the program small enough to fit

Re: If code is data why do we use text editors?

2014-11-14 Thread Colin Fleming
and functions. I suppose, in that case, one could link the functions to be used to the data that is in its domain. There's a variation on type safety. Some people do program with a bare text editor. For what one gives up, a bare text editor does encourages keeping the program small enough to fit

where do I think the wrong way

2014-10-29 Thread Roelof Wobben
Hello, For a exercise I have to add something to the end of a existing map. So I thought this would work : (defn add-author [book new-author] (assoc book (conj :authors new-author))) and call the function with : (add-author little-schemer {:name Gerald J. Sussman}) then I see this

Re: where do I think the wrong way

2014-10-29 Thread Di Xu
maybe you should do this: (defn add-author [book new-author] (update-in book [:authors] conj new-author) Thanks, Di Xu 2014-10-29 19:01 GMT+08:00 Roelof Wobben rwob...@hotmail.com: Hello, For a exercise I have to add something to the end of a existing map. So I thought this would work

Re: where do I think the wrong way

2014-10-29 Thread James Reeves
On 29 October 2014 11:01, Roelof Wobben rwob...@hotmail.com wrote: For a exercise I have to add something to the end of a existing map. So I thought this would work : (defn add-author [book new-author] (assoc book (conj :authors new-author))) Take a look at that conj expression on its

Re: where do I think the wrong way

2014-10-29 Thread Roelof Wobben
Thanks James, But how do I use assoc with it I tried this : (defn add-author [book new-author] (assoc book (conj (book :authors) new-author))) but then I see this message : ArityException Wrong number of args (2) passed to: core$assoc clojure.lang.AFn.throwArity (AFn.java:437

Re: where do I think the wrong way

2014-10-29 Thread Sven Richter
to have IDEs with an instant inline REPL for different languages too while learning these. However, what I usually did (and still sometimes do) is fire up Lighttable, open a barebone namespace, insert this function: (defn add-author [book new-author] (assoc book (conj :authors new-author

Re: where do I think the wrong way

2014-10-29 Thread Luc Prefontaine
You need to provide a key and a value. (assoc book :authors (conj ... LP Thanks James, But how do I use assoc with it I tried this : (defn add-author [book new-author] (assoc book (conj (book :authors) new-author))) but then I see this message : ArityException Wrong

Re: where do I think the wrong way

2014-10-29 Thread James Reeves
On 29 October 2014 11:20, Roelof Wobben rwob...@hotmail.com wrote: Thanks James, But how do I use assoc with it I tried this : (defn add-author [book new-author] (assoc book (conj (book :authors) new-author))) but then I see this message : ArityException Wrong number of args (2

Re: where do I think the wrong way

2014-10-29 Thread François Rey
d to a new author, you need to do: (assoc book :authors (conj (get book :authors) new-author)) Which can also be made more idiomatic as already mentioned: (update-in book [:authors] assoc new-author) The twisted way of doing it would be: (conj book [:authors (conj (:au

Re: where do I think the wrong way

2014-10-29 Thread François Rey
onvenience, not idiomatic. In the end add to a new author, you need to do: (assoc book :authors (conj (get book :authors) new-author)) Which can also be made more idiomatic as already mentioned: (update-in book [:authors] assoc new-author) The twisted way of doing it would be:

Re: where do I think the wrong way

2014-10-29 Thread François Rey
onvenience, not idiomatic. In the end add to a new author, you need to do: (assoc book :authors (conj (get book :authors) new-author)) Which can also be made more idiomatic as already mentioned: (update-in book [:authors] assoc new-author) The twisted way of doing it would be:

Re: where do I think the wrong way

2014-10-29 Thread Roelof Wobben
such as vectors. That being said, you can still use assoc on vectors (indices are the keys) and use conj on maps (with a vector in the form of [key value]), but that's polymorphism convenience, not idiomatic. In the end add to a new author, you need to do: (assoc book :authors (conj (get

Re: where do I think the wrong way

2014-10-29 Thread Benjamin VanRyseghem
, But how do I use assoc with it I tried this : (defn add-author [book new-author] (assoc book (conj (book :authors) new-author))) but then I see this message : ArityException Wrong number of args (2) passed to: core$assoc clojure.lang.AFn.throwArity (AFn.java:437) Roelof Op woensdag

Re: where do I think the wrong way

2014-10-29 Thread Henrik Lundahl
think that update-in, as Di Xu suggested is simpler, though. You can use the doc function to get documentation, e.g. (doc assoc) -- Henrik On Wed, Oct 29, 2014 at 12:20 PM, Roelof Wobben rwob...@hotmail.com wrote: Thanks James, But how do I use assoc with it I tried this : (defn add

Re: Do this or that

2014-10-11 Thread Mike Fikes
Thanks all! FWIW, the snake game in Programming Clojure has an example (where refs are conditionally updated) which is consistent with the advice given here. Two nice things I noticed in that example: 1. The first form inside do is kept on the same line (a small but nice improvement reducing

Do this or that

2014-10-06 Thread Mike Fikes
Here's a style question: If you have to conditionally do one set of side effects or another set, is your preference to use when and when-not, or an if containing do blocks? Or perhaps some other construct? In terms of a concrete example: (let [boolean-value (some-predicate?)] (when boolean

Re: Do this or that

2014-10-06 Thread James Reeves
The latter is what I'd consider to be the correct approach. If the do blocks become unwieldy, you can factor them out into functions. - James On 7 October 2014 02:16, Mike Fikes mikefike...@gmail.com wrote: Here's a style question: If you have to conditionally do one set of side effects

Re: Do this or that

2014-10-06 Thread adrian . medina
to be the correct approach. If the do blocks become unwieldy, you can factor them out into functions. - James On 7 October 2014 02:16, Mike Fikes mikef...@gmail.com javascript: wrote: Here's a style question: If you have to conditionally do one set of side effects or another set, is your

Re: Do this or that

2014-10-06 Thread Colin Fleming
I agree - I always use the second form. Generally I find that I often need a let-block for each branch of the if, so I nearly always avoid the need for an explicit 'do'. On 7 October 2014 14:54, adrian.med...@mail.yu.edu wrote: I agree with James. The first can be tempting when you're doing

Re: How do I track down a painfully long pause in a small web app?

2014-09-24 Thread dennis zhuang
Lamina Dire When someone complains about the pauses, I will go test the service, and I can hit with 40 requests in 10 seconds and it has great performance. The pauses actually seem to come after periods of inactivity, which made me think that this had something to do with garbage collection

Re: How do I track down a painfully long pause in a small web app?

2014-09-23 Thread larry google groups
with 40 requests in 10 seconds and it has great performance. The pauses actually seem to come after periods of inactivity, which made me think that this had something to do with garbage collection, except that the pauses are so extreme -- like I said, sometimes as much as 30 seconds

Re: How do I track down a painfully long pause in a small web app?

2014-09-23 Thread larry google groups
that this had something to do with garbage collection, except that the pauses are so extreme -- like I said, sometimes as much as 30 seconds, causing requests to timeout. When the app does finally start to respond it again, it goes very fast, and responds to those pending request very fast

Re: Anyone willing to do a tutorial on minecraft modding in clojure?

2014-09-19 Thread Michael Swierczek
On Thursday, September 18, 2014 4:31:05 PM UTC-4, Jeb wrote: Is Bukkit an option? I've used https://github.com/CmdrDats/clj-minecraft. Active project, fun and easy to use. On Thu, Sep 18, 2014 at 4:30 AM, Hi-tech Robert hitech...@gmail.com javascript: wrote: Hi, I am looking for tutorial

Anyone willing to do a tutorial on minecraft modding in clojure?

2014-09-18 Thread Hi-tech Robert
Hi, I am looking for tutorial on modding minecraft 1.7.4 in clojure. There are plenty of tutorial that use java e.g. http://www.youtube.com/watch?v=e6v5egIkThk but I want to use clojure instead as Java is too verbose. The closest i managed to find is this

Re: Anyone willing to do a tutorial on minecraft modding in clojure?

2014-09-18 Thread Jeb Beich
Is Bukkit an option? I've used https://github.com/CmdrDats/clj-minecraft. Active project, fun and easy to use. On Thu, Sep 18, 2014 at 4:30 AM, Hi-tech Robert hitechrob...@gmail.com wrote: Hi, I am looking for tutorial on modding minecraft 1.7.4 in clojure. There are plenty of tutorial that

Re: How do I track down a painfully long pause in a small web app?

2014-09-15 Thread Linus Ericsson
If you turn on verbose gc for the JVM you could at least rule out GC pauses. Hmm, exactly how do you route the requests through the apache server? It almost sounds like your applikation is restarted every now and then, iirc Apache only servers a limited amount of requests per server thread

Re: How do I track down a painfully long pause in a small web app?

2014-09-15 Thread François Rey
GC would be the first suspect, but then it could also be combined with a swap issue, or a JVM bug. Have a look at this article, which ends with a concrete list of things to do: https://blogs.oracle.com/poonam/entry/troubleshooting_long_gc_pauses -- You received this message because you

Re: How do I track down a painfully long pause in a small web app?

2014-09-15 Thread David Powell
with a swap issue, or a JVM bug. Have a look at this article, which ends with a concrete list of things to do: https://blogs.oracle.com/poonam/entry/troubleshooting_long_gc_pauses -- You received this message because you are subscribed to the Google Groups Clojure group. To post

Re: How do I track down a painfully long pause in a small web app?

2014-09-15 Thread larry google groups
1. Which API calls pause? If only certain calls pause, then probably you have something specific to suspect. Try adding a dummy REST call - see if that call pauses while others do. I will add a dummy REST call, although this pause does not seem specific to a particular API call. 2

Re: How do I track down a painfully long pause in a small web app?

2014-09-15 Thread larry google groups
Hmm, exactly how do you route the requests through the apache server? It almost sounds like your applikation is restarted every now and then, iirc Apache only servers a limited amount of requests per server thread. Interesting if true, but I assume there would be an error if 2 instances

Re: How do I track down a painfully long pause in a small web app?

2014-09-15 Thread larry google groups
rule out GC pauses. Hmm, exactly how do you route the requests through the apache server? It almost sounds like your applikation is restarted every now and then, iirc Apache only servers a limited amount of requests per server thread. If this somehow started a new JVM per apache thread things

Re: How do I track down a painfully long pause in a small web app?

2014-09-15 Thread larry google groups
. On Mon, Sep 15, 2014 at 7:55 AM, François Rey fmj...@gmail.com javascript: wrote: GC would be the first suspect, but then it could also be combined with a swap issue, or a JVM bug. Have a look at this article, which ends with a concrete list of things to do: https://blogs.oracle.com/poonam

Re: How do I track down a painfully long pause in a small web app?

2014-09-15 Thread Nando Breiter
cell skype: ariamedia On Mon, Sep 15, 2014 at 4:04 PM, larry google groups lawrencecloj...@gmail.com wrote: 1. Which API calls pause? If only certain calls pause, then probably you have something specific to suspect. Try adding a dummy REST call - see if that call pauses while others do

How do I track down a painfully long pause in a small web app?

2014-09-14 Thread larry google groups
Liberator Monger Timbre Lamina Dire When someone complains about the pauses, I will go test the service, and I can hit with 40 requests in 10 seconds and it has great performance. The pauses actually seem to come after periods of inactivity, which made me think that this had something to do

Re: How do I track down a painfully long pause in a small web app?

2014-09-14 Thread Shantanu Kumar
Few thing to consider: 1. Which API calls pause? If only certain calls pause, then probably you have something specific to suspect. Try adding a dummy REST call - see if that call pauses while others do. 2. Is any of your services running on a t1.micro or a burst-oriented EC2 instance on AWS

Re: how do you name your protocols?

2014-09-06 Thread Bobby Eickhoff
What might be an advantage to using something like the I-prefix? At first glance, this appears to be unbeneficial hungarian notation. Aesthetically, this seems backwards (to me). I want interfaces and protocols to have the most readable names. I'm willing to concede on less readable names

Re: how do you name your protocols?

2014-09-06 Thread Jozef Wagner
Clojure API exposes types to the user (Agent, Ref, Var, ...), so it is benefical to see on the first glance whether the name is of a type or interface/protocol. If the API would be built solely on the protocols/interfaces, those prefixes would be of less use. Moreover, I think that names of types

how do you name your protocols?

2014-09-05 Thread Dave Sann
I saw a comment on protocol naming here: https://groups.google.com/d/msg/clojure/A4xIitQWloU/6E4xHDTPPaIJ there is nothing in the coding standards: http://dev.clojure.org/display/community/Library+Coding+Standards (are these maintained?) is there any sensible consensus on good naming

Re: how do you name your protocols?

2014-09-05 Thread Jozef Wagner
I use IBlah (camel cased, prefixed with capital i) in both Clojure and ClojureScript. It looks better than PBlah and is consistent with how ClojureScript names its protocols. Jozef On Fri, Sep 5, 2014 at 11:52 AM, Dave Sann daves...@gmail.com wrote: I saw a comment on protocol naming here:

Re: how do you name your protocols?

2014-09-05 Thread john walker
As you demonstrated, P, I or nothing is up to taste. The only consensus I know of is camel case. https://github.com/bbatsov/clojure-style-guide#CamelCase-for-protocols-records-structs-and-types On Friday, September 5, 2014 2:52:48 AM UTC-7, Dave Sann wrote: I saw a comment on protocol naming

Re: How do you typecast and insert a Postgres enum value using Clojure JDBC?

2014-08-18 Thread Ryan Neufeld
is an enum so you can't insert it as a normal string without casting it to an enum: 'InStock'::product_status I know you can do it with a prepared statement, such as: INSERT INTO product (name, status) VALUES (?, ?::product_status) But is there a way to do it without using a prepared statement

Re: how do I clojure.string/replace regex characters? Escaping gives me StringIndexOutOfBoundsException

2014-08-05 Thread Vincent H
On Tuesday, August 5, 2014 7:49:21 AM UTC+2, larry google groups wrote: I'm working on a website with a frontender who asked to be able to save JSON maps that contain field names such as: $$hashKey : 00C The dollar signs are a violation of MongoDB limits on field names, so i need to

Re: how do I clojure.string/replace regex characters? Escaping gives me StringIndexOutOfBoundsException

2014-08-05 Thread Andy Fingerhut
Or even more simply, since the thing you want to replace is a single character, you do not need a regex to match it, but can match a string that is not a regex at all, e.g.: (st/replace **username * $) The doc string for clojure.string/replace is fairly explicit on this. Andy On Mon, Aug 4

Re: how do I clojure.string/replace regex characters? Escaping gives me StringIndexOutOfBoundsException

2014-08-05 Thread Daniel Compton
: Or even more simply, since the thing you want to replace is a single character, you do not need a regex to match it, but can match a string that is not a regex at all, e.g.: (st/replace **username * $) The doc string for clojure.string/replace is fairly explicit on this. Andy On Mon

how do I clojure.string/replace regex characters? Escaping gives me StringIndexOutOfBoundsException

2014-08-04 Thread larry google groups
I'm working on a website with a frontender who asked to be able to save JSON maps that contain field names such as: $$hashKey : 00C The dollar signs are a violation of MongoDB limits on field names, so i need to convert to something else and then convert back. So I thought I would convert to

Re: What does :resource-paths in leiningen do?

2014-07-05 Thread Chris Kuttruff
So if you have an arbitrary number of files in said resources directory, is there a good way to find all files underneath a certain resource path? if I have resources/foo.txt and resources/bar.txt, what function would I use to exact both names of the txt files I have? Thanks in advance, -Chris

Re: Clojure: Clojure.contrib.sql: How do I update ALL the rows of a database table?

2014-06-26 Thread Sean Corfield
be found here: http://clojure.github.io/java.jdbc/ Sean On Jun 25, 2014, at 7:40 AM, June liangfangfan...@gmail.com wrote: clojuredocs.org/clojure_contrib/clojure.contrib.sql/… How do I set the where clause to 1=1? signature.asc Description: Message signed with OpenPGP using GPGMail

Re: Clojure: Clojure.contrib.sql: How do I update ALL the rows of a database table?

2014-06-26 Thread Raoul Duke
://clojure.github.io/java.jdbc/ Sean On Jun 25, 2014, at 7:40 AM, June liangfangfan...@gmail.com wrote: clojuredocs.org/clojure_contrib/clojure.contrib.sql/… How do I set the where clause to 1=1? -- You received this message because you are subscribed to the Google Groups Clojure group. To post

Re: Clojure: Clojure.contrib.sql: How do I update ALL the rows of a database table?

2014-06-26 Thread Sean Corfield
On Jun 26, 2014, at 4:03 PM, Raoul Duke rao...@gmail.com wrote: e.g. things that turn up in google: http://dev.clojure.org/display/doc/Clojure+Contrib+Libraries Which says: If you currently depend on the Monolithic Contrib, you are encouraged to look at the new modular contrib projects to see

Clojure: Clojure.contrib.sql: How do I update ALL the rows of a database table?

2014-06-25 Thread June
*clojuredocs.org/clojure_contrib/clojure.contrib.sql/…* http://clojuredocs.org/clojure_contrib/clojure.contrib.sql/update-values#example_953 How do I set the where clause to 1=1? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group

Given a CSV file, how do I take the values in each row and convert it into a map?

2014-06-12 Thread Shelley Tong
kinda like a key value pair for each row -- 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

Re: Given a CSV file, how do I take the values in each row and convert it into a map?

2014-06-12 Thread Marc Limotte
See https://github.com/clojure-cookbook/clojure-cookbook/blob/master/04_local-io/4-20_read-write-csv.asciidoc Which will give you a seq of the values for each row. To get Maps, try this: (def headers [colA colB ...]) (map (partial zipmap headers) result-of-read-csv) If your headers are the

Re: Given a CSV file, how do I take the values in each row and convert it into a map?

2014-06-12 Thread Devin Walters
I tend to do this: (require '[clojure.data.csv :as csv]) (require '[clojure.java.io :as io]) (require '[clojure.walk :as walk]) (let [[header rows] (- my.csv io/file io/reader csv/read-csv)] (map #(- (zipmap header

<    1   2   3   4   5   6   7   8   9   10   >