Re: clojure debugging repl

2014-01-24 Thread Alexandr Kurilin
I've been looking for a simple and convenient to use clojure debugger for
ages now and would love to hear your recommendations. I'm a vim-fireplace
user as well, if that makes a difference.

I'd love to be able to set breakpoints in a running clojure application,
step through the code and inspect locals and the referencing environment.
Anything that gets me off of the time-consuming process of adding
timbre/clojure.tools.trace statements would be really welcome. Is vim-redl
the closest I can get to that, or is ritz the way to go? Any other
recommendations?

I'll have to checkout JoC2's chapter on that, that sounds really helpful.


On Fri, Jan 24, 2014 at 4:11 PM, dgrnbrg dsg123456...@gmail.com wrote:

 I have an implementation of this that's thoroughly integrated into vim.

 clojure code: https://github.com/dgrnbrg/redl
 vim plugin: https://github.com/dgrnbrg/vim-redl

 The code itself is written with core.async, and is capable of monitoring a
 thread, inspecting its stack while its running, stopping it, and
 programmatically creating breakpoints that give you a repl with captured
 locals.

 I'd love for this work to be extended to a generic nrepl handler, but I
 don't have the time to do so at the moment.


 On Friday, January 24, 2014 6:46:23 PM UTC-5, Jarrod Swart wrote:

 The second version of The Joy of Clojure talks about building a debugging
 repl that allows insertion of breakpoints into code.  Perhaps something
 similar could be done here.

 On Friday, January 24, 2014 4:38:59 PM UTC-5, t x wrote:

 Found it, apparently it's

 debug-repl = swank-clojure = CDT = ritz

 It appears cider does not yet support this, so ritz is probably the
 most powerful at the moment.


 On Fri, Jan 24, 2014 at 3:39 AM, t x txre...@gmail.com wrote:

 Hi,

   One thing I miss from pre-Clojure scheme days is as follows:

 ## What I want

 1 = (foo) ;; I'm calling foo at the repl
 ... foo executes ...
 ... at some point, an exception is thrown ...

 2 = my interpreter _starts a new repl_
   * at the point where the exception was thrown
   * lets me examine local environment variables
   * lets me execute commands
   * lets me resume the execution


 ## Why it can't work

 Now, I understand why this can not work in general in Clojure, i.e. the
 following example:

 (defn foo []
   (.someJavaFunctionThatThrowsException object))

 In this case, the above is impossible since the exception is thrown
 from _java land_ rather than Clojure land.


 ## Why it might work

 Now, I'm not writing any code in java. The work I'm doing is pure
 clojure. I can throw when the exception is thrown.


 Is there some library, where instead of doing

 (defn foo []
   ...
   (throw (ex-data ...))
   ...)

 I instead do:

 (defn foo []
   ...
   (something-went-wrong-please-fire-up-a-repl)
   ...)

 ?

 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.




-- 
Alexandr Kurilin
206.687.8740 | @alex_kurilin https://twitter.com/alex_kurilin |
bloghttp://www.kurilin.net

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


What's your testing flow with the current clj tools?

2014-01-24 Thread Alexandr Kurilin
I've been running my app's tests through `lein test` (most often for
specific namespaces) for a long time now, but after reading Leiningen's
recommendationhttps://github.com/technomancy/leiningen/blob/stable/doc/TUTORIAL.md#teststo
run them from the REPL I decided I should figure out how to make this
happen.

I've heard a few options on this subject, and would love to know what you
yourselves use. A couple I stumbled upon were:


   - In your favorite editor with nrepl/cider, do some work in the ns
   you're testing, reload it from within the editor, then switch to the
   testing ns and run (clojure.test/run-tests) from within. Then when you're
   done with your work, run a `lein test` just in case your state while
   nrepling in was corrupted or another ns was affected etc.
   - Use your favorite editor with nrepl/cider to work on the app's ns, but
   then switch to a repl started within `lein repl` in which you're only
   running tests. This potentially helps with a slightly cleaner state. (I'm
   not clear how you'd reload the app's ns without the hassle of having to
   always (require) the right set of changed nses)
   - In a new `lein repl`, use bultitude, load all test nses, use
   clojure.test/run-all-tests with the right regex. Like `lein repl`, minus
   having to spin up a new JVM every time.

I'm currently playing around with the first approach. I'd love to know if I
missed something much more effective, or if I can make this a bit simpler
and less manual. Tips would be greatly welcome.

Cheers!

-- 
Alexandr Kurilin
206.687.8740 | @alex_kurilin https://twitter.com/alex_kurilin |
bloghttp://www.kurilin.net

-- 
-- 
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: Adding query customization to Ring-based REST APIs

2014-01-21 Thread Alexandr Kurilin
That's a great point of reference, thanks for the tip. I'm in the market
mostly for bits and pieces that I can stitch onto my project, so something
like service-hub-examples is a great way to see how it's used. I haven't
used protocols much, your project seems like a pretty good fit for them.


On Sun, Jan 12, 2014 at 11:03 PM, Jan Herich jan.her...@gmail.com wrote:

 Hello Alexander,

 I did some work in this area some time ago, and the result was service-hub
 library https://github.com/ITEdge/service-hub - created to simplify
 basic CRUD services.
 It's designed to allow more then one type of data-store, currently it
 supports SQL databases (i use my own fork of korma here),
 simple in-memory data-stores and datomic.
 I built it around a set of handler protocols which define what basic and
 more advanced data-store implementations can do,
 you can see those 
 herehttps://github.com/ITEdge/service-hub/blob/master/core/src/itedge/service_hub/core/handlers.clj
 .
 Furthermore, the library tries to also simplify validations,
 authorizations and wrapping those ready-to-be-exposed-to-outer-world
 services behind another set of services protocols, see 
 herehttps://github.com/ITEdge/service-hub/blob/master/core/src/itedge/service_hub/core/services.clj
 .
 You can then simply use library web layer to automatically expose those
 instances over web via ring  compojure libraries.
 Regarding translating requests maps to data-structures for data-store
 implementations, see for example korma util 
 namespacehttps://github.com/ITEdge/service-hub/blob/master/persistence-korma/src/itedge/service_hub/persistence_korma/util.clj
 or datomic util 
 namespacehttps://github.com/ITEdge/service-hub/blob/master/persistence-datomic/src/itedge/service_hub/persistence_datomic/util.clj
 .
 There are also some examples of such CRUD based web-services in project
 service-hub-examples https://github.com/ITEdge/service-hub-examples.

 I hope it will help you, or at least provides some clues

 Dňa pondelok, 13. januára 2014 3:25:40 UTC+1 Alexandr Kurilin napísal(-a):

 I'm investigating adding query options to my Ring app's GET requests for
 the more boring CRUD routes.

 I'd like to allow the caller to specify a set of SQL-level query
 customizations such as sorting, paging, counting, distinct ons, limits,
 some basic constraints etc. across all of my resources, ideally in such a
 way that I only have to write this once and it will magically just work
 across the board.

 First of all, there's the hard question of elegantly designing the API
 itself and how a caller will be able to specify query details. I have some
 experience with how Parse.com does this with their JSON requests (they
 pretty much allow you to specify the whole query in there), but I've heard
 Stack Overflow's and Elastic Search's APIs mentioned as good examples as
 well. Any other ones you'd recommend?

 Second, there's the whole business of translating those maps into
 requests. As far as I can tell, Korma is the right fit here, but I might be
 also missing out on another good SQL-generation library that I should know
 of, something I might integrate directly with clojure.jdbc. This doesn't
 sound like an unsolved problem.

 Folks, I could use words of wisdom on the subject. Have you done this
 kind of work on your APIs before? What did you use for reference? Anything
 clojure-specific I could leverage here to make it as elegant and concise as
 possible?

 Cheers!

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




-- 
Alexandr Kurilin
206.687.8740 | @alex_kurilin https://twitter.com/alex_kurilin |
bloghttp://www.kurilin.net

-- 
-- 
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] Yesql 0.3.0 - Clojure SQL queries rethought.

2014-01-20 Thread Alexandr Kurilin
I might have missed this in the docs, but is there support for c.j.j's
optional keyword arguments such as :row-fn and :identifiers? I couldn't
quite figure out how to get that to work with yesql, as far as I can tell
you can only pass query parameters at this point.


On Thu, Jan 9, 2014 at 3:00 PM, Kris Jenkins krisajenk...@gmail.com wrote:

 Hmm...I'll have to mull that one. I have been thinking that I'm going to
 leave the whole issue of namespaces to Clojure, and let the call-site of
 (defqueries) decide. But I'll have to think it through some more. :-)

 Kris

 On Wednesday, 8 January 2014 00:26:58 UTC, Marco Shimomoto wrote:

 It looks great and I will try it.
 Have you thought about namespaces and different database implementations?
 Something like a general repository for SQL files and some vendor
 specific override repositories.

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




-- 
Alexandr Kurilin
206.687.8740 | @alex_kurilin https://twitter.com/alex_kurilin |
bloghttp://www.kurilin.net

-- 
-- 
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: Managing role-based permissions in Ring apps

2014-01-13 Thread Alexandr Kurilin
Disclaimer: I think what Friend is trying to do is super important and
cemerick rocks.

However, I found Friend to be really difficult to grok the first time I
took a stab at it many months ago, perhaps I'm more capable of getting into
it now. My concern was that it is so broadly encompassing and there are too
few examples of how to use it in scenarios similar to the ones I face every
day. For example, I ended up rolling my own cookie-based role auth
middleware (relying on Ring's cookie store) in about 15 lines of clj,
significantly simpler for a basic scenario.

By the way, it would be really neat if someone added a Friend chapter to
the upcoming Clojure Cookbook. I created an issue for it over 6 months ago
and nobody's taken it up so far, so I can't tell if most of the community
has given up on the library or if it's just too much of a hassle to explain
to others.


On Sun, Jan 12, 2014 at 11:40 PM, Stefan Kamphausen ska2...@gmail.comwrote:



 On Monday, January 13, 2014 3:53:43 AM UTC+1, Sam Ritchie wrote:

 cemerick's Friend library is the way to do this:

 https://github.com/cemerick/friend

 I'm writing up a post on how to combine Friend with Liberator, for easy
 ACL management for RESTful APIs. Take a look and let us know what you think!


 Can't wait to read that post. :)

 stefan

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




-- 
Alexandr Kurilin
206.687.8740 | @alex_kurilin https://twitter.com/alex_kurilin |
bloghttp://www.kurilin.net

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


Managing role-based permissions in Ring apps

2014-01-12 Thread Alexandr Kurilin
My Ring app is undergoing growing pains: I think I need some kind of
abstraction for managing user permissions when working with my RDBMS. Our
system has few user roles and they all own or have rights to a bunch of
data in a hierarchical fashion e.g. admin  manager  employee etc.

So far I've gotten away with manually writing permissions checks as part of
input validation functions in my Ring handlers. Mississippi takes care of
the basic input validation step, then I do some higher level checking,
including permissions, and then in case of a POST/UPDATE I attempt an
insertion and listen for SQL exceptions. At the end I generate the right
HTTP code.

The problem is that I have to write a bespoke check for each separate
route, often having to account for 2-3 user types, each with a different
set of tables to join to validate permissions. Business rules like is the
requesting user A in the same group as the requested user B? If not, return
403 or is requesting user A owner of the group user B is part of? If not,
return 403 etc.

My gut feeling is that this should be handled in a much more abstract and
declarative fashion. I should be able to say: if user type X requesting
data type Y with operation Z, check X-to-Y ACL table for whether the user
has that right. Then I can just declare these business rules in a central
location (akin to routes) and know that I didn't accidentally mess
something up UTing might get simpler too. I think the Rails gem CanCan does
something similar to the above.

Now, does anybody have suggestions regarding this pattern? Have you added
something similar to your project or did you opt for a different design?
Any clj libraries you found useful here?

Cheers!

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


Adding query customization to Ring-based REST APIs

2014-01-12 Thread Alexandr Kurilin
I'm investigating adding query options to my Ring app's GET requests for
the more boring CRUD routes.

I'd like to allow the caller to specify a set of SQL-level query
customizations such as sorting, paging, counting, distinct ons, limits,
some basic constraints etc. across all of my resources, ideally in such a
way that I only have to write this once and it will magically just work
across the board.

First of all, there's the hard question of elegantly designing the API
itself and how a caller will be able to specify query details. I have some
experience with how Parse.com does this with their JSON requests (they
pretty much allow you to specify the whole query in there), but I've heard
Stack Overflow's and Elastic Search's APIs mentioned as good examples as
well. Any other ones you'd recommend?

Second, there's the whole business of translating those maps into requests.
As far as I can tell, Korma is the right fit here, but I might be also
missing out on another good SQL-generation library that I should know of,
something I might integrate directly with clojure.jdbc. This doesn't sound
like an unsolved problem.

Folks, I could use words of wisdom on the subject. Have you done this kind
of work on your APIs before? What did you use for reference? Anything
clojure-specific I could leverage here to make it as elegant and concise as
possible?

Cheers!

-- 
-- 
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] Yesql 0.3.0 - Clojure SQL queries rethought.

2014-01-07 Thread Alexandr Kurilin
This is neat, I'll need to give this a shot.

Our application involves a lot of OLAP-style queries and I currently have
several DAL namespaces of  clojure.jdbc with 30+ lines of SQL query in
them, which is pretty nasty to look at. This should clean up things nicely.


On Tue, Jan 7, 2014 at 4:26 PM, Marco Shimomoto mashi...@gmail.com wrote:

 It looks great and I will try it.
 Have you thought about namespaces and different database implementations?
 Something like a general repository for SQL files and some vendor specific
 override repositories.

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




-- 
Alexandr Kurilin
206.687.8740 | @alex_kurilin https://twitter.com/alex_kurilin |
bloghttp://www.kurilin.net

-- 
-- 
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] quickie- autotest plugin for clojure.test

2013-09-13 Thread Alexandr Kurilin
Thanks for putting this plugin together, very useful!

A couple of remarks:

   - Seems to the advantage over aphyr/prism in terms of not forcing you to
   use the foo-test convention, for those of us who are keeping same names as
   the namespaces in the test/ folder. It's possible I'm being non-idiomatic
   here and I should suffix tests with -test instead.
   - Looks like it's not running under the test leiningen profile. In my
   case, I suppress a lot of logging in test mode to keep lein test output
   readable, and quickie bypasses that. I'm not sure if perhaps I'm just not
   logging things the right way and this is a wontfix.
   - Would be very neat if it re-ran only the tests that changed, or whose
   corresponding namespace contents changed.

Thanks!


On Fri, Sep 13, 2013 at 12:36 PM, Jake Pearson jpear...@rallydev.comwrote:

 Hi,
 I added a screenshot to the readme.  I think in general filtering items
 from the stacktrace is a good idea, but I am probably doing it too much.  I
 have an idea.  I will work on it this weekend.

 thanks,
 Jake


 On Friday, September 13, 2013 12:21:00 PM UTC-6, Christopher Allen wrote:

 Link:

 https://github.com/**jakepearson/quickiehttps://github.com/jakepearson/quickie

 Is it possible to see *some* of the stack trace so you can debug?

 Also you should include a screenshot of what the library looks like in
 action. :)


 On Friday, September 13, 2013 10:57:35 AM UTC-7, Jake Pearson wrote:

 Hi,
 Quickie is a leiningen plugin to autotest clojure.test tests.  There
 don't seem to be any active projects for clojure.test, so a couple of
 people at my office wrote one.  Please let me know if you have any problems
 or ideas:

- Uses the builtin clojure.test test runner so you don't need to
rewrite your tests
- Tools.namespace will unload and reload namespaces as needed to
keep process in sync
- Runs every time a clojure file in your project changes
- Uses 
 (Clansi)[https://github.com/**ams-clj/clansihttps://github.com/ams-clj/clansi]
to show a red or green bar to know if you tests are passing
- Filters out exception stacktraces to remove cruft

 thanks,
 Jake

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




-- 
Alexandr Kurilin - Front Row Education (www.frontrowed.com)
206.687.8740 | a...@kurilin.net
@alex_kurilin

-- 
-- 
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: Functional purity and globals in Clojure

2013-09-11 Thread Alexandr Kurilin
://github.com/mikera/alchemy/blob/master/src/main/clojure/mikera/alchemy/main.clj
  
   On Tuesday, 10 September 2013 15:19:35 UTC+8, Alexandr Kurilin wrote:
   
I'm trying to determine how to best deal with the concept of
 globals in
Clojure. Say I have a map of configuration values for my Ring app,
 populate
at app startup from disk or env, and I need to reference the
 contents of
this map from all over the project. Assuming MVC, models and
 controllers
all would be interested in its contents. I just want to clarify
 that the
question is not so much about configuration as it is about
 dealing with
state that many different components in an application might be all
interested in. This is an issue that seems to arise very often.
   
I'm seeing a couple of options here:
   
   - Pass the configs map along with each Ring request with some
   middleware, and then down every subsequent function call that
 might
   eventually need it. It's a bit of a hassle since now you're
 passing more
   data, potentially increasing the # of parameters, or forcing you
 to use a
   parameter map everywhere where you might have passed along just 1
   primitive. Nonetheless, this is as pure as it gets.
   - Def the configs map in a namespace somewhere and refer to it
 from
   wherever, just like global state. The trick is now that now
 you're no
   longer certain what e.g. your model functions are expecting
 there to be in
   the system and testing becomes trickier. Now you have to either
 lein test
   with a separate set of configurations (which doesn't actually
 give you much
   per-test granularity) or use with-redefs everywhere to make sure
 the right
   test config state is being used.
   - Something in the middle where perhaps you agree to never
 directly
   reference the configs map from your models (again, thinking MVC
 here) and
   instead only ever access it from controllers, and pass the
 necessary
   options along down to the model functions. This way you can test
 both
   controllers and models in isolation in purity.
   
Ultimately I want to contain the chaos of having to know internal
implementation details of my functions at different layers and want
 them to
be easily testable in isolation. It does seem like the first option
 is the
most straightforward, but I'd be curious to find out what those of
 you who
have deal with the problem for a while would recommend. Purity all
 the way,
or are there patterns that can give you the best of both worlds? Or
 what
else?
   
   
   
  
   --
   --
   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.
  
   --
   Softaddictslprefonta...@softaddicts.ca sent by ibisMail from my
 ipad!
  
   --
   --
   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.
 
 --
 Softaddictslprefonta...@softaddicts.ca sent by ibisMail from my

Functional purity and globals in Clojure

2013-09-10 Thread Alexandr Kurilin
I'm trying to determine how to best deal with the concept of globals in 
Clojure. Say I have a map of configuration values for my Ring app, populate 
at app startup from disk or env, and I need to reference the contents of 
this map from all over the project. Assuming MVC, models and controllers 
all would be interested in its contents. I just want to clarify that the 
question is not so much about configuration as it is about dealing with 
state that many different components in an application might be all 
interested in. This is an issue that seems to arise very often.

I'm seeing a couple of options here:

   - Pass the configs map along with each Ring request with some 
   middleware, and then down every subsequent function call that might 
   eventually need it. It's a bit of a hassle since now you're passing more 
   data, potentially increasing the # of parameters, or forcing you to use a 
   parameter map everywhere where you might have passed along just 1 
   primitive. Nonetheless, this is as pure as it gets.
   - Def the configs map in a namespace somewhere and refer to it from 
   wherever, just like global state. The trick is now that now you're no 
   longer certain what e.g. your model functions are expecting there to be in 
   the system and testing becomes trickier. Now you have to either lein test 
   with a separate set of configurations (which doesn't actually give you much 
   per-test granularity) or use with-redefs everywhere to make sure the right 
   test config state is being used.
   - Something in the middle where perhaps you agree to never directly 
   reference the configs map from your models (again, thinking MVC here) and 
   instead only ever access it from controllers, and pass the necessary 
   options along down to the model functions. This way you can test both 
   controllers and models in isolation in purity.

Ultimately I want to contain the chaos of having to know internal 
implementation details of my functions at different layers and want them to 
be easily testable in isolation. It does seem like the first option is the 
most straightforward, but I'd be curious to find out what those of you who 
have deal with the problem for a while would recommend. Purity all the way, 
or are there patterns that can give you the best of both worlds? Or what 
else?


-- 
-- 
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: new ClojureDocs experiment

2013-09-08 Thread Alexandr Kurilin
I use clojuredocs daily and would definitely benefit from it being as 
up-to-date as possible. I wasn't even aware of those two macros you listed, 
which is a bummer and a good indication that a replacement might be 
warranted.

I'd be happy to use your wiki as a day-to-day reference, or we can somehow 
keep ClojureDocs more up to date, although I'm not sure who's running it.

On Sunday, September 8, 2013 1:07:33 AM UTC-7, Steven Degutis wrote:

 ClojureDocs.org is pretty awesome, I think I use it nearly every day, 
 especially for the Examples and See Also sections. But sometimes I've 
 been wishing it had Clojure 1.5.1 support. For example, I think as- 
 and cond- would have been easier for me to pick up had there been 
 entries for these with community-driven Examples. 

 A while back, someone told me complaining is laziness. So I worked 
 on an experiment that I'd like to propose to you all. It's a github 
 wiki that's been seeded with data scraped from in-process docs and 
 clojuredocs.org's API. Here it is: 

 https://github.com/sdegutis/clojuredocs/wiki 

 Pros: 
 - Docs are for Clojure 1.5.1 
 - Anyone logged into github can edit it 
 - Any part of it can be edited (to fix typos in docstring, etc) 
 - All namespaces are shown on the Home page for easy searching 
 - Free hosting, free database storage :) 

 Cons: 
 - Doesn't have dynamic relevance-based search field 
 - Doesn't have an API (but an external one could be built) 
 - Doesn't have Quick Ref tables (yet) 
 - A few URLs are kind of ugly 
 - The namespace-navigation bar is gone, you'd have to click Home 
 - Doesn't store nearly as much data as clojuredocs.org does 

 (But as usual, pros/cons are totally subjective to individual needs. 
 This is just how I saw it. These tables may be reversed for you, who 
 knows.) 

 Right now, it only has core namespaces. But I've made it easy to add 
 data from new namespaces, so long as the right dependencies are added 
 to project.clj. 

 Thoughts? 

 -Steven 


-- 
-- 
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 in the Large style JDBC library

2013-09-07 Thread Alexandr Kurilin
I've been using clojure.java.jdbc for a while and have been able to get 
away with the query and execute! functions for most of the work, frequently 
wrapping them with transactions. All three, from what I recall, give you 
the option of either using an open connection (very useful for 
transactions) or to just pass in a map with DB configs that will be used to 
open a new connection right there and then. I remember switching away from 
korma and its defdb partially for that reason.

On Friday, September 6, 2013 7:43:42 AM UTC-7, Jason Gilman wrote:

 That's excellent. I'll feel more comfortable using it in that case.


 On Fri, Sep 6, 2013 at 8:31 AM, Justin Kramer jkkr...@gmail.comjavascript:
  wrote:

 clojure.java.jdbc is transitioning to an API that uses explicit passing 
 of db context - see e.g. the db-find-connection and query functions. The 
 functions that look for a dynamically-scoped db are deprecated - 
 e.g., find-connection, with-query-results.

 Justin


 On Friday, September 6, 2013 8:20:11 AM UTC-4, Jason Gilman wrote:

 It looks like java.jdbc would work since it offers the get-connection 
 function that returns a new connection that can be passed to most of the 
 functions that operate on the database. I'm still concerned by the 
 preponderance of functions with documentation like Executes SQL commands 
 on the open database connection. or Returns the current database 
 connection (or throws if there is none). It smells like there are vars 
 being held onto by the library that hold database connections or other 
 state. It could still work out if I'm careful about which functions I call. 

 What I'd really like is a library that returns some kind of context 
 object when it connects and all functions that operate on the database take 
 that context as an arguments. This is way more flexible, easier to test and 
 fits more in line with the style I was going for. I'm still curious if 
 there are other people out there who want use that same style and have to 
 work with a relational database. I'd like to know if they just accept 
 that's the way the libraries are written or if they have ways to get around 
 it.




 On Fri, Sep 6, 2013 at 7:17 AM, Shantanu Kumar kumar.s...@gmail.comwrote:

 Hi Jason,

 Did you look at (URLs below) clojure/java.jdbc and HoneySQL? I'd be 
 interested to know if you are looking for anything different from these:

 http://clojure-doc.org/**articles/ecosystem/java_jdbc/**home.htmlhttp://clojure-doc.org/articles/ecosystem/java_jdbc/home.html

 https://github.com/clojure/**java.jdbc/https://github.com/clojure/java.jdbc/

 https://github.com/jkk/**honeysql https://github.com/jkk/honeysql

 Shantanu


 On Friday, 6 September 2013 16:28:09 UTC+5:30, Jason Gilman wrote:

 I've been trying to setup all my projects in the style Stuart Sierra 
 documented in Clojure in the 
 Largehttp://www.infoq.com/presentations/Clojure-Large-scale-patterns-techniques
  and My Clojure Workflow, 
 Reloadedhttp://thinkrelevance.com/blog/2013/06/04/clojure-workflow-reloaded.
  
 I've been trying to only use libraries that don't store any explicit 
 mutable state in vars. I've been having trouble finding a Clojure JDBC 
 library that does this. It seems like they all put the connection in some 
 kind of var or other area. I know I could just use the Java JDBC APIs 
 directly but I was hoping to avoid concatenating a bunch of SQL in my 
 Clojure and dealing with these lower level APIs. Does anyone have any 
 recommendations for Clojure libraries that might allow this? I'm also 
 wondering if there might be a Java library with a higher level API that 
 might allow this style. I'm betting other people have run into this issue 
 with relational databases and if they have any tips for how to avoid it. 
 (and yes I'm aware of Datomic :) )

  -- 
 -- 
 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=enhttp://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to a topic in the 
 Google Groups Clojure group.
 To unsubscribe from this topic, visit https://groups.google.com/d/**
 topic/clojure/CpP0pr7bC-Y/**unsubscribehttps://groups.google.com/d/topic/clojure/CpP0pr7bC-Y/unsubscribe
 .
 To unsubscribe from this group and all its topics, send an email to 
 clojure+u...@**googlegroups.com.

 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://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 clo...@googlegroups.comjavascript:
 Note that posts from 

Re: [ANN] Blackwater 0.0.5 released (SQL query logging)

2013-09-07 Thread Alexandr Kurilin
This is awesome, thanks for making it, will try to integrate it asap. I'm 
not a Korma user, so it'll be good to see how well it plays with clojure 
jdbc.

Just to confirm, is the recommendation to use this only at development 
time? It's been a while since Rails and I don't recall if they turn off SQL 
logging in production mode.

On Friday, August 30, 2013 9:46:43 AM UTC-7, Christopher Allen wrote:

 https://github.com/bitemyapp/blackwater/

 Clojure library for logging SQL queries and the time they took for Korma 
 and clojure.java.jdbc.

 I like having a 'canary in the coal mine' while developing locally so that 
 I can see the queries getting executed and the time they took to run, 
 similar to Rails query logging. The library stands alone although this 
 imports specific (recent) versions of c.j.j and Korma, exclude and replace 
 as you need to.

 Some users to help me shake this out beyond how I use it (I'm primarily a 
 Korma guy) would be very useful, Github Issues and PRs very welcome!

 Thanks everybody. I've got another library to announce once a friend helps 
 me do some testing with it.

 --- Chris



-- 
-- 
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: Introducing a new SQL migration library for clojure / jdbc

2013-09-07 Thread Alexandr Kurilin
This is great, thanks for making it.

There was nothing quite like that I could find back when I started on our 
web app, so I ended using 
standalone_migrationshttps://github.com/thuss/standalone-migrations, 
which is essentially ActiveRecord's Migration module extracted for 
standalone use. Right now it has the advantage over clj-sql-up of 
supporting multiple environments, but it does unfortunately force you to 
have ruby support a Gemfile etc, which isn't as awesome as doing everything 
through clojure.

I'll be following clj-sql-up's progress :)

On Saturday, July 20, 2013 6:35:29 PM UTC-7, Plinio Balduino wrote:

 Thank you, Chris

 I think it will be very useful for my next project.

 Regards

 Plínio

 On Sat, Jul 20, 2013 at 7:19 PM, Chris Kuttruff 
 kutt...@gmail.comjavascript:
  wrote:

 When starting a project to create a clojure blog with 
 ring/compojure/hiccup, I quickly found myself looking for an SQL migration 
 library to use.

 There are some interesting projects out there, but I found myself wanting 
 the following features:

- A standard up/down migration method setup (so I could execute 
multiple migrate/rollback statements within a clojure file) 
- The ability to execute arbitrary SQL (including creation of 
triggers/stored procedures)
- A generic structure to support as many databases as possible
- A simple create method (to generate migration files) 

 I have used other migration setups (eg: rails), and was looking for 
 something similar in terms of features and simplicity of usage.

 The following leiningen plugin is my attempt to accomplish the 
 aforementioned objectives as simply as possible:

 https://github.com/ckuttruff/clj-sql-up

 I am new to clojure / leiningen, so any suggestions / feedback would be 
 much appreciated.  It's still very much a work in progress; I plan to add 
 many more tests, clean up some of the repetition/inelegance, and make 
 various aspects more generic.

 Thanks for your time and consideration; I hope this library can be of use 
 to others.

 -Chris

 -- 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.comjavascript:
 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 javascript:
 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 javascript:.
 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.


How do you configure your Ring apps?

2013-09-07 Thread Alexandr Kurilin
I'm curious to find out how you folks decided to organize configuration for 
your Ring applications, assuming you also use configuration management like 
Puppet/Ansiblet etc to deploy them.

So far I've been using a combination of daemontools' envdir (through runit) 
+ weavejester's environ https://github.com/weavejester/environ for things 
like db address, db password, cookie secret keys, logging level etc. Each 
one is an individual file in root-only folder that runit envdirs from.

I honestly can't decide whether a single configuration file (YAML, EDN, 
whatever) would be more appropriate for this scenario or if I should go 
ahead and continue keeping each configuration value in its own file and use 
env to load them.

What are people's thoughts on this? Any reason why one or the other would 
be better, or is there an even better option out there I'm not considering?

-- 
-- 
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: Model validation - exceptions as side-effects?

2013-08-17 Thread Alexandr Kurilin
Leonardo, that's an interesting solution, thanks for writing it out and 
giving me some food for thought.

My thought process was that at this point I have a pure API that either 
gets the right inputs or it simply does nothing. As in, no helping messages 
about what went wrong, no attempt to do recovery. Some claim that for 
security purposes errors encountered by the API should be as opaque as 
possible to leak few internal details, so that's vaguely the direction I'm 
going in at this point, even though you lose on the development front.

I'd love to know your expert opinion on this, since you wrote Bouncer: say 
you're in the situation I listed above, where you don't care about nice 
error handling, you just want to give the caller a 400 if the input is 
incorrect. Would you still go the route where the validator function 
returns a list of errors? My concern is that now I have to have additional 
checks in place in my controller for whether the model save returned a list 
of errors, which will regardless ultimately result in a 400 status code.

Thanks!

(BTW, your blog is great, great content)

On Friday, August 16, 2013 7:28:51 PM UTC-7, Leonardo Borges wrote:

 I would prefer not throwing an exception in the case of a validation.

 Say your validation function returns a vector or the first argument 
 contains validation errors if any and the second contains the original map:

 (validate my-map) ;; returns [{:errors '(blah)} original-map]


 Then a neat way to write your function, taking advantage or core.match[1], 
 would be this:

 (defn my-fn [my-map]
   (match (validate my-map)
   [{:errors errors} original-map] (handle-errors)
   [_ original-map] (save original-map)))

 This is my personal preference. It's concise, elegant and idiomatic in 
 languages that support pattern matching.

 If you'd rather not use core.match for whatever reason, I'd still opt out 
 of throwing an exception. The function would just need a little bit more 
 code to simulate the behaviour above.

 [1]: https://github.com/clojure/core.match

 Leonardo Borges
 www.leonardoborges.com


 On Sat, Aug 17, 2013 at 12:08 PM, Alexandr Kurilin 
 al...@kurilin.netjavascript:
  wrote:

 Let's hypothetically say I have a Ring application and I'm performing 
 some validation on the input map I receive as part of a POST request. The 
 validate function throws an exception if anything's wrong with the input. 
 The exception is caught in the middleware and turned into a 400 code 
 response.

  I could do either:

 (- input
  validate
  save)

 or I could do:

 (do
   (validate input)
   (save input))

 The former doesn't really buy me anything, since a new version of input 
 would never be returned by validate. It is however side-effect free in a 
 way?
 The latter is probably less idiomatic, but makes it obvious that input is 
 not changing as part of the evaluation.

 What would be the more elegant way of handling this? Is the do block 
 approach somehow inferior?

 Thanks!

 -- 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.comjavascript:
 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 javascript:
 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 javascript:.
 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.


Model validation - exceptions as side-effects?

2013-08-16 Thread Alexandr Kurilin
Let's hypothetically say I have a Ring application and I'm performing some 
validation on the input map I receive as part of a POST request. The 
validate function throws an exception if anything's wrong with the input. 
The exception is caught in the middleware and turned into a 400 code 
response.

 I could do either:

(- input
 validate
 save)

or I could do:

(do
  (validate input)
  (save input))

The former doesn't really buy me anything, since a new version of input 
would never be returned by validate. It is however side-effect free in a 
way?
The latter is probably less idiomatic, but makes it obvious that input is 
not changing as part of the evaluation.

What would be the more elegant way of handling this? Is the do block 
approach somehow inferior?

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.


ExceptionInInitializerError in clojure.main in every clojure lein project.

2013-06-01 Thread Alexandr Kurilin
Hello folks,

I'm wondering if someone out there might have encountered this problem 
before. I'm not sure when exactly it started, perhaps 2-3 days ago, but 
ever since I have not been able to run neither lein repl nor lein ring 
server[-headless] on this machine on any of my leiningen-created clojure 
projects. The machine I'm running on is a Ubuntu 12.04 LTS box with 
java-7-openjdk.

As an example, I can create a new lein project with lein new justatest 
and run lein repl in its folder right away, and I will get the following 
error:

Exception in thread main java.lang.ExceptionInInitializerError
at clojure.main.clinit(main.java:20)
Caused by: java.lang.IllegalStateException: Attempting to call unbound fn: 
#'clojure.core/refer
at clojure.lang.Var$Unbound.throwArity(Var.java:43)
at clojure.lang.AFn.invoke(AFn.java:39)
at clojure.lang.Var.invoke(Var.java:415)
at clojure.lang.RT.doInit(RT.java:460)
at clojure.lang.RT.clinit(RT.java:329)
... 1 more
Could not find the main class: clojure.main. Program will exit.
Exception in thread Thread-1 clojure.lang.ExceptionInfo: Subprocess 
failed {:exit-code 1}
at clojure.core$ex_info.invoke(core.clj:4327)
at leiningen.core.eval$fn__1963.invoke(eval.clj:213)
at clojure.lang.MultiFn.invoke(MultiFn.java:231)
at leiningen.core.eval$eval_in_project.invoke(eval.clj:283)
at leiningen.repl$start_server.invoke(repl.clj:117)
at leiningen.repl$server$fn__4421.invoke(repl.clj:173)
at clojure.lang.AFn.applyToHelper(AFn.java:159)
at clojure.lang.AFn.applyTo(AFn.java:151)
at clojure.core$apply.invoke(core.clj:617)
at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1788)
at clojure.lang.RestFn.invoke(RestFn.java:425)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at clojure.core$apply.invoke(core.clj:621)
at clojure.core$bound_fn_STAR_$fn__4102.doInvoke(core.clj:1810)
at clojure.lang.RestFn.invoke(RestFn.java:397)
at clojure.lang.AFn.run(AFn.java:24)
at java.lang.Thread.run(Thread.java:679)


Does this ring a bell at all? I have seen this error pop up a couple of 
times when Googling around, but no conclusive solutions that are applicable 
to my situation.

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.




Re: ExceptionInInitializerError in clojure.main in every clojure lein project.

2013-06-01 Thread Alexandr Kurilin
Answering myself on this one, thanks to hiredman from #clojure.

The 1.5.1 clojure jar was somehow broken, nuking the folder and letting 
leiningen re-fetch it fixed it.

On Saturday, June 1, 2013 11:11:41 AM UTC-7, Alexandr Kurilin wrote:

 Hello folks,

 I'm wondering if someone out there might have encountered this problem 
 before. I'm not sure when exactly it started, perhaps 2-3 days ago, but 
 ever since I have not been able to run neither lein repl nor lein ring 
 server[-headless] on this machine on any of my leiningen-created clojure 
 projects. The machine I'm running on is a Ubuntu 12.04 LTS box with 
 java-7-openjdk.

 As an example, I can create a new lein project with lein new justatest 
 and run lein repl in its folder right away, and I will get the following 
 error:

 Exception in thread main java.lang.ExceptionInInitializerError
 at clojure.main.clinit(main.java:20)
 Caused by: java.lang.IllegalStateException: Attempting to call unbound fn: 
 #'clojure.core/refer
 at clojure.lang.Var$Unbound.throwArity(Var.java:43)
 at clojure.lang.AFn.invoke(AFn.java:39)
 at clojure.lang.Var.invoke(Var.java:415)
 at clojure.lang.RT.doInit(RT.java:460)
 at clojure.lang.RT.clinit(RT.java:329)
 ... 1 more
 Could not find the main class: clojure.main. Program will exit.
 Exception in thread Thread-1 clojure.lang.ExceptionInfo: Subprocess 
 failed {:exit-code 1}
 at clojure.core$ex_info.invoke(core.clj:4327)
 at leiningen.core.eval$fn__1963.invoke(eval.clj:213)
 at clojure.lang.MultiFn.invoke(MultiFn.java:231)
 at leiningen.core.eval$eval_in_project.invoke(eval.clj:283)
 at leiningen.repl$start_server.invoke(repl.clj:117)
 at leiningen.repl$server$fn__4421.invoke(repl.clj:173)
 at clojure.lang.AFn.applyToHelper(AFn.java:159)
 at clojure.lang.AFn.applyTo(AFn.java:151)
 at clojure.core$apply.invoke(core.clj:617)
 at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1788)
 at clojure.lang.RestFn.invoke(RestFn.java:425)
 at clojure.lang.AFn.applyToHelper(AFn.java:163)
 at clojure.lang.RestFn.applyTo(RestFn.java:132)
 at clojure.core$apply.invoke(core.clj:621)
 at clojure.core$bound_fn_STAR_$fn__4102.doInvoke(core.clj:1810)
 at clojure.lang.RestFn.invoke(RestFn.java:397)
 at clojure.lang.AFn.run(AFn.java:24)
 at java.lang.Thread.run(Thread.java:679)


 Does this ring a bell at all? I have seen this error pop up a couple of 
 times when Googling around, but no conclusive solutions that are applicable 
 to my situation.

 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.