Re: namespace dependency

2014-03-21 Thread Chris Jeris
You might take a look at Tim McCormack's Nephila visualizer:

https://github.com/timmc/nephila


On Fri, Mar 21, 2014 at 6:33 AM, Dave Sann daves...@gmail.com wrote:

 Assuming a set of directories/classpath, is there a simple way to
 determine the set of namespaces that are dependent on another namespace?

 in this case, by dependent I mean (for example):

 A refers B
 B refers C D

 dependents of B are A
 dependents of C are B and A
 dependents of D are B and A
 dependents of A are nothing.

 I had a look at tools.namespace but I didn't see an easy way to do this.
 Maybe I missed it.

 Thanks

 Dave

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




-- 
Chris Jeris
cje...@brightcove.com
freenode/twitter/github: ystael

-- 
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: how to packge lein project in a maven-style?

2014-01-06 Thread Chris Jeris
https://github.com/djpowell/lein-libdir may do what you want for assembling
dependencies.

peace, Chris Jeris


On Mon, Jan 6, 2014 at 12:33 AM, Qiu Xiafei qiuxia...@gmail.com wrote:



 Using maven, we usually package the project in a directory with sub dirs
 like:
 bin/ # bash/python scripts
 lib/  # all jars
 conf/   # resources/configuration files

 And, we often use the *maven-dependency-plugin* to copy dependency jars
 and use the *maven-resources-plugin* to copy scripts and other resource
 files. But I find no alernertives in lein.

 Is there any lein plugin can help me about this?

 thanks!

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




-- 
Chris Jeris
cje...@brightcove.com
freenode/twitter/github: ystael

-- 
-- 
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: newbie question about symbols

2013-05-30 Thread Chris Jeris
Commas are whitespace in Clojure.  If you are looking for the unquote
operator, it is ~.

user= (first `(~+ 5))
#core$_PLUS_ clojure.core$_PLUS_@6f6827b5

peace, Chris


On Thu, May 30, 2013 at 5:42 PM, Brian Craft craft.br...@gmail.com wrote:

 What's up with the 3rd result here?

 user= (symbol? +)
 false
 user= (symbol? clojure.core/+)
 false
 user= (symbol? (first `(,+ 5)))
 true
 user= (first `(,+ 5))
 clojure.core/+

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






-- 
Chris Jeris
cje...@brightcove.com
freenode/twitter/github: ystael

-- 
-- 
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: org.junit.Assert/assertArrayEquals massive confusion!

2013-05-28 Thread Chris Jeris
It doesn't seem to be in the published javadoc, but this is an array
comparison with an epsilon tolerance, which was likely added after the
published javadoc was generated.  0.01 here is the maximum permitted
absolute difference between each compared number.

https://github.com/junit-team/junit/blob/master/src/main/java/org/junit/Assert.java#L474

peace, Chris


On Tue, May 28, 2013 at 12:42 PM, Jim - FooBar(); jimpil1...@gmail.comwrote:

  Hi everyone,

 sometimes I feel really stupid!

 I am currently looking at a well-known java library's tests and found this:

 Assert.assertArrayEquals(arrayOutput[0], arrayOutput[1], 0.01);
 //arrayOutput is a 2d double-array btw

 since I've basically wrapped this lib, I'd like to port the java tests as
 well. First of all, how do I compare 2 arrays in Clojure without using
 .equals() which is broken for arrays. More importantly, where on earth is
 that method (*assertArrayEquals*)? Looking at the docs for JUnit [1], I
 can see no overload that takes 2 arrays and a double!!! In fact the only
 methods that take 3 args expect a String as the first argwhat is
 happening? can anyone shine some light please?  I am utterly confused...

 thanks in advance,

 Jim

 [1]http://junit.sourceforge.net/javadoc/org/junit/Assert.html

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






-- 
Chris Jeris
cje...@brightcove.com
freenode/twitter/github: ystael

-- 
-- 
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: does lein2 use repositories defined in ~/.m2/settings.xml?

2013-02-21 Thread Chris Jeris
On Thu, Feb 21, 2013 at 12:44 PM, Phil Hagelberg p...@hagelb.org wrote:

 It's possible, but highly discouraged. If your project requires certain
 repositories in order to operate, you should declare them in project.clj.


Just as a data point, we're currently using a profiles.clj on each of our
build agents to declare our internal Nexus repos (including our mirrors of
Maven Central and Clojars), because that is more maintainable for us than
repeating the entire repo declaration in every one of our project.clj
files.  For Maven projects, we can use a parent pom, but there isn't any
corresponding parent project concept for Leiningen, correct?

I experimented a bit with trying to use a Lein middleware to supply the
repo entries, but unless you install the middleware manually, that ends up
begging the question, since Lein has to know where to get the middleware.
-- 
Chris Jeris
cje...@brightcove.com
freenode/twitter/github: ystael

-- 
-- 
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: Help: instance? always false for record type (in tomcat but not in jetty)

2012-12-13 Thread Chris Jeris
In the Tomcat uberwar setting, is ns1 AOT-compiled?  Are (.getClassLoader
A) and (.getClassLoader (.getClass an-A-record)) different class loaders?
That's what the problem was when this one bit me.  I never did track down
exactly why it happens or how to fix it.

peace, Chris Jeris

On Thu, Dec 13, 2012 at 6:13 PM, CGAT genovese...@gmail.com wrote:

  I have a frustrating situation and would appreciate any help.
 The call

(instance? A  an-A-record)

 is returning false when an-A-record is in fact an instance of A.

 This is in a noir/compojure/ring server. But the problem *only* *occurs
 *when run under tomcat, *not* when run under Jetty. I'm guessing
 that I've missed declaring something properly, but I don't see what it is.
 (I hope this is a suitable forum for this question.)

 Here's the situation in more detail.

 In  ns1

   (defrecord A ...)
   (defrecord B ...)
   (defn AorB? [x] (or (instance? A x) (instance? B x)))
   (defn Afactory [] ...) ; makes an A

 In ns2, which   :require's ns 1 refering AorB? and Afactory and :imports A
 and B properly from ns1.

   (AorB? (Afactory))  ;=  true in jetty, false in tomcat

 I'm using Clojure 1.4.0, compojure 1.1.3, noir 1.3.0-beta10, 
 I use lein run to start the jetty server (with a suitable -main),
 and lein ring uberwar to create a warfile which runs under
 Apache Tomcat 6.0.24 (with JVM 1.6.0_26-b03).
 All the rest of the code appears to be behaving identically under either
 platform.

 I've been banging my head against the wall over this and would
 appreciate any help or pointers.  Thanks!


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




-- 
Chris Jeris
cje...@brightcove.com (617) 686-3271
freenode/twitter/github: ystael

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

AOT-compilation, record types and DynamicClassLoader

2012-10-16 Thread Chris Jeris
I have a problem where I am trying to do an isa? or instance? check on an
object of a record type which is defined in an AOT-compiled namespace.  The
isa? check fails because -- under circumstances which I do not yet well
understand -- the object I actually have is an instance of its class in a
clojure.lang.DynamicClassLoader, whereas a reference to the class by its
literal name yields the class in the base sun.misc.Launcher$AppClassLoader.

My Clojure code is compiled into a jar which is included into a Jetty
server whose app code is largely written in Java.  Here is an example which
illustrates the problem:

;; src/foo/core.clj
(ns foo.core)
(defrecord T [a b])

;; project.clj
(defproject foo 1.0.0-SNAPSHOT
  :dependencies [[org.clojure/clojure 1.4.0]]
  :aot [foo.core])

Now if I add the artifact foo/foo as a Maven dependency of the Jetty
server, and attach a liverepl to the running server (without taking any
action to call the Clojure code from Java), I see the following:

Clojure 1.4.0
user= (require '[foo.core])
nil
user= (.getClassLoader foo.core.T)
#AppClassLoader sun.misc.Launcher$AppClassLoader@a6eb38a
user= (.getClassLoader (type (foo.core.T. 1 2)))
#AppClassLoader sun.misc.Launcher$AppClassLoader@a6eb38a
user= (.getClassLoader (type (foo.core/-T 1 2)))
#DynamicClassLoader clojure.lang.DynamicClassLoader@433d3253

My actual case is more complicated, but the principle is the same:
instances of foo.core.T which were built by the defrecord constructor
function -T do not inhabit the AppClassLoader version of the class, but
rather a DynamicClassLoader version.  The result is that instance? or
instanceof checks -- whether in my own Clojure code or in that of Java
clients of my library who are trying to downcast -- do not behave as
expected.

This example cannot be reduced too far:  if one just builds an uberjar and
invokes a repl on the Clojure library alone, using 'java -cp
target/foo-1.0.0-SNAPSHOT-standalone.jar clojure.main', the result is
different:

Clojure 1.4.0
user= (require '[foo.core])
nil
user= (.getClassLoader foo.core.T)
#AppClassLoader sun.misc.Launcher$AppClassLoader@43be2d65
user= (.getClassLoader (type (foo.core.T. 1 2)))
#AppClassLoader sun.misc.Launcher$AppClassLoader@43be2d65
user= (.getClassLoader (type (foo.core/-T 1 2)))
#AppClassLoader sun.misc.Launcher$AppClassLoader@43be2d65

Unfortunately I don't understand enough about the Clojure class loading
mechanism to understand what might be causing the DynamicClassLoader to be
invoked in one case and not the other.

This problem seems to have been described by Ryan Senior about 20 months
ago on clojure-dev, but I do not find any follow-up posts:
https://groups.google.com/forum/?fromgroups=#!topic/clojure-dev/VBJFMEFBeFY

Can anyone shed light on the situation?

thanks, Chris Jeris
-- 
Chris Jeris
cje...@brightcove.com (617) 686-3271
freenode/twitter/github: ystael

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

2012-09-26 Thread Chris Jeris
I am also having trouble getting the nrepl-ritz debugger to start.  I am
able to start a repl with M-x nrepl-ritz-jack-in.  Then when I do M-x
nrepl-ritz-break-on-exception and type '(throw (Exception. OHAI))' into
the repl, what happens is that I see nrepl-dbg-setup 1 in the minibuffer
and the repl becomes unresponsive.  The process is still alive, but nothing
ever comes back to the buffer.

Am I missing some important part of setup here?  I have Clojure 1.4.0,
clojure-mode 1.11.5, nrepl.el 0.1.4, ritz 0.5.0, Emacs 24.2.1 on Mac OS
10.6; all the Emacs packages were installed from marmalade.

thanks, Chris Jeris

On Mon, Sep 24, 2012 at 10:49 PM, Hugo Duncan duncan.h...@gmail.com wrote:


 Tim,


 Timothy Washington twash...@gmail.com writes:

  I was following the instructions on the ritz-nrepl
  pagehttps://github.com/pallet/ritz/tree/develop/nrepl. And
  I get the error below, when executing the *M-x nrepl-ritz-jack-in*
  command.

 ...

  Caused by: java.lang.RuntimeException: Unable to resolve symbol: ex-info
 in
  this context
  at clojure.lang.Util.runtimeException(Util.java:156)
  at clojure.lang.Compiler.resolveIn(Compiler.java:6720)
  at clojure.lang.Compiler.resolve(Compiler.java:6664)
  at clojure.lang.Compiler.analyzeSymbol(Compiler.java:6625)
  at clojure.lang.Compiler.analyze(Compiler.java:6198)
  ... 171 more

 This seems to be an issue with clojure 1.4 not being used in the
 controlling vm, and should have been fixed by
 https://github.com/pallet/ritz/issues/53, which will be included in the
 next release.

  You mention that this is meant to be used in tandem with nrepl.el (*
  nrepl-jack-in*)? Because it looks like a parallel tool
 (*nrepl-ritz-jack-in*).

 You should be able to invoke nrepl-ritz-jack-in once nrepl-ritz.el is
 installed.

  Could you run through a typical workflow of setting and using the *M-x
  nrepl-ritz-break-on-exception* command? I just want to make sure that
 I'm
  grokking how to use it.

 After running  'M-x nrepl-ritz-break-on-exception', you should get the
 debugger activated on an exception. So, entering something like
 (throw (Exception. Hello)) at the repl should result in a debugger
 buffer being displayed, showing you a stacktrace.

 Hope that helps,

 Hugo

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




-- 
Chris Jeris
cje...@brightcove.com (617) 686-3271
freenode/twitter/github: ystael

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