[ANN] Nginx-Clojure v0.2.3 released

2014-07-05 Thread Xfeep Zhang
Nginx-Clojure  is a Nginx 
module for embedding Clojure or Java programs, typically those Ring based 
handlers.

Release 0.2.3 contains four important updates


   1. Fix issue - After invoking on coroutine based socket nginx worker 
   will exit and be recreated when network is disabled (issue #26)
   2. Fix issue - PATCH loses the data payload (issue #27)
   3. Support user defined http request method (issue #28 )
   4. Fix issue - Nginx worker crashes when to fetch http header 
   "authorization" from request (issue #30)
   


The binary release (support win32, linux x86 32bit, linux x64, macosx) can 
be found from https://sourceforge.net/projects/nginx-clojure/files/
The source files and guide can be found from 
https://github.com/nginx-clojure/nginx-clojure/blob/master/README.md
The index page for guide can be found from 
https://github.com/nginx-clojure/nginx-clojure/wiki

There are some core features of Nginx-Clojure:


   1. Compatible with Ring and obviously supports those Ring based 
   frameworks, such as Compojure etc.
   2. Use Java/Clojure code to write a simple nginx rewrite handler to set 
   var before proxy pass
   3. Non-blocking coroutine based socket which is Compatible with Java 
   Socket API and works well with largely existing java library such as apache 
   http client, mysql jdbc drivers. With this feature one java main thread can 
   handle thousands of connections.
   4. Handle multiple sockets parallel in sub coroutines, e.g. we can 
   invoke two remote services at the same time feature
   5. Asynchronous callback API of socket for some advanced usage
   6. Run initialization clojure code when nginx worker starting
   7. Support user defined http request method
   8. Compatible with the Nginx lastest stable version 1.6.0. (Nginx 1.4.x 
   is also ok, older version is not tested and maybe works.)
   9. One of benifits of Nginx is worker processes are automatically 
   restarted by a master process if they crash
   10. Utilizes lazy headers and direct memory operation between Nginx and 
   JVM to fast handle dynamic contents from Clojure or Java code.
   11. Utilizes Nginx zero copy file sending mechanism to fast handle 
   static contents controlled by Clojure or Java code.
   12. Supports Linux x64, Linux x86 32bit, Win32 and Mac OS X. Win64 users 
   can also run it with a 32bit JRE/JDK.
   

-- 
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: Deploying to Clojars no longer works

2014-07-05 Thread Colin Fleming
A few Cursive users have experience "peer not authenticated" errors -
there's some info and some debugging steps here:
https://github.com/cursiveclojure/cursive/issues/285. It seems to be caused
by a problem with the certificates in your JVM, but it's not clear to me
why it suddenly starts happening for some users.


On 5 July 2014 18:37, Zach Oakes  wrote:

> One thing worth noting is that I don't have a home internet connection, so
> all my deployments happen over a tethered 3G connection. I suppose that a
> large upload combined with a slow link to the net is the problem.
>
>
> On Saturday, July 5, 2014 12:24:20 PM UTC-4, Zach Oakes wrote:
>>
>> Regarding "Read timed out", I made an issue
>>  for it. It happened with
>> play-clj/lein-template 0.3.7, as well as nightcode/nightcode 0.3.7. And
>> yes, they are quite large because they contain native binaries, but after a
>> few tries they did eventually upload.
>>
>> On Saturday, July 5, 2014 10:49:17 AM UTC-4, Nelson Morris wrote:
>>>
>>> "Read timed out" sounds like the artifact might be too large, but if
>>> future tries succeed then that's not the case.  Could you send me the
>>> group/artifact/versions that failed?
>>>
>>>
>>> On Thu, Jul 3, 2014 at 9:02 AM, Zach Oakes  wrote:
>>>
 Even on the latest version (2.4.0), I've experienced problems in the
 last three weeks. I believe they've coincided with the site redesign, but
 they may not be related. I sometimes get "Read timed out" when uploading an
 artifact. Since deployments aren't atomic, the library or template will be
 partially uploaded and thus unusable, so I have to increment the version
 number and try again.


 On Thursday, July 3, 2014 3:29:17 AM UTC-4, Adam Clements wrote:

> Have you tried upgrading leiningen to the latest version? I don't
> think you can deploy from old versions, at least that's been a problem for
> me in the past.
> On 2 Jul 2014 20:55, "Jacob Goodson"  wrote:
>
>>  I have been deploying the same project to clojars for quite a while
>> now(5 months?); for some reason it decided it no longer wanted to work.
>>  After giving my pass phrase I get "peer not authenticated".  I have not
>> changed computers nor do I have a new internet connection.  Does anyone
>> know what the heck I've done to blow it up?
>>
>> --
>> 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
>>
>> Note that posts from new members are moderated - please be patient
>> with your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@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+u...@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 clo...@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+u...@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+u...@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.
>

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

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

On Thursday, September 13, 2012 3:02:09 AM UTC-7, Murtaza Husain wrote:
>
>
> A good use case - You want to place html files, that can be processed in 
> your server side code. Inorder for your code to have access to it, you will 
> have to place them in the src dir. However if you use the :resource-path, 
> you can define a dir relative to the root of your project where you are 
> placing your html files. 
>
> I recently used them to place my html files in resource/public/templates 
> folder, when using enlive for processing html files. 
>
> On Monday, September 10, 2012 9:35:56 PM UTC+5:30, Phil Hagelberg wrote:
>>
>> larry google groups  writes: 
>>
>> > I see this: 
>> > 
>> > :resource-paths ["src/main/resource"] ; non-code files included in 
>> > classpath/jar 
>> > 
>> > I am confused in 2 ways: 
>> > 
>> > 1.) is this a break from java conventions? I thought Java projects 
>> > tended to put a "resources" folder at the top level of a project, 
>> > rather than inside of src? 
>>
>> The top-level resources/ is what you get by default; the sample 
>> project.clj file just shows you what it would look like if you were to 
>> change it. Personally I'm not a fan of the paid-by-the-directory deep 
>> nesting approach, but it's shown there because it's the only other 
>> common convention. =) 
>>
>> -Phil 
>>
>

-- 
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: Deploying to Clojars no longer works

2014-07-05 Thread Zach Oakes
One thing worth noting is that I don't have a home internet connection, so 
all my deployments happen over a tethered 3G connection. I suppose that a 
large upload combined with a slow link to the net is the problem.

On Saturday, July 5, 2014 12:24:20 PM UTC-4, Zach Oakes wrote:
>
> Regarding "Read timed out", I made an issue 
>  for it. It happened with 
> play-clj/lein-template 0.3.7, as well as nightcode/nightcode 0.3.7. And 
> yes, they are quite large because they contain native binaries, but after a 
> few tries they did eventually upload.
>
> On Saturday, July 5, 2014 10:49:17 AM UTC-4, Nelson Morris wrote:
>>
>> "Read timed out" sounds like the artifact might be too large, but if 
>> future tries succeed then that's not the case.  Could you send me the 
>> group/artifact/versions that failed?
>>
>>
>> On Thu, Jul 3, 2014 at 9:02 AM, Zach Oakes  wrote:
>>
>>> Even on the latest version (2.4.0), I've experienced problems in the 
>>> last three weeks. I believe they've coincided with the site redesign, but 
>>> they may not be related. I sometimes get "Read timed out" when uploading an 
>>> artifact. Since deployments aren't atomic, the library or template will be 
>>> partially uploaded and thus unusable, so I have to increment the version 
>>> number and try again.
>>>
>>>
>>> On Thursday, July 3, 2014 3:29:17 AM UTC-4, Adam Clements wrote:
>>>
 Have you tried upgrading leiningen to the latest version? I don't think 
 you can deploy from old versions, at least that's been a problem for me in 
 the past. 
 On 2 Jul 2014 20:55, "Jacob Goodson"  wrote:

>  I have been deploying the same project to clojars for quite a while 
> now(5 months?); for some reason it decided it no longer wanted to work. 
>  After giving my pass phrase I get "peer not authenticated".  I have not 
> changed computers nor do I have a new internet connection.  Does anyone 
> know what the heck I've done to blow it up?
>
> -- 
> 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
>
> Note that posts from new members are moderated - please be patient 
> with your first post.
> To unsubscribe from this group, send email to
> clojure+u...@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+u...@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 clo...@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+u...@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+u...@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.


Re: Deploying to Clojars no longer works

2014-07-05 Thread Zach Oakes
Regarding "Read timed out", I made an issue 
 for it. It happened with 
play-clj/lein-template 0.3.7, as well as nightcode/nightcode 0.3.7. And 
yes, they are quite large because they contain native binaries, but after a 
few tries they did eventually upload.

On Saturday, July 5, 2014 10:49:17 AM UTC-4, Nelson Morris wrote:
>
> "Read timed out" sounds like the artifact might be too large, but if 
> future tries succeed then that's not the case.  Could you send me the 
> group/artifact/versions that failed?
>
>
> On Thu, Jul 3, 2014 at 9:02 AM, Zach Oakes 
> > wrote:
>
>> Even on the latest version (2.4.0), I've experienced problems in the last 
>> three weeks. I believe they've coincided with the site redesign, but they 
>> may not be related. I sometimes get "Read timed out" when uploading an 
>> artifact. Since deployments aren't atomic, the library or template will be 
>> partially uploaded and thus unusable, so I have to increment the version 
>> number and try again.
>>
>>
>> On Thursday, July 3, 2014 3:29:17 AM UTC-4, Adam Clements wrote:
>>
>>> Have you tried upgrading leiningen to the latest version? I don't think 
>>> you can deploy from old versions, at least that's been a problem for me in 
>>> the past. 
>>> On 2 Jul 2014 20:55, "Jacob Goodson"  wrote:
>>>
  I have been deploying the same project to clojars for quite a while 
 now(5 months?); for some reason it decided it no longer wanted to work. 
  After giving my pass phrase I get "peer not authenticated".  I have not 
 changed computers nor do I have a new internet connection.  Does anyone 
 know what the heck I've done to blow it up?

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

 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@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+u...@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 clo...@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+u...@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+u...@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.


Re: Deploying to Clojars no longer works

2014-07-05 Thread Nelson Morris
"Read timed out" sounds like the artifact might be too large, but if future
tries succeed then that's not the case.  Could you send me the
group/artifact/versions that failed?


On Thu, Jul 3, 2014 at 9:02 AM, Zach Oakes  wrote:

> Even on the latest version (2.4.0), I've experienced problems in the last
> three weeks. I believe they've coincided with the site redesign, but they
> may not be related. I sometimes get "Read timed out" when uploading an
> artifact. Since deployments aren't atomic, the library or template will be
> partially uploaded and thus unusable, so I have to increment the version
> number and try again.
>
>
> On Thursday, July 3, 2014 3:29:17 AM UTC-4, Adam Clements wrote:
>
>> Have you tried upgrading leiningen to the latest version? I don't think
>> you can deploy from old versions, at least that's been a problem for me in
>> the past.
>> On 2 Jul 2014 20:55, "Jacob Goodson"  wrote:
>>
>>> I have been deploying the same project to clojars for quite a while
>>> now(5 months?); for some reason it decided it no longer wanted to work.
>>>  After giving my pass phrase I get "peer not authenticated".  I have not
>>> changed computers nor do I have a new internet connection.  Does anyone
>>> know what the heck I've done to blow it up?
>>>
>>> --
>>> 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
>>>
>>> Note that posts from new members are moderated - please be patient with
>>> your first post.
>>> To unsubscribe from this group, send email to
>>> clojure+u...@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+u...@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.
>

-- 
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: Deploying to Clojars no longer works

2014-07-05 Thread Nelson Morris
Peer not authenticated sounds like an ssl issue.  Could you try adding
:certificates ["clojars.pem"] to your :user profile and seeing if it
authenticates?


On Fri, Jul 4, 2014 at 3:11 PM, Jacob Goodson 
wrote:

> I tried updating to the latest version and it still keeps saying that peer
> is not authenticated.  I cannot upload anything its annoying!
>
>
> On Thursday, July 3, 2014 10:02:07 AM UTC-4, Zach Oakes wrote:
>>
>> Even on the latest version (2.4.0), I've experienced problems in the last
>> three weeks. I believe they've coincided with the site redesign, but they
>> may not be related. I sometimes get "Read timed out" when uploading an
>> artifact. Since deployments aren't atomic, the library or template will be
>> partially uploaded and thus unusable, so I have to increment the version
>> number and try again.
>>
>> On Thursday, July 3, 2014 3:29:17 AM UTC-4, Adam Clements wrote:
>>>
>>> Have you tried upgrading leiningen to the latest version? I don't think
>>> you can deploy from old versions, at least that's been a problem for me in
>>> the past.
>>> On 2 Jul 2014 20:55, "Jacob Goodson"  wrote:
>>>
 I have been deploying the same project to clojars for quite a while
 now(5 months?); for some reason it decided it no longer wanted to work.
  After giving my pass phrase I get "peer not authenticated".  I have not
 changed computers nor do I have a new internet connection.  Does anyone
 know what the heck I've done to blow it up?

 --
 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
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@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+u...@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.
>

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


Having a package visible in the environment in which generated code is compiled?

2014-07-05 Thread Simon Brooke
I am trying to write a domain-specific production rule language which is 
compiled down at run-time into Clojure code. It's intended that the rule 
language should be usable by primary school children with little help.

So far it's going extremely well, except for one problem. If I run it in 
the REPL, like this, it works:


user=> (use 'mw-parser.core :reload)
nil
user=> (use 'mw-engine.utils)
nil
user=> (parse-rule "if state is forest and fertility is between 55 and 75 
then state should be climax")
(fn [cell world] (if (and (= (:state cell) :forest) (or (< 55 (get-int cell 
:fertility) 75) (> 55 (get-int cell :fertility) 75))) (merge cell {:state 
:climax})))
user=> (eval *1)
#
user=> (apply *1 (list {:state :forest :fertility 60} nil))
{:state :climax, :fertility 60}
user=> 


However, I have a test as follows:

ns mw-parser.core-test
  (:use mw-engine.utils)
  (:require [clojure.test :refer :all]
[mw-parser.core :refer :all]))

(deftest rules-tests
  (testing "if altitude is less than 100 and state is forest then state 
should be climax and deer should be 3"
   (is (parse-rule "if altitude is less than 100 and state is 
forest then state should be climax and deer should be 3"))
   (is (let [cell (apply (eval (parse-rule "if altitude is less 
than 100 and state is forest then state should be climax and deer should be 
3"))
 (list {:state :forest :altitude 99} nil))]
 (and (= (:state cell) :climax) (= (:deer cell) 3
   ))

This fails as follows:

simon@engraver:~/workspace/mw-parser$ lein test

lein test mw-parser.core-test

lein test :only mw-parser.core-test/rules-tests

ERROR in (rules-tests) (Compiler.java:6380)
if altitude is less than 100 and state is forest then state should be 
climax and deer should be 3
expected: (let [cell (apply (eval (parse-rule "if altitude is less than 100 
and state is forest then state should be climax and deer should be 3")) 
(list {:state :forest, :altitude 99} nil))] (and (= (:state cell) :climax) 
(= (:deer cell) 3)))
  actual: clojure.lang.Compiler$CompilerException: 
java.lang.RuntimeException: Unable to resolve symbol: get-int in this 
context, compiling:(/tmp/form-init4592216274934008360.clj:1:6384)


The function get-int is in mw-engine.utils, and is:

(defn get-int
  "Get the value of a property expected to be an integer from a map; if not 
present (or not an integer) return 0.
  
   * `map` a map;
   * `key` a symbol or keyword, presumed to be a key into the `map`."
  [map key]
  (cond map
(let [v (map key)]
  (cond (and v (integer? v)) v
true 0))

true (throw (Exception. "No map passed?"

 
I'm trying to understand why this function is not available in the test 
environment when the anonymous function generated from the rule text is 
compiled and applied. This matters, because I expect the users of the 
system to add rules via a web form, so they won't have a REPL. 

As you can see I've specified that mw-engine.utils is used by the test 
file, but that does not apparently make the namespace available in eval. It 
is the eval step, not the apply step, that fails, I've verified that by 
trying:

user=> (use 'mw-parser.core :reload)
nil
user=> (parse-rule "if state is forest and fertility is between 55 and 75 
then state should be climax")
(fn [cell world] (if (and (= (:state cell) :forest) (or (< 55 (get-int cell 
:fertility) 75) (> 55 (get-int cell :fertility) 75))) (merge cell {:state 
:climax})))
user=> (eval *1)

CompilerException java.lang.RuntimeException: Unable to resolve symbol: 
get-int in this context, 
compiling:(/tmp/form-init2345285067501587397.clj:1:1) 
user=> 


(Note that on this occasion I didn't include the (use 'mw-engine.utils) 
step)

Any assistance gratefully received!

-- 
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: is their a Clojure framework for handling form validation?

2014-07-05 Thread Asim Jalis
For validation check out Bouncer [1][2]. It is elegant and minimal, and 
also lets you chain together validators using the threading macro. 

[1] https://github.com/leonardoborges/bouncer
[2] 
http://www.leonardoborges.com/writings/2013/01/04/bouncer-validation-lib-for-clojure/

Asim

On Sunday, July 22, 2012 4:46:52 PM UTC-7, larry google groups wrote:
>
> Since 2000 I've been doing web development, first with PHP and then with 
> Ruby On Rails. In the world of PHP, there are some frameworks, such as 
> Symfony, that have classes for managing forms, both generating the HTML for 
> the forms, and also handling the validation of the forms. In the world of 
> Python, the Django framework also has facilities for generating and 
> validating forms. These frameworks offer certain time saving conveniences. 
> For instance, with the Symfony framework, if you have a database table that 
> has a foreign key, then you can get that other table (the target of the 
> foreign key) to appear in a form as a pre-populated select box, 
> automatically (after filling out some config files).
>
> I'm now trying to make Clojure my primary development language for 
> everything, including web development. I'm curious, are there any libraries 
> in the land of Clojure that offer similar conveniences for forms? 
>

-- 
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: reloading enlive templates

2014-07-05 Thread Sven Richter
Hi Curtis,

this solution works as expected, thank you very much.

Best Regards,
Sven

Am Donnerstag, 3. Juli 2014 18:30:03 UTC+2 schrieb Curtis Summers:
>
> I'm using ring.middleware.force-reload to always reload the namespaces 
> that reference my enlive templates.  (only in dev, of course)
>
> https://github.com/citizenparker/ring-middleware-force-reload
>
>
> Hope that helps,
>
> Curtis
>
> On Wednesday, July 2, 2014 3:14:16 PM UTC-5, Sven Richter wrote:
>>
>> Hi,
>>
>> I am trying to reload my enlive templates with a watcher, how it was 
>> suggested in this issue: https://github.com/cgrand/enlive/issues/6
>>
>> I am calling this function of start of my application:
>>
>>(watcher/watcher ["resources/"]
>> (watcher/rate 50) ; poll every 50ms
>> (watcher/on-change (fn [file] (do (println "file 
>>changed: " file)
>>  ;(use 
>>'de.sveri.clj.adspread :reload) ;as soon as I uncomment this, the 
>> anonymous 
>>function is not called anymore
>>
>>
>> But just like I stated in the comment, as soon as I try to reload a 
>> namespace the anonymous function is not executed anymore, whereas without 
>> the (use ...) call it gets executed on file change.
>> I also tried to call (reload 'namespace) but that did not work either.
>>
>> Any ideas on how to fix this or make enlive templates reload on change?
>>
>> Best Regards,
>> Sven
>>
>

-- 
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: [ANN] Debug: clojure port of node debug

2014-07-05 Thread Atamert Ölçgen
Awesome! Thanks for sharing.

For those who are wondering what debug does exactly, I suggest checking out
the screenshots in the node port's GitHub page. (Any chance you can
borrowsteal them?)

There's also flatland.useful.debug/? for inspecting forms. (
https://github.com/amalloy/useful/blob/develop/src/flatland/useful/debug.clj
)



On Sat, Jul 5, 2014 at 7:10 AM, Sun Ning  wrote:

> Hi all,
>
> I just ported node debug[1] library to clojure, hoping it could be helpful
> in clojure world. The debug library is widely used in node projects. The
> usage is very simple: print debug message when certain namespace is enabled
> via environment variable DEBUG.
>
> https://github.com/sunng87/debug
>
> The Clojure version of debug has almost all features of node one. And
> there are some advantages:
>
> * No need to configure module name since we have *ns* in clojure
> * Zero overhead in runtime if debug is disabled: the debug macro won't
> produce anything
>
> Compared with logging tools of clojure, the debug library is:
>
> * Much simpler, no xml or properties at all
> * Light weight, no additional dependencies
>
>
>
> [1] https://github.com/visionmedia/debug
>
> --
> 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.
>



-- 
Kind Regards,
Atamert Ölçgen

-+-
--+
+++

www.muhuk.com

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


[ANN] Debug: clojure port of node debug

2014-07-05 Thread Sun Ning

Hi all,

I just ported node debug[1] library to clojure, hoping it could be 
helpful in clojure world. The debug library is widely used in node 
projects. The usage is very simple: print debug message when certain 
namespace is enabled via environment variable DEBUG.


https://github.com/sunng87/debug

The Clojure version of debug has almost all features of node one. And 
there are some advantages:


* No need to configure module name since we have *ns* in clojure
* Zero overhead in runtime if debug is disabled: the debug macro won't 
produce anything


Compared with logging tools of clojure, the debug library is:

* Much simpler, no xml or properties at all
* Light weight, no additional dependencies



[1] https://github.com/visionmedia/debug

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