Re: boot(2) question

2015-06-18 Thread Haim Ashkenazi
Thanks Luc,

This was a simplification if what I really have :) I actually need the
result. The actual code was something like:

(let [results (for [host hosts]
  (future (remote-exec commands host)))]
(pmap deref results))

where remote-exec runs commands via ssh-clj.

Is there another way to verify that the futures executed?

Thanks.




On Thu, Jun 18, 2015 at 11:06 AM, Luc Prefontaine 
lprefonta...@softaddicts.ca wrote:

 Btwy,

 For is not a loop as in imperative  languages. It returns a lazy sequence.

 Luc P.

 Sent from my iPhone

 On Jun 18, 2015, at 07:51, Haim Ashkenazi haim.ashken...@gmail.com
 wrote:

 Hi,

 I'm trying boot scripting capabilities so I have the following file:

 #!/usr/bin/env boot
 (set-env!
  :dependencies '[[org.clojure/clojure 1.6.0]])

 (defn -main
   []
   (println before)
   (for [s [one two three]]
 (do
   (spit output s :append true)
   (println s)))
   (println after))


 When running this script form the command line all the stuff inside the
 *for* loop is doesn't seem to run:

 ✓ src ➤ ./testboot
 before
 after

 ... and there's no out[put file. Inside a REPL it runs without a
 problem. Am I missing something?

 Thanks in advance

 --
 Haim

 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

  --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.




-- 
Haim

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: boot(2) question

2015-06-18 Thread Haim Ashkenazi
Thanks James, it works now :)

On Thu, Jun 18, 2015 at 3:04 PM, James Reeves ja...@booleanknot.com wrote:

 pmap is still semi-lazy, and there's little point to derefing futures in
 parallel.

 You'd be better off with:

 (doseq [r results]
   (deref r))

 Or:

 (dorun (map deref results))

 - James

 On 18 June 2015 at 12:57, Haim Ashkenazi haim.ashken...@gmail.com wrote:

 Thanks Luc,

 This was a simplification if what I really have :) I actually need the
 result. The actual code was something like:

 (let [results (for [host hosts]
   (future (remote-exec commands host)))]
 (pmap deref results))

 where remote-exec runs commands via ssh-clj.

 Is there another way to verify that the futures executed?

 Thanks.




 On Thu, Jun 18, 2015 at 11:06 AM, Luc Prefontaine 
 lprefonta...@softaddicts.ca wrote:

 Btwy,

 For is not a loop as in imperative  languages. It returns a lazy
 sequence.

 Luc P.

 Sent from my iPhone

 On Jun 18, 2015, at 07:51, Haim Ashkenazi haim.ashken...@gmail.com
 wrote:

 Hi,

 I'm trying boot scripting capabilities so I have the following file:

 #!/usr/bin/env boot
 (set-env!
  :dependencies '[[org.clojure/clojure 1.6.0]])

 (defn -main
   []
   (println before)
   (for [s [one two three]]
 (do
   (spit output s :append true)
   (println s)))
   (println after))


 When running this script form the command line all the stuff inside the
 *for* loop is doesn't seem to run:

 ✓ src ➤ ./testboot
 before
 after

 ... and there's no out[put file. Inside a REPL it runs without a
 problem. Am I missing something?

 Thanks in advance

 --
 Haim

 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

  --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.




 --
 Haim

 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


  --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.




-- 
Haim

-- 
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

boot(2) question

2015-06-18 Thread Haim Ashkenazi
Hi,

I'm trying boot scripting capabilities so I have the following file:

#!/usr/bin/env boot
(set-env!
 :dependencies '[[org.clojure/clojure 1.6.0]])

(defn -main
  []
  (println before)
  (for [s [one two three]]
(do
  (spit output s :append true)
  (println s)))
  (println after))


When running this script form the command line all the stuff inside the
*for* loop is doesn't seem to run:

✓ src ➤ ./testboot
before
after

... and there's no out[put file. Inside a REPL it runs without a problem.
Am I missing something?

Thanks in advance

-- 
Haim

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Namespace metadata

2014-10-29 Thread Haim Ashkenazi
Hi

When I first wrote ayler https://github.com/babysnakes/ayler/wiki (a
simple namespace browser) I used to get the doc for namespace by running
something like this:

(:doc (meta (find-ns 'some.namespace)))

It used to work on all namespaces (IIRC I was working on clojure 1.4).

Lately I noticed that it doesn't get the metadata. e.g.:

user= (require 'clojure.test)
nil
user= (meta (find-ns 'clojure.test))
nil

I'm not sure if it started on clojure 1.5 or 1.6.

-- 
Haim

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Namespace metadata

2014-10-29 Thread Haim Ashkenazi
Sorry, I pressed send too soon :) Here it is from the start:


When I first wrote ayler https://github.com/babysnakes/ayler/wiki (a
simple namespace browser) I used to get the doc for namespace by running
something like this:

(:doc (meta (find-ns 'some.namespace)))

It used to work on all namespaces (IIRC I was working on clojure 1.4).

Lately I noticed that it doesn't get the metadata. e.g.:

user= (require 'clojure.test)
nil
user= (meta (find-ns 'clojure.test))
nil

I'm not sure if it started on clojure 1.5 or 1.6, but the clojure.test
source does contain metadata doc.

Did something change in the way we access namespace metadata?

Thanks in advance

Haim Ashkenazi

On Wed, Oct 29, 2014 at 2:38 PM, Haim Ashkenazi haim.ashken...@gmail.com
wrote:

 Hi

 When I first wrote ayler https://github.com/babysnakes/ayler/wiki (a
 simple namespace browser) I used to get the doc for namespace by running
 something like this:

 (:doc (meta (find-ns 'some.namespace)))

 It used to work on all namespaces (IIRC I was working on clojure 1.4).

 Lately I noticed that it doesn't get the metadata. e.g.:

 user= (require 'clojure.test)
 nil
 user= (meta (find-ns 'clojure.test))
 nil

 I'm not sure if it started on clojure 1.5 or 1.6.

 --
 Haim




-- 
Haim

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Namespace metadata

2014-10-29 Thread Haim Ashkenazi
Thanks Nicola,

I don't think this is the reason. clojure.test is also explicitly adding
docs. Also I encountered it in riemann in a namespace that is not AOT at
all.


On Wed, Oct 29, 2014 at 3:03 PM, Nicola Mometto brobro...@gmail.com wrote:


 Might be an instance of http://dev.clojure.org/jira/browse/CLJ-130

 Haim Ashkenazi writes:

  Sorry, I pressed send too soon :) Here it is from the start:
 
 
  When I first wrote ayler https://github.com/babysnakes/ayler/wiki (a
  simple namespace browser) I used to get the doc for namespace by running
  something like this:
 
  (:doc (meta (find-ns 'some.namespace)))
 
  It used to work on all namespaces (IIRC I was working on clojure 1.4).
 
  Lately I noticed that it doesn't get the metadata. e.g.:
 
  user= (require 'clojure.test)
  nil
  user= (meta (find-ns 'clojure.test))
  nil
 
  I'm not sure if it started on clojure 1.5 or 1.6, but the clojure.test
  source does contain metadata doc.
 
  Did something change in the way we access namespace metadata?
 
  Thanks in advance
 
  Haim Ashkenazi
 
  On Wed, Oct 29, 2014 at 2:38 PM, Haim Ashkenazi 
 haim.ashken...@gmail.com
  wrote:
 
  Hi
 
  When I first wrote ayler https://github.com/babysnakes/ayler/wiki (a
  simple namespace browser) I used to get the doc for namespace by running
  something like this:
 
  (:doc (meta (find-ns 'some.namespace)))
 
  It used to work on all namespaces (IIRC I was working on clojure 1.4).
 
  Lately I noticed that it doesn't get the metadata. e.g.:
 
  user= (require 'clojure.test)
  nil
  user= (meta (find-ns 'clojure.test))
  nil
 
  I'm not sure if it started on clojure 1.5 or 1.6.
 
  --
  Haim
 
 
 
 
  --
  Haim

 --

 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.




-- 
Haim

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Namespace metadata

2014-10-29 Thread Haim Ashkenazi
Thanks Nicola, I stand corrected :)

However, It did work on 1.4 so there's something strange. Anyway, hope it
will be solved.

On Wed, Oct 29, 2014 at 3:20 PM, Nicola Mometto brobro...@gmail.com wrote:


 I just tested for clojure.test and I'm getting nil with clojure
 1.7.0-master-SNAPSHOT but the correct metadata when using master w/
 clj-130 patch.

 Haim Ashkenazi writes:

  Thanks Nicola,
 
  I don't think this is the reason. clojure.test is also explicitly adding
  docs. Also I encountered it in riemann in a namespace that is not AOT at
  all.
 
 
  On Wed, Oct 29, 2014 at 3:03 PM, Nicola Mometto brobro...@gmail.com
 wrote:
 
 
  Might be an instance of http://dev.clojure.org/jira/browse/CLJ-130
 
  Haim Ashkenazi writes:
 
   Sorry, I pressed send too soon :) Here it is from the start:
  
  
   When I first wrote ayler https://github.com/babysnakes/ayler/wiki
 (a
   simple namespace browser) I used to get the doc for namespace by
 running
   something like this:
  
   (:doc (meta (find-ns 'some.namespace)))
  
   It used to work on all namespaces (IIRC I was working on clojure 1.4).
  
   Lately I noticed that it doesn't get the metadata. e.g.:
  
   user= (require 'clojure.test)
   nil
   user= (meta (find-ns 'clojure.test))
   nil
  
   I'm not sure if it started on clojure 1.5 or 1.6, but the clojure.test
   source does contain metadata doc.
  
   Did something change in the way we access namespace metadata?
  
   Thanks in advance
  
   Haim Ashkenazi
  
   On Wed, Oct 29, 2014 at 2:38 PM, Haim Ashkenazi 
  haim.ashken...@gmail.com
   wrote:
  
   Hi
  
   When I first wrote ayler https://github.com/babysnakes/ayler/wiki
 (a
   simple namespace browser) I used to get the doc for namespace by
 running
   something like this:
  
   (:doc (meta (find-ns 'some.namespace)))
  
   It used to work on all namespaces (IIRC I was working on clojure
 1.4).
  
   Lately I noticed that it doesn't get the metadata. e.g.:
  
   user= (require 'clojure.test)
   nil
   user= (meta (find-ns 'clojure.test))
   nil
  
   I'm not sure if it started on clojure 1.5 or 1.6.
  
   --
   Haim
  
  
  
  
   --
   Haim
 
  --
 
  --
  You received this message because you are subscribed to the Google
  Groups Clojure group.
  To post to this group, send email to clojure@googlegroups.com
  Note that posts from new members are moderated - please be patient with
  your first post.
  To unsubscribe from this group, send email to
  clojure+unsubscr...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/clojure?hl=en
  ---
  You received this message because you are subscribed to the Google
 Groups
  Clojure group.
  To unsubscribe from this group and stop receiving emails from it, send
 an
  email to clojure+unsubscr...@googlegroups.com.
  For more options, visit https://groups.google.com/d/optout.
 
 
 
 
  --
  Haim

 --

 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.




-- 
Haim

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How can I mimic load testing

2014-09-30 Thread Haim Ashkenazi
Hi

I’m trying to mimic *ab* load testing (I want to see the actual errors, not
just the error count) so I created the following script:

(ns test-recycle.core
  (:require [clj-http.client :as http])
  (:import (java.util.concurrent Executors)))

(def url http://somehost/test.js;)
(def errors (atom []))
(def counter 25000)
(def threads 30)

(defn run-single-request [_]
  (fn []
(try
  (http/get url)
  (catch Exception e (swap! errors conj (.getMessage e))

(defn go
  Try to connect $count times in $threads and collect the erors
  []
  (let [pool (Executors/newFixedThreadPool threads)
tasks (map run-single-request (range counter))]
(doseq [future (.invokeAll pool tasks)]
  (.get future))
(.shutdown pool)))

This runs great (takes about 10 minutes), but if I double the counter
(5) it probably enters some kind of loop because it’s doing some
calculations which takes lots of CPU and it doesn’t finish even after 40
minutes (the actual web requests ends after about 20 minutes). Can someone
help me understand why?

Also, is there a better way to perform this concurrent load testing (maybe
with http-kit)?

Thanks in advance
-- 
Haim

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How would I write it with concurrency

2014-02-10 Thread Haim Ashkenazi
Hi

I have a simple code that generates a list of maps:

(defn test-data
  [nsamples]
  (loop [acc []]
(if (= (count acc) nsamples)
  acc
  (recur (concat acc (session))

The session function returns a list of one to five generated maps. The idea
is to get a list of (not much more then) nsamples generated maps. This code
runs fairly fast for my needs but out of curiosity I was wondering how
would I make it run concurrently?

Thanks in advance
-- 
Haim

-- 
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 would I write it with concurrency

2014-02-10 Thread Haim Ashkenazi
Thanks Aaron, simple-check is actually on my (very long) list of things to
learn, but generating the data myself was pretty easy and a nice exercise.

/haim


On Mon, Feb 10, 2014 at 9:31 PM, Aaron France aaron.l.fra...@gmail.comwrote:

 Hi,

 Ignoring your question for a second to recommend using simple-check[0]
 to generate test data.

 [0] https://github.com/reiddraper/simple-check

 Aaron

 On Mon, Feb 10, 2014 at 08:46:59PM +0200, Haim Ashkenazi wrote:
  Hi
 
  I have a simple code that generates a list of maps:
 
  (defn test-data
[nsamples]
(loop [acc []]
  (if (= (count acc) nsamples)
acc
(recur (concat acc (session))
 
  The session function returns a list of one to five generated maps. The
 idea
  is to get a list of (not much more then) nsamples generated maps. This
 code
  runs fairly fast for my needs but out of curiosity I was wondering how
  would I make it run concurrently?
 
  Thanks in advance
  --
  Haim
 
  --
  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.




-- 
Haim

-- 
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 would I write it with concurrency

2014-02-10 Thread Haim Ashkenazi
Hi JIm,

The reason I don't use repeatedly is because (unless I'm mistaken) I would
get a list of 5 outputs of session (file lists of between one and 5
elements each). I am interesting in taking the elements returned from
session and concat it to what was already generated.

Regarding concurrency, As I said, I don't really need it for this but I
just thought that if the generation processed had to do some hard
computation I would like to be able to use all CPU's.

Thanks

/haim


On Mon, Feb 10, 2014 at 9:35 PM, Jim - FooBar(); jimpil1...@gmail.comwrote:

  If `session` returns a list, why don't you just do `(take 5 (repeatedly
 session))` ???
 with regards to concurrency I am not sure what you're asking...you want to
 do the same thing from multiple threads and accumulate a global result?

 Jim



 On 10/02/14 18:46, Haim Ashkenazi wrote:

 Hi

  I have a simple code that generates a list of maps:

  (defn test-data
   [nsamples]
(loop [acc []]
 (if (= (count acc) nsamples)
   acc
   (recur (concat acc (session))

  The session function returns a list of one to five generated maps. The
 idea is to get a list of (not much more then) nsamples generated maps.
 This code runs fairly fast for my needs but out of curiosity I was
 wondering how would I make it run concurrently?

  Thanks in advance
 --
 Haim
  --
 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.




-- 
Haim

-- 
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 would I write it with concurrency

2014-02-10 Thread Haim Ashkenazi
Hi Gary

Your idea about applying concurrency in the generation function seems to be
an interesting solution. I'll try it. I'll also take a look at reducers
(which I meant to do a long time ago :) ).

Thanks a lot.

/haim


On Mon, Feb 10, 2014 at 11:28 PM, Gary Trakhman gary.trakh...@gmail.comwrote:

 (apply concat (session))?

 or consider mapcat..

 if the thing behind session needs to be concurrent, it needs to be
 concurrent at that point, not in the code that calls it.  There's no way to
 generally make it concurrent from above unless you know more about what's
 happening below.


 On Mon, Feb 10, 2014 at 4:15 PM, Haim Ashkenazi 
 haim.ashken...@gmail.comwrote:

 Hi JIm,

 The reason I don't use repeatedly is because (unless I'm mistaken) I
 would get a list of 5 outputs of session (file lists of between one and
 5 elements each). I am interesting in taking the elements returned from
 session and concat it to what was already generated.

 Regarding concurrency, As I said, I don't really need it for this but I
 just thought that if the generation processed had to do some hard
 computation I would like to be able to use all CPU's.

 Thanks

 /haim


 On Mon, Feb 10, 2014 at 9:35 PM, Jim - FooBar(); jimpil1...@gmail.comwrote:

  If `session` returns a list, why don't you just do `(take 5
 (repeatedly session))` ???
 with regards to concurrency I am not sure what you're asking...you want
 to do the same thing from multiple threads and accumulate a global result?

 Jim



 On 10/02/14 18:46, Haim Ashkenazi wrote:

 Hi

  I have a simple code that generates a list of maps:

  (defn test-data
   [nsamples]
(loop [acc []]
 (if (= (count acc) nsamples)
   acc
   (recur (concat acc (session))

  The session function returns a list of one to five generated maps. The
 idea is to get a list of (not much more then) nsamples generated maps.
 This code runs fairly fast for my needs but out of curiosity I was
 wondering how would I make it run concurrently?

  Thanks in advance
 --
 Haim
  --
 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.




 --
 Haim

 --
 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.




-- 
Haim

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post

Need help interfacing with ruby digest(hmac-sha256)

2014-02-07 Thread Haim Ashkenazi
Hi

I'm trying to interface with a web service that expects a base64 code
produced as followed (I included both the direct output of digest and the
base64 encoding):

require 'openssl'
digest = OpenSSL::Digest::Digest.new('sha256')
OpenSSL::HMAC.digest(digest, key, string)
=
\x97\xD1[\xEA\xBA\x06\r\a8\xECu\x9E\xA3\x18e\x17\x8A\xB8\xBBx\e-!\adK\xA8\x81\xF3\x99\xD8\xD6
Base64.encode64(OpenSSL::HMAC.digest(digest, key, string))
= l9Fb6roGDQc47HWeoxhlF4q4u3gbLSEHZEuogfOZ2NY=\n


I need to send the base64 encoded string to the web service. I tried with
pandec and base64-clj:

✓ ~ ➤ lein try [pandect] [base64-clj]
...
user= (require '[base64-clj.core :as base64])
nil
user= (require '[pandect.core :as p])
nil
user= (p/sha256-hmac string key)
97d15beaba060d0738ec759ea31865178ab8bb781b2d2107644ba881f399d8d6
user= (base64/encode (p/sha256-hmac string key))
OTdkMTViZWFiYTA2MGQwNzM4ZWM3NTllYTMxODY1MTc4YWI4YmI3ODFiMmQyMTA3NjQ0YmE4ODFmMzk5ZDhkNg==

As you can see the generated sha-256 is similar to the ruby digest, but
it's not the same and the base64 is completely different. I've also tried
using javax.crypto.Mac directly but it's the same:

(defn- secret-key-inst [key mac]
  (SecretKeySpec. (.getBytes key) (.getAlgorithm mac)))

(defn- sign* [key string]
  Returns the signature of a string with a given
  key, using a SHA-256 HMAC.
  (let [mac (Mac/getInstance HMACSHA256)
secretKey (secret-key-inst key mac)]
(- (doto mac
  (.init secretKey)
  (.update (.getBytes string)))
.doFinal)))

(defn sign [key string]
  (let [bytes (sign* key string)]
(apply str (map #(format 2%x %) bytes

Does anybody has an idea of how can I produce the same result as ruby? I
really don't want to resort to calling jruby snippet from clojure :(

Thanks
-- 
Haim

-- 
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: Need help interfacing with ruby digest(hmac-sha256)

2014-02-07 Thread Haim Ashkenazi
Thanks. This solved the problem :)

Bye


On Fri, Feb 7, 2014 at 12:57 PM, Thomas Heller th.hel...@gmail.com wrote:

 Just a quick guess but it seems like the ruby version base64 encodes the
 BINARY version of the digest, while the clojure version encodes the HEX
 version of the digest.

 The sign function also converts to hex, so if you put that into base64
 encode you get the same (wrong) result, use the returned bytes of .doFinal
 and use that to generate the base64 and you should be fine.

 HTH,
 /thomas


 On Friday, February 7, 2014 10:08:27 AM UTC+1, babysnakes wrote:

 Hi

 I'm trying to interface with a web service that expects a base64 code
 produced as followed (I included both the direct output of digest and the
 base64 encoding):

 require 'openssl'
 digest = OpenSSL::Digest::Digest.new('sha256')
 OpenSSL::HMAC.digest(digest, key, string)
 = \x97\xD1[\xEA\xBA\x06\r\a8\xECu\x9E\xA3\x18e\x17\x8A\xB8\
 xBBx\e-!\adK\xA8\x81\xF3\x99\xD8\xD6
 Base64.encode64(OpenSSL::HMAC.digest(digest, key, string))
 = l9Fb6roGDQc47HWeoxhlF4q4u3gbLSEHZEuogfOZ2NY=\n


 I need to send the base64 encoded string to the web service. I tried with
 pandec and base64-clj:

 ✓ ~ ➤ lein try [pandect] [base64-clj]
 ...
 user= (require '[base64-clj.core :as base64])
 nil
 user= (require '[pandect.core :as p])
 nil
 user= (p/sha256-hmac string key)
 97d15beaba060d0738ec759ea31865178ab8bb781b2d2107644ba881f399d8d6
 user= (base64/encode (p/sha256-hmac string key))
 OTdkMTViZWFiYTA2MGQwNzM4ZWM3NTllYTMxODY1MTc4YWI4YmI3ODFiMmQy
 MTA3NjQ0YmE4ODFmMzk5ZDhkNg==

 As you can see the generated sha-256 is similar to the ruby digest, but
 it's not the same and the base64 is completely different. I've also tried
 using javax.crypto.Mac directly but it's the same:

 (defn- secret-key-inst [key mac]
   (SecretKeySpec. (.getBytes key) (.getAlgorithm mac)))

 (defn- sign* [key string]
   Returns the signature of a string with a given
   key, using a SHA-256 HMAC.
   (let [mac (Mac/getInstance HMACSHA256)
 secretKey (secret-key-inst key mac)]
 (- (doto mac
   (.init secretKey)
   (.update (.getBytes string)))
 .doFinal)))

 (defn sign [key string]
   (let [bytes (sign* key string)]
 (apply str (map #(format 2%x %) bytes

 Does anybody has an idea of how can I produce the same result as ruby? I
 really don't want to resort to calling jruby snippet from clojure :(

 Thanks
 --
 Haim

  --
 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.




-- 
Haim

-- 
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: Annoying Emacs Problem

2013-11-14 Thread Haim Ashkenazi
Hi Alexandru,

I believe emacs-starter-kit displays all your “(fn” as “(ƒ”. This has no
effect on the program. If you’ll open the file in a different text editor
you’ll see it with regular “(fn”. It’s just a nicer display.

HTH

Haim


On Thu, Nov 14, 2013 at 10:29 AM, Alexandru Nedelcu
a...@bionicspirit.comwrote:

 Hi guys,

 I've got an embarrassing problem with Emacs.

 In Clojure mode, I cannot type (fn, at all. I cannot copy paste text
 with (fn either, the n simply vanishes. Therefore, I can only
 declare anonymous functions by means of #().

 :-)

 For setting up the environment I followed the Getting Started tutorial
 at http://clojure-doc.org/articles/tutorials/emacs.html and thus
 installed starter-kit, starter-kit-lisp, starter-kit-bindings,
 starter-kit-eshell, clojure-mode, clojure-test-mode and cider.

 Any ideas?


 --
 Alexandru Nedelcu
 www.bionicspirit.com

 PGP Public Key:
 https://bionicspirit.com/alexandru-nedelcu.asc

 --
 --
 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.




-- 
Haim

-- 
-- 
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: [ANN] Ayler - A simple namespace/documentation browser

2013-09-12 Thread Haim Ashkenazi
Thanks.


On Fri, Sep 13, 2013 at 12:55 AM, Joel Holdbrooks cjholdbro...@gmail.comwrote:

 This is really cool! Nice work!


 On Wednesday, September 11, 2013 8:35:31 AM UTC-7, babysnakes wrote:

 Hi

 As a clojure noob I constantly find myself browsing through various API
 docs to see what's available in a library. While this data is available in
 a REPL it's not easy to look for it if you don't know what you're looking
 for. I first saw a namespace browser concept in Relevance's 
 labreplhttps://github.com/relevance/labrepl and
 I really liked the idea. I decided to create one as a learning project. So
 now I present to you Ayler https://github.com/babysnakes/ayler/wiki.
 It's a web based namespace browser that is external to your project and has
 the following features:


- Requires minimal (or no) dependencies in your project. It operates
by connecting to a running nreplhttps://github.com/clojure/tools.nrepl
.
- Displays all loaded namespaces.
- Displays all public member for a selected namespace.
- Displays docstring for selected namespace.
- Displays the docstring and source of selected var.
- Allows you to search and load any namespace from a list of all
namespaces in your classpath (provided you've added required 
 dependencies).

 I also have to point out the 
 clj-ns-browserhttps://github.com/franks42/clj-ns-browser project.
 I borrowed a few features from it, but it's still much more advanced then
 Ayler.

 Since this is a learning project for me (both clojure and javascript)
 I'll appreciate some feedback.

 https://github.com/babysnakes/**ayler/wikihttps://github.com/babysnakes/ayler/wiki

 Thanks
 --
 Haim

  --
 --
 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.




-- 
Haim

-- 
-- 
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] Ayler - A simple namespace/documentation browser

2013-09-11 Thread Haim Ashkenazi
Hi

As a clojure noob I constantly find myself browsing through various API
docs to see what's available in a library. While this data is available in
a REPL it's not easy to look for it if you don't know what you're looking
for. I first saw a namespace browser concept in Relevance's
labreplhttps://github.com/relevance/labrepl and
I really liked the idea. I decided to create one as a learning project. So
now I present to you Ayler https://github.com/babysnakes/ayler/wiki. It's
a web based namespace browser that is external to your project and has the
following features:


   - Requires minimal (or no) dependencies in your project. It operates by
   connecting to a running nrepl https://github.com/clojure/tools.nrepl.
   - Displays all loaded namespaces.
   - Displays all public member for a selected namespace.
   - Displays docstring for selected namespace.
   - Displays the docstring and source of selected var.
   - Allows you to search and load any namespace from a list of all
   namespaces in your classpath (provided you've added required dependencies).

I also have to point out the
clj-ns-browserhttps://github.com/franks42/clj-ns-browser project.
I borrowed a few features from it, but it's still much more advanced then
Ayler.

Since this is a learning project for me (both clojure and javascript)
I'll appreciate some feedback.

https://github.com/babysnakes/ayler/wiki

Thanks
-- 
Haim

-- 
-- 
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: run-jetty not working in a virtualbox vm?

2013-07-13 Thread Haim Ashkenazi
Hi

Sorry if it's obvious, but I don't know your skill level (system
administration wise). On one terminal ssh to the virtual box vm, start the
repl and run jetty as above. On a different terminal ssh to the same
virtual box vm and run:

curl -v http://localhost:8080/

What do you get?

Haim



On Sat, Jul 13, 2013 at 4:45 AM, Daniel Higginbotham nonrecurs...@gmail.com
 wrote:

 I'm trying to start a jetty server on a virtualbox vm (ubuntu 12.04 32
 bit) by running the following:

 (run-jetty #'app {:port (Integer. (get (System/getenv) PORT 8080))
 :join? false})

 However, I can't connect to the server. If I run netstat -lp the java
 process doesn't show up and it looks as if nothing's listening on 8080.
  However, if I run the above run-jetty function again in a separate process
 I get the error message that another process is already bound to 8080.

 The weirdest part of all this is that the very first time I tried starting
 the server, it did start and I was actually able to reach it, but it only
 worked that one time. Has anyone run into this? Is there any way to debug
 the problem?

 Thanks!
 Daniel

 --
 --
 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.






-- 
Haim

-- 
-- 
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 can I count lines of code?

2013-03-27 Thread Haim Ashkenazi
Hi

I know of two tools. Both of them however count docstrings as code:


   - cloc - http://cloc.sourceforge.net
   - lein-vanity - A leiningen plugin (
   https://github.com/dgtized/lein-vanity).

HTH

On Wed, Mar 27, 2013 at 9:36 PM, larry google groups 
lawrencecloj...@gmail.com wrote:

 I am curious, is there a simple command line script I could use to count
 lines of code? Or is there some trick in emacs that I can do? I'd like to
 know how many lines there are, minus the comments and white space.

 --
 --
 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.






-- 
Haim

-- 
-- 
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 Conj Videos

2013-01-03 Thread Haim Ashkenazi
Actually there are a lot of videos available:

http://www.infoq.com/strange_loop_2012/

Bye

On Thu, Jan 3, 2013 at 10:43 AM, kinleyd kinl...@gmail.com wrote:

 I've been waiting forever for the recent Strange Loop Clojure talks to be
 made available as well. So far I've only seen two, Amit Rathore's Clojure
 + Datomic + Stomr = Zolodeck and David Nolen's ClojureScript - Better
 semantics at low, low prices on InfoQ. Any one have any idea when the
 others will be made available?


 On Thursday, January 3, 2013 2:26:18 PM UTC+6, CA wrote:

 Let the party begin :-)

 On Thursday, January 3, 2013 2:02:41 AM UTC+1, Lynn Grogan wrote:

 Confreaks is just completing the final edits on the videos and we should
 be releasing them soon (in a week or so?).
 Of course, it will probably be a staggered release just to drive
 everyone crazy ;)

 Lynn Grogan
 Relevance

 On Wednesday, January 2, 2013 7:12:03 PM UTC-5, Sean Corfield wrote:

 On Wed, Jan 2, 2013 at 3:42 PM, Mark Derricutt ma...@talios.com
 wrote:
 
  +1 - I'm sure I've even seen any BLOGS on this years Conj let alone
 videos.

 http://corfield.org/blog/post.**cfm/clojure-conj-2012http://corfield.org/blog/post.cfm/clojure-conj-2012
 --
 Sean A Corfield -- (904) 302-SEAN
 An Architect's View -- http://corfield.org/
 World Singles, LLC. -- http://worldsingles.com/

 Perfection is the enemy of the good.
 -- Gustave Flaubert, French realist novelist (1821-1880)

  --
 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




-- 
Haim

-- 
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

Re: New Clojure user group in Israel

2012-12-18 Thread Haim Ashkenazi
Finally! I'm in :)

On Mon, Dec 17, 2012 at 12:58 PM, Daniel Szmulewicz 
daniel.szmulew...@gmail.com wrote:

 Hi everybody,

 Happy to announce that Israel has its first Clojure user group.

 http://www.meetup.com/Clojure-**Israel/http://www.meetup.com/Clojure-Israel/

 Sincerely,

 Daniel Szmulewicz

 --
 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




-- 
Haim

-- 
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

Re: Interactive form workflow with Friend, can't log in

2012-11-13 Thread Haim Ashkenazi
Hi

On Mon, Nov 12, 2012 at 9:23 PM, Thorsten Wilms t...@freenet.de wrote:

 On 11/12/2012 03:20 PM, Chas Emerick wrote:

 Looks like you're not using the keyword-params middleware, which
 Friend requires (among others).  Please check the last paragraph in
 the 'Authentication' section here:

 https://github.com/cemerick/**friend/#authenticationhttps://github.com/cemerick/friend/#authentication

 Once you add that, then the interactive-form middleware will pick up
 the form data you're submitting.


 I tried to make sense of that in wrapping my main handler in authenticate
 in wrap-keyword-params, later also adding wrap-session, wrap-params and
 wrap-nested params.

 I still get a redirect to http://localhost:8080/login?**
 login_failed=Yusername=http://localhost:8080/login?login_failed=Yusername=

 So please, how/where shall I *add* wrap-keyword-params (and the others?)
 exactly?

Here's how you wrap your application with middleware (root-routes is your
main routes:

(def app
  (- #'root-routes
   (friend/authenticate …)
   (wrap-keyword-params)
   (wrap-params)
   …))

Now following your example you can
(web/start app)

note that the above set of middleware are just sample. I have no idea if
this is all you need. If you'll use the hiccup library you have a
'handler/site' function that includes many of the required middleware you
need for a website (you can also just check the documentation to see the
list of middleware it uses).

In order to learn more about middleware check the *middleware* section here:
https://github.com/ring-clojure/ring/wiki/Concepts

Also, the friend repository has a mock application you can check:
https://github.com/cemerick/friend/blob/master/test/test_friend/mock_app.clj

HTH
-- 
Haim

-- 
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

Re: ANN Drip: A fast JVM launcher

2012-09-11 Thread Haim Ashkenazi
Hi

I seem to have a problem running it with leiningen:

After setting LEIN_JAVA_CMD I run 'lein test' 3 times and 'lein repl' 2
times. Here's the output of 'drip ps':

37826 org.flatland.drip.Main clojure.main
/Users/haim/.drip/0.1.4/7f5d7985a3c16a2f30c1614767d09d71c419b13e/37801-1
-XX:+TieredCompilation -Dfile.encoding=UTF-8
-Dmaven.wagon.http.ssl.easy=false
-Dleiningen.original.pwd=/Users/haim/Documents/Projects/moritz34
-Dleiningen.trampoline-file=/tmp/lein-trampoline-37796
-Djava.awt.headless=true
-Xbootclasspath/a:/opt/homebrew/Cellar/drip/0.1.4/libexec/bin/../drip.jar:/Users/haim/.lein/self-installs/leiningen-2.0.0-preview10-standalone.jar
37910 org.flatland.drip.Main clojure.main
/Users/haim/.drip/0.1.4/6a85d0253eb4ac050459980830b8e59bad6f892d/37885-1
-XX:+TieredCompilation -Dfile.encoding=UTF-8
-Dmaven.wagon.http.ssl.easy=false
-Dleiningen.original.pwd=/Users/haim/Documents/Projects/moritz34
-Dleiningen.trampoline-file=/tmp/lein-trampoline-37880
-Djava.awt.headless=true
-Xbootclasspath/a:/opt/homebrew/Cellar/drip/0.1.4/libexec/bin/../drip.jar:/Users/haim/.lein/self-installs/leiningen-2.0.0-preview10-standalone.jar
37863 org.flatland.drip.Main clojure.main
/Users/haim/.drip/0.1.4/ef3e475a67c8f52aa61a9cc20262da3ef3d2a540/37838-1
-XX:+TieredCompilation -Dfile.encoding=UTF-8
-Dmaven.wagon.http.ssl.easy=false
-Dleiningen.original.pwd=/Users/haim/Documents/Projects/moritz34
-Dleiningen.trampoline-file=/tmp/lein-trampoline-37833
-Djava.awt.headless=true
-Xbootclasspath/a:/opt/homebrew/Cellar/drip/0.1.4/libexec/bin/../drip.jar:/Users/haim/.lein/self-installs/leiningen-2.0.0-preview10-standalone.jar
37789 org.flatland.drip.Main clojure.main
/Users/haim/.drip/0.1.4/ee72afecd652d5acad7c57005396c9f94b52b523/37764-1
-XX:+TieredCompilation -Dfile.encoding=UTF-8
-Dmaven.wagon.http.ssl.easy=false
-Dleiningen.original.pwd=/Users/haim/Documents/Projects/moritz34
-Dleiningen.trampoline-file=/tmp/lein-trampoline-37759
-Djava.awt.headless=true
-Xbootclasspath/a:/opt/homebrew/Cellar/drip/0.1.4/libexec/bin/../drip.jar:/Users/haim/.lein/self-installs/leiningen-2.0.0-preview10-standalone.jar
37751 org.flatland.drip.Main clojure.main
/Users/haim/.drip/0.1.4/8ea454b26e49ac850aae5d3092d3245895004797/37726-1
-XX:+TieredCompilation -Dfile.encoding=UTF-8
-Dmaven.wagon.http.ssl.easy=false
-Dleiningen.original.pwd=/Users/haim/Documents/Projects/moritz34
-Dleiningen.trampoline-file=/tmp/lein-trampoline-37721
-Djava.awt.headless=true
-Xbootclasspath/a:/opt/homebrew/Cellar/drip/0.1.4/libexec/bin/../drip.jar:/Users/haim/.lein/self-installs/leiningen-2.0.0-preview10-standalone.jar

It seems that every run spawns new drip server. I read that drip matches
the arguments so maybe the different lein-trampoline file causes this.

I'm using Leiningen 2.0.0-preview10

Thanks

On Mon, Sep 10, 2012 at 7:31 PM, Justin Balthrop
jus...@justinbalthrop.comwrote:

 Drip is a drop in replacement for the 'java' command that provides faster
 startup times. It does this by keeping a fresh JVM spun up in reserve with
 the correct classpath and other JVM options so you can quickly connect and
 use it when needed, then throw it away.

 Drip works with Clojure and Leiningen. Drip also works with other JVM
 languages like Scala and JRuby.

 It's easy to install. Just follow the instructions here:

 https://github.com/flatland/drip

 There are also some speed comparisons on the wiki:

 https://github.com/flatland/drip/wiki

 Once you've installed drip, setting up Leiningen to use it just requires
 adding the following to ~/.lein/leinrc:

 LEIN_JAVA_CMD=${LEIN_JAVA_CMD-drip}

 As some of you know, I implemented the persistent JVM in Cake. Compared to
 that, Drip is not quite as fast, but way less of a headache to use. It
 strikes a way better balance between fast and correct. You don't have to
 worry about running 'cake kill' when the state of your persistent JVM gets
 corrupt.

 Let us know in #flatland or #leiningen on IRC how it works for you once
 you try it!

 - Justin

  --
 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




-- 
Haim

-- 
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

Re: doubt about clojure.test output

2012-08-18 Thread Haim Ashkenazi
Hi Vencent,

On Sat, Aug 18, 2012 at 3:49 PM, Vincent vincent@gmail.com wrote:

 Dear ,

 I am using clojure.test  for test

 in one 'deftest , i had used 3   'is   function to assert
 and in another 'deftest , i had used 5  'is function to assert

 It ran all test with sucess , but output is

 Ran 4 tests containing 12 assertions

 How come 12 ?

I had a case where I used Noir test helper (has-status) inside 'is'
functions without realizing that has-status in itself uses assertions. The
output showed me twice the assertions i wrote. The solutions was to not
wrap has-status with an 'is' function.

HTH


 thanks in advance
 Vincent


-- 
Haim

-- 
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

Extracting all the strings of a web app to resource files

2012-08-05 Thread Haim Ashkenazi
Hi

I'm new here :)

I have a web app which I want to extract all the text out of the hiccup
templates. In my very limited java experience I remember there is a good
support for i18n resource files, but I don't really need the overhead of
i18n. What would be a good way to do it (except for making a file with one
large map of strings)?

Thanks in advance
-- 
Haim

-- 
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

Re: newer versions

2012-07-16 Thread Haim Ashkenazi
Hi

I've never used it but there is a plugin to pull git dependencies:
https://github.com/tobyhede/lein-git-deps

HTH

On Sun, Jul 15, 2012 at 5:58 PM, cej38 junkerme...@gmail.com wrote:

 I know that this might be more of a question for elsewhere, but I have
 been playing with core.logic from time to time when I am sick of looking at
 stuff for my day job.  Many months ago, I figured out how to make a project
 using lein and at the time  core.logic-0.6.8.jar  was the newest version
 and I found something that told me to use this command in project.clj

   :dependencies [[org.clojure/clojure 1.3.0]
  [org.clojure/core.logic 0.6.8]]

 In looking at the github page for core logic I see that there are several
 branches.  How do I change my project.clj file so that lein downloads and
 uses one of the other branches, say for example the cKanren branch?

 --
 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




-- 
Haim

-- 
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