Re: Encapsulating Local Mutable State

2016-05-02 Thread Stefan Kamphausen
Good point, Paul.  Thanks.



Best,
stefan

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


connecting to infobrite server from clojure

2016-05-02 Thread Sunil S Nandihalli
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: 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: connecting to infobrite server from clojure

2016-05-02 Thread Sunil S Nandihalli
Thanks Shantanu for the response. I installed dbvisualizer and it seems to
work perfectly fine with infobright.



On Mon, May 2, 2016 at 1:04 PM, Shantanu Kumar 
wrote:

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

-- 
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: Best practice for calling Clojure from Java

2016-05-02 Thread Patrick Martin
Great - thanks for the tips! My gist example was applying the 1.6 Clojure 
API, but I was not sure if anything has evolved through 1.7 and 1.8.

I will check out the Tapestry approach. I like the idea of mapping an 
interface to a namespace.

Patrick

On Monday, May 2, 2016 at 1:18:47 AM UTC-4, Howard M. Lewis Ship wrote:
>
> You can also look into this:
>
>
> http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/clojure/package-summary.html
>
> It's an extension to the Tapestry 5 IoC container that allow you to map an 
> interface to a Clojure namespace. You define the Java interface and supply 
> a mapping, via naming conventions or annotations, to a Clojure namespace.  
> Invoke the Java method and the corresponding Clojure function is invoked, 
> efficiently.
>
> On Sun, May 1, 2016 at 6:08 PM, Timothy Baldridge  > wrote:
>
>> Ah apparently someone also added a section to the docs on it: 
>> http://clojure.org/reference/java_interop#_calling_clojure_from_java
>>
>> On Sun, May 1, 2016 at 7:06 PM, Timothy Baldridge > > wrote:
>>
>>> Take a look at this class: 
>>> https://github.com/clojure/clojure/blob/master/src/jvm/clojure/java/api/Clojure.java
>>>  
>>> It was added in Clojure 1.6 exactly for this use-case, and will be quite 
>>> fast, especially if you store the vars somewhere and only look them up 
>>> once. 
>>>
>>> Timothy
>>>
>>> On Sun, May 1, 2016 at 6:28 PM, Patrick Martin >> > wrote:
>>>
 I am working on a Clojure/Java stack, where the Java layer uses Vert.x 
 to manage a collection of embedded computers and the Clojure layer would 
 allow interaction with this system dynamically. I am designing a Clojure 
 DSL that would allow a user to load new functions and deploy them live 
 into 
 the Java framework. My current design is to push a Clojure function string 
 into the Java layer and use the guidance from this post to execute: 
 http://stackoverflow.com/questions/2181774/calling-clojure-from-java/23555959#23555959

 Here is a gist example based on that thread:
 https://gist.github.com/anonymous/f443b7acb1fcd6b1acf816a25f917ccd

 Since the S.O. thread was from 2014, I was curious if there might be 
 newer/better ways to do this operation. 

 Thanks in advance for any guidance or thoughts!

 ps: I will not call Vertx directly as I already have a Java codebase 
 that wraps the functionality I need. I am really interested in dynamically 
 creating and running new functions by leveraging Clojure on top of this 
 Java framework.

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

Re: connecting to infobrite server from clojure

2016-05-02 Thread Sunil S Nandihalli
Hi Shantanu,
 I am attaching the error stack trace of the exception I got. I am still
unable to figure out what is happening.
Thanks,
sunil.

On Mon, May 2, 2016 at 1:22 PM, Sunil S Nandihalli <
sunil.nandiha...@gmail.com> wrote:

> Thanks Shantanu for the response. I installed dbvisualizer and it seems to
> work perfectly fine with infobright.
>
>
>
> On Mon, May 2, 2016 at 1:04 PM, Shantanu Kumar 
> wrote:
>
>> 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.
>>
>
>

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


error.stacktrace
Description: Binary data


Cider test - Print to Report?

2016-05-02 Thread JvJ
I've been using cider test, and I think it's great.

However, I would like to know if it's possible to report results so that 
they appear in cider's automatically-generated test report.

Does anyone know if this is possible?

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: Cider test - Print to Report?

2016-05-02 Thread Bozhidar Batsov
Can you be a bit more specific? What do you mean by "report results"?

On 2 May 2016 at 20:29, JvJ  wrote:

> I've been using cider test, and I think it's great.
>
> However, I would like to know if it's possible to report results so that
> they appear in cider's automatically-generated test report.
>
> Does anyone know if this is possible?
>
> 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.
>

-- 
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: Cider test - Print to Report?

2016-05-02 Thread JvJ
I guess "results" isn't the right word at all.

What I meant was, can I print arbitrary strings/values to the report?

I'd just like to display additional information to help debug test 
failures.  I know I can print to the standard output stream, but having it 
in the report generated by cider would be nicer.

On Monday, 2 May 2016 21:01:07 UTC-7, Bozhidar Batsov wrote:
>
> Can you be a bit more specific? What do you mean by "report results"?
>
> On 2 May 2016 at 20:29, JvJ > wrote:
>
>> I've been using cider test, and I think it's great.
>>
>> However, I would like to know if it's possible to report results so that 
>> they appear in cider's automatically-generated test report.
>>
>> Does anyone know if this is possible?
>>
>> Thanks.
>>
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.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} funcool/struct - yet another validation library for Clojure and ClojureScript.

2016-05-02 Thread Andrey Antukh
Hi all.

I am happy to announce the first public release of funcool/struct
validation library.

https://github.com/funcool/struct

Why an other?

I have started on my project using well know and very nice library:
bouncer; that has worked pretty well for me, but over time I have needed
some features that are missing: such as value coercion and dependent
validators.

Then, I decided to build a own one. And these are the main highlights of
the resulting library:

- Validators are defined using plain hash-maps instead of opaque macros.
- Optional value coercion (very useful if you want to validate query params
or form-data that by default comes as string).
- Dependent validators (add the ability to the validator access to previos
state, also useful for form-data validation).
- Serves pretty well as simple data structure validation in the same way as
bouncer or schema works and also works well for validate user input such as
query params and forms.

Github: https://github.com/funcool/struct
Documentation: http://funcool.github.io/struct/latest/

Regards.
-- 
Andrey Antukh - Андрей Антух - 
http://www.niwi.nz
https://github.com/niwinz

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