[ANN] Bract: Data-driven Application initialisation framework

2019-01-15 Thread Shantanu Kumar
Hi,

I am happy to announce a data-driven application initialisation framework 
called Bract.

https://bract.github.io/

Bract provides a first class, declarative way to express application 
initialisation config and steps/workflow. Bract has modules for various 
purposes, and offers the necessary glue to bind an application. It can 
integrate with tests, REPL (Reloaded workflow) and CLI etc. There are 
example applications included to demonstrate how to use Bract. Gossamer is 
a minimal, extensible web framework built on top of Bract modules.

At SAP Concur, we have been using Bract for over a year in production to 
build REST(ish) microservices. I spoke about Bract at the IN/Clojure 2019 
conference recently, the slides for which are at the URL below:

https://speakerdeck.com/kumarshantanu/bract-a-minimal-dry-application-framework

I would be happy to receive any feedback, suggestions and questions about 
Bract. Please let me know what you think.


Shantanu

-- 
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] Stringer (v0.3.1) - fast string concatenation

2019-01-11 Thread Shantanu Kumar
Hi,

I am pleased to announce Stringer, a library for fast string concatenation. 
Stringer is designed (with tradeoffs) to complement Clojure's string concat 
operations.

https://github.com/kumarshantanu/stringer


Stringer's API contains several macros (so they can not be used as 
functions) - notably `strcat` and `strfmt` that are used frequently. 
`strcat` is the Java equivalent of string concatenation + operator. In 
Java, when you write ("foo" + 42 + "bar") the Java compiler generates 
in-line bytecode using java.lang.StringBuilder to concatenate the tokens. 
`strfmt` expects the format string (with limited specifier support) to be a 
literal and applies string interpolation to generate the formatted string 
much faster than `clojure.core/format`. The perf benchmark code is included 
in the repo.

We have used Stringer in production for over 3 years at SAP Concur with 
only one issue noticed/fixed over 2 years ago. It is usually hard to 
troubleshoot and optimize the long tail of latency; however, using Stringer 
has led to overall perf improvements in several composite use cases.


Shantanu

-- 
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] Calfpath (v0.7.1), a fast and flexible Ring request router

2019-01-06 Thread Shantanu Kumar
Sorry, the runtime complexity in Calfpath would be generally O(n^2) because 
iterating routes and under every route iterating each character in the URI 
template in the worst case.


Shantanu

On Monday, 7 January 2019 12:43:44 UTC+5:30, Shantanu Kumar wrote:
>
>
>
> On Monday, 7 January 2019 01:03:16 UTC+5:30, Paul deGrandis wrote:
>>
>> Hi Shantanu,
>>
>> Interesting project and congrats on the release!
>>
>> I think Alan was asking more about the runtime and space complexities.  
>> What is the core approach used in Calfpath?  What is the runtime and space 
>> complexity?  What are the ideal operational conditions and under what 
>> conditions does it suffer?  What were the trade-offs made in the approach?
>>
>> I'm curious to know the answers myself.  Thanks!
>>
>
>
> Hi Paul,
>
> Thanks for expanding Alan's question. I think, the short answer about 
> runtime and space complexity would be O(n) and O(n) in Calfpath. Please 
> read on for more details. The top performing implementations in Calfpath 
> cannot support a very large number of routes (subject to Java method size 
> limit.)
>
> At the grass root level, the URI matching code (hand coded in Java, not 
> using any regex) is common across all Calfpath routing. It pre-compiles a 
> URI pattern, e.g. "/foo/:id/bar" into a vector of tokens ["/foo" :id 
> "/bar"] and later the URI-matching function iterates over the tokens.
>
> There are three implementations of routing supported in Calfpath, each of 
> which returns `nil` as soon as it realises a match is not likely:
>
> 1. Macros: There are macros (in calfpath.core ns) for matching URI, method 
> etc. that expand in-line. The URI, method etc are literals that are 
> pre-compiled for efficient matching. Obviously, this approach leads to 
> in-lined code that runs the risk of exceeding the Java method size (in 
> bytecodes) limit for a large number of routes. However, given that the vast 
> majority of applications have < 50 routes in number, it is not a concern 
> for many.
>
> 2. Walking precompiled routes: This is an implementation (in 
> calfpath.route ns) of data driven, potentially nested, routes (vector of 
> maps). The routes are pre-compiled to a substrate form, still as vector of 
> maps, that a function iterates over recursively where nested. This is a 
> simple, iterative implementation that can also handle a large number of 
> routes. It is also the slowest among the three routing implementations.
>
> 3. Loop-unrolled expression tree: This is also an implementation (in 
> calfpath.route ns) of data driven, potentially nested, routes (vector of 
> maps). The routes are pre-compiled to a substrate form like in the second 
> implementation. Then, a function assembles an expression tree using all the 
> routes info, wraps it in a function form and calls `eval` to turn the 
> expression tree into a function. The result is an in-lined function that 
> performs close to the first macro-based implementation, and runs the same 
> risk of exceeding Java method size limit for a large number of routes. This 
> technique also makes optional (enabled by default) use of deep 
> expression-tree building, where pre-compiling URI matching and method 
> matching also emit expressions in addition to matcher functions.
>
> In general, the optimisations in Calfpath rely more on JIT's instruction 
> caching than data-cache coherence, and the fact that web-routing is such a 
> repeatedly executed code that it's OK to inline most of the routing code 
> together. Hope this explains Calfpath's approach. Please let me know if you 
> have any other questions.
>
>
> Shantanu
>  
>
>>
>> Cheers,
>> Paul
>>
>>

-- 
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] Calfpath (v0.7.1), a fast and flexible Ring request router

2019-01-06 Thread Shantanu Kumar


On Monday, 7 January 2019 01:03:16 UTC+5:30, Paul deGrandis wrote:
>
> Hi Shantanu,
>
> Interesting project and congrats on the release!
>
> I think Alan was asking more about the runtime and space complexities.  
> What is the core approach used in Calfpath?  What is the runtime and space 
> complexity?  What are the ideal operational conditions and under what 
> conditions does it suffer?  What were the trade-offs made in the approach?
>
> I'm curious to know the answers myself.  Thanks!
>


Hi Paul,

Thanks for expanding Alan's question. I think, the short answer about 
runtime and space complexity would be O(n) and O(n) in Calfpath. Please 
read on for more details. The top performing implementations in Calfpath 
cannot support a very large number of routes (subject to Java method size 
limit.)

At the grass root level, the URI matching code (hand coded in Java, not 
using any regex) is common across all Calfpath routing. It pre-compiles a 
URI pattern, e.g. "/foo/:id/bar" into a vector of tokens ["/foo" :id 
"/bar"] and later the URI-matching function iterates over the tokens.

There are three implementations of routing supported in Calfpath, each of 
which returns `nil` as soon as it realises a match is not likely:

1. Macros: There are macros (in calfpath.core ns) for matching URI, method 
etc. that expand in-line. The URI, method etc are literals that are 
pre-compiled for efficient matching. Obviously, this approach leads to 
in-lined code that runs the risk of exceeding the Java method size (in 
bytecodes) limit for a large number of routes. However, given that the vast 
majority of applications have < 50 routes in number, it is not a concern 
for many.

2. Walking precompiled routes: This is an implementation (in calfpath.route 
ns) of data driven, potentially nested, routes (vector of maps). The routes 
are pre-compiled to a substrate form, still as vector of maps, that a 
function iterates over recursively where nested. This is a simple, 
iterative implementation that can also handle a large number of routes. It 
is also the slowest among the three routing implementations.

3. Loop-unrolled expression tree: This is also an implementation (in 
calfpath.route ns) of data driven, potentially nested, routes (vector of 
maps). The routes are pre-compiled to a substrate form like in the second 
implementation. Then, a function assembles an expression tree using all the 
routes info, wraps it in a function form and calls `eval` to turn the 
expression tree into a function. The result is an in-lined function that 
performs close to the first macro-based implementation, and runs the same 
risk of exceeding Java method size limit for a large number of routes. This 
technique also makes optional (enabled by default) use of deep 
expression-tree building, where pre-compiling URI matching and method 
matching also emit expressions in addition to matcher functions.

In general, the optimisations in Calfpath rely more on JIT's instruction 
caching than data-cache coherence, and the fact that web-routing is such a 
repeatedly executed code that it's OK to inline most of the routing code 
together. Hope this explains Calfpath's approach. Please let me know if you 
have any other questions.


Shantanu
 

>
> Cheers,
> Paul
>
>

-- 
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] Calfpath (v0.7.1), a fast and flexible Ring request router

2019-01-04 Thread Shantanu Kumar
Hi Alan,

On Saturday, 5 January 2019 12:25:36 UTC+5:30, Alan Thompson wrote:
>
> Hi have been very happy using Pedestal for routing <http://pedestal.io/> 
> chores.  How does this compare to Pedestal?
>

I haven't benchmarked Calfpath against Pedestal, but Reitit-ring is 
supposed to be faster than Pedestal as 
per https://github.com/metosin/reitit/blob/master/doc/performance.md and in 
my benchmarks Calfpath outperforms Reitit-ring in most use cases, so I 
guess Calfpath should be much faster than Pedestal. But again, benchmarks 
are tricky, so you should measure the candidate libraries for your actual 
use cases.


Shantanu
 

> Alan
>
>
> On Fri, Jan 4, 2019 at 9:50 PM Shantanu Kumar  > wrote:
>
>> Hi,
>>
>> (Cross-posted on Clojure and Ring mailing lists.)
>>
>> Happy new year to all!
>>
>> I am pleased to announce Calfpath, a fast Ring-based routing library that 
>> supports flexible, à la carte request matching. It supports both 
>> macro-based and data-driven routing.
>>
>> https://github.com/kumarshantanu/calfpath
>>
>> At SAP Concur we have been using this library for over 3 years in 
>> production on REST(ish) API servers. During early 2015 when we were using 
>> Compojure, we found it was causing 4% of the total internal latency. That 
>> is when we switched to Calfpath - roughly an order of magnitude faster. The 
>> benchmarking code is included in the repo - however, you should probably 
>> test against your own use-case to determine suitability.
>>
>> The API has matured quite a bit over time and is now more stable than 
>> ever before. Among downsides, as of now Calfpath is neither bi-directional, 
>> nor ClojureScript ready.
>>
>> I would love to receive your feedback and answer any questions. Please 
>> let me know what you think.
>>
>>
>> Shantanu
>>
>> -- 
>> 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.


[ANN] Calfpath (v0.7.1), a fast and flexible Ring request router

2019-01-04 Thread Shantanu Kumar
Hi,

(Cross-posted on Clojure and Ring mailing lists.)

Happy new year to all!

I am pleased to announce Calfpath, a fast Ring-based routing library that 
supports flexible, à la carte request matching. It supports both 
macro-based and data-driven routing.

https://github.com/kumarshantanu/calfpath

At SAP Concur we have been using this library for over 3 years in 
production on REST(ish) API servers. During early 2015 when we were using 
Compojure, we found it was causing 4% of the total internal latency. That 
is when we switched to Calfpath - roughly an order of magnitude faster. The 
benchmarking code is included in the repo - however, you should probably 
test against your own use-case to determine suitability.

The API has matured quite a bit over time and is now more stable than ever 
before. Among downsides, as of now Calfpath is neither bi-directional, nor 
ClojureScript ready.

I would love to receive your feedback and answer any questions. Please let 
me know what you think.


Shantanu

-- 
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] Promenade 0.7.0 - Elegant error handling and control flow

2018-10-30 Thread Shantanu Kumar
Hi,

I'm happy to release version 0.7.0 of the Promenade library. This release 
switches expression sequencing to use clojure.core/reduce, hence adding 
early termination support. Please see changelog for the list of changes.

Project website:
https://github.com/kumarshantanu/promenade

Changelog:
https://github.com/kumarshantanu/promenade/blob/v0.7.0/CHANGELOG.md#070--2018-october-30

Project documentation:
https://cljdoc.org/d/promenade/promenade/0.7.0/doc/readme


Shantanu

-- 
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: Promenade 0.6.0 - Elegant error handling and more for Clojure/CLJS

2018-08-02 Thread Shantanu Kumar
Hi,

Promenade is a Clojure/ClojureScript library to elegantly handle errors and 
other oddities. The 0.6.0 release adds support for (1) wrapping functions 
that throw exceptions, and (2) early termination in reducing functions.

URL: https://github.com/kumarshantanu/promenade

Docs: https://github.com/kumarshantanu/promenade/blob/master/doc/intro.md


Shantanu

-- 
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: Protocols considered harmful?

2018-05-22 Thread Shantanu Kumar
Hi Sam,

In my experience, protocols are a great mechanism for extensibility. Let's 
say you build an abstraction with a default implementation. If your 
abstraction is based on protocols, somebody can extend the abstraction to 
build a different implementation (that possibly integrates with another 
system). I think the sweet spot of protocols lies in (1) protocols being an 
implementation detail rather than public API, (2) protocols being used for 
extensibility.


Shantanu

On Tuesday, 22 May 2018 11:19:35 UTC+5:30, Sam Bartolucci wrote:
>
> Hi,
>
> I've been an enthusiastic Clojure tinkerer for a few years now--it's a 
> great language!--but only recently began using it professionally, where 
> I've stumbled into a strong disagreement over the use of protocols vs. 
> multimethods for single dispatch polymorphism. I had always assumed that 
> protocols were a normal part of Clojure when polymorphism was called for, 
> but a few of my coworkers (often, it seems, those who have experience with 
> Lisp prior to Clojure) swear up and down that protocols are only to be used 
> as a last resort because they "break the REPL". Apparently they're frowned 
> upon because, due to the JVM interop, they don't reload as well as other 
> constructs. It has even been suggested a few times that all uses of 
> protocols should be refactored to use a multimethod with a "type" as the 
> dispatch function. Protocols, in other words, should be considered harmful. 
> This seems strange to me considering how many successful and mainstream 
> Clojure projects use protocols, but maybe I am missing something, so I 
> thought I would ask the list. So what is it? Is there any consensus around 
> the assertion that "good, idiomatic Clojure will use multimethods rather 
> than protocols for single-dispatch polymorphism"?
>
> Thanks,
> Sam
>

-- 
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: DIME - Dependency Injection for Clojure

2018-05-07 Thread Shantanu Kumar
Hi,

I am happy to announce DIME - a "Dependency Injection" library for Clojure:

Project: https://github.com/kumarshantanu/dime

Docs: https://github.com/kumarshantanu/dime/blob/master/doc/intro.md

Blog 
post: 
https://medium.com/@kumarshantanu/dependency-injection-with-clojure-using-dime-af57b140bd3f

DIME works mainly by creating partially applied functions in cascading 
order. It aims to be unintrusive and painless to use. Though "dependency 
injection" is not widely popular in FP/Clojure, those who have used DIME 
effectively on real projects like the clarity and simplicity it brings to 
initializing applications and wiring up components. I would love to receive 
your feedback and comments - please let me know what you think.


Shantanu

-- 
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: Promenade - Elegant handling of errors and other oddities (Clojure/ClojureScript)

2018-04-16 Thread Shantanu Kumar
Hi,

I am pleased to announce Promenade - a Clojure/ClojureScript library to 
elegantly handle errors and other oddities:

Project: https://github.com/kumarshantanu/promenade

Docs: https://github.com/kumarshantanu/promenade/blob/master/doc/intro.md

Promenade helps one express odd conditions (such as errors etc.) as data 
and provides associated control flow facilities. This library is only a 
couple of months old, but the code I have seen this applied to has greatly 
simplified error-handling and improved readability because of it. I hope 
others would find it useful too. I would love to receive your feedback and 
comments - please let me know what you think.


Shantanu

-- 
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: Cambium 0.9.2 (Structured logging for Clojure)

2018-03-22 Thread Shantanu Kumar
Hi,

I am happy to announce the availability of Cambium 0.9.2 - Cambium is a 
structured logging library for Clojure, compatible based on SLF4J/Logback 
and clojure/tools.logging libraries.

https://cambium-clojure.github.io/

The release changelog for various modules[1] are in their respective 
repositories. Since the last announcement[2] the most interesting change is 
that now caller metadata (ns, line, column attributes) is transparently and 
cheaply added to the context of all log events. This particular feature is 
inspired by Howard L Ship's blog post[3].

Cross-posted from Cambium discussion group[4].

[1] https://github.com/cambium-clojure
[2] https://groups.google.com/forum/#!topic/clojure/pxIuZ52f7Mg
[3] https://medium.com/@hlship/macros-meta-and-logging-575d5047924c
[4] https://groups.google.com/forum/#!topic/cambium-clojure/KD6tw9mFwLA


Shantanu

-- 
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] Cambium - Structured logging for Clojure

2017-12-01 Thread Shantanu Kumar


On Friday, 1 December 2017 18:18:36 UTC+5:30, oleksand...@zalando.de wrote:
>
> On Thursday, November 30, 2017 at 3:35:24 PM UTC+1, Shantanu Kumar wrote:
>>
>>
>> I am happy to announce the availability of Cambium, an Open Source 
>> project for structured logging in Clojure using SLF4j and Logback.
>>
>> Details: https://cambium-clojure.github.io/
>> Repos: https://github.com/cambium-clojure
>>
>
> Looks nice, thank you for sharing!  I've got a number of questions:
>

Thanks! My responses are inline:
 

> 1) Is it possible to include example output for FlatJsonLayout in the 
> documentation?
>

I have updated the quickstart section with the 
output: https://cambium-clojure.github.io/#quickstart 
 

> 2) Given that it uses SLF4J, I guess it can also work with 
> java.util.logging?
>

SLF4j works with java.util.logging with a caveat. Cambium uses the MDC 
feature of SLF4j for context-logging (structured logs), which requires a 
logging backend with MDC support. Logback and Log4j support MDC but 
java.util.logging does not, so it may be challenging to get MDC to work 
with the latter.
Ref: 
https://stackoverflow.com/questions/16811885/mdcmapped-diagnostic-context-support-for-juljava-util-logging
 

> 3) How exception messages are logged: in or outside of the context?
>

Exceptions are logged in the context, try (cambium.core/error {:foo :bar} 
exception "Error happened") - it ends up under the "exception" key in the 
JSON map.
 

> 4) Are clojure.lang.ExceptionInfo exceptions printed with the data map?  
> From what I've seen previously, only java.util.logging uses .toString() on 
> exception object which results in message *and* data, the rest of logging 
> backends use only .getMessage() for some reason, completely missing the 
> data from the log message.
>

The data is not extracted/merged into the context from 
clojure.lang.ExceptionInfo - you can possibly log it as (cambium.core/error 
{:foo :bar} ex (str ex)) to have similar effect. The message ends up under 
the "message" key in the JSON map. (It probably makes sense to include 
the ex-data as a separate attribute - I will think about it; also, 
suggestions welcome.)


Shantanu

-- 
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] Cambium - Structured logging for Clojure

2017-11-30 Thread Shantanu Kumar
Hi,

I am happy to announce the availability of Cambium, an Open Source project 
for structured logging in Clojure using SLF4j and Logback.

Details: https://cambium-clojure.github.io/
Repos: https://github.com/cambium-clojure

*Highlights:*
- Evolved through two years of production use at Concur for application and 
business/ops metrics logs using a heavily indexed 
ElasticSearch/Logstash/Kibana stack.
- Used in Clojure applications of various sizes.
- SLF4j-backend integration for Logback is provided. (In theory, can be 
extended to Log4j2.)
- Tested with RabbitMQ and Filebeat transports, though in theory, it should 
work with other Logback-compatible transports too.
- Code organization is modular to provide flexibility without loss of 
performance.
- Compatible with Java libraries that use SLF4j (directly or via a bridge) 
for logging.
- Compatible with Clojure code that uses clojure/tools.logging for logging.

*Caveats:*
- You still need to deal with Logback config, which means XML files in most 
cases: https://logback.qos.ch/manual/index.html (though easy to Google.)
- Some capabilities, such as altering log levels of certain loggers at 
runtime, are specific to the backend, i.e. Logback only.

I hope this is useful to others. Feedback is welcome!


Shantanu

-- 
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] Clojure 1.9.0-RC1

2017-11-13 Thread Shantanu Kumar
Sorry, my bad. I can see the same behavior in previous Clojure versions 
too. I discovered this in the middle of moving to 1.9.0-RC1 in one of 
the projects and somehow got it all mixed up.


Shantanu

On Tuesday, 14 November 2017 11:36:30 UTC+5:30, Andy Fingerhut wrote:
>
> I see the same behavior in Clojure 1.7.0 and 1.8.0 as you see in 1.9.0-RC1.
>
> Andy
>
> On Mon, Nov 13, 2017 at 9:48 PM, Shantanu Kumar  > wrote:
>
>> Sorry, I did not specify the problem completely earlier. The coercion 
>> fails only when *uncheked-math* is set to truthy in 1.9.0-RC1.
>>
>> user=> (byte \a)
>> 97
>> user=> (set! *unchecked-math* true)  ; or :warn-on-boxed
>> true
>> user=> (byte \a)
>>
>> ClassCastException java.lang.Character cannot be cast to 
>> java.lang.Number  clojure.lang.RT.uncheckedByteCast (RT.java:1376)
>>
>>
>> Shantanu
>>
>> On Tuesday, 14 November 2017 01:27:36 UTC+5:30, Alex Miller wrote:
>>>
>>> Works for me in 1.9.0-RC1. I don't know of anything that changed in this 
>>> area.
>>>
>>> Clojure 1.9.0-RC1
>>> user=> (byte \a)
>>> 97
>>>
>>> On Mon, Nov 13, 2017 at 1:09 PM, Shantanu Kumar  
>>> wrote:
>>>
>>>> The coercion (byte \a) works fine in Clojure 1.8, but it fails with 
>>>> `ClassCastException java.lang.Character cannot be cast to 
>>>> java.lang.Number` 
>>>> in 1.9.0-RC1. Is this by design?
>>>>
>>>>
>>>> Shantanu
>>>>
>>>> -- 
>> 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: [ANN] Clojure 1.9.0-RC1

2017-11-13 Thread Shantanu Kumar
Sorry, I did not specify the problem completely earlier. The coercion fails 
only when *uncheked-math* is set to truthy in 1.9.0-RC1.

user=> (byte \a)
97
user=> (set! *unchecked-math* true)  ; or :warn-on-boxed
true
user=> (byte \a)

ClassCastException java.lang.Character cannot be cast to java.lang.Number  
clojure.lang.RT.uncheckedByteCast (RT.java:1376)


Shantanu

On Tuesday, 14 November 2017 01:27:36 UTC+5:30, Alex Miller wrote:
>
> Works for me in 1.9.0-RC1. I don't know of anything that changed in this 
> area.
>
> Clojure 1.9.0-RC1
> user=> (byte \a)
> 97
>
> On Mon, Nov 13, 2017 at 1:09 PM, Shantanu Kumar  > wrote:
>
>> The coercion (byte \a) works fine in Clojure 1.8, but it fails with 
>> `ClassCastException java.lang.Character cannot be cast to java.lang.Number` 
>> in 1.9.0-RC1. Is this by design?
>>
>>
>> Shantanu
>>
>>

-- 
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] Clojure 1.9.0-RC1

2017-11-13 Thread Shantanu Kumar
The coercion (byte \a) works fine in Clojure 1.8, but it fails with 
`ClassCastException java.lang.Character cannot be cast to java.lang.Number` 
in 1.9.0-RC1. Is this by design?


Shantanu

On Monday, 13 November 2017 07:32:00 UTC+5:30, Alex Miller wrote:
>
> Hi David, 
>
> Clojure 1.9 now depends on two external dependencies (spec.alpha and 
> core.specs.alpha) so the instructions listed there will no longer work. We 
> are evaluating whether and how to update those instructions in the readme 
> right now.
>
> Most Clojure users work with Clojure through a project manager like 
> Leiningen or Boot (where simply declaring a dependency on 
> org.clojure/clojure "1.9.0-RC1" will automatically pull in its new 
> dependencies). We also have a new command line tool, `clj` that you can use 
> to start a repl with 1.9 (see https://clojure.org/guides/deps_and_cli).
>
> Alex
>
>
>
> On Sunday, November 12, 2017 at 7:51:26 PM UTC-6, David Kinzer wrote:
>>
>> I'm getting an error when I follow the instructions in the readme.txt, am 
>> I missing something?
>>
>> java -cp clojure-1.9.0-RC1.jar clojure.main
>> Exception in thread "main" java.lang.ExceptionInInitializerError
>> at java.base/java.lang.Class.forName0(Native Method)
>> at java.base/java.lang.Class.forName(Class.java:375)
>>
>> same instructions work for 1.8, though
>>
>>
>

-- 
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: Don't Laugh - How to Get the Name of an Anonymous Function

2017-10-23 Thread Shantanu Kumar
Not sure whether you can deterministically recover the exact name at all 
times, but the following can get you started:

(re-matches #".*\$(.*)__.*" (.getName (class (fn cool-func! [] (println 
"hi")

I have altered the name to `cool-func!` on purpose to show where it may 
break.


Shantanu

On Tuesday, 24 October 2017 10:35:12 UTC+5:30, Nick Mudge wrote:
>
> Let's say I have this anonymous function:
>
> (fn cool [] (println "hi"))
>
> How can I extract the name from it?
>
> Obviously the name of the function is stored with the function. How can I 
> get to it?
>
>
>

-- 
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: Can slingshot/try+ and then catch Object really catch any error?

2017-10-09 Thread Shantanu Kumar


On Monday, 9 October 2017 12:34:41 UTC+5:30, lawrence...@gmail.com wrote:
>
> Shantanu Kumar, thanks for that, I might try it. I assume you've never had 
> the problem I'm talking about, of messages on background threads that 
> disappear?
>

Logback (the SLF4j impl we use) is capable of logging from multiple 
threads. I always set the default uncaught handler to log any exception 
arising from background threads:
https://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html#setDefaultUncaughtExceptionHandler(java.lang.Thread.UncaughtExceptionHandler)

Stuart Sierra also wrote about how to do 
this: https://stuartsierra.com/2015/05/27/clojure-uncaught-exceptions

If you do this step correctly, you might be able to notice the 
background-thread exceptions even with a plain `println` call.


Shantanu
 

>
>
> On Monday, October 9, 2017 at 2:56:24 AM UTC-4, Shantanu Kumar wrote:
>>
>>
>>>
>>> I'm curious what others do for logging? 
>>>
>>
>> At Concur we using Cambium https://github.com/kumarshantanu/cambium 
>> that's being moved (WIP) here: https://github.com/cambium-clojure
>>
>> Cambium wraps SLF4j and gives a Clojure API (which extends tools.logging) 
>> to use it's MDC feature.
>>
>>
>> Shantanu
>>
>>>

-- 
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: Can slingshot/try+ and then catch Object really catch any error?

2017-10-09 Thread Shantanu Kumar


On Monday, 9 October 2017 12:31:57 UTC+5:30, lawrence...@gmail.com wrote:
>
> Kumar,
>
> Just so you know, on this page:
>
> https://github.com/cambium-clojure/cambium.logback.core
>
> you link to here:
>
> https://cambium-clojure.github.io/
>
> but I get a 404 when I go there. 
>


I'm sorry the https://cambium-clojure.github.io/ site is still WIP, hence 
not announced publicly yet. (I hope to be able to do that in some time.)


Shantanu

>

-- 
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: Can slingshot/try+ and then catch Object really catch any error?

2017-10-08 Thread Shantanu Kumar

>
>
>
> I'm curious what others do for logging? 
>

At Concur we using Cambium https://github.com/kumarshantanu/cambium that's 
being moved (WIP) here: https://github.com/cambium-clojure

Cambium wraps SLF4j and gives a Clojure API (which extends tools.logging) 
to use it's MDC feature.


Shantanu

>

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


Predicates for atom/ref/agent

2017-07-16 Thread Shantanu Kumar
Hi,

Since Clojure 1.7 there's a `volatile?` predicate function, but no such 
equivalent for atom/ref/agent. Can anybody explain the rationale behind the 
difference? I found an old thread on a related topic (URL below) but would 
like to know if there's an updated explanation.
https://groups.google.com/forum/#!topic/clojure/mIJK3x_SUyM


Shantanu

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


Compiling a library with direct-linking

2017-03-09 Thread Shantanu Kumar
Hi,

As per Clojure 1.8 release info [1][2] "As of Clojure 1.8, the Clojure core 
library itself is compiled with direct linking." I want to know whether it 
is possible to compile a 3rd-party Clojure library with direct-linking - 
does it require AOT compilation? I know about the 
`-Dclojure.compiler.direct-linking=true` flag for applications, but has 
anybody tried to compile a redistributable library with direct-linking 
enabled?

[1] https://clojure.org/reference/compilation#directlinking
[2] 
https://github.com/clojure/clojure/blob/master/changes.md#11-direct-linking


Shantanu

-- 
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: Why does "clojure.core/run!" end in an exclamation mark?

2016-12-24 Thread Shantanu Kumar
I'm curious about `clojure.core/run!` too, but my question is whether it is 
meant to be a `reduce` variant of `clojure.core/doseq` or it has some other 
purpose.

Shantanu

On Saturday, 24 December 2016 21:37:11 UTC+5:30, James Reeves wrote:
>
> My understanding is that the convention used in clojure.core is to put an 
> exclamation mark onto the end of any function unsafe to run in a 
> transaction.
>
> Does the reasoning differ for "run!" or is it assumed that the function 
> passed to "run!" will not usually be idempotent?
>
> - James
>

-- 
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: Good way of handling metric gathering?

2016-11-11 Thread Shantanu Kumar
Hi Tianxiang,

In my experience a good way to decouple a non-trivial fn with metrics is to 
make the fn provide hooks for various events when metrics may be gathered.

(defn nop [& args])

(defn foo->bar [foo {:keys [on-foo on-bar] :or {on-foo nop on-bar nop} :as 
options}]
  (on-foo)
  (let [bar (produce-bar foo)]
(on-bar)
bar))

Now, when unit testing for functionality of foo->bar you can pass {} as 
options, which wouldn't do any metrics collection. In actual usage, or for 
unit testing metrics collection, you would pass {:on-foo #(counter/inc! 
foo-counter) :on-bar #(counter/inc! bar-counter)} as options.

This is a small fn, so it may not be apparent how can providing hooks be 
useful, but for large fns with multiple metrics-collection I've found 
providing hooks to be working quite well.

HTH

Shantanu

On Saturday, 12 November 2016 08:24:40 UTC+5:30, Tianxiang Xiong wrote:
>
> What are some good ways of handling metric gathering (or, more generally, 
> AOP) in Clojure?
>
> Suppose we have an application in which there is a transformation 
> function, foo->bar. Every time a foo is input to foo->bar, we'd like to 
> increment the foo-counter. Every time a bar is produced, we'd like to 
> increment the bar-counter.
>
> To keep foo->bar pure, we can wrap foo->bar in another function like:
>
> (fn [& args]
>   (counter/inc! foo-counter)
>   (let [result (apply f args)]
> (counter/inc! bar-counter)
> result))
>
> But the side effect of incrementing counters makes it difficult to write a 
> unit test.
>
> I have a vague idea of what I'd *like* to see, which is the function 
> returning:
>
>- The result
>- Some operation to be carried out, OR some data allowing the receiver 
>to carry out some operation?
>
> I'm sure this is not a new problem for Clojure applications; what are some 
> strategies for handling it?
>

-- 
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: clojure.spec - Using :pre conditions (or not)?

2016-09-15 Thread Shantanu Kumar
Hi Joakim,

You might be interested in Paul Stadig's library 
https://github.com/pjstadig/assertions that leverages Java's `-ea` 
(enable-assertions, which you may want to keep enabled in dev) command-line 
flag. If you have a bunch of things together to assert, you may want to use 
the `when-assert` macro for wholesale 
optimization: 
https://github.com/pjstadig/assertions/blob/0.2.0/src/pjstadig/assertions.clj#L13


Shantanu

On Thursday, 15 September 2016 16:50:17 UTC+5:30, joakim.t...@nova.com 
wrote:
>
> Ok, thanks!
>
> In the Java world, the assertions is also something that need to be turn 
> on explicitly.
> In that sence, they are kind of not mandatory to be executed (or at least 
> signals that to the reader of the code).
>
> I would be happier if you guys could add another method, that I can use in 
> my :pre conditions, that leverage
> the same amount of details in the error messages, but that is always 
> "turned on".
>
> In the meanwhile, I will use s/assert ;-)
>
> BR,
> Joakim Tengstrand
>
>
> On Wednesday, 14 September 2016 15:59:09 UTC+2, Alex Miller wrote:
>>
>> Another option that has been added since the guide was written is 
>> s/assert which seems closer to what you're suggesting.
>>
>> (defn name [user]
>>   {:pre [(s/assert :common/user user)]}
>>   (-> user :user/name))
>>
>> ;; need to enable assertion checking - this can also be enabled globally 
>> with system property clojure.spec.check-asserts
>> (s/check-asserts true)
>>
>> (name {:user/name "Elon"})
>> "Elon"
>>
>> (name {:x "Elon"})
>> ExceptionInfo Spec assertion failed
>> val: {:x "Elon"} fails predicate: (contains? % :user/name)
>> :clojure.spec/failure  :assertion-failed
>>   clojure.core/ex-info (core.clj:4725)
>>
>> Rather than use it in a precondition, you can also use s/assert directly 
>> in the code.
>>
>> On Wednesday, September 14, 2016 at 7:37:24 AM UTC-5, 
>> joakim.t...@nova.com wrote:
>>>
>>> (ns spec-test.core
>>>   (:require [clojure.spec :as s]))
>>>
>>> (s/def :user/name string?)
>>> (s/def :common/user (s/keys :req [:user/name]))
>>>
>>> ; first version of name (using :pre)
>>> (defn name [user]
>>>   {:pre [(s/valid? :common/user user)]}
>>>   (-> user :user/name))
>>>
>>> ; This statement works ok and returns "Elon":
>>> (name {:user/name "Elon"})
>>>
>>> ; but this statement...
>>> (name {:x "Elon"})
>>>
>>> ;...will throw:
>>> CompilerException java.lang.AssertionError:
>>> Assert failed: (s/valid? :common/user user)
>>>
>>> ; ...but then I don't get as much information
>>> ; about the error as if I would have called:
>>> (s/explain :common/user {:x "Elon"})
>>>
>>> ;...which also contains the predicate:
>>> val: {:x "Elon"} fails spec: :common/user
>>> predicate: (contains? % :user/name)
>>>
>>> ; (second version of name - more verbose)
>>> ; or do I need to wite it like this:
>>> (defn name [user]
>>>   (let [parsed (s/conform :common/user user)]
>>> (if (= parsed ::s/invalid)
>>>   (throw (ex-info "Invalid input" (s/explain-data :common/user user)))
>>>   (-> user :user/name
>>>
>>> ; so that:
>>> (name {:x "Elon"})
>>>
>>> ; ...will return:
>>> CompilerException clojure.lang.ExceptionInfo:
>>>   Invalid input #:clojure.spec{:problems}
>>> ({:path [], :pred (contains? % :user/name),
>>>   :val {:x "Elon"}, :via [:common/user], :in []})
>>>
>>> ; It should be nice if I could be able to write it like this
>>> ; (or similar, to get a better error message):
>>> (defn name [user]
>>>   {:pre [(s/explain :common/user user)]}
>>>   (-> user :user/name))
>>>
>>>

-- 
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: Protocols for persistence - not sure about a few cases

2016-08-28 Thread Shantanu Kumar
Considering the regular use-cases with records:

Create - requires record without any auto-generated identifiers
Retrieve - requires primary identifier or lookup parameters
Update - requires record with primary identifier and updated fields
Delete - requires primary identifier or lookup parameters

Retrieve and Delete and quite similar, except that `Retrieve` returns 
record(s). Create and Update are similar, except that `Update` requires 
only the updated fields. It is clear that one record type cannot expose all 
of the CRUD operations. Could it be possible that protocols/records are a 
wrong axis to think about this problem?

Can you share some details about the type of database and the access use 
cases you are considering?


Shantanu

On Sunday, 28 August 2016 19:59:46 UTC+5:30, Jonathon McKitrick wrote:
>
> I'm beginning a foray into protocols after coming from the Common Lisp 
> world of multimethods. I'm using them initially to implement a consistent 
> load/save API over the DB layer.
>
> It's pretty simple to have a Saveable protocol to save one object, because 
> the first argument is a Record of the type I am saving.
>
> But since protocols dispatch on the first argument, how do you define a 
> Loadable protocol that loads an object or handles a collection of objects?
>
> For example, if I want to load an object by idx, the first argument is not 
> a Record, but an integer, or perhaps an arbitrary field to used in a query.
>
>
>

-- 
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: why is it so annoying to run clojure code

2016-06-09 Thread Shantanu Kumar
Consider http://inlein.org/ or https://github.com/kumarshantanu/lein-exec

HTH

Shantanu

On Thursday, 9 June 2016 21:38:39 UTC+5:30, Jiacai Liu wrote:
>
> I  started learning clojure recently, and I am annoyed at the way to run 
> it (aka. lein run). why clojure script can't be run like python,ruby or 
> scala, like python .py
>

-- 
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] Clojure 1.9.0-alpha5

2016-06-07 Thread Shantanu Kumar


On Wednesday, 8 June 2016 00:31:41 UTC+5:30, Alex Miller wrote:
>
> I'm not opposed to it but can't say that's anywhere on my priority list. 
> Does anyone use incubator?
>

Just to add a data point, I use incubator at work for `dissoc-in`.

Shantanu
 

>
>
> On Tuesday, June 7, 2016 at 1:21:34 PM UTC-5, Sean Corfield wrote:
>>
>> An excellent set of new predicates – thank you!
>>
>>  
>>
>> Will clojure.core.incubator get a new release to reflect that seqable? is 
>> available in core?
>>
>>  
>>
>> WARNING: seqable? already refers to: #'clojure.core/seqable? in 
>> namespace: clojure.core.incubator, being replaced by: 
>> #'clojure.core.incubator/seqable?
>>
>>  
>>
>> Sean Corfield -- (904) 302-SEAN
>> An Architect's View -- http://corfield.org/
>>
>> "If you're not annoying somebody, you're not really alive."
>> -- Margaret Atwood
>>
>>  
>>
>> On 6/7/16, 10:38 AM, "Alex Miller"  
>> on behalf of al...@puredanger.com > wrote:
>>
>>  
>>
>> Clojure 1.9.0-alpha5 is now available.
>>
>>  
>>
>> Try it via
>>
>>  
>>
>> - Download:
>>  https://repo1.maven.org/maven2/org/clojure/clojure/1.9.0-alpha5 
>> 
>>
>> - Leiningen: [org.clojure/clojure "1.9.0-alpha5"]
>>
>>  
>>
>> 1.9.0-alpha4 includes the following changes since 1.9.0-alpha4:
>>
>>  
>>
>> Fixes:
>>
>> - doc was printing "Spec" when none existed
>>
>> - fix ? explain
>>
>>  
>>
>> New predicates in core (all also now have built-in generator support in 
>> spec):
>>
>> - seqable?
>>
>> - boolean?
>>
>> - long?, pos-long?, neg-long?, nat-long?
>>
>> - double?, bigdec?
>>
>> - ident?, simple-ident?, qualified-ident?
>>
>> - simple-symbol?, qualified-symbol?
>>
>> - simple-keyword?, qualified-keyword?
>>
>> - bytes? (for byte[])
>>
>> - indexed?
>>
>> - inst? (and new inst-ms)
>>
>> - uuid?
>>
>> - uri?
>>
>>  
>>
>> New in spec:
>>
>> - unform - given a spec and a conformed value, returns the unconformed 
>> value
>>
>> - New preds: long-in-range?, inst-in-range?
>>
>> - New specs (with gen support): long-in, inst-in, double-in
>>
>> -- 
>> 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: connecting to infobrite server from clojure

2016-05-02 Thread Shantanu Kumar
Could you try connecting to InfoBright using DbVisualizer? It is a Java 
based tool and any differences w.r.t. the MySQL JDBC driver would be 
evident if it fails to work with DbVisualizer.

https://www.dbvis.com/

Shantanu

On Monday, 2 May 2016 12:48:16 UTC+5:30, Sunil Nandihalli wrote:
>
> Hi Everybody,
>  I have tried to connect to infobrite server using clojure.java.jdbc . 
> Infobrite server is supposed to be identical to mysql in terms of the 
> protocol. I have successfully used mysqlworkbench to talk to it. When I try 
> to connect to the infobrite server using clojure.java.jdbc, I get the 
> following exception
>
> java.sql.SQLNonTransientConnectionException: CLIENT_PLUGIN_AUTH is required
>
> however if I use the exact same code to query a mysql db it works 
> perfectly fine. Can somebody help please me with this?
> Thanks and regards,
> Sunil.
>
> The code i use is
>
> (ns cpi.core
>   (:require [clojure.java.jdbc :as jdbc]
> [clojure.string :as s]))
>
> (defn run-query [{:keys [url user password db] :as cnf} & qs]
>   (println qs)
>   (println cnf)
>   (jdbc/with-db-connection [db-conn {:classname "com.mysql.jdbc.Driver"
>  :subprotocol "mysql"
>  :subname (str "//" url "/" db)
>  :user user
>  :password password}]
> (jdbc/query db-conn qs)))
>

-- 
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 configure a library from a file in the project that has it as a dependency?

2016-04-19 Thread Shantanu Kumar
How about accepting a fn as argument to provide the config required? In 
that case the user is free to use whichever library/hand-rolled code to 
read config from a file.

Shantanu

On Tuesday, 19 April 2016 22:15:22 UTC+5:30, Facundo Olano wrote:
>
> Hi! I started to use clojure a couple of months ago and now I'm struggling 
> to extract a little library from a larger project I'm working on.
>
> The lib is a gettext-like tool that allows translating strings based on a 
> translations dictionary. I'd like to be able to include the lib as a 
> dependency of the larger project and point to my translations dictionary 
> from a setting in a configuration file (Ideally I would use project.clj to 
> avoid having a lib specific file just for one setting).
>
> My problem is I'm not sure how to read a configuration file in my project 
> from the generated JAR of the lib (if that's even possible and not a bad 
> idea for some reason). I tried using configleaf 
>  and it worked while I 
> included the lib as a checkout project but it seems the config file gets 
> freezed to whatever it is when the lib's JAR is packed.
>
> I wonder if there's a straightforward and idiomatic way to achieve this. 
> "That's a terrible idea" type of answers are also welcome :P
>
> Thanks, 
> Facundo.
>

-- 
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 use a Java SDK from Amazon?

2016-01-09 Thread Shantanu Kumar


On Sunday, 10 January 2016 04:09:45 UTC+5:30, Laws wrote:
>
> Damn. I tried localrepo, just like I have in the past: 
>
> lein localrepo install alexa-skills-kit-1.1.jar alexa-sdk 1.1
>
> and then in project.clj: 
>
>   :dependencies [[org.clojure/clojure "1.6.0"]
>  [alexa-sdk "1.1"]
>
> but I still ran into configuration issues:
>
> Compiling salesvoice.core
> Exception in thread "main" java.lang.NoClassDefFoundError: 
> org/slf4j/LoggerFactory, compiling:(query.clj:1:1)
>
> Have others dealt with this issue, when using an SDK that uses slf4j? Is 
> there an obvious way to configure this? 
>

Logback natively implements the SLF4j API. I guess including Logback in 
your dependencies and putting in a resources/logback.xml file for 
configuration would do the trick. For example, 
https://github.com/kumarshantanu/logback-bundle (just stick to core-bundle 
for a start) includes several related logback artifacts to make it all work 
together.

Shantanu
 

>
>
>
> On Saturday, January 9, 2016 at 5:17:00 PM UTC-5, Laws wrote:
>>
>> Nevermind. I just noticed they offer a Jar:
>>
>>
>> https://github.com/amzn/alexa-skills-kit-java/tree/master/repo/alexa-skills-kit/alexa-skills-kit/1.1
>>
>> I'll just use that.
>>
>> Ignore this post. 
>>
>>
>> On Saturday, January 9, 2016 at 5:14:51 PM UTC-5, Laws wrote:
>>>
>>> I'm not sure if this is a Clojure question, but I'm not sure where else 
>>> to ask. I've been working on an app for the Amazon Echo. I'm trying to deal 
>>> with this requirement, which I must deal with if I am to get the app into 
>>> the Amazon app store: 
>>>
>>> Check the request signature to verify the authenticity of the request. 
>>> Alexa signs all HTTPS requests.
>>>
>>>- The Java library does this verification in the SpeechletServlet class. 
>>>If you do not use the Java library, you must do this verification 
>>> yourself.
>>>- If you use the Java library without using the SpeechletServlet class, 
>>>you can use theSpeechletRequestSignatureVerifier class to do this.
>>>
>>>
>>> For some bizarre reason, Amazon does not make its SDK available via the 
>>> main Maven repository. Many developers have asked Amazon to change this, 
>>> but for now, we have to: 
>>>
>>> git clone g...@github.com:amzn/alexa-skills-kit-java.git
>>>
>>> I thought I could then: 
>>>
>>> cp -r ../../alexa-skills-kit-java/src/* src/java/
>>>
>>> In my project.clj file I have: 
>>>
>>>   :source-paths  ["src/clojure"]
>>>   :java-source-paths ["src/java"]
>>>   :main salesslick.core
>>>   :aot :all
>>>
>>> So all of alexa-skills-kit-java/src is now in my src/java directory. 
>>>
>>> I still end up with these kinds of dependency issues: 
>>>
>>> Compiling 47 source files to 
>>> /Users/lkrubner/projects/salesvoiceapp/salescricket/target/classes
>>> /Users/lkrubner/projects/salesvoiceapp/salescricket/src/java/com/amazon/speech/speechlet/Session.java:16:
>>>  
>>> error: package org.apache.commons.lang3 does not exist
>>> import org.apache.commons.lang3.Validate;
>>> ^
>>> /Users/lkrubner/projects/salesvoiceapp/salescricket/src/java/com/amazon/speech/slu/Intent.java:17:
>>>  
>>> error: package org.apache.commons.lang3 does not exist
>>> import org.apache.commons.lang3.Validate;
>>> ^
>>> /Users/lkrubner/projects/salesvoiceapp/salescricket/src/java/com/amazon/speech/slu/Slot.java:13:
>>>  
>>> error: package org.apache.commons.lang3 does not exist
>>> import org.apache.commons.lang3.Validate;
>>> ^
>>> /Users/lkrubner/projects/salesvoiceapp/salescricket/src/java/com/amazon/speech/speechlet/authentication/ApplicationIdVerifier.java:17:
>>>  
>>> error: package org.slf4j does not exist
>>> import org.slf4j.Logger;
>>> ^
>>> /Users/lkrubner/projects/salesvoiceapp/salescricket/src/java/com/amazon/speech/speechlet/authentication/ApplicationIdVerifier.java:18:
>>>  
>>> error: package org.slf4j does not exist
>>> import org.slf4j.LoggerFactory;
>>> ^
>>> /Users/lkrubner/projects/salesvoiceapp/salescricket/src/java/com/amazon/speech/speechlet/authentication/ApplicationIdVerifier.java:29:
>>>  
>>> error: cannot find symbol
>>> private static final Logger log = 
>>> LoggerFactory.getLogger(ApplicationIdVerifier.class);
>>> ^
>>> symbol: class Logger
>>> location: class ApplicationIdVerifier
>>> /Users/lkrubner/projects/salesvoiceapp/salescricket/src/java/com/amazon/speech/speechlet/IntentRequest.java:15:
>>>  
>>> error: package org.apache.commons.lang3 does not exist
>>> import org.apache.commons.lang3.Validate;
>>> ^
>>>
>>> [shortened to avoid boredom]
>>>
>>>
>>> What would I have to do to get a line such as this to resolve: 
>>>
>>> import org.apache.commons.lang3.Validate;
>>>
>>> ??? 
>>>
>>> I know there are many Clojure developers who also do a great deal of 
>>> Java development, but I am not one of them. I love Clojure/Leinengen 
>>> because most of the time it protects me from this craziness. 
>>>
>>> However, if I knew of an easy way to compile the Amazon SDK on its own, 
>>> then 

Re: Is it possible to print log statements on clojure repl as well?

2015-12-17 Thread Shantanu Kumar
Sorry Mayank, my bad. I didn't realize you were connected via an nREPL 
client. I guess you need an appender supported by nREPL server to do this 
kind of a thing.

Shantanu

On Thursday, 17 December 2015 12:24:36 UTC+5:30, Mayank Jain wrote:
>
> I tried both the solutions, neither worked.
>
> Solution #1 - Use only clojure.tools.logging
>
> My Dependencies
> [[org.clojure/clojure "1.7.0"]
>  [org.clojure/tools.logging "0.3.1"]]
>
> Repl Output
> > (require '[clojure.tools.logging :as ctl])
> nil
> > (ctl/error "hi")
> nil
> > (ctl/info "hi")
> nil
>
> Console Output
> $ lein repl :headless :port 4005
> nREPL server started on port 4005 on host 127.0.0.1 - nrepl://
> 127.0.0.1:4005
> Dec 17, 2015 12:07:16 PM clojure.tools.logging$eval406$fn__410 invoke
> SEVERE: hi
> Dec 17, 2015 12:07:22 PM clojure.tools.logging$eval406$fn__410 invoke
> INFO: hi
>
>
> Solution #2 - Add suggested dependencies
>
> My Dependencies
> [[org.clojure/clojure "1.7.0"]
>  [org.clojure/tools.logging "0.3.1"]
>  [org.slf4j/slf4j-log4j12 "1.7.13"]
>  [org.slf4j/slf4j-api "1.7.13"]
>  [log4j/log4j "1.2.17"]]
>
> Repl Output
> > (require '[clojure.tools.logging :as ctl])
> nil
> > (ctl/error "hi")
> nil
>
> Console Output
> $ lein repl :headless :port 4005
> nREPL server started on port 4005 on host 127.0.0.1 - nrepl://
> 127.0.0.1:4005
> 2015-12-17 12:11:50 ERROR user:288 - hi
>
> Am I missing something?
>
> Other infomation:
> $ java -version
> java version "1.8.0_45"
> Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
> Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
>
> $ lein -v
> Leiningen 2.5.3 on Java 1.8.0_45 Java HotSpot(TM) 64-Bit Server VM
>
> Emacs 24.5
> OS: Mac OS 10.10.5 
>
>
> On Thursday, December 17, 2015 at 7:58:37 AM UTC+5:30, Shantanu Kumar 
> wrote:
>>
>> Below is the order in which c.t.l picks up loggers:
>> 1. SLF4j (which also includes Logback, since it natively implements the 
>> SLF4j API)
>> 2. Apache Commons-logging
>> 3. Log4j
>> 4. java.util.logging
>>
>> Reference: 
>> https://github.com/clojure/tools.logging/blob/master/src/main/clojure/clojure/tools/logging/impl.clj#L214
>>
>> Both #1 and #2 are merely logger facade, incapable of logging anywhere 
>> except to the console by themselves. They need an underlying logger for 
>> real-world logging.
>>
>> Your dependencies only include the SLF4j-log4j bridge (without the log4j 
>> dependency), which I am not sure is supposed to be picked up by c.t.l. I 
>> would suggest either remove slf4j-log4j dependency altogether (allowing 
>> j.u.l to be chosen) or add the slf4j [org.slf4j/slf4j-api "1.7.13"]
>>  and log4j [log4j/log4j "1.2.17"] dependencies to your current config.
>>
>> Hope this helps.
>>
>> Shantanu
>>
>> On Wednesday, 16 December 2015 23:47:39 UTC+5:30, Mayank Jain wrote:
>>>
>>> Thanks Shantanu for your reply,
>>>
>>> It still didn't work.
>>>
>>> Here's my project.clj
>>> (defproject log "0.1.0-SNAPSHOT"
>>>   :description "FIXME: write description"
>>>   :url "http://example.com/FIXME";
>>>   :license {:name "Eclipse Public License"
>>> :url "http://www.eclipse.org/legal/epl-v10.html"}
>>>   :dependencies [[org.clojure/clojure "1.7.0"]
>>>  [org.clojure/tools.logging "0.3.1"]
>>>  [org.slf4j/slf4j-log4j12 "1.7.13"]])
>>>
>>>
>>> And here's my resources/log4j.properties file
>>> # Root logger option
>>> log4j.rootLogger=INFO, stdout
>>>
>>> # Direct log messages to stdout
>>> log4j.appender.stdout=org.apache.log4j.ConsoleAppender
>>> log4j.appender.stdout.Target=System.out
>>> log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
>>> log4j.appender.stdout.layout.ConversionPattern=%d{-MM-dd HH:mm:ss} 
>>> %-5p %c{1}:%L - %m%n
>>>
>>> And here's my the output from my Clojure repl in Emacs:
>>> user> (require '[clojure.tools.logging :as ctl])
>>> nil
>>> user> (ctl/error "Fail!")
>>> nil
>>>
>>> And here's what I get on my console
>>> $ lein repl :headless :port 4005
>>> nREPL server started on port 4005 on host 127.0.0.1 - nrepl:

Re: Is it possible to print log statements on clojure repl as well?

2015-12-16 Thread Shantanu Kumar
Below is the order in which c.t.l picks up loggers:
1. SLF4j (which also includes Logback, since it natively implements the 
SLF4j API)
2. Apache Commons-logging
3. Log4j
4. java.util.logging

Reference: 
https://github.com/clojure/tools.logging/blob/master/src/main/clojure/clojure/tools/logging/impl.clj#L214

Both #1 and #2 are merely logger facade, incapable of logging anywhere 
except to the console by themselves. They need an underlying logger for 
real-world logging.

Your dependencies only include the SLF4j-log4j bridge (without the log4j 
dependency), which I am not sure is supposed to be picked up by c.t.l. I 
would suggest either remove slf4j-log4j dependency altogether (allowing 
j.u.l to be chosen) or add the slf4j [org.slf4j/slf4j-api "1.7.13"]
 and log4j [log4j/log4j "1.2.17"] dependencies to your current config.

Hope this helps.

Shantanu

On Wednesday, 16 December 2015 23:47:39 UTC+5:30, Mayank Jain wrote:
>
> Thanks Shantanu for your reply,
>
> It still didn't work.
>
> Here's my project.clj
> (defproject log "0.1.0-SNAPSHOT"
>   :description "FIXME: write description"
>   :url "http://example.com/FIXME";
>   :license {:name "Eclipse Public License"
> :url "http://www.eclipse.org/legal/epl-v10.html"}
>   :dependencies [[org.clojure/clojure "1.7.0"]
>  [org.clojure/tools.logging "0.3.1"]
>  [org.slf4j/slf4j-log4j12 "1.7.13"]])
>
>
> And here's my resources/log4j.properties file
> # Root logger option
> log4j.rootLogger=INFO, stdout
>
> # Direct log messages to stdout
> log4j.appender.stdout=org.apache.log4j.ConsoleAppender
> log4j.appender.stdout.Target=System.out
> log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
> log4j.appender.stdout.layout.ConversionPattern=%d{-MM-dd HH:mm:ss} 
> %-5p %c{1}:%L - %m%n
>
> And here's my the output from my Clojure repl in Emacs:
> user> (require '[clojure.tools.logging :as ctl])
> nil
> user> (ctl/error "Fail!")
> nil
>
> And here's what I get on my console
> $ lein repl :headless :port 4005
> nREPL server started on port 4005 on host 127.0.0.1 - nrepl://
> 127.0.0.1:4005
> 2015-12-16 23:44:50 ERROR user:288 - Fail!
>
> I would like it to print the same on both Emacs repl and on console (and 
> add to a file).
>
> I can get it to write on console and file but not on repl.
>
> On Wednesday, December 16, 2015 at 10:13:12 PM UTC+5:30, Shantanu Kumar 
> wrote:
>>
>> If you enabled Log4j console logger, the logs should appear in the REPL 
>> too.
>>
>> See example at 
>> http://www.mkyong.com/logging/log4j-log4j-properties-examples/
>>
>> You do not necessarily need log4j to log to the REPL via 
>> clojure.tools.logging - you can just use c.t.l. without any logging library 
>> and it will fall back to java.util.logging using STDOUT.
>>
>> Shantanu
>>
>> On Wednesday, 16 December 2015 21:58:40 UTC+5:30, Mayank Jain wrote:
>>>
>>> Hi,
>>>
>>> I would like to be able to print log statements 
>>> via clojure.tools.logging to print on clojure repl as well.
>>> I am using log4j logging framework for configurations.
>>> Is this possible? I am unable to figure it out. 
>>> I am open to any other logging framework if that solves 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/d/optout.


Re: Is it possible to print log statements on clojure repl as well?

2015-12-16 Thread Shantanu Kumar
If you enabled Log4j console logger, the logs should appear in the REPL too.

See example at 
http://www.mkyong.com/logging/log4j-log4j-properties-examples/

You do not necessarily need log4j to log to the REPL via 
clojure.tools.logging - you can just use c.t.l. without any logging library 
and it will fall back to java.util.logging using STDOUT.

Shantanu

On Wednesday, 16 December 2015 21:58:40 UTC+5:30, Mayank Jain wrote:
>
> Hi,
>
> I would like to be able to print log statements via clojure.tools.logging 
> to print on clojure repl as well.
> I am using log4j logging framework for configurations.
> Is this possible? I am unable to figure it out. 
> I am open to any other logging framework if that solves 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/d/optout.


Re: [ANN] Clojure 1.8.0-RC3

2015-12-07 Thread Shantanu Kumar


On Tuesday, 8 December 2015 07:17:15 UTC+5:30, Howard M. Lewis Ship wrote:
>
> I suspect there's a few cases where we would like to use direct linking, 
> but will not be able to, because it will disrupt a 3rd party library we 
> use.  This is hypothetical, so I'll keep you posted ... I may run some 
> experiments in the next couple of days.
>
> Certainly, the use of alter-var-root by, say, io.aviso/pretty (and others 
> of its ilk) may be affected; I'll want to review which Vars, in which 
> namespaces, have been annotated with ^:redef (if not already ^:dynamic).
>
> It's possible a solution where we can provide a list of namespaced symbols 
> to exclude from dynamic linking will be needed for full adoption.
>

+1 (I guess you meant `direct` linking in the last sentence above?)

Another use case is instrumentation using `alter-var-root`, for which 
providing a namespaced list of symbols to exclude from direct linking would 
be really useful.

Shantanu
 

>
>
> On Mon, Dec 7, 2015 at 5:20 PM, Sean Corfield  > wrote:
>
>> We’ve had it in QA since 12/2 but it hasn’t had much of a work out yet 
>> due to various staff vacations etc. This build is our first with direct 
>> linking enabled for our whole code base. I don’t know when we’ll get it 
>> into production.
>>
>> We’ve had RC2 in production since 11/24 with no issues. That used the 
>> default setting regards direct linking (so, just clojure.core).
>>
>> Sean Corfield -- (904) 302-SEAN
>> World Singles -- http://worldsingles.com/
>>
>>
>> From: > on behalf of Alex Miller <
>> al...@puredanger.com >
>> Reply-To: >
>> Date: Monday, December 7, 2015 at 1:36 PM
>> To: Clojure >
>> Subject: Re: [ANN] Clojure 1.8.0-RC3
>>
>> Just a reminder that this is a release candidate - that means that if we 
>> don't hear any issues, we will release it as 1.8.0.
>>
>> If you haven't yet, please give it a try
>>
>> Thanks,
>> Alex
>>
>>
>>
>> On Wednesday, December 2, 2015 at 10:03:31 AM UTC-6, Alex Miller wrote:
>>>
>>> Clojure 1.8.0-RC3 is now available. *This build is a "release 
>>> candidate"!* We would appreciate any and all testing you can do on your 
>>> own libraries or internal projects to find problems. 
>>>
>>> Try it via
>>>
>>>- Download: 
>>>https://repo1.maven.org/maven2/org/clojure/clojure/1.8.0-RC3
>>>- Leiningen: [org.clojure/clojure "1.8.0-RC3"]
>>>
>>> Below are the changes since 1.8.0-RC2. See the full 1.8 change log here: 
>>> https://github.com/clojure/clojure/blob/master/changes.md.
>>>
>>>- CLJ-1845  / CLJ-1851 
>>> New ^:redef to mark 
>>>vars that should not be direct linked
>>>   - The metadata ^:redef can be used to mark function vars that 
>>>   should not be direct linked
>>>   - clojure.core/load was previously marked with ^:dynamic for this 
>>>   purpose, but is now marked ^:redef
>>>- CLJ-1856  Direct 
>>>linking breaks clojure.test location reporting for failures
>>>- CLJ-1854  Set line 
>>>number in bytecode prior to invokeStatic call
>>>- CLJ-1853  In socket 
>>>server, require the ns of the accept-fn before resolving it
>>>
>>>
>> -- 
>> 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.
>>
>
>
>
> -- 
> Howard M. Lewis Ship
>
> Senior Mobile Developer at Walmart Labs
>
> Creator of Apache Tapestry
>
> (971) 678-5210
> http://howardlewisship.com
> @hlship
>

-- 
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: Practical ways to deal with 'bag-of-properties' syndrome, AKA dynamic typing?

2015-11-30 Thread Shantanu Kumar
I think https://github.com/pjstadig/assertions is very useful to assert the 
values in development, and turn off in production without any penalty. 
Can't expect libraries to include this though.

Shantanu

On Tuesday, 1 December 2015 03:19:09 UTC+5:30, Jonathon McKitrick wrote:
>
> I've read the recent comments on 'the end of dynamic languages' and I'm 
> curious what ways you have found for dealing with one of the issues I've 
> heard mentioned frequently: when libraries (or functions in general) pass 
> maps around as arguments or return values, how to go about finding out 
> exactly what those maps contains without slogging through source code.
>
> Any suggestions?
>

-- 
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] Clojure 1.8.0-RC1 is now available

2015-11-11 Thread Shantanu Kumar
Thanks, Nicola!

Filed the ticket: http://dev.clojure.org/jira/browse/CLJ-1846

Shantanu

On Wednesday, 11 November 2015 17:13:05 UTC+5:30, Nicola Mometto wrote:
>
> Here's a minimal repro case:
>
> user=> (defn foo ^long [] 1)
> #'user/foo
> user=> (Integer/bitCount ^int (foo))
> VerifyError (class: user$eval13, method: invokeStatic signature: 
> ()Ljava/lang/Object;) Expecting to find integer on stack 
>  java.lang.Class.getDeclaredConstructors0 (Class.java:-2)
>
>
> On 11 Nov 2015, at 07:46, Shantanu Kumar  > wrote:
>
> One of my libraries (https://github.com/kumarshantanu/asphalt) is failing 
> to compile with 1.8 (works fine with 1.6, 1.7); the stack trace is below:
>
> $ lein do clean, with-profile dev,c18 test
> Exception in thread "main" java.lang.VerifyError: (class: 
> asphalt/core$invoke_with_transaction, method: invokeStatic signature: 
> (Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;) 
> Expecting to find integer on stack, compiling:(core.clj:201:1)
> at clojure.lang.Compiler$DefExpr.eval(Compiler.java:463)
> at clojure.lang.Compiler.eval(Compiler.java:6918)
> at clojure.lang.Compiler.load(Compiler.java:7360)
> at clojure.lang.RT.loadResourceScript(RT.java:372)
> at clojure.lang.RT.loadResourceScript(RT.java:363)
> at clojure.lang.RT.load(RT.java:453)
> at clojure.lang.RT.load(RT.java:419)
> at clojure.core$load$fn__5673.invoke(core.clj:5895)
> at clojure.core$load.invokeStatic(core.clj:5894)
> at clojure.core$load_one.invokeStatic(core.clj:5694)
> at clojure.core$load_one.invoke(core.clj)
> at clojure.core$load_lib$fn__5622.invoke(core.clj:5739)
> at clojure.core$load_lib.invokeStatic(core.clj:5738)
> at clojure.core$load_lib.doInvoke(core.clj)
> at clojure.lang.RestFn.applyTo(RestFn.java:142)
> at clojure.core$apply.invokeStatic(core.clj:647)
> at clojure.core$load_libs.invokeStatic(core.clj:5776)
> at clojure.core$load_libs.doInvoke(core.clj)
> at clojure.lang.RestFn.applyTo(RestFn.java:137)
> at clojure.core$apply.invokeStatic(core.clj:647)
> at clojure.core$require.invokeStatic(core.clj:5798)
> at clojure.core$require.doInvoke(core.clj)
> at clojure.lang.RestFn.invoke(RestFn.java:457)
> at 
> asphalt.test_util$eval198$loading__5565__auto199.invoke(test_util.clj:1)
> at asphalt.test_util$eval198.invokeStatic(test_util.clj:1)
> at asphalt.test_util$eval198.invoke(test_util.clj)
> at clojure.lang.Compiler.eval(Compiler.java:6913)
> at clojure.lang.Compiler.eval(Compiler.java:6902)
> at clojure.lang.Compiler.load(Compiler.java:7360)
> at clojure.lang.RT.loadResourceScript(RT.java:372)
> at clojure.lang.RT.loadResourceScript(RT.java:363)
> at clojure.lang.RT.load(RT.java:453)
> at clojure.lang.RT.load(RT.java:419)
> at clojure.core$load$fn__5673.invoke(core.clj:5895)
> at clojure.core$load.invokeStatic(core.clj:5894)
> at clojure.core$load_one.invokeStatic(core.clj:5694)
> at clojure.core$load_one.invoke(core.clj)
> at clojure.core$load_lib$fn__5622.invoke(core.clj:5739)
> at clojure.core$load_lib.invokeStatic(core.clj:5738)
> at clojure.core$load_lib.doInvoke(core.clj)
> at clojure.lang.RestFn.applyTo(RestFn.java:142)
> at clojure.core$apply.invokeStatic(core.clj:647)
> at clojure.core$load_libs.invokeStatic(core.clj:5776)
> at clojure.core$load_libs.doInvoke(core.clj)
> at clojure.lang.RestFn.applyTo(RestFn.java:137)
> at clojure.core$apply.invokeStatic(core.clj:647)
> at clojure.core$require.invokeStatic(core.clj:5798)
> at clojure.core$require.doInvoke(core.clj)
> at clojure.lang.RestFn.invoke(RestFn.java:457)
> at 
> asphalt.core_test$eval192$loading__5565__auto193.invoke(core_test.clj:1)
> at asphalt.core_test$eval192.invokeStatic(core_test.clj:1)
> at asphalt.core_test$eval192.invoke(core_test.clj)
> at clojure.lang.Compiler.eval(Compiler.java:6913)
> at clojure.lang.Compiler.eval(Compiler.java:6902)
> at clojure.lang.Compiler.load(Compiler.java:7360)
> at clojure.lang.RT.loadResourceScript(RT.java:372)
> at clojure.lang.RT.loadResourceScript(RT.java:363)
> at clojure.lang.RT.load(RT.java:453)
> at clojure.lang.RT.load(RT.java:419)
> at clojure.core$load$fn__5673.invoke(core.clj:5895)
> at clojure.core$load.invokeStatic(core.clj:5894)
> at clojure.core$load_one.invokeStatic(core.clj:5694)
> at clojure.core$load_one.invoke(core.clj)
> at clojure.core$load_lib$fn__5622.invoke(core.clj:5739)
> at clojure.core$load_lib.invokeStatic(core.clj:5738)
> at clojure.core$load_lib.doInvoke(core.clj)
> at clojure.lang.RestFn.applyTo(RestFn.java:142)
> at clojure.core$apply.invokeStatic(core.clj:647)
> at clojure.core$load_libs.invokeStatic(core.clj:5776)
> at clojure.core$load_libs.doInvoke(core.clj)
> at clojure.lang.RestFn.applyTo(RestFn.java:13

Re: [ANN] Clojure 1.8.0-RC1 is now available

2015-11-10 Thread Shantanu Kumar
One of my libraries (https://github.com/kumarshantanu/asphalt) is failing 
to compile with 1.8 (works fine with 1.6, 1.7); the stack trace is below:

$ lein do clean, with-profile dev,c18 test
Exception in thread "main" java.lang.VerifyError: (class: 
asphalt/core$invoke_with_transaction, method: invokeStatic signature: 
(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;) 
Expecting to find integer on stack, compiling:(core.clj:201:1)
at clojure.lang.Compiler$DefExpr.eval(Compiler.java:463)
at clojure.lang.Compiler.eval(Compiler.java:6918)
at clojure.lang.Compiler.load(Compiler.java:7360)
at clojure.lang.RT.loadResourceScript(RT.java:372)
at clojure.lang.RT.loadResourceScript(RT.java:363)
at clojure.lang.RT.load(RT.java:453)
at clojure.lang.RT.load(RT.java:419)
at clojure.core$load$fn__5673.invoke(core.clj:5895)
at clojure.core$load.invokeStatic(core.clj:5894)
at clojure.core$load_one.invokeStatic(core.clj:5694)
at clojure.core$load_one.invoke(core.clj)
at clojure.core$load_lib$fn__5622.invoke(core.clj:5739)
at clojure.core$load_lib.invokeStatic(core.clj:5738)
at clojure.core$load_lib.doInvoke(core.clj)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invokeStatic(core.clj:647)
at clojure.core$load_libs.invokeStatic(core.clj:5776)
at clojure.core$load_libs.doInvoke(core.clj)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invokeStatic(core.clj:647)
at clojure.core$require.invokeStatic(core.clj:5798)
at clojure.core$require.doInvoke(core.clj)
at clojure.lang.RestFn.invoke(RestFn.java:457)
at 
asphalt.test_util$eval198$loading__5565__auto199.invoke(test_util.clj:1)
at asphalt.test_util$eval198.invokeStatic(test_util.clj:1)
at asphalt.test_util$eval198.invoke(test_util.clj)
at clojure.lang.Compiler.eval(Compiler.java:6913)
at clojure.lang.Compiler.eval(Compiler.java:6902)
at clojure.lang.Compiler.load(Compiler.java:7360)
at clojure.lang.RT.loadResourceScript(RT.java:372)
at clojure.lang.RT.loadResourceScript(RT.java:363)
at clojure.lang.RT.load(RT.java:453)
at clojure.lang.RT.load(RT.java:419)
at clojure.core$load$fn__5673.invoke(core.clj:5895)
at clojure.core$load.invokeStatic(core.clj:5894)
at clojure.core$load_one.invokeStatic(core.clj:5694)
at clojure.core$load_one.invoke(core.clj)
at clojure.core$load_lib$fn__5622.invoke(core.clj:5739)
at clojure.core$load_lib.invokeStatic(core.clj:5738)
at clojure.core$load_lib.doInvoke(core.clj)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invokeStatic(core.clj:647)
at clojure.core$load_libs.invokeStatic(core.clj:5776)
at clojure.core$load_libs.doInvoke(core.clj)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invokeStatic(core.clj:647)
at clojure.core$require.invokeStatic(core.clj:5798)
at clojure.core$require.doInvoke(core.clj)
at clojure.lang.RestFn.invoke(RestFn.java:457)
at 
asphalt.core_test$eval192$loading__5565__auto193.invoke(core_test.clj:1)
at asphalt.core_test$eval192.invokeStatic(core_test.clj:1)
at asphalt.core_test$eval192.invoke(core_test.clj)
at clojure.lang.Compiler.eval(Compiler.java:6913)
at clojure.lang.Compiler.eval(Compiler.java:6902)
at clojure.lang.Compiler.load(Compiler.java:7360)
at clojure.lang.RT.loadResourceScript(RT.java:372)
at clojure.lang.RT.loadResourceScript(RT.java:363)
at clojure.lang.RT.load(RT.java:453)
at clojure.lang.RT.load(RT.java:419)
at clojure.core$load$fn__5673.invoke(core.clj:5895)
at clojure.core$load.invokeStatic(core.clj:5894)
at clojure.core$load_one.invokeStatic(core.clj:5694)
at clojure.core$load_one.invoke(core.clj)
at clojure.core$load_lib$fn__5622.invoke(core.clj:5739)
at clojure.core$load_lib.invokeStatic(core.clj:5738)
at clojure.core$load_lib.doInvoke(core.clj)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invokeStatic(core.clj:647)
at clojure.core$load_libs.invokeStatic(core.clj:5776)
at clojure.core$load_libs.doInvoke(core.clj)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invokeStatic(core.clj:647)
at clojure.core$require.invokeStatic(core.clj:5798)
at clojure.core$require.doInvoke(core.clj)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invokeStatic(core.clj:647)
at clojure.core$apply.invoke(core.clj)
at user$eval91.invokeStatic(form-init7505432955041312280.clj:1)
at user$eval91.invoke(form-init7505432955041312280.clj)
at clojure.lang.Compiler.eval(Compiler.java:6913)
at clojure.lang.Compiler.eval(Compiler.java:6903)
at clojure.lang.Compiler.load(Compiler.java:7360)
at clojure.lang.Compiler.loadFile(Compiler.java:7298)
at clojure.main$load_script.invokeStatic(main.clj:275)
at clojure.main$init_opt.invokeStatic(main.clj:277)
at clojure.main$init_opt.invoke(main.clj)
at clojure.main$initialize.invokeStatic(main.clj:308)
at clojure.main$null_opt.invokeStatic(main.clj:342)
at clojure.main$null_opt.invoke(main.clj)
at clojure.main$main.invokeStatic(main.clj:421)
at clojure.main$main.doInvoke(main.clj)
at clojure.lang.Res

Re: is there a community "best practice" for including your co-workers libraries?

2015-10-16 Thread Shantanu Kumar
We are using Artifactory for our internal Maven repo (supports enterprise 
Single-Sign-On):
https://www.jfrog.com/open-source/

Shantanu

On Saturday, 17 October 2015 02:47:29 UTC+5:30, Lawrence Krubner wrote:
>
> I know this question has been asked before, but when I went searching I 
> mostly found old entries that were on a somewhat different topic, such as 
> "How to add a java library (that is not in maven) as a dependency for a 
> clojure library?"
>
> I wrote a Clojure app and my co-worker wrote a Java app. I have another 
> co-worker who is working on an app that would include the first 2 apps as 
> libraries. 
>
> I have been able to get the combination working using the Leiningen plugin 
> "localrepo" but my co-worker wants me to make the other 2 libraries 
> available from some central repo that Leiningen can download from. How is 
> this usually done? Do I set up a Maven repo on one of the company servers? 
>
>
>
>
>
>
>
>
>

-- 
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] Clojure High Performance Programming, 2nd edition

2015-10-08 Thread Shantanu Kumar
Hi,

I am happy to share that second edition of `Clojure High Performance 
Programming` is now published. This book is targeted at intermediate 
Clojure programmers and covers Clojure abstractions, Java interop, JVM 
internals, Concurrency and other performance-related topics.

On Packt website: 
https://www.packtpub.com/application-development/clojure-high-performance-programming-second-edition
On Amazon: 
http://www.amazon.com/Clojure-Performance-Programming-Shantanu-Kumar-ebook/dp/B013EJ3DRK

This edition is updated for Clojure 1.7 and Java 8, and includes a new 
chapter on measuring performance. The book is updated throughout with 
practical tips and techniques. I hope readers will enjoy the book.

Shantanu

-- 
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: Strictly tagged clojure

2015-08-08 Thread Shantanu Kumar
This is a very useful enhancement indeed. I wonder if it is feasible (or if 
it makes sense) to extend this to have type based overloading:

(defn foo
  ([^TypeA a] ..)
  ([^TypeB b] ..))

Shantanu

On Friday, 7 August 2015 11:40:42 UTC+5:30, Alex Miller wrote:
>
> Hey Reid, 
>
> I've forwarded this over to Rich and Stu to take a look at.
>
> Alex
>
> On Thursday, August 6, 2015 at 11:46:09 AM UTC-5, Reid McKenzie wrote:
>>
>> Hello all,
>>
>> Alan Malloy and I recently implemented[1] and contributed[2] an opt-in
>> strict tags mode to Alexander Yakushev's Skummet compiler. To
>> summarize the linked blog post and merge request, we created the
>> `clojure.core/*strict-tags*` dynamic var which may either be set by
>> users at the namespace level a la `clojure.core/*warn-on-reflection*`
>> or set on a per-fn basis with the `^:strict` metadata annotation. When
>> in strict mode, type hints are interpreted not as optional and late
>> checked hints (the Clojure default) but as eagerly checked static
>> types on tagged locals and expressions.
>>
>> The effect of these changes is to greatly reduce the number of
>> checkcast instructions emitted when performing tagged interop should
>> users opt into using strict mode and accept the requisite
>> responsibility for managing their types.
>>
>> While the odds that these changes will be accepted as-is are slim, we
>> think they represent a valuable addition to the language and so
>> present them for your consideration.
>>
>> - Reid
>>
>> [1] - http://blog.factual.com/strictly-tagged-clojure
>> [2] - https://github.com/alexander-yakushev/clojure/pull/1
>>
>>

-- 
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: Anotating functions for pre-processing

2015-08-07 Thread Shantanu Kumar
Hi Georgi,

Have you seen this thread?
https://groups.google.com/forum/#!topic/clojure/0hKOFQXAwRc

Shantanu

On Wednesday, 5 August 2015 17:28:42 UTC+5:30, Georgi Danov wrote:
>
> Hi,
>  I have had good 6 months of fun with Clojure and have big appreciation 
> for it's way of doing things. Coming from the Java/Spring world however, I 
> still have this nagging desire to be able to annotate functions and have 
> some preprocessor pick up these annotations and decorate the code 
> accordingly. Let me illustrate it:
>
> In Java + Spring
> @Transactional
> public void someFunction(){...}
>
> the Spring core container has excellent support for preprocessors to 
> instrument this function with some advice.
>
> -
>
> I wish I could do that in Clojure:
>
> (defn ^:transactional someFunction [...] ...)
>
> and then have somehow means to decorate someFunction (yes, I am aware 
> there is no container)
>
> I have read some blog posts (about dependency injection in the context of 
> testing clojure) that discuss *alter-var-root,* but that looks like very 
> brutal approach.
>
> What would be the advice on that? I am even happy to go with solution that 
> involves some micro-container spring-like approach.
>
> 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/d/optout.


Re: [ANN] Release 0.32.0 of Counterclockwise

2015-07-31 Thread Shantanu Kumar


On Friday, 31 July 2015 19:41:45 UTC+5:30, fasfsfgs wrote:
>
> Sorry for my noobness but is there any tutorial on how to use 
> counterclockwise? 
>

> I'm a java developer and I'm super curious about Clojure.
> I'm still learning the very basics of the language and I'd like to keep 
> using eclipse for now since I'm very familiar with it.
>

You might know that in Eclipse you can go to menu item 
Help->EclipseMarketplace, search for "clojure", select CounterClockWise and 
install it from there. After installation, you would probably find this 
useful:
http://doc.ccw-ide.org/documentation.html

You may find more guides and tutorials (also videos) via Internet search.

If you are completely new to Clojure, you may want to know about 
http://leiningen.org/ (and probably https://sekao.net/nightcode/ too) 
first. Welcome to the community and all the best on learning Clojure.

Shantanu
 

>
> Thanks for any help you guys can give me. =)
>
> On Wed, Jul 29, 2015 at 8:33 PM, Laurent PETIT  > wrote:
>
>> Counterclockwise, the Eclipse Clojure development tool.
>>
>> Counterclockwise 0.32.0 has been released.
>>
>> Highlights:
>>
>> - Clojure 1.7.0 support
>> - Cider-nrepl support
>> - Clojurescript support
>> - macro-expansion via editor hovers
>> - Embedded User plugins such as : font zoom mode for presentations, ANSI 
>> Colors in the REPL
>> - tons of small enhancements and bugs fixes (total 62 issues closed 
>> https://github.com/laurentpetit/ccw/issues?q=milestone%3A0.32.0+is%3Aclosed
>> )
>>
>>
>> ChangeLog
>> =
>>
>>
>> http://doc.ccw-ide.org/ChangeLog.html#_changes_between_counterclockwise_0_31_1_and_0_32_0
>>
>> Installation instructions
>> ==
>>
>> http://doc.ccw-ide.org/documentation.html#_install_counterclockwise
>>
>> Cheers,
>>
>>
>> -- 
>> Laurent Petit
>>
>> -- 
>> 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: What is the best way to pass log configs everywhere without a global var?

2015-07-25 Thread Shantanu Kumar
Logging calls are far too frequent to practically pass config as argument 
everywhere, hence some kind of shared implicit context is required. Which 
logging libraries are you dealing with? If you use Timbre[1], you can pass 
config using dynamic vars or altering global state. If you use Logback[2] 
or Log4j[3], you can set system properties using Java interop ahead of 
dynamically loading (by looking up ns/var entry points in) Clojure code.

[1] Timbre: https://github.com/ptaoussanis/timbre
[2] Logback: http://logback.qos.ch/
[3] Log4j: http://logging.apache.org/log4j/2.x/

Shantanu

On Saturday, 25 July 2015 20:20:55 UTC+5:30, crocket wrote:
>
> Logging libraries seem to rely on a global config. This looks like a 
> dangerous state that could blow up.
> I researched a little, and there seems to be reader monad and dependency 
> injection, all of which feel awkard.
>
> Is there not a decent approach to passing log config without a global var?
>

-- 
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: http-kit and context root?

2015-07-07 Thread Shantanu Kumar
I think what you need on the http-kit side is a context "stripper" 
middleware, because http-kit would receive a URI like /server1/foo/bar that 
needs to be stripped down to /foo/bar to match your app routes.

(defn strip-middleware
  [handler ^String prefix]
  (let [plen (count prefix)]
(fn [request]
  (let [^String uri (:uri request)]
(if (.startsWith uri prefix)
  (handler (assoc request :uri (subs uri plen)))
  (handler request))

Call it like: (strip-middleware handler "/server1")

I didn't test this, but should be close to what might cut it.

Shantanu

On Tuesday, 7 July 2015 20:56:25 UTC+5:30, Colin Yates wrote:
>
> Thanks Jo. The problem I have is that I have a bunch of hosts behind a 
> single Apache server which ProxyForwards over SSL. My Apache FU isn’t great 
> and I have only managed to get this to work if there is symmetry between 
> the URL coming in and the context root on the machine being proxied, i.e. 
> /server1 is proxied to something like http://my-server:3000/server1. 
> /server1 being proxied to http://my-server:3000/ doesn’t work.
>
>
>
> On 7 Jul 2015, at 15:23, Jo Geraerts > wrote:
>
> I think you don't. 
>
> But you can make a small piece of middleware that dispatches to a 
> different handler based on the 'context root'. You can also strip off the 
> context root as u dispatch the request to the correct handler. 
>
> I'm doing something similar with virtual hosts. 
>
> (ns net.umask.imageresizer.vhost)
>
> (defn vhost-handler [vhosts]
>   (fn [request]
> (let [hostname (:server-name request)
>   handler (get-in vhosts [hostname :handler])]
>   (if-not (nil? handler)
> (handler request)
> {:status 404
>  :body "vhost config not found"}
>
>
> Hope you can work with this. 
>
>
>
>
> -- 
> 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: awful performance on Windows 7 compared to anything else

2015-07-03 Thread Shantanu Kumar
Hi Colin,

If you know that the delay is happening in the server-side Clojure code, 
maybe you can give https://github.com/kumarshantanu/espejito a try to 
determine where in the call stack is the latency happening?

Shantanu

On Friday, 3 July 2015 22:20:23 UTC+5:30, Colin Yates wrote:
>
> Hi all,
>
> I have a Clojure/ClojureScript app using http-kit. When deployed on 
> Windows 7 it is a insanely slow. For example, loading the first screen 
> loads immediately but then takes minutes to populate. The exact same jar on 
> Windows XP, OS X, Linux, Windows 2008 server etc. take a handful of seconds.
>
> In total, 3 Windows 7 machines (including a fresh VM I just booted up, 
> installed Win7SP1 and all patches, installed latest JDK on and then ran the 
> JAR) exhibit the same performance. 2 OSXs, 1 Linux box and 1 Windows 2008 
> are all fine.
>
> Fortunately no-one is going to run the server on Windows 7, and using a 
> browser on Windows 7 to connect to the server running anywhere else is 
> absolutely fine. 
>
> Anyone else run into this? Any pointers?
>

-- 
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 use a java web service project in clojure?

2015-05-27 Thread Shantanu Kumar
Leiningen doesn't work with local JARs, rather it requires the Maven 
coordinates for dependencies so that it can download those. I'd suggest you 
figure out the Maven coordinates of your WEB-INF/lib/*.jar files and 
specify those in project.clj

Should you have local JARs not available on any Maven repo, try 
https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L118 
or the lein-localrepo plugin.

Shantanu

On Wednesday, 27 May 2015 20:59:59 UTC+5:30, Peng Lin wrote:
>
> Yes, this works. I added javax to dependencies, and the errors about this 
> disappeared. But there is a lot of jars i used (in the WEB-INF/lib), how to 
> add all these jars once and ever? 
>
> i found jvm-opts -Djava.library.path, but i don't know how to use it
>
> 在 2015年5月27日星期三 UTC+8下午9:01:15,Shantanu Kumar写道:
>>
>> You should probably include the right dependencies in project.clj, e.g.
>>
>> :dependencies [[javax.ws.rs/jsr311-api "1.1.1"]]
>>
>> You might actually need an implementation, e.g. Apache-CXF, or RestEasy 
>> etc. as dependency but I am not sure.
>>
>> Shantanu
>>
>> On Wednesday, 27 May 2015 16:28:54 UTC+5:30, Peng Lin wrote:
>>>
>>> Hi guys,
>>> i'm new to clojure, and we have built our production using java. 
>>> It's a web service, named "ddi", which runs on tomcat. 
>>>
>>> i use eclipse to build a clojure project, and set in project.clj:
>>>  :java-source-paths ["/Users/apple/ife/ddi/src"]
>>> then, set project.Properties.Libraries: Apache Tomcat, JUnit 4, Web 
>>> App Libraries(ddi)
>>>
>>> then, i try to do "lein javac". And i got a lot of error like this:
>>> 
>>> /Users/apple/ife/ddi/src/com/buildInfo/resource/InvokeEntryPoint.java:3: 
>>> 错误: 程序包javax.ws.rs不存在
>>>
>>> import javax.ws.rs.Consumes;
>>>
>>> It's Chinese, means javax.ws.rs dose not existed.
>>>
>>>
>>> How can i do this?
>>>
>>>   
>>>
>>

-- 
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 use a java web service project in clojure?

2015-05-27 Thread Shantanu Kumar
You should probably include the right dependencies in project.clj, e.g.

:dependencies [[javax.ws.rs/jsr311-api "1.1.1"]]

You might actually need an implementation, e.g. Apache-CXF, or RestEasy 
etc. as dependency but I am not sure.

Shantanu

On Wednesday, 27 May 2015 16:28:54 UTC+5:30, Peng Lin wrote:
>
> Hi guys,
> i'm new to clojure, and we have built our production using java. It's 
> a web service, named "ddi", which runs on tomcat. 
>
> i use eclipse to build a clojure project, and set in project.clj:
>  :java-source-paths ["/Users/apple/ife/ddi/src"]
> then, set project.Properties.Libraries: Apache Tomcat, JUnit 4, Web 
> App Libraries(ddi)
>
> then, i try to do "lein javac". And i got a lot of error like this:
> /Users/apple/ife/ddi/src/com/buildInfo/resource/InvokeEntryPoint.java:3: 
> 错误: 程序包javax.ws.rs不存在
>
> import javax.ws.rs.Consumes;
>
> It's Chinese, means javax.ws.rs dose not existed.
>
>
> How can i do this?
>
>   
>

-- 
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: Advice when running java -jar rather than a managed server like tomcat?

2015-05-26 Thread Shantanu Kumar
I'm doing some of those things at work (http-kit, 
logback+slf4j+MDC+clojure.tools.logging, config via property files). My 
entry point (main) is a Java class that reads properties file, sets system 
properties to hoist logging config variables, then uses reflection to load 
other Java/Clojure initializers that may be referring to SLF4j in some 
fashion.

We're yet to settle on a way to run Java JAR as a system service, but we 
are looking at http://supervisord.org/ and https://mmonit.com/wiki/Monit/FAQ

Shantanu

On Tuesday, 26 May 2015 17:08:30 UTC+5:30, Colin Yates wrote:
>
> Hi,
>
> I am venturing into new territory using http-kit, as I usually use a 
> 'managed' web server container like tomcat and have a few questions about 
> packing and running a JAR file:
>
>  - are there are convenient service wrappers for windows and/or Linux
>  - any best practice around managing class path for things like logback.xml
>
> I have a jar created from lein uberjar and java -jar the.jar works, but 
> this seems a long way away from automated deployment :).
>
> Any advice welcome - 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/d/optout.


Re: contains? on String

2015-05-12 Thread Shantanu Kumar
I agree about the counter-intuitiveness. I'm only wondering whether the 
error message is a bit misleading "contains? not supported on type: 
java.lang.String" because of course (contains? "hello" 2) works fine.

Shantanu

On Wednesday, 13 May 2015 00:12:19 UTC+5:30, James Reeves wrote:
>
> contains? has always been a little counter-intuitive. It essentially only 
> works on collections that allow for a constant or logarithmic lookup time, 
> and often works on the "keys" of a collection, rather than its values. The 
> only exception to this are sets, where the values are essentially keys as 
> well.
>
> So:
>
> (contains? {:a 1} :a) => true
> (contains? {:a 1} 1) => false
> (contains? [:a] :a) => false
> (contains? [:a] 0) => true
> (contains? #{:a} :a) => true
> (contains? "a" \a) => error
> (contains? '(:a) :a) => error
>
> - James
>
> On 12 May 2015 at 19:25, Shantanu Kumar  > wrote:
>
>> Hi,
>>
>> I notice the following in Clojure 1.7.0-beta2:
>>
>> user=> (contains? "hello" 2)
>> true
>> user=> (contains? "hello" \e)
>>
>> IllegalArgumentException contains? not supported on type: 
>> java.lang.String  clojure.lang.RT.contains (RT.java:800)
>>
>>
>> Is this just a case of misleading error message or am I missing something?
>>
>> Shantanu
>>
>> -- 
>> 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.


contains? on String

2015-05-12 Thread Shantanu Kumar
Hi,

I notice the following in Clojure 1.7.0-beta2:

user=> (contains? "hello" 2)
true
user=> (contains? "hello" \e)

IllegalArgumentException contains? not supported on type: java.lang.String 
 clojure.lang.RT.contains (RT.java:800)


Is this just a case of misleading error message or am I missing something?

Shantanu

-- 
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: Idiomatic access to collaborators/services

2015-02-25 Thread Shantanu Kumar
Having tried few other ways earlier, I now prefer the `first` approach you 
described. Protocols decouple the contract and the implementation very 
well, and can be reified for various profiles (unit tests, scenario tests, 
integration etc.) For constructing the graph I have found Prismatic graph 
with reifying-functions to be very apt -- you may still need to borrow the 
lifecycle idea from Stuart Sierra's component (maybe define IStoppable) for 
things that need shutdown, such as custom thread-pools.

Shantanu

On Wednesday, 25 February 2015 18:52:28 UTC+5:30, Colin Yates wrote:
>
> Hi,
>
> I ran into a bit of a brick wall when thinking about how to register to 
> and dispatch to multiple micro-services and it made me realise the 
> underlying tension came from not having peace about a fundamental design 
> decision; how do you access your collaborators. Note: I am specifically 
> talking about 'providers of functionality' as oppose to state. I think 
> everybody agrees that passing state around is a "good thing" (e.g. *db* is 
> so 90s, (defn my-thing-which-needs-a-db [db] ...) is where it is at).
>
> One option is to receive instances of a service (probably some 
> implementation of a defprotocol):
>
> (den my-service [service-1 service-2 payload]
>  (some-method service-1)
>  (some-method service-2))
>
> The other is to directly reach into the collaborator's namespace:
>
> (den my-service [payload]
>  (service-1-ns/some-function)
>  (service-2-ns/some-function))
>
> (maybe some config is passed into my-service which the other services use.
>
> The first approach has a much smaller coupling and makes it much easier to 
> reason about. If there is coupling then it is on the protocol of the 
> collaborator. It is therefore trivial to unit-test as you can stub out the 
> collaborators without redef. It also has echoes of OO services, which might 
> be just fine.
>
> The second approach means you don't end up passing collaborators deep down 
> hierarchy graphs (which I haven't run into actually - Clojure tends to have 
> a much 'flatter' graph then Java). It does mean testing etc. requires 
> redefs.
>
> My inclination is to go for the first as it seems simpler, but I still 
> have an allergic reaction to using protocols like this (because of the OO 
> trap). 
>
> This clearly isn't new ground, but I could find surprisingly little blogs 
> and discussion about this. It is also something that only really becomes a 
> problem in the larger scale as well.
>
> What do you all do?
>

-- 
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: Why no h2 1.4.176

2015-02-25 Thread Shantanu Kumar


On Wednesday, 25 February 2015 15:11:14 UTC+5:30, Cecil Westerhof wrote:
>
> 2015-02-25 10:10 GMT+01:00 Shantanu Kumar  >:
>
>> This has nothing to do with Leiningen, I think. The H2 artifacts are here:
>> http://mvnrepository.com/artifact/com.h2database/h2
>>
>> You can only use the artifacts that are available, which doesn't include 
>> 1.4.176 on Maven Central.
>>
>
> ​In the mvnrepository (the link you gave) there is 1.4.176. (It is used 82 
> times.) How to get it replicated to Maven Central?
>

One that is used 82 times is 1.3.176, not 1.4.176 -- you can change the 
version to "1.3.176" in project.clj to use it.

Shantanu
 

>  
>  
>
>> On Wednesday, 25 February 2015 14:27:51 UTC+5:30, Cecil Westerhof wrote:
>>>
>>> I am starting to play with SQL and Clojure. My choice (at least to start 
>>> with is H2). With Leiningen you can use version 1.4.77 up-to 1.4.185, but 
>>> those are all beta version. I would prefer to work with the last stable 
>>> version which is 1.4.176. Why is that not included in central or clojars?
>>>
>>
> -- 
> Cecil Westerhof
>  

-- 
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: Why no h2 1.4.176

2015-02-25 Thread Shantanu Kumar
This has nothing to do with Leiningen, I think. The H2 artifacts are here:
http://mvnrepository.com/artifact/com.h2database/h2

You can only use the artifacts that are available, which doesn't include 
1.4.176 on Maven Central.

Shantanu

On Wednesday, 25 February 2015 14:27:51 UTC+5:30, Cecil Westerhof wrote:
>
> I am starting to play with SQL and Clojure. My choice (at least to start 
> with is H2). With Leiningen you can use version 1.4.77 up-to 1.4.185, but 
> those are all beta version. I would prefer to work with the last stable 
> version which is 1.4.176. Why is that not included in central or clojars?
>
> -- 
> Cecil Westerhof
>  

-- 
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: Name of a function

2015-02-14 Thread Shantanu Kumar
You can probably omit try and throw to achieve the same effect.

(let [ste# (aget (.getStackTrace (Exception.)))]
  ..)

Shantanu

On Sunday, 15 February 2015 00:58:28 UTC+5:30, Shantanu Kumar wrote:
>
> See if you can put this to any use (implies no warranty) - applicable to 
> the JVM only:
>
> (defmacro whereami
>   []
>   `(try (throw (Exception.))
> (catch Exception e#
>   ;; (.printStackTrace e#) ; uncomment this line to inspect stack 
> trace
>   (let [ste# (aget (.getStackTrace e#) 0)]
> {:class-name  (.getClassName  ste#)
>  :file-name   (.getFileName   ste#)
>  :line-number (.getLineNumber ste#)
>  :method-name (.getMethodName ste#)}
>
> (defn foo []
>   (println "This is at" (whereami)))
>
> Shantanu
>
> On Saturday, 14 February 2015 21:41:48 UTC+5:30, Cecil Westerhof wrote:
>>
>> In Bash I use the following construct:
>> printf "${FUNCNAME} needs an expression\n"
>>
>> In this way I do not have to change the print statement when the name of 
>> the function changes. Is something like this also possible in clojure?
>>
>> -- 
>> Cecil Westerhof
>>  
>

-- 
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: Name of a function

2015-02-14 Thread Shantanu Kumar
See if you can put this to any use (implies no warranty) - applicable to 
the JVM only:

(defmacro whereami
  []
  `(try (throw (Exception.))
(catch Exception e#
  ;; (.printStackTrace e#) ; uncomment this line to inspect stack 
trace
  (let [ste# (aget (.getStackTrace e#) 0)]
{:class-name  (.getClassName  ste#)
 :file-name   (.getFileName   ste#)
 :line-number (.getLineNumber ste#)
 :method-name (.getMethodName ste#)}

(defn foo []
  (println "This is at" (whereami)))

Shantanu

On Saturday, 14 February 2015 21:41:48 UTC+5:30, Cecil Westerhof wrote:
>
> In Bash I use the following construct:
> printf "${FUNCNAME} needs an expression\n"
>
> In this way I do not have to change the print statement when the name of 
> the function changes. Is something like this also possible in clojure?
>
> -- 
> Cecil Westerhof
>  

-- 
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: which are the pros and cons between stuartsierra/component and prismatic/graph?

2015-02-04 Thread Shantanu Kumar


On Wednesday, 4 February 2015 19:36:58 UTC+5:30, tbc++ wrote:
>
> Most of the time, if you are using a component like system, you'll also 
> want some level of polymorphism as well. This is what the defrecord 
> approach enables, it not only provides dependency injection, but also 
> provides a type that calls to that component can dispatch against. In 
> testing it's then quite easy to swap out a component with a mock component, 
> that's something that's pretty hard to do with just functions. 
>

True. With Prismatic graph, one needs to build one dependency-graph per 
profile (i.e. prod, each test suite etc.) though the test profiles (where 
one wants mock impl) may require much smaller graphs depending on the scope.

Shantanu
 

>
> Timothy
>
> On Wed, Feb 4, 2015 at 6:42 AM, Shantanu Kumar  > wrote:
>
>>
>>
>> On Wednesday, 4 February 2015 18:26:43 UTC+5:30, Lucas Bradstreet wrote:
>>>
>>> Component is more for managing state, whereas graph is for structuring 
>>> computation. All I can really tell you is that after using component I am 
>>> never going back (at least in Clojure).
>>>
>>
>> With Prismatic graph you can structure a hierarchy of functions that 
>> initialize parts of app and return functions/protocol implementations, thus 
>> using it like a dependency injection mechanism. The advantage is you don't 
>> have to pass a giant map around in the app, avoiding runtime overhead. The 
>> downside is, this style makes REPL-driven development more challenging.
>>
>> Shantanu
>>
>> -- 
>> 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.
>>
>
>
>
> -- 
> “One of the main causes of the fall of the Roman Empire was that–lacking 
> zero–they had no way to indicate successful termination of their C 
> programs.”
> (Robert Firth) 
>  

-- 
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: which are the pros and cons between stuartsierra/component and prismatic/graph?

2015-02-04 Thread Shantanu Kumar


On Wednesday, 4 February 2015 18:26:43 UTC+5:30, Lucas Bradstreet wrote:
>
> Component is more for managing state, whereas graph is for structuring 
> computation. All I can really tell you is that after using component I am 
> never going back (at least in Clojure).
>

With Prismatic graph you can structure a hierarchy of functions that 
initialize parts of app and return functions/protocol implementations, thus 
using it like a dependency injection mechanism. The advantage is you don't 
have to pass a giant map around in the app, avoiding runtime overhead. The 
downside is, this style makes REPL-driven development more challenging.

Shantanu

-- 
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: lein uberjar not creating class files with :aot

2015-01-04 Thread Shantanu Kumar
I have run into this (using lein 2.5.0 and 2.4.1) as well. `lein uberjar` 
seems to wipe out the pre-generated classes when creating an uberjar.

Shantanu

On Sunday, 4 January 2015 01:09:30 UTC+5:30, Shoeb Bhinderwala wrote:
>
> When I create a uberjar with aot compilation I am surprised to see ".clj" 
> files in there. Then when I run the jar with the "java -jar myuberjar" 
> command I get a ClassNotFoundException.
>
> For example, I am have the following dependency in my project.clj file:
>
>  [org.clojure/java.jdbc "0.3.6"]
>
> However, when running the uberjar I see the following exception
>
>java.lang.ClassNotFoundException: clojure.java.jdbc.Connectable
>
> Inside the uberjar when I traverse to the location \clojure\java\jdbc I 
> see only one file "jdbc.clj" and no ".class" files? I don't see the 
> Connectable.class file there.  I am expecting to see the .class files here 
> as I am specifying :aot :all in my project.clj file:
>
>   :profiles
> {:dev   {:resource-paths ["config_dev"]}
>  :stage {:resource-paths ["config_stage"]}
>  :prod  {:resource-paths ["config_prod"]}
>*  :uberjar {:aot :all}})*
>
> Have spent many hours hair pulling but not able to figure out how to solve 
> this problem.
>
> Many thanks for your help.
> Regards,
> Shoeb
>
> Leiningen version 2.5.0
> Java version 1.7
> Issue is on both Windows 7 and Linux.
>
>

-- 
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: Clojure CLR Experiences

2014-11-11 Thread Shantanu Kumar
Not sure why you say that 1.4 is the current version. ClojureCLR releases 
are here: https://www.nuget.org/packages/Clojure - as of today 1.6.0.1 is 
the current stable version.

Leiningen plugin is here: https://github.com/kumarshantanu/lein-clr

Shantanu

On Tuesday, 11 November 2014 21:08:58 UTC+5:30, Adrian Mowat wrote:
>
> Hi All,
>
> We are using Clojure on the JVM but one of our .Net developers has asked 
> me whether I have considered using it on the CLR.  I haven't tried doing it 
> so I wondered if anyone can share any experiences using Clojure on the CLR? 
>  A quick google search suggests the project is still active but not 
> especially vibrant (current version 1.4, last commit 24 days ago) but maybe 
> that's unfair.
>
> I'm broadly interested in the following...
>
> * Is Clojure CLR production ready?
> * Do its version numbers correspond to the core Clojure version numbers? 
>  (would it be fair to say the Java version is the core version)
> * Is it sensible to think in terms of writing platform independent code in 
> the same way as we do with cljx files in ClojureScript?
> * How good is the Visual Studio support for Clojure?
> * Does Leiningen work?
> * Are there any significant pitfalls to be aware of?
>
> Any other comments would be greatly appreciated.
>
> Many Thanks
>
> Adrian
>
>
>
>
>
>

-- 
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] rete4frames, v. 5.2.0 - CLIPS-like expert system shell

2014-10-13 Thread Shantanu Kumar
OK, I understand now - will report bugs if I find any, am at a newbie level 
now. I was confused whether it's an Alpha release, because the subject 
didn't mention that.

Shantanu

On Monday, 13 October 2014 17:46:30 UTC+5:30, ru wrote:
>
> Hi Shantanu,
>
> 1. I am waiting for bug reports from you, guys :)
> 2. Does this create some problems?
>
> -- ru
>
>
> суббота, 11 октября 2014 г., 20:59:43 UTC+4 пользователь ru написал:
>>
>> Hello all,
>>
>> New version 5.2.0 of rete4frames CLIPS-like expert system shell published 
>> on https://github.com/rururu/rete4frames.
>>
>> News:
>>
>> 1. Tests can be used in negative condition
>> 2. Because of this CLIPS examples reducted to canonical form
>> 3. Several bug fixes including logical
>> 4. Lot of code optimizations
>>
>> Enjoy!
>>
>> Sincerely,
>>   Ru
>>
>

-- 
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] rete4frames, v. 5.2.0 - CLIPS-like expert system shell

2014-10-12 Thread Shantanu Kumar
Hi Ru,

Congrat's on the release.

I wonder why did you choose to release the new version as "5.2.0-SNAPSHOT" 
instead of "5.2.0".

Shantanu

On Saturday, 11 October 2014 22:29:43 UTC+5:30, ru wrote:
>
> Hello all,
>
> New version 5.2.0 of rete4frames CLIPS-like expert system shell published 
> on https://github.com/rururu/rete4frames.
>
> News:
>
> 1. Tests can be used in negative condition
> 2. Because of this CLIPS examples reducted to canonical form
> 3. Several bug fixes including logical
> 4. Lot of code optimizations
>
> Enjoy!
>
> Sincerely,
>   Ru
>

-- 
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 do I track down a painfully long pause in a small web app?

2014-09-14 Thread Shantanu Kumar
Few thing to consider:
1. Which API calls pause? If only certain calls pause, then probably you 
have something specific to suspect. Try adding a dummy REST call - see if 
that call pauses while others do.
2. Is any of your services running on a t1.micro or a burst-oriented EC2 
instance on AWS? Try changing the instance type in that case.
3. Can you mock out the components that you suspect could be a problem? 
Begin by mocking out everything you suspect, then replace the mock with 
actual impl one component at a time until you isolate the problematic 
component.
4. Have you tried running a profiler?
5. Have you tried printing GC info? Maybe this could be 
useful: 
http://blog.ragozin.info/2011/09/hotspot-jvm-garbage-collection-options.html

Shantanu

On Monday, 15 September 2014 09:45:14 UTC+5:30, larry google groups wrote:
>
>
> I have an embarrassing problem. I convinced my boss that I could use 
> Clojure to build a RESTful API. I was successful in so far as that went, 
> but now I face the issue that every once in a while, the program pauses, 
> for a painfully long time -- sometimes 30 seconds, which causes some 
> requests to the API to timeout. We are still in testing, so there is no 
> real load on the app, just the frontenders, writing Javascript and making 
> Ajax calls to the service. 
>
> The service seems like a basic Clojure web app. I use Jetty as the 
> webserver, and the libraries in use are: 
>
> Ring
>
> Compojure
>
> Liberator
>
> Monger 
>
> Timbre
>
> Lamina
>
> Dire
>
> When someone complains about the pauses, I will go test the service, and I 
> can hit with 40 requests in 10 seconds and it has great performance. The 
> pauses actually seem to come after periods of inactivity, which made me 
> think that this had something to do with garbage collection, except that 
> the pauses are so extreme -- like I said, sometimes as much as 30 seconds, 
> causing requests to timeout. When the app does finally start to respond it 
> again, it goes very fast, and responds to those pending request very fast. 
>
> But I have to find a way to fix these pauses. 
>
> Right now I packaged the app as an Uberjar and put it on the server, spun 
> it up on port 24000 and proxied it through Apache. I put a script in 
> /etc/init.d to start the app using  start-stop-daemon.
>
> Possible things that could be going wrong:
>
> Maybe Jetty needs more threads, or maybe less threads? How would I test 
> that?
>
> Maybe the link to MongoDB sometimes dies? (Mongo is on another server at 
> Amazon) How would I test that? 
>
> Maybe it is garbage collection? How would I test that? 
>
> Maybe I have some code that somehow blocks the whole app? Seems unlikely 
> but I'm trying to keep an open mind. 
>
> Maybe the thread pool managed by Lamina sometimes gets overwhelmed? How 
> would I test that? 
>
> Maybe when Timbre writes to the log file it causes things to pause? (But I 
> believe Timbre does this in its own thread?) How do I test that? 
>
> This is a small app: only about 1,100 lines of code.
>
> I don't have much experience debugging problems on the JVM, so I welcome 
> any suggestions. 
>
>
>
>
>
>
>
>

-- 
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: running a jar-based cli tool

2014-08-13 Thread Shantanu Kumar


On Thursday, 14 August 2014 03:25:48 UTC+5:30, Brian Craft wrote:
>
> Thanks! This works perfectly.
>
> It took a few tries to find the right incantation, but this seems to do:
>
> (defn -main [& args]
>   (Main/main (into-array String args)))
>
> I note that the .clj file for this namespace ends up in the uberjar, but 
> looks like it doesn't pull in the jar for the tool.
>

That could be because the JAR dependency is a dev dependency, whereas the 
uberjar didn't include dev dependencies. If you need the JAR to be included 
in the uberjar you may want to make that a regular dependency.

Shantanu

-- 
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: running a jar-based cli tool

2014-08-13 Thread Shantanu Kumar


On Thursday, 14 August 2014 02:23:50 UTC+5:30, Brian Craft wrote:
>
> I need to run a tool while building docs which is distributed as a jar 
> file, and is run with "java -jar". Not sure the best way to do this. lein 
> can fetch the jar if I add it to dev dependencies, but then it's in some 
> directory in ~/.m2. Is there some simple way to get the path so I can pass 
> it to java? Does lein expose the m2 repository directory somehow?
>

If lein can fetch it, it'd be on the project classpath too -- just write a 
Clojure ns with a `-main` fn that invokes the main class in the JAR (find 
that in MANIFEST.MF file in the JAR), and trigger this ns using `lein run`. 
HTH.

Shantanu

-- 
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: Leiningen resource-paths

2014-07-25 Thread Shantanu Kumar

>
>
> For our project we have decided to depend on Maven and require user to 
> install Maven and execute these several commands to add jars to the local 
> repository.
>

You could probably have a script that uses lein-localrepo (to install all 
dependencies in one go) if you don't want to install Maven. (Sorry about 
the plug.)

https://github.com/kumarshantanu/lein-localrepo

Shantanu

-- 
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: [Request for Feedback] Clojure Lab: IDE for Clojure in Clojure

2014-06-27 Thread Shantanu Kumar
Downloaded and tried. It's very neat! Thanks for sharing.

Shantanu

On Friday, 27 June 2014 20:30:37 UTC+5:30, juan.facorro wrote:
>
> Hello Clojurians!
>
> I wanted to share with you a project called *Clojure Lab*, an *IDE for 
> Clojure in Clojure*.
>
> *https://github.com/jfacorro/clojure-lab 
> *
>
> Yes! Another IDE for Clojure, uhm... the more the merrier?
>
> This project started as a learning exercise and ended up being my final 
> project for school, it has gone through a prototyping phase, a few 
> refactorings and finally became something that works and is usable. I have 
> used ideas from a number of places, but the two bigger sources of 
> inspiration were *Emacs* and *Light Table*.
>
> The main two goals of this project are *usability* and *extensibility*.
>
> In terms of *usability* there's been an effort to make the *UI* as simple 
> and as clean as possible (how fruitful this effort has been is for you to 
> say :). The user always has access to a quick reminder of the commands 
> available in each context thanks to a help dialog that pops up by pressing 
> F1.
>
> *Extensibility* is offered through being able to implement every 
> functionality as a plugin (including the support for new languages) and by 
> presenting an abstraction over all UI controls that mimics the hiccup 
>  syntax and selectors *alla* enlive 
> . The currently available 
> implementation for this abstraction uses Swing.
>
> Even though I've been working on *Clojure Lab* for quite some time now, 
> I've been reluctant of making any announcements because of the number of 
> great tools and environments that exist in the Clojure ecosystem already 
> (i.e. *Counter-Clockwise*, *Light Table*, *Cursive* and *NightCode* just 
> to name a few). Regardless, a time comes when one must share with the world 
> the fruits of one's labor and ask the world for feedback on one's work... 
> mustn't one?
>
> Any and all feedback is extremely welcome as well as reports on any issues 
> you might have if you try it out.
>
> Thank you for being such a great community and for supporting such an 
> awesome language!
>
> Yours truly,
>
> Juan Facorro
>
> PS: If you want to check out what it looks like, there are some 
> screenshots here 
> . To 
> try it out you can download an executable jar here 
> 
> .
>

-- 
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: dynamic java obj construction from classname string

2014-05-25 Thread Shantanu Kumar


On Sunday, 25 May 2014 22:45:27 UTC+5:30, Gregg Reynolds wrote:
>
> Hi, 
>
> I'm trying to construct a Java obj from a from a classname string. 
> I've managed to import the thing using a macro: 
>
> (defmacro import-by-name [name] `(import [~name])) 
> (let [klass-name "foo.bar.Baz" 
>the-ns (import-by-name klass-name) 
>the-obj (new foo.bar.Baz arg)] ...) 
> 
>
> But when I use a string instead of literal arg to new I get "Unable to 
> resolve classname": 
>   ... 
>   the-obj  (eval `(new ~klass-name ~arg)) 
>

Instead of ~klass-name, try ~(symbol klass-name) or ~(Class/forName 
klass-name).

HTH

Shantanu

-- 
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: lein-servlet 0.4.0

2014-03-22 Thread Shantanu Kumar
Hi,

lein-servlet helps you to work with servlet based apps. I pushed out 
version 0.4.0 of lein-servlet to Clojars -- the changes are listed at the 
URL below:

https://github.com/kumarshantanu/lein-servlet/blob/master/CHANGES.md#2014-march-22--040

Shantanu

-- 
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: Creating multi-module projects with dependencies between modules

2014-03-18 Thread Shantanu Kumar


On Tuesday, 18 March 2014 08:25:30 UTC+5:30, Dave Kincaid wrote:
>
> I'm trying to create a project with multiple modules where there are some 
> dependencies between modules. So far I've tried out lein-sub and 
> lein-modules but neither one seems to handle inter-module dependencies 
> (either that or I just can't figure out how to do it). What are people 
> using for projects like this? Any open source examples I could look at?
>

lein-sub supports an `-s` flag that can be used to work on one specific 
module at a time. I think you can combine this with lein-cascade 
(https://github.com/kumarshantanu/lein-cascade) to work with cascading 
module dependencies.

Shantanu

-- 
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: algorithm help: extracting groups of consecutive ints from a sorted list

2014-03-18 Thread Shantanu Kumar


On Wednesday, 19 March 2014 09:39:56 UTC+5:30, Shantanu Kumar wrote:
>
> Something like this?
>
> (defn x [1 3 4 5 7 9 10 13])
>

Sory for the typo. Should be (def x [1 3 4 5 7 9 10 13])
 

>
> (reduce (fn [a i] (let [y (last a) z (last y)] (if (and z (= (inc z) i)) 
> (conj (pop a) (conj y i)) (conj a [i] [] x)
>
> Shantanu
>
> On Wednesday, 19 March 2014 08:26:43 UTC+5:30, John Gabriele wrote:
>>
>> If you've got a sorted list of numbers, for example:
>>
>> [1 3 4 5 7 9 10 13]
>>
>> where some are consecutive, how can you pull out the consecutive runs? 
>> That is, either produce
>>
>> [1 [3 4 5] 7 [9 10] 13]; or maybe something like
>> [[1 7 13] [3 4 5] [9 10]]  ; (the first vec is the elements left over)
>>
>> from the original coll?
>>
>> I can do it in Python in an imperative style, but it's a bit messy. My 
>> hunch is that there's probably a shorter way in Clojure, but I'm not seeing 
>> it.
>>
>> 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/d/optout.


Re: algorithm help: extracting groups of consecutive ints from a sorted list

2014-03-18 Thread Shantanu Kumar
Something like this?

(defn x [1 3 4 5 7 9 10 13])

(reduce (fn [a i] (let [y (last a) z (last y)] (if (and z (= (inc z) i)) 
(conj (pop a) (conj y i)) (conj a [i] [] x)

Shantanu

On Wednesday, 19 March 2014 08:26:43 UTC+5:30, John Gabriele wrote:
>
> If you've got a sorted list of numbers, for example:
>
> [1 3 4 5 7 9 10 13]
>
> where some are consecutive, how can you pull out the consecutive runs? 
> That is, either produce
>
> [1 [3 4 5] 7 [9 10] 13]; or maybe something like
> [[1 7 13] [3 4 5] [9 10]]  ; (the first vec is the elements left over)
>
> from the original coll?
>
> I can do it in Python in an imperative style, but it's a bit messy. My 
> hunch is that there's probably a shorter way in Clojure, but I'm not seeing 
> it.
>
> 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/d/optout.


Re: Get a LAZY list of records from a database query ?

2014-03-14 Thread Shantanu Kumar
Hi Frank,

You can look at the source code of `resultset-seq` (in Clojure-JVM) to see 
how it does a similar thing. You must consume the entire set of messages 
before closing the connection though. The `clojure.java.jdbc` library 
ensures that, for example.

You may also want to discuss this on ClojureCLR 
list: https://groups.google.com/forum/#!forum/clojure-clr

Shantanu

On Friday, 14 March 2014 13:44:27 UTC+5:30, Frank Behrens wrote:
>
> Hi, I wonder if its possible to convert this database query (its CLR) into 
> a lazy sequence.
>
> The reader loop is wrapped in the opening and closing of the db-connection 
> and reader.
>
> When i 'take a few records from the sequence, will then the connection be 
> closed 
> because it's getting out of scope and will be garbage collected ?
>
> How is it possible ?
>
> (defn user [conn-str]
>   (let [conn (System.Data.SqlClient.SqlConnection. conn-str)
> _ (.Open conn)
> cmd (System.Data.SqlClient.SqlCommand.
>   (str "SELECT name from User") conn)
> reader (.ExecuteReader cmd)]
> (let [out (loop [out '()]
> (if (.Read reader)
>   (do 
> (print ".")
> ((recur (conj out (.GetString reader 0)
>   out))]
> (.Close reader)
> (.Close conn)
> 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/d/optout.


Re: Clojure & Jruby (Ruby on Rails) Interop

2014-03-11 Thread Shantanu Kumar


On Monday, 9 September 2013 07:55:15 UTC+5:30, rdelcueto wrote:
>
> Hi everyone, 
> I'm about to start working on building a site for a startup company. 
>
> We are a small team, and currently they've been coding the site using RoR 
> (Ruby on Rails). I was thinking Clojure might be better suited for the 
> task, specially because we'll need to implement a backend which is robust, 
> scalable and secure, but also we'll need flexibility, which I think the RoR 
> framework won't shine at all. 
>
> At our team, we are two coders, non of us are proficient in Web 
> Developing, and we have little experience with RoR, and I thought (I'm 
> sure) maybe investing time learning Clojure will provide us with better 
> tools. 
>
> PROBLEM/QUESTION
>
> While searching for alternative solutions, I stumbled upon the 
> Flightcaster case, we're they are using RoR to implement the site's 
> frontend and Clojure for the system backend. I thought this was a very 
> elegant solution, using each tool for what it's good at. Plus this way we 
> can reuse what they've already implemented. 
>
> I found a way to do this is by using Torquebox and Immutant, and using the 
> messaging systems to communicate between Jruby and Clojure. Still I have no 
> idea of how this works, and the performance and security implications it 
> brings to the table. I found little information on the subject. 
>
> I would appreciate if anyone could provide guidance, examples or 
> documentation on the subject.
>
> Any reference to open source projects which use this hybrid language 
> solutions on the JVM would be great to have. 
>
> Is this the best way to solve the RoR interactions? Is there any other way?
>

I somehow missed this thread earlier. If you are OK to use RoR with JRuby, 
you might want to use the rack servlet https://github.com/jruby/jruby-rack 
with lein-servlet: https://github.com/kumarshantanu/lein-servlet and use 
both JRuby and Clojure in the same JVM process.

Shantanu

>

-- 
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: Do I have to have knowlegde about Lisp

2014-03-10 Thread Shantanu Kumar


On Monday, 10 March 2014 20:11:12 UTC+5:30, Roelof Wobben wrote:
>
> Hello, 
>
> I like the idea of Clojure but I wonder if I have to know a lot of Lisp to 
> work with Clojure.
>
> What is the best way to go from a absolute beginner to someone who can 
> work with Clojure.
>

To have a quick feel of Clojure, install Leiningen from leiningen.org, run 
`lein repl` and check this 
out: http://adambard.com/blog/clojure-in-15-minutes/

Then, move onto Clojure books, 4clojure etc. using Nightcode from 
https://nightcode.info/ or any editor you like.

Shantanu

-- 
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: clojure lazy-seq caching?

2014-03-04 Thread Shantanu Kumar


On Tuesday, 4 March 2014 14:54:49 UTC+5:30, Andy Smith wrote:
>
> Does this mean that in a single threaded application lazy sequences suffer 
> the overhead of locks? I thought one of the features of clojure is that it 
> tries to avoid locks as much as possible.
>

The JIT compiler eliminates locks for single-thread access, so practically 
there should be no impact.

Shantanu

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

2014-03-02 Thread Shantanu Kumar


On Monday, 3 March 2014 02:18:39 UTC+5:30, tbc++ wrote:
>
> How are you running these tests? The "correct" way to benchmark such 
> things is via a real benchmark framework (such as criterium) then compile 
> your clojure app to a jar (perhaps via lein uberjar) and finally run it via 
> a bare java invocation: java -jar my.jar. 
>
> Lein for example sometimes uses sub-par JVM settings, trading runtime 
> performance for startup speed. 
>

Relevant bits from my project.clj are below:

  :dependencies [[org.clojure/clojure "1.5.1"]
 [criterium "0.4.3"]]
  :global-vars {*warn-on-reflection* true
*assert* false
*unchecked-math* true}
  :jvm-opts ^:replace ["-server" "-Xmx1g"]

I believe this overrides Lein's default tiered compilation setting. I 
bench'ed both Java and Clojure code using Criterium.

Shantanu

>

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

2014-03-02 Thread Shantanu Kumar


On Sunday, 2 March 2014 12:49:15 UTC+5:30, Shantanu Kumar wrote:
>
>
>
> On Sunday, 2 March 2014 05:32:00 UTC+5:30, bob wrote:
>>
>>
>> Good point, Thanks a lot. 
>>
>> Shall we improve the str fn in the core lib? From my point of view, the 
>> core fns should be performance sensitive.
>>
>
> If string formation is the bottleneck in your app and if you can come up 
> with a version of `str` function that works in all use-cases, then you can 
> probably `alter-var-root` the str fn with yours as long as you own the 
> responsibility.
>
> I noticed the following macro (ignore the reflection warnings) can help 
> shave some nanoseconds in a large tight loop, but I leave to you to decide 
> how much worth it really is:
>

Just to clarify: I meant `some nanoseconds` per invocation for small string 
only. Overall saving would be proportional to the occurrence count and args 
count.

Shantanu

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

2014-03-01 Thread Shantanu Kumar


On Sunday, 2 March 2014 05:32:00 UTC+5:30, bob wrote:
>
>
> Good point, Thanks a lot. 
>
> Shall we improve the str fn in the core lib? From my point of view, the 
> core fns should be performance sensitive.
>

If string formation is the bottleneck in your app and if you can come up 
with a version of `str` function that works in all use-cases, then you can 
probably `alter-var-root` the str fn with yours as long as you own the 
responsibility.

I noticed the following macro (ignore the reflection warnings) can help 
shave some nanoseconds in a large tight loop, but I leave to you to decide 
how much worth it really is:

(defmacro sb-str
  [& args]
  (cond (empty? args)  ""
(= 1 (count args)) (let [x (first args)]
 `(let [y# ~x]
(cond (nil? y#)""
  (instance? Boolean   y#) (.toString 
(Boolean.   y#))
  (instance? Byte  y#) (.toString 
(Byte.  y#))
  (instance? Character y#) (.toString 
(Character. y#))
  (instance? Doubley#) (.toString 
(Double.y#))
  (instance? Float y#) (.toString 
(Float. y#))
  (instance? Integer   y#) (.toString 
(Integer.   y#))
  (instance? Long  y#) (.toString 
(Long.  y#))
  (instance? Short y#) (.toString 
(Short. y#))
  :otherwise   (.toString 
y#
:otherwise (let [sb (gensym)
each-append #(list '.append sb %)
all-appends (map each-append args)]
`(let [~sb (StringBuilder.)]
   ~@all-appends
   (.toString ~sb)

Note that it is not a function, so you cannot use it with high order 
functions. You can possibly use `definline` instead of a macro but you lose 
varargs then.

Shantanu

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

2014-03-01 Thread Shantanu Kumar


On Saturday, 1 March 2014 15:32:41 UTC+5:30, bob wrote:
>
> Case :
>
> clojure verison:
>
> (time (dotimes [n 1000] (str n "another word"))) ;; take about 5000msec
>
> java version
>
> long time = System.nanoTime();
>
> for(int i=0 ; i<1000 ;i++){
> String a=i+"another word";
> }
>   System.out.println(System.nanoTime()-time); 
>  
>
> The java version take about 500 msecs, I thought it might be caused by the 
> str implementation which is using string builder, and it might not be the 
> best choice in the case of no much string to concat, and then I replace 
> "another word" with 5 long strings as the parameter, however no surprise.
>
> I just wonder what make the difference, or how to find the difference.
>

Others have added useful points to this thread. Java string concatenation 
internally uses StringBuilder, so if you replace (str n "another word") 
with the following:

(let [sb (StringBuilder.)]
 (.append sb n)
 (.append sb "another word")
 (.toString sb))

..then the perf improves 1/4 to 1/3. Further, with the following tweak:

(let [sb (StringBuilder. 20)]  ; because StringBuilder allocates only 16 
chars by default on Oracle JRE
 (.append sb n)
 (.append sb "another word")
 (.toString sb))

..the perf improves from 1/3 to less than 1/2. Here we simply avoid double 
allocation in StringBuilder.

Other things I made sure were:

1. I used Criterium to measure
2. I used `-server` option
3. Made sure reflection warning was on

Shantanu

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

2014-02-28 Thread Shantanu Kumar
I have seen (and I keep seeing) a ton of Java code that performs poorly. 
Empirically, it's equally easy to write a slow Java app. You always need a 
discerning programmer to get good performance from any language/tool.

Numbers like 1/4 or 1/10 can be better discussed in presence of the 
use-cases and perf test cases. Most of the problems you listed can be 
mitigated by `-server` JIT, avoiding reflection, transients, loop-recur, 
arrays, perf libraries and some Java code.

Shantanu

On Saturday, 1 March 2014 10:32:26 UTC+5:30, bob wrote:
>
> Hi,
>
> Can I ask a newbie question about clojure performance?
>
> What make clojure performance slow than java?, it seems clojure has the 
> 1/4 performance compared to java in general, according to  tests, some 
> cases it might be 1/10. the reasons I can think out are 
>
> - the byte code is not efficient sometimes
> - the byte code might not enjoy the jvm optimization
> - the reflection 
> - the immutable data structure
> - the abstract interface design
>
> The abstract interface like seq offers its power, but it is easy to drop 
> in the performance trap.
>
> And it seems to me that it is easy to write a slow clojure program, I know 
> the efficiency of code depends on coder, you can write the code faster than 
> java sometimes,but  need to know a lot of deep thing and tricky, and 
> clojure is not the funny clojure any more.
>
>
> 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: Source code reloading with leiningen checkouts

2014-02-26 Thread Shantanu Kumar


On Wednesday, 26 February 2014 14:58:06 UTC+5:30, Niels van Klaveren wrote:
>
> Windows (7) has different versions of linking. For checkouts to work on 
> Windows 7 you need to have a *junction* to the directory, not a symbolic 
> link.
> I make mine with Link Shell Extension for Windows 
> Explorer, 
> and have no problems.
>

This is useful information. I think it would be useful to mention this on 
the Leiningen Wiki page that explains checkouts.

Shantanu

-- 
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: call clojure from java

2014-02-18 Thread Shantanu Kumar
Hi Sorin,

Are you looking for something like 
load-file: http://clojuredocs.org/clojure_core/clojure.core/load-file

Shantanu

On Tuesday, 18 February 2014 17:09:20 UTC+5:30, sorin cristea wrote:
>
> Hi 
>
> do you know how I can call a clojure script from a java method ?
>
>
> Thanks,
> Sorin.
>

-- 
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: Korma Sql model not accepting url var

2014-02-11 Thread Shantanu Kumar

>
>
> Btw, would you recommend using an ORM or straight java.jdbc and if an ORM, 
> any particular one you'd recommend?
>

ORMs are not prevalent in Clojure. You can use java.jdbc (the 0.3.x series 
or later) with one of the SQL generators (HoneySQL, YeSQL etc) that you 
like. See what works for you and post your feedback on this forum.

Shantanu

-- 
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: Korma Sql model not accepting url var

2014-02-11 Thread Shantanu Kumar
Can you post the SQL template (with ? symbols) you are trying to execute? 
Usually, with PostgreSQL you can specify ?::integer in place of ? to imply 
that the passed parameter is an integer.

Shantanu

On Tuesday, 11 February 2014 13:52:54 UTC+5:30, The Dude (Abides) wrote:
>
> Hi, I'm getting an error calling a record from an id passed via a url 
> using Korma Sql. The error says:
>
> org.postgresql.util.PSQLException
> ERROR: operator does not exist: smallint = character varying Hint: No 
> operator matches the given name and argument type(s). You might need to add 
> explicit type casts. Position: 57
>
> I have a list of members, with a url /member/:id to call profile for that 
> member in the view showing the member list. Here's my 3 moving parts:
>
> ROUTE
>
> (GET "/member/:id" [id] (get-the-member id))
>
> FUNCTION
>
> (defn get-the-member [id]
> (layout/render 
>   "member/profile.html"
>   {:member (db/get-member-url id)}))
>
> MODEL
>
> (defn get-member-url [id]
>   (first (select members
>  (where {:id id})
>  (limit 1
>
> Now if I hard code the id number in the model, it works, but its not 
> accepting the id var as an integer. How would I give it an explicit 
> typecast in this instance. Or would it perhaps be better to use java.jdbc 
> or another ORM like Sql Lingov, HoneySQL, Clojureql or clojure-sql? Rest of 
> crud working fine, but id var not being accepted by the model. The model 
> itself works if an id number is hardcoded. Perhaps I'm missing some simple 
> syntax point here?
>

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


ANN: clj-liquibase 0.5.1 for database change management

2014-01-28 Thread Shantanu Kumar
Hi,

I'm happy to announce clj-liquibase version 
0.5.1: https://github.com/kumarshantanu/clj-liquibase for database (JDBC) 
change management.

Since 0.4.0, this version upgraded Liquibase dependency from 2.5 to 3.0 and 
added support for free-form SQL and SQL files as units of change. (Thanks 
to Jonathan Rojas for contributing.)


Shantanu

-- 
-- 
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: core.async question - canceling thread

2014-01-22 Thread Shantanu Kumar


On Thursday, 23 January 2014 02:37:43 UTC+5:30, puzzler wrote:
>
> Is there a convenient way within Clojure to launch a Clojure function or 
> Java call in a separate process as opposed to a separate thread?  Only way 
> I know of is to literally shell out to the command prompt and launch a new 
> executable.
>

There's ProcessBuilder and Runtime.exec stuff, but it will have the JVM and 
Clojure initialization overhead anyway.

http://docs.oracle.com/javase/7/docs/api/java/lang/ProcessBuilder.html

http://www.tutorialspoint.com/java/lang/runtime_exec_envp.htm

Shantanu

-- 
-- 
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: Servlet adapter for ring handlers with support for asynchronous processing

2014-01-18 Thread Shantanu Kumar
Hi Jan,

This not directly related, but i thought it might be useful in some way. In 
case you do the java interop stuff on your own to implement the servlet 3.0 
methods, you might want to use lein-servlet to run the servlet using Jetty 
9 maybe.

https://github.com/kumarshantanu/lein-servlet

Shantanu

On Saturday, 18 January 2014 16:01:02 UTC+5:30, Jan Herich wrote:
>
> Hi Folks,
>
> Is someone aware of servlet adapter (other then pedestal-service) for ring 
> based handlers with support for 
> asynchronous processing as specified in Servlet 3.0+ api ?
>
> Given that ring core was already refactored to support such solutions 
> (middleware had been split into wrapping 
> and request "modifying" functions) it should be not so hard to combine it 
> with core.async go macros to assemble 
> handler chain which supporting async processing and write an adapter to 
> connect it with Servler 3.0+ API ->
> HttpServletRequest.startAsync(), AsyncContext.complete() and so on... 
>
> If you assembled something similar yourself, or you now about such project 
> (even in development, immature, alpha),
> please let me know, thank you very much.
>
> Jan
>

-- 
-- 
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: Extracting a database schema and using it to synthesize and check SQL queries at compile time

2014-01-08 Thread Shantanu Kumar

>
>
> The approach to read the database to generate code is pretty interesting. 
> There is a more portable way to extract the schema information, using 
> DatabaseMetadata that you can extract from a Connection.
>
> http://docs.oracle.com/javase/7/docs/api/java/sql/DatabaseMetaData.html
>
> http://docs.oracle.com/javase/7/docs/api/java/sql/Connection.html#getMetaData()
>

I did some related work quite a while ago: 
https://github.com/kumarshantanu/clj-jdbcutil/blob/master/src/clj_jdbcutil/core.clj#L535

Sharing just in case somebody finds it useful.

Shantanu

-- 
-- 
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: Extracting a database schema and using it to synthesize and check SQL queries at compile time

2014-01-08 Thread Shantanu Kumar
Hi Alex,

On Wednesday, 8 January 2014 13:28:29 UTC+5:30, Alexander Hudek wrote:
>
> Hey everyone,
>
> We've been exploring ways to make working with database code more 
> efficient and less error prone.
> For complex queries, we prefer working directly with SQL. However, like 
> for many others, a lot of our 
> queries are very simple and repetitive. For example, retrieving or 
> updating single rows, or a set of rows 
> based on a foreign key. 
>

I totally agree with this. I have noticed this is the most common scenario 
when working with SQL databases.
 

>
> As an experiment, we wrote a prototype that uses the information_schema 
> standard to automatically 
> extract the schema from a database and represent it as clojure code at 
> compile time. With this, we 
> were able to synthesize some simple SQL queries. The interesting part of 
> this is that the code generator
> automatically picks up primary key constraints and also performs 
> validation on table and column names.
> All of this is done at compile time. Errors are caught early and the 
> compiled code uses clojure.java.jdbc
> prepared statements. You can find the code and demo here:
>
> https://github.com/diligenceengine/edl
>
> I'm personally not a big fan of huge ORM systems, so I don't know where to 
> go with this, if anywhere.
> Though it seems useful for building small macros for common patterns we 
> have. 
>
> Would love to hear if anyone has thoughts on the technique.
>

The approach to read the database to generate code is pretty interesting. 
There is a more portable way to extract the schema information, using 
DatabaseMetadata that you can extract from a Connection.

http://docs.oracle.com/javase/7/docs/api/java/sql/DatabaseMetaData.html
http://docs.oracle.com/javase/7/docs/api/java/sql/Connection.html#getMetaData()

Shantanu

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


Re: how to packge lein project in a maven-style?

2014-01-05 Thread Shantanu Kumar
There's Clojure Maven plugin if that can help:

https://github.com/talios/clojure-maven-plugin

Shantanu

On Monday, 6 January 2014 11:03:45 UTC+5:30, Qiu Xiafei 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.


Re: Advice for dealing with CSV data set

2014-01-05 Thread Shantanu Kumar
If you are only going to read the CSV files, you can put the CSV file in 
`resources` directory (so that it is part of the jar/uberjar), and use 
https://github.com/clojure/data.csv with 
http://clojuredocs.org/clojure_core/clojure.java.io/resource to read the 
data. If you need to make some change to the CSV file then it must lie 
outside of the JAR.

Shantanu

On Monday, 6 January 2014 10:09:55 UTC+5:30, Kyle Sexton wrote:
>
> I am new to clojure and working on a small jabber bot as a starter 
> project.  One of the things I am adding is a simple weather lookup, but 
> in doing so I need to convert zip code to lat/long.  I've found a 
> suitable CSV from http://www.boutell.com/zipcodes/ and am wondering the 
> best way to deal with the data.  I'd like to keep it "contained" in an 
> uberjar and not have to add a database as a requirement.  I've 
> considered sqlite, but again not sure if it can be inside the uberjar. 
>
> The data set is rather small: 
>
> , 
> | bash-3.2$ ls -larh zipcode.csv 
> | -rw-r--r--@ 1 kes  staff   2.4M Aug  6  2004 zipcode.csv 
> | bash-3.2$ wc -l zipcode.csv 
> |43205 zipcode.csv 
> | bash-3.2$ 
> ` 
>
> What would be the recommended way for dealing with this data? 
>
> -- 
> Kyle Sexton 
>

-- 
-- 
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: library development

2013-12-20 Thread Shantanu Kumar
Author of lein-localrepo here. Just to mention few points:

1. Leiningen builds over Maven's transitive dependency management system. 
So, I guess at some point of time you just have to accept Maven's 
nomenclature.

2. `lein install` works when you have source code and a `project.clj` for 
your project. `lein-localrepo` helps you with third-party JARs for which 
you probably have no source code.

3. Can `lein-localrepo` help you totally forget about Maven? Sorry, see #1

Shantanu

On Friday, 20 December 2013 23:57:55 UTC+5:30, Magomimmo wrote:
>
> I used localrepo as Timmy said: 
> - to install in the local maven repository a native dynamic c++ lib and 
> its corresponding java wrapper
> - to makes it available to all my clojure/java projects requiring to use 
> that lib (artifact in maven parlance) 
>
> It works like a charm.
>
> Here you can find a sample of its use:
>
>
> http://docs.opencv.org/2.4/doc/tutorials/introduction/clojure_dev_intro/clojure_dev_intro.html#install-the-java-specific-libs-as-local-repository
>
> HIH 
> mimmo
>
> On Dec 20, 2013, at 6:22 PM, Tim Visher > 
> wrote:
>
> On Fri, Dec 20, 2013 at 12:16 PM, John Gabriele 
> > 
> wrote:
>
> If I can just `lein install` my libs (or other people's libs) and then use
> them in all my projects (just like the libs found at clojars), what extra
> functionality does lein-localrepo provide beyond that?
>
>
> lein-localrepo provides ways to interact with the local repo beyond
> just installing a leiningen project to it. You can install arbitrary
> artifacts that have poms. You can use to grab coords for a file. Etc.
>
> --
>
> In Christ,
>
> Timmy V.
>
> http://blog.twonegatives.com/
> http://five.sentenc.es/ -- Spend less time on mail
>
> -- 
> -- 
> 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/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.


Re: Clojure CLR versioning and binary downloads

2013-11-24 Thread Shantanu Kumar
I am trying to run some tests (that worked fine with Mono+ClojureCLR 1.4.1) 
in Mono+ClojureCLR 1.5.0 from SourceForge and finding the below exception:

$ # CLOJURE_LOAD_PATH is configured properly
$ mono "/path/to/clojure-clr-1.5.0-Release-4.0/Clojure.Main.exe" -i 
/tmp/intermediate-file -e "(use 'clojure.test) (run-tests 
'sqlrat.template-test 'sqlrat.entity-test)"

FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: An exception 
was thrown by the type initializer for Clojure.CljMain ---> 
System.TypeInitializationException: An exception was thrown by the type 
initializer for clojure.lang.RT ---> 
clojure.lang.Compiler+AssemblyInitializationException: Cannot find 
initializer for clojure.core.clj, Version=0.0.0.0, Culture=neutral, 
PublicKeyToken=null.clojure/core
  at clojure.lang.Compiler.InitAssembly (System.Reflection.Assembly assy, 
System.String relativePath) [0x0] in :0 
  at clojure.lang.Compiler.LoadAssembly (System.IO.FileInfo assyInfo, 
System.String relativePath) [0x0] in :0 
  at clojure.lang.RT.load (System.String relativePath, Boolean 
failIfNotFound) [0x0] in :0 
  at clojure.lang.RT.load (System.String relativePath) [0x0] in 
:0 
  at clojure.lang.RT.DoInit () [0x0] in :0 
  at clojure.lang.RT..cctor () [0x0] in :0 
  --- End of inner exception stack trace ---
  at Clojure.CljMain..cctor () [0x0] in :0 
  --- End of inner exception stack trace ---

Can you give any pointer where should I probe?

Shantanu

On Sunday, 24 November 2013 04:59:56 UTC+5:30, dmiller wrote:
>
> 1.5.0 of Clojure CLR includes the one fix in 1.5.1.  I got excited and 
> went one too far. Normally, the version numbers match exactly.
>
> I tagged 1.5.0 a little prematurely.  We had some troubles on the NuGet 
> release and on the mono build.  I wasn't really ready for an official 1.5.0 
> release, so I hadn't done the SourceForge binary distributions.
>
> That's all been fixed as of earlier today (11/23/2013 relative to Central 
> Standard).
>
> ClojureCLR 1.5.0 is officially out.
>
> This version has a NuGet package, with binaries for .Net 3.5 and .Net 4.0. 
>  All the binaries to run ClojureCLR itself are in one file, Clojure.dll, 
> due to the magic of ILMerge and a lot of new internal plumbing to allow 
> embedded DLL resources and merged DLLs.  Also, this version is signed so 
> that it can be referenced in signed projects or GAC'd.  
>
> There are Debug and Release binaries  (not ILMerged) for .Net 3.5 and 4.0 
> on the SourceForge site.
>
> The wiki pages on the github site have been updated.
>
> Mono is now supported.  You can run it under Mono.  You can compile it 
> directly using xbuild with mono.  Details on the wiki.
>
> Regarding the Clojure.Main and Clojure.Compile binaries in the NuGet 
> package:  Yes, you have to move them to run them.  Clojure.dll has to be in 
> the lib\ folder in order for the package to work properly when included in 
> a project.  Ancillary files such as Clojure.Main and Clojure.Compile are 
> standalones and are not needed for other projects.  They are properly 
> contained in the tools\  folder.  I was asked to include them in the NuGet 
> package for ClojureCLR.  I'm not happy with the current arrangement, in a 
> nitpicky way.  I'm open to suggestions.
>
> -David
>
>
>
> On Friday, November 22, 2013 8:41:58 PM UTC-6, Frank Hale wrote:
>>
>> As far as I can tell the Clojure CLR version number does not track the 
>> JVM version number at least for some builds. The latest build 1.5.0 as far 
>> as I can tell is at the same patch level as 1.5.1 on the JVM. This 
>> numbering seems confusing to me. Are there any plans to streamline the 
>> version numbers between the two platforms?
>>
>> Additionally I don't understand why on the Clojure CLR SourceForge page 
>> there are only debug versions available for download and 1.5.0 is not 
>> represented there. If you want 1.5.0 you have to use nuget to get it. I was 
>> also a bit dumbfounded that the nuget version was broken out of the box and 
>> what I mean by that is that once you have downloaded it you cannot run the 
>> compiler or the REPL from it's current directory without first dumping the 
>> exe's into the lib folder since they are segregated in the package. Running 
>> the compiler or REPL from their directory will result in them complaining 
>> that they cannot find the required Clojure CLR DLL's that they need.
>>
>> These are kind of nit-picky issues but they've been bugging me for a 
>> while. 
>>
>

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

Re: ANN: Clojure High Performance Programming

2013-11-21 Thread Shantanu Kumar


On Thursday, 21 November 2013 21:39:36 UTC+5:30, Gary Johnson wrote:
>
> This looks incredible! Just bought a copy. Congratulations, Shantanu!
>

Thanks, Gary!

Those who might look for a Kindle edition can find it here:
http://www.amazon.com/Clojure-Performance-Programming-Shantanu-Kumar-ebook/dp/B00GTE1RVW/ref=sr_1_2?s=digital-text&ie=UTF8&qid=1385043536&sr=1-2&keywords=packt+publishing

Shantanu

-- 
-- 
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: Clojure High Performance Programming

2013-11-21 Thread Shantanu Kumar


On Thursday, 21 November 2013 16:48:56 UTC+5:30, Ulises wrote:
>
> > Could you please let me know which URL and page no. did you find the 
> images 
> > missing on? I noticed the images are visible (for example on page number 
> 21) 
> > when I visited http://www.amazon.com/dp/1782165606/?tag=packtpubli-20and 
> > clicked on the book image to open the preview. 
>
> Apologies for the lack of clarity. It's the Packt page for your book 
> that doesn't load images (at least for me.) 
>

I can see the images on the Packt website. I think you would have tried 
clearing the browser cache or using a different browser. Can you try and 
see if others in your network neighborhood can access the images?

Shantanu
 

>
> U 
>

-- 
-- 
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: Clojure High Performance Programming

2013-11-21 Thread Shantanu Kumar


On Thursday, 21 November 2013 16:28:14 UTC+5:30, Ulises wrote:
>
> > Thank you! The book is published very recently and I noticed it took a 
> while 
> > for the printed editions to appear on Amazon. I am getting in touch with 
> > Packt to find out why the kindle editions not on Amazon and whether this 
> is 
> > temporary. 
>
> Great! Thanks for the diligence. 
>
> If you're getting in touch with them you can also let them know that 
> the page for your book is broken (it doesn't load images for 
> instance.) 
>

Could you please let me know which URL and page no. did you find the images 
missing on? I noticed the images are visible (for example on page number 
21) when I visited http://www.amazon.com/dp/1782165606/?tag=packtpubli-20 and 
clicked on the book image to open the preview.

Shantanu
 

>
> 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: Clojure High Performance Programming

2013-11-21 Thread Shantanu Kumar


On Thursday, 21 November 2013 15:57:21 UTC+5:30, Ulises wrote:
>
> First of all: Congratulations, looks like a great book! 
>
> Second, do you know why Amazon doesn't offer the kindle version while 
> Packt says it's available in digital format and displays an Amazon 
> logo (I'm assuming the Amazon logo means it's kindle)? 
>
> Cheers and looking forward to reading your book! 
>

Thank you! The book is published very recently and I noticed it took a 
while for the printed editions to appear on Amazon. I am getting in touch 
with Packt to find out why the kindle editions not on Amazon and whether 
this is temporary.

Shantanu
 

>
> On 21 November 2013 02:10, Alex Baranosky 
> > 
> wrote: 
> > Congratulation on the book Shantanu! 
> > 
> > 
> > On Wed, Nov 20, 2013 at 5:16 PM, Shantanu Kumar 
> > > 
>
> > wrote: 
> >> 
> >> Now also available on 
> >> Amazon US: http://www.amazon.com/dp/1782165606/?tag=packtpubli-20 
> >> Amazon UK: http://www.amazon.co.uk/dp/1782165606/?tag=packtpubli-21 
> >> 
> >> Shantanu 
> >> 
> >> On Thursday, 21 November 2013 05:21:45 UTC+5:30, Shantanu Kumar wrote: 
> >>> 
> >>> Hi, 
> >>> 
> >>> I am pleased to announce availability of the book `Clojure High 
> >>> Performance Programming` that I have been writing for the better part 
> of 
> >>> this year: 
> >>> 
> >>> http://www.packtpub.com/clojure-high-performance-programming/book 
> >>> 
> >>> This book is ideally meant for intermediate Clojure programmers. It is 
> >>> divided into seven chapters covering Clojure abstractions, Java 
> interop, JVM 
> >>> internals, Concurrency and other performance-related topics. 
> >>> 
> >>> Shantanu 
> >> 
> >> -- 
> >> -- 
> >> 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/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.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/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.


Re: ANN: Clojure High Performance Programming

2013-11-21 Thread Shantanu Kumar


On Thursday, 21 November 2013 07:40:09 UTC+5:30, Alex Baranosky wrote:
>
> Congratulation on the book Shantanu!
>

Thanks, Alex!

Shantanu
 

>
>
> On Wed, Nov 20, 2013 at 5:16 PM, Shantanu Kumar 
> 
> > wrote:
>
>> Now also available on
>> Amazon US: http://www.amazon.com/dp/1782165606/?tag=packtpubli-20
>> Amazon UK: http://www.amazon.co.uk/dp/1782165606/?tag=packtpubli-21
>>
>> Shantanu
>>
>> On Thursday, 21 November 2013 05:21:45 UTC+5:30, Shantanu Kumar wrote:
>>>
>>> Hi,
>>>
>>> I am pleased to announce availability of the book `Clojure High 
>>> Performance Programming` that I have been writing for the better part of 
>>> this year:
>>>
>>> http://www.packtpub.com/clojure-high-performance-programming/book
>>>
>>> This book is ideally meant for intermediate Clojure programmers. It is 
>>> divided into seven chapters covering Clojure abstractions, Java interop, 
>>> JVM internals, Concurrency and other performance-related topics.
>>>
>>> Shantanu
>>>
>>  -- 
>> -- 
>> 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/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.


  1   2   3   4   5   6   >