Re: Stubbornly eager results in clojure.java.jdbc

2017-06-23 Thread r0man
Hi Luke,

which database are you using? I had the same issue with MySQL recently. At 
the end I got it working with clojure.java.jdbc.
I don't have the code at hand, but according to the MySQL docs you have to 
set the fetch size to Integer.MIN_VALUE.

https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-reference-implementation-notes.html

r0man

On Saturday, June 17, 2017 at 3:15:13 AM UTC+2, Luke Burton wrote:
>
>
> Riddle me this:
>
> https://gist.github.com/hagmonk/a75621b143501966c22f53ed1e2bc36e
>
> Wherein I synthesize a large table in Postgres, then attempt to lazily 
> load the table, discarding each row as I receive it. I tried *many* 
> permutations and experiments, but settled on these two tests to illustrate 
> my point. Which is that I simply can't get it to work with 
> clojure.java.jdbc.
>
> test1, according to all my research and reading of the source code 
> involved, should consume the query results lazily. It does not, and I can't 
> for the life of me figure out why. Traffic starts to stream in, and the 
> heap is overwhelmed almost immediately. I've deliberately set the heap to 1 
> GB.
>
> test2 uses a technique I borrowed wholesale from Ghadi Shayban in JDBC-99 
> <https://dev.clojure.org/jira/browse/JDBC-99?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#issue-tabs>,
>  
> which is to have ResultSet implement IReduceInit. It consumes a nominal 
> amount of memory. I've verified it's actually doing something by putting 
> counters in, and using YourKit to watch about 20 MB/s of traffic streaming 
> into the JVM. It's brilliant, it doesn't even break 200 MB total heap usage.
>
> I used YourKit to track where the memory is being retained for test1. 
> Initially I made the mistake of not setting the fetchSize, so I saw an 
> ArrayList inside the driver holding the reference. The driver 
> documentation <https://jdbc.postgresql.org/documentation/head/query.html> 
> confirms 
> that autoCommit must be disabled and the fetchSize set to some non-zero 
> number.
>
> After making that change, YourKit confirmed that the GC root holding all 
> the memory was the stack local variable "rs". At least I think it did, as a 
> non-expert in this domain. I tried disassembling the functions using 
> no.disassemble and the IntelliJ decompiler but I'm not really at the point 
> where I understand what to look for.
>
> So my questions are:
>
> 1) what am I doing wrong with clojure.java.jdbc?
>
> Note some things I've already tried:
>
> * using row-fn instead of result-set-fn
> * using prepared statements
> * explicitly setting auto-commit false on the connection
> * declaring my result-set-fn with (^{:once true} *fn […]) (I did not see a 
> change in the disassembly when using this)
> * probably other things I am forgetting
>
> 2) in these situations where you suspect that the head of a lazy sequence 
> is being retained, how do you reason about it? I'm kind of lucky this one 
> blew the heap so quickly, who knows how much of my production code might 
> burning memory unnecessarily but not quite as fatally. Do you disassemble 
> the functions and observe some smoking gun? How do you peek under the 
> covers to see where the problem is? 
>
> Luke.
>

-- 
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 supress warning when including cljx?

2014-11-27 Thread r0man
It's a bug in cljx related to the middleware I think. Try this one:
[org.clojars.cemerick/cljx 0.5.0-SNAPSHOT]

On Thursday, November 27, 2014 12:22:54 PM UTC+1, Colin Yates wrote:

 I have included cljx and everytime lein starts it gives the following:

 [code]
 WARNING!!! version ranges found for:
 [com.keminglabs/cljx 0.4.0] - [org.clojars.trptcolin/sjacket 0.1.0.6] 
 - [org.clojure/clojure [1.3.0,)]
 Consider using [com.keminglabs/cljx 0.4.0 :exclusions 
 [org.clojure/clojure]].
 [com.keminglabs/cljx 0.4.0] - [org.clojars.trptcolin/sjacket 0.1.0.6] 
 - [net.cgrand/regex 1.1.0] - [org.clojure/clojure [1.2.0,)]
 Consider using [com.keminglabs/cljx 0.4.0 :exclusions 
 [org.clojure/clojure]].
 [com.keminglabs/cljx 0.4.0] - [org.clojars.trptcolin/sjacket 0.1.0.6] 
 - [net.cgrand/parsley 0.9.1] - [org.clojure/clojure [1.2.0,)]
 Consider using [com.keminglabs/cljx 0.4.0 :exclusions 
 [org.clojure/clojure]].
 [com.keminglabs/cljx 0.4.0] - [org.clojars.trptcolin/sjacket 0.1.0.6] 
 - [net.cgrand/parsley 0.9.1] - [net.cgrand/regex 1.1.0] - 
 [org.clojure/clojure [1.2.0,)]
 Consider using [com.keminglabs/cljx 0.4.0 :exclusions 
 [org.clojure/clojure]].
 [/code]

 Great, nice that it is being helpful, the problem is I am using the 
 exclusions :).

 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: Need help to store a SVM Model

2014-02-24 Thread r0man
In my svm-clj library I read and write the LibSVM model in a text
format that LibSVM's C library also understands. That's a sparse
text file you could also store in Mongo. Use or take a look at:

https://github.com/r0man/svm-clj/blob/master/src/svm/core.clj#L125

Roman


On Monday, February 24, 2014 8:36:21 PM UTC+1, Goldritter wrote:

 Hi,

 I wanted to use the Java library of the libsvm (
 http://www.csie.ntu.edu.tw/~cjlin/libsvm/) jlibsvm (
 http://dev.davidsoergel.com/trac/jlibsvm/) to learn a Support Vector 
 Machine and then store the learned model into a MongoDB (used kernel, 
 support vectors, alphas, label(s), rho, ...). 

 A way to train the SVM has been described here
 http://lilyx.net/2011/07/02/using-svm-support-vector-machine-from-clojure/
 and so far it works.

 The main problem I have now is to store the model. The supportvectors and 
 the alphas are all arrays (the supportvectors are an array of 
 SparseVectors). 
 And I have no clue how to transform these arrays into a list, map or other 
 clojure data structure.

 Does somebody has an idea how to to this in a clojure way or have I to go 
 over Java to transform the array in a Java List and then use this List to 
 create the needed datastructure?


-- 
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] Slamhound 1.5.0 + screencast + Vim plugin

2013-11-30 Thread r0man
This is very cool. Thanks!

On Saturday, November 30, 2013 5:14:36 AM UTC+1, guns wrote:

 Hello, 

 I am happy to announce version 1.5.0 of Slamhound, technomancy's amazing 
 ns rewriting tool. 

 ;; ~/.lein/profiles.clj 
 {:user {:dependencies [[slamhound 1.5.0]]}} 

 This is a *major* bugfix release. If you've tried Slamhound in the past 
 and felt frustrated, now is a great time to give it another try. 

 If you're unfamiliar with Slamhound, I've posted a short screencast 
 here: 

 https://vimeo.com/80650659 

 Many thanks to Phil Hagelberg for allowing me to take the reins for this 
 release. 

 Enhancements since the last version include: 

 - Greatly improved detection and disambiguation of missing ns 
   references. Slamhound is now much better at DWIM. 

 - References in the existing ns form are always preferred over other 
   candidates on the classpath. 

 - Mass-referred namespaces (via :use or :refer :all) are preserved 
   as (:require [my.ns :refer :all]). Simply remove it from the ns 
   form to get a vector of explicit refers. 

 - File comment headers, ns metadata maps, docstrings, and :require 
   flags (:reload et al), are correctly preserved. 

 - Multiple options per require libspec are emitted correctly. 
   e.g. (:require [clojure.test :as t :refer [deftest]]) 

 - Classes created via defrecord/deftype etc are correctly found. 

 - Capitalized vars that shadow class names are no longer ignored. 

 A full changelog is available here: 

 https://github.com/technomancy/slamhound/blob/master/CHANGES 

 Finally, for Vim users there is a new plugin for Slamhound integration: 

 https://github.com/guns/vim-slamhound 

 It was always easy to use Slamhound from fireplace.vim, but now it's 
 just a Pathogen infect away. 

 Cheers, 

 guns 


-- 
-- 
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] SQLingvo 0.5.9 released.

2013-11-22 Thread r0man
SQLingvo is a Clojure DSL to generate SQL statements.

README, source code and examples: 

https://github.com/r0man/sqlingvo

Leiningen dependency information:

[sqlingvo 0.5.9]

Enhancements:

* Added WITH statements.

-- 
-- 
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: Jsonify a Jdbc4Array in Clojure

2013-10-01 Thread r0man
I think you need to implement the JSONWriter protocol for the
Jdbc4Array class, and possibly for the datatypes that are in the
array. This for example makes the json library aware of
java.util.Date classes. 

(extend-type java.util.Date
  JSONWriter
  (-write [date out]
(-write (str date) out)))

Something like this (not tested):

(extend-type org.postgresql.jdbc4.Jdbc4Array
  JSONWriter
  (-write [array out]
(-write (seq (.getArray array)) out)))

Roman


On Tuesday, October 1, 2013 3:57:02 PM UTC+2, Christian Jauvin wrote:

 Hi,

 I asked this question on Stack Overflow yesterday:

 I want to jsonify the results of a query performed against a Postgres 
 table containing a column of type text[], but the problem is that 
 clojure.data.json.write-str doesn't seem to know how to handle PG arrays:

 *Exception Don't know how to write JSON of class 
 org.postgresql.jdbc4.Jdbc4Array  clojure.data.json/write-generic*

 Do I have to supply a custom handler, or is there a simpler way?


 http://stackoverflow.com/questions/19103870/jsonify-a-jdbc4array-in-clojure

 I'm asking it here in the hope of getting (maybe) a simpler solution, or 
 at least one I can implement readily, because the problem I have with one 
 of the suggestions I received (extending org.postgresql.jdbc4.Jdbc4Arrayto 
 implement the missing function) is that I don't know how to make it work 
 with my usage pattern, which is simply:

 (json/write-str 
 (jdbc/query *db* 
 [SELECT * FROM ...]))

 How do I get the array before the connection is closed with such a 
 construct? Is there another way?



-- 
-- 
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: Building with Java 7 but running on Java 6?

2013-09-04 Thread r0man
Hi Tom,

add this to your project.clj

:javac-options [-target 1.6 -source 1.6]

I have the same problem with our Hadoop cluster ;)

On Wednesday, September 4, 2013 9:45:11 PM UTC+2, Tom Emerson wrote:

 Greetings,

 I develop with JDK 7 but have coworkers who (for reasons I don't want to 
 get into) run Java 6, and they cannot run the uberjars I create because of 
 the version mismatch. Is it possible for Clojure/Leiningen to generate 
 compatible class files? Or do I need to setup a VM that has Java 6 
 installed and build the code there?

 Thanks in advance,

 -tree



-- 
-- 
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] Pedestal-app Tutorial has been released

2013-07-09 Thread r0man
Hi Pedestal Team,

this is great. Thank you very much!

Roman

On Tuesday, July 9, 2013 6:03:58 PM UTC+2, Ryan Neufeld wrote:

 Hey there, Clojurians/Pedestallions! 

 I'm pleased to announce the release of a comprehensive tutorial for 
 pedestal-app: http://bit.ly/pedestal-app-tutorial. In this tutorial we 
 finally *dive deep* into the guts of pedestal-app and build a distributed 
 multiplayer game using pedestal-app. 

 Major kudos to @brentonashworth for all his hard work on the pedestal-app 
 tutorial. 

 Enjoy!

 -- Ryan Neufeld 


 -- Ryan Neufeld 



-- 
-- 
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-sql 0.1.0: relational algebra in clojure

2013-07-06 Thread r0man
Composing queries is done via compose.

Take a look here: 
https://github.com/r0man/sqlingvo/blob/master/test/sqlingvo/test/core.clj#L16

On Saturday, July 6, 2013 5:46:06 AM UTC+2, Carlo wrote:

 Hey Roman,

 The issue that I see with `sqlingvo`, and the thing which I was trying to 
 solve for myself, is that it doesn't compose well. Unless I'm missing 
 something, you have to generate the entire query in the one `sql` form. To 
 me, this is a big restriction and was the number one thing I was trying to 
 fix with `clojure-sql`.

 The basic sort of thing I want to be able to do is this:

 (def users (- (table :users) (project [:id :person :username])))
 (def people (- (table :people) (project [:id :first-name])))

 (def combined-query (- people
 (rename {:id :person})
 (join users)
 (project [:username :first-name])))

 So now in queries I can use `people`, `users` and `combined-query` in the 
 same way. The only difference in terms of how I can compose them is that 
 they expose different fields (`users` exposes [:id, :person, :username], 
 `people` exposes [:id :first-name], `combined-query` exposes [:username 
 :first-name]). In this example it's not completely obvious why this would 
 be beneficial, but it means that I can change `users`, for instance, to 
 also have a `(select '(= :deleted false)` in its definition and no other 
 code has to change. They will all join/query against the users where 
 `deleted` is false without any other modifications of code.

 This freedom of composition is what you have in relational algebra, and 
 what I was trying to get in Clojure as well. All the naming of tables and 
 field aliases and everything is handled by the library, so you only have to 
 worry about constructing the queries. Unfortunately SQL provides a number 
 of operations outside of the relational algebra model (grouping, sorting, 
 take/drop), so they've been tacked on as a bit of an afterthought and 
 could probably use some improvement.

 Looking at `sqlingvo` did show up a mistake that I made in how I was 
 dealing with sorts, though, so thanks for that! I think our libraries just 
 have fairly different concerns at the moment.

 Carlo


 On 5 July 2013 20:59, r0man roman@burningswell.com javascript:wrote:

 Hi Carlo,

 if you'are looking for generating more complex SQL there's also:

 https://github.com/r0man/sqlingvo

 Roman.

 On Wednesday, July 3, 2013 10:48:07 AM UTC+2, Carlo wrote:

 Hey guys!

 I've been working on a small library to make writing SQL queries a 
 little bit easier. It's along the same lines as ClojureQL, but takes a 
 different approach and compiles into quite different SQL in the end.

 At the moment it's quite immature, but it should be able to support any 
 queries which can be expressed in relational algebra. There will be some 
 SQL queries which can't be expressed in clojure-sql, but hopefully there 
 won't be too many of those. A greater limitation is that at the moment the 
 SQL generation is specific to the PostgresSQL database (although any 
 contributions for other databases are welcome!).

 Dependency vector: [clojure-sql 0.1.0]
 Repository: 
 https://bitbucket.org/czan/**clojure-sqlhttps://bitbucket.org/czan/clojure-sql
 Clojars link: 
 https://clojars.org/clojure-**sqlhttps://clojars.org/clojure-sql

 Let me know what you think!

 Carlo

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




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




Re: [ANN] clojure-sql 0.1.0: relational algebra in clojure

2013-07-06 Thread r0man
You can do this with the second argument to the where function. I added an 
example here:
https://github.com/r0man/sqlingvo/blob/master/test/sqlingvo/test/core.clj#L24

On Saturday, July 6, 2013 4:02:23 PM UTC+2, Carlo wrote:

 This is a fairly restricted composition, though:

 (def triangles (compose (select [:color :num_sides] (from :shapes))
 (where '(= :num_sides 3
 (def green-triangles (compose triangles
   (where '(= :color green
 (sql green-triangles)
 ;= [SELECT color, num_sides FROM shapes WHERE (color = ?) green]

 We've lost our `num_sides` selection, so now our query is wrong. Last 
 clause wins means you have to be aware of the previous ones to ensure you 
 don't obliterate them when composing.

 The same example in `clojure-sql`:

 (def triangles (- (table :shapes)
(project [:color :num_sides])
(select '(= :num_sides 3
 (def green-triangles (select triangles '(= :color :green)))
 (deref green-triangles)
 ;= [SELECT \shapes2142\.\color\ AS \color\, 
 \shapes2142\.\num_sides\ AS \num_sides\ FROM \shapes\ AS 
 \shapes2142\ WHERE ((\shapes2142\.\num_sides\ = 3) AND 
 (\shapes2142\.\color\ = ?)) green]

 On 6 July 2013 22:37, r0man roman@burningswell.com javascript:wrote:

 Composing queries is done via compose.

 Take a look here: 
 https://github.com/r0man/sqlingvo/blob/master/test/sqlingvo/test/core.clj#L16


 On Saturday, July 6, 2013 5:46:06 AM UTC+2, Carlo wrote:

 Hey Roman,

 The issue that I see with `sqlingvo`, and the thing which I was trying 
 to solve for myself, is that it doesn't compose well. Unless I'm missing 
 something, you have to generate the entire query in the one `sql` form. To 
 me, this is a big restriction and was the number one thing I was trying to 
 fix with `clojure-sql`.

 The basic sort of thing I want to be able to do is this:

 (def users (- (table :users) (project [:id :person :username])))
 (def people (- (table :people) (project [:id :first-name])))

 (def combined-query (- people
 (rename {:id :person})
 (join users)
 (project [:username :first-name])))

 So now in queries I can use `people`, `users` and `combined-query` in 
 the same way. The only difference in terms of how I can compose them is 
 that they expose different fields (`users` exposes [:id, :person, 
 :username], `people` exposes [:id :first-name], `combined-query` exposes 
 [:username :first-name]). In this example it's not completely obvious why 
 this would be beneficial, but it means that I can change `users`, for 
 instance, to also have a `(select '(= :deleted false)` in its definition 
 and no other code has to change. They will all join/query against the users 
 where `deleted` is false without any other modifications of code.

 This freedom of composition is what you have in relational algebra, and 
 what I was trying to get in Clojure as well. All the naming of tables and 
 field aliases and everything is handled by the library, so you only have to 
 worry about constructing the queries. Unfortunately SQL provides a number 
 of operations outside of the relational algebra model (grouping, sorting, 
 take/drop), so they've been tacked on as a bit of an afterthought and 
 could probably use some improvement.

 Looking at `sqlingvo` did show up a mistake that I made in how I was 
 dealing with sorts, though, so thanks for that! I think our libraries just 
 have fairly different concerns at the moment.

 Carlo


 On 5 July 2013 20:59, r0man roman@burningswell.**com wrote:

 Hi Carlo,

 if you'are looking for generating more complex SQL there's also:

 https://github.com/r0man/**sqlingvo https://github.com/r0man/sqlingvo

 Roman.

 On Wednesday, July 3, 2013 10:48:07 AM UTC+2, Carlo wrote:

 Hey guys!

 I've been working on a small library to make writing SQL queries a 
 little bit easier. It's along the same lines as ClojureQL, but takes a 
 different approach and compiles into quite different SQL in the end.

 At the moment it's quite immature, but it should be able to support 
 any queries which can be expressed in relational algebra. There will be 
 some SQL queries which can't be expressed in clojure-sql, but hopefully 
 there won't be too many of those. A greater limitation is that at the 
 moment the SQL generation is specific to the PostgresSQL database 
 (although 
 any contributions for other databases are welcome!).

 Dependency vector: [clojure-sql 0.1.0]
 Repository: 
 https://bitbucket.org/czan/**clo**jure-sqlhttps://bitbucket.org/czan/clojure-sql
 Clojars link: 
 https://clojars.org/clojure-**sq**lhttps://clojars.org/clojure-sql

 Let me know what you think!

 Carlo

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

Re: [ANN] clojure-sql 0.1.0: relational algebra in clojure

2013-07-05 Thread r0man
Hi Carlo,

if you'are looking for generating more complex SQL there's also:

https://github.com/r0man/sqlingvo

Roman.

On Wednesday, July 3, 2013 10:48:07 AM UTC+2, Carlo wrote:

 Hey guys!

 I've been working on a small library to make writing SQL queries a little 
 bit easier. It's along the same lines as ClojureQL, but takes a different 
 approach and compiles into quite different SQL in the end.

 At the moment it's quite immature, but it should be able to support any 
 queries which can be expressed in relational algebra. There will be some 
 SQL queries which can't be expressed in clojure-sql, but hopefully there 
 won't be too many of those. A greater limitation is that at the moment the 
 SQL generation is specific to the PostgresSQL database (although any 
 contributions for other databases are welcome!).

 Dependency vector: [clojure-sql 0.1.0]
 Repository: https://bitbucket.org/czan/clojure-sql
 Clojars link: https://clojars.org/clojure-sql

 Let me know what you think!

 Carlo


-- 
-- 
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] java.jdbc 0.3.0-alpha2

2013-05-04 Thread r0man
Hi Sean,

I just tested java.jdbc 0.3.0-alpha2 against my code base and got
the following excpetion when running my tests:

Exception in thread main java.lang.IllegalArgumentException: Unable to 
resolve classname: Connection,

I think the problem only happens when you use the get-connection
function in a macro, and the java.sql.Connection class was not
already imported.

The problem could be fixed by adding the fully qualified type
hint java.sql.Connection instead of just Connection to
get-connection. Could you please change this?

Thanks, Roman.

On Saturday, May 4, 2013 2:32:37 AM UTC+2, Sean Corfield wrote:

 Another step toward the 0.3.0 release for Clojure's JDBC wrapper. A 
 very minor update, mostly bug fixes and consistency issues. Based on 
 feedback from some users, the new boolean transaction? argument in 
 some of the new API functions will probably change in alpha3 although 
 that's not fully decided yet. Watch this space. 

 Release 0.3.0-alpha2 on 2013-05-03 

 Address JDBC-51 by declaring get-connection returns java.sql.Connection 
 Add IResultSetReadColumn protocol extension point for custom read 
 conversions JDBC-46 
 Add :multi? to execute! so it can be used for repeated operations JDBC-52 
 Reverted specialized handling of NULL values (reopens JDBC-40) 
 Rename :as-arrays to :as-arrays? since it is boolean 
 Add curried version of clojure.java.jdbc.sql/as-quoted-str 
 Officially deprecate resultset-seq 

 For more details about past releases: https://github.com/clojure/java.jdbc 
 -- 
 Sean A Corfield -- (904) 302-SEAN 
 An Architect's View -- http://corfield.org/ 
 World Singles, LLC. -- http://worldsingles.com/ 

 Perfection is the enemy of the good. 
 -- Gustave Flaubert, French realist novelist (1821-1880) 


-- 
-- 
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] java.jdbc 0.3.0-alpha1

2013-04-09 Thread r0man
Hi Sean  Matching Socks,

first off, I like the new API design. Here are my questions and
suggestions:

1.) Despite the asymmetry I'm also thinking that passing entities
and identifiers functions via the db argument is quite
convienient. Otherwise I always have to wrestle with those extra
parameters and pass them through my underlying SQL generation
functions. Which I have to to with the db anyway (maybe one level
less). 

2.) The default naming strategy for columns coming from the
database is at the moment lower-case. Wouldn't it be more
idiomatic to lower case and replace _ with -. That would be
more consistent with the Clojure defaults of naming keywords at
the expense of maybe performance. I use this naming strategy for
example, because I don't want to constantly remember which keys
in my maps use the Clojure and which the database convention.
Would this be an option for 0.3.0?
   
3.) Would it make sense to define some connection spec, into
which the current specs get translated to? Something like the
Ring SPEC for connections. I'm often interested in the name of
the database, the credentials of the hostname the database is
running on, etc. Something like this?
   
{:product :postgresql
 :server-name example.com
 :server-port 5432
 :username tiger
 :password scotch
 :db my_db
}

Othwerwise thanks for your work on clojure.java.jdbc,

Roman.

-- 
-- 
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] oauth-clj

2013-02-05 Thread r0man
When I started this library I wanted something that was based on
clj-http and the concept of middleware. At that time Matt's
library was not based on clj-http yet. But this has changed ...

On Tuesday, February 5, 2013 6:37:13 AM UTC+1, Leonardo Borges wrote:

 Nobody ever replied to this and I'm now wondering the same.

 Any opinions one way or the other?

 On Tuesday, January 24, 2012 5:08:44 PM UTC+11, Dave Sann wrote:

 Hi r0man,

 I am curious as to similarities/differences of your library to: 
 https://github.com/mattrepl/clj-oauth

 Dave



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




ClojureScript macro eval bug since 0.0-1211?

2012-05-28 Thread r0man
Hello ClojureScripters,

I'm trying to update a port of hiccup [1] to the latest
ClojureScript version. During HTML compilation I call at some
point eval (in a Clojure macro) on a datastructure and get a
java.lang.ClassCastException. This used in ClojureScript versions
before 0.0-1211.

I traced it down to the following example. This works in
ClojureScript 0.0-1011:

; Define a Clojure macro.
(defmacro eval-test [arg]
  (eval arg))

; Use the Clojure macro from ClojureScript.
(eval-test 1)
;= 1
(eval-test 1)
;= 1
(eval-test div)
;= div
(eval-test :div)
;= :div
(eval-test [])
;= []
(eval-test {})
;= {}
(eval-test #{})
;= #{}

In ClojureScript 0.0-1211 it works on strings, numbers and
symbols, but fails on vectors, maps and sets. I get the follwoing
results:

(eval-test 1)
;= 1
(eval-test 1)
;= 1
(eval-test div)
;= div
(eval-test :div)
;= :div
(eval-test [])

java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to 
clojure.lang.Namespace, compiling:(NO_SOURCE_PATH:1)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6462)
at clojure.lang.Compiler.analyze(Compiler.java:6262)
at clojure.lang.Compiler.eval(Compiler.java:6508)
at clojure.lang.Compiler.eval(Compiler.java:6477)
at clojure.core$eval.invoke(core.clj:2797)
at hiccup.core$eval_test.invoke(core.clj:20)
at clojure.lang.AFn.applyToHelper(AFn.java:167)
at clojure.lang.AFn.applyTo(AFn.java:151)
at clojure.core$apply.invoke(core.clj:605)
at cljs.compiler$macroexpand_1.invoke(compiler.clj:1351)
at cljs.compiler$analyze_seq.invoke(compiler.clj:1368)
at cljs.compiler$analyze.invoke(compiler.clj:1425)
at cljs.compiler$analyze.invoke(compiler.clj:1418)
at cljs.repl$evaluate_form.invoke(repl.clj:64)
at cljs.repl$eval_and_print.invoke(repl.clj:124)
at cljs.repl$repl.doInvoke(repl.clj:173)
at clojure.lang.RestFn.invoke(RestFn.java:410)
at cljsbuild.repl.listen$run_repl_listen.invoke(listen.clj:10)
at cljsbuild.repl.listen$run_repl_launch.invoke(listen.clj:31)
at user$eval2490.invoke(NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:6511)
at clojure.lang.Compiler.eval(Compiler.java:6500)
at clojure.lang.Compiler.eval(Compiler.java:6501)
at clojure.lang.Compiler.eval(Compiler.java:6477)
at clojure.core$eval.invoke(core.clj:2797)
at clojure.main$eval_opt.invoke(main.clj:297)
at clojure.main$initialize.invoke(main.clj:316)
at clojure.main$null_opt.invoke(main.clj:349)
at clojure.main$main.doInvoke(main.clj:427)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:419)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.Var.applyTo(Var.java:532)
at clojure.main.main(main.java:37)
Caused by: java.lang.ClassCastException: clojure.lang.Symbol cannot be cast 
to clojure.lang.Namespace
at clojure.lang.Compiler.currentNS(Compiler.java:6864)
at clojure.lang.Compiler.lookupVar(Compiler.java:6826)
at clojure.lang.Compiler.lookupVar(Compiler.java:6847)
at clojure.lang.Compiler.isInline(Compiler.java:6323)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6448)
... 33 more
java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to 
clojure.lang.Namespace, compiling:(NO_SOURCE_PATH:1)

Does anyone have an idea what has changed between those versions?
Could this be a bug?

Thanks for your help, Roman.

[1] https://github.com/r0man/hiccup/tree/clojurescript

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

Help in porting Hiccup to ClojureScript

2012-04-07 Thread r0man
Hello ClojureScripters,

I started to port the Hiccup library to ClojureScript. The goal
is to have a port of Hiccup that has exactly the same api. This
would make it possible to write views once (provided no platform
specific code is used), and run them on the server with Clojure
and on the client with ClojureScript.

At the moment I copied most of the Clojure files and made some
modifications where necessary. The whole Hiccup testsuite runs
fine in the browser, as well in a headless v8 session.

However I have one last hurdle to take. Most macros I can use in
Clojure and in ClojureScript with some minor adjustments, except
the defelem macro in the hiccup.def namespace. To get this
one running in ClojureScript I had to change it's implementation
and move it to the hiccup.macro namespace.

The problem with this macro is, that it uses the alter-var-root
fn to add additional functionality to the given fn. As far as I
can tell there is no alter-var-root in ClojureScript. I got the
code running by using set! in the ClojureScript version.

The original Clojure macro:

https://github.com/r0man/hiccup/blob/clojurescript/src/clj/hiccup/def.clj#L38

The ClojureScript macro:

https://github.com/r0man/hiccup/blob/clojurescript/src/clj/hiccup/macro.clj#L13

Is anyone aware of a solution that would share the same code and
work in both cases? Are there plans to add alter-var-root to
ClojureScript as well?

Thanks, Roman.

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

Re: Help in porting Hiccup to ClojureScript

2012-04-07 Thread r0man
Hi Chris,

yes I have seen crate. But I wanted something where I can share
the same view code and use it on the client and the server and
use the same api. I also think Hiccup's aproach to generate html
strings at compile time is quite nice. That way the
deconstruction of [:div#id.class] stuff can be done at compile
time.

Thanks anyway. I'm looking at add-optional-attrs in your lib.
Maybe that can get me further ...

Roman.


On Saturday, April 7, 2012 9:32:38 PM UTC+2, Chris Granger wrote:

 Have you seen Crate? 

 http://github.com/ibdknox/crate 

 On Apr 7, 1:18 pm, r0man roman.sche...@burningswell.com wrote: 
  Hello ClojureScripters, 
  
  I started to port the Hiccup library to ClojureScript. The goal 
  is to have a port of Hiccup that has exactly the same api. This 
  would make it possible to write views once (provided no platform 
  specific code is used), and run them on the server with Clojure 
  and on the client with ClojureScript. 
  
  At the moment I copied most of the Clojure files and made some 
  modifications where necessary. The whole Hiccup testsuite runs 
  fine in the browser, as well in a headless v8 session. 
  
  However I have one last hurdle to take. Most macros I can use in 
  Clojure and in ClojureScript with some minor adjustments, except 
  the defelem macro in the hiccup.def namespace. To get this 
  one running in ClojureScript I had to change it's implementation 
  and move it to the hiccup.macro namespace. 
  
  The problem with this macro is, that it uses the alter-var-root 
  fn to add additional functionality to the given fn. As far as I 
  can tell there is no alter-var-root in ClojureScript. I got the 
  code running by using set! in the ClojureScript version. 
  
  The original Clojure macro: 
  
  https://github.com/r0man/hiccup/blob/clojurescript/src/clj/hiccup/def... 

  
  The ClojureScript macro: 
  
  https://github.com/r0man/hiccup/blob/clojurescript/src/clj/hiccup/mac... 

  
  Is anyone aware of a solution that would share the same code and 
  work in both cases? Are there plans to add alter-var-root to 
  ClojureScript as well? 
  
  Thanks, Roman.

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

Re: Help in porting Hiccup to ClojureScript

2012-04-07 Thread r0man
Hi Evan,

I think Hiccup is a also a good starting point for this. In fact
99% of the port is already working. The last thing I struggle
with is actually only cosmetics, like carrying over the meta data
with the arglist and documentation.

Why do you think it is impossible to have the same API in Clojure
and ClojureScript? If you look at the header of the following
file you can see that it's using exactly Hiccup's API (except :use-macros).

https://github.com/r0man/hiccup/blob/clojurescript/test/cljs/hiccup/test/page.cljs

Your lein-cljsbuild will take care of modifiying the :use-macros
clause in the namespace declaration when used in crossover files.
But maybe I missed something?

Roman.


On Saturday, April 7, 2012 10:22:58 PM UTC+2, Evan Mezeske wrote:

 I think crate is about the closest that you're going to be able to get to 
 hiccup in practice.  ClojureScript macros are written in Clojure, and thus 
 have to come from separate namespaces from the rest of the ClojureScript 
 code.  So, it is not possible to just port hiccup to ClojureScript on a 
 var-by-var basis; the namespaces will always have to be slightly different. 
  The only way you could have hiccup provide the exact same API on both 
 Clojure and ClojureScript would be to modify the Clojure API so that it is 
 conducive to being implemented in ClojureScript.

 Aside from the impossibility of keeping the API identical in 
 ClojureScript, I don't see why it should not be possible to have more of 
 the templating work done at compile-time via macros.  IMHO, though, crate 
 would be a good starting point for that, rather than creating yet another 
 hiccup-in-clojurescript clone.

 -Evan

 On Saturday, April 7, 2012 1:03:39 PM UTC-7, r0man wrote:

 Hi Chris,

 yes I have seen crate. But I wanted something where I can share
 the same view code and use it on the client and the server and
 use the same api. I also think Hiccup's aproach to generate html
 strings at compile time is quite nice. That way the
 deconstruction of [:div#id.class] stuff can be done at compile
 time.

 Thanks anyway. I'm looking at add-optional-attrs in your lib.
 Maybe that can get me further ...

 Roman.


 On Saturday, April 7, 2012 9:32:38 PM UTC+2, Chris Granger wrote:

 Have you seen Crate? 

 http://github.com/ibdknox/crate 

 On Apr 7, 1:18 pm, r0man roman.sche...@burningswell.com wrote: 
  Hello ClojureScripters, 
  
  I started to port the Hiccup library to ClojureScript. The goal 
  is to have a port of Hiccup that has exactly the same api. This 
  would make it possible to write views once (provided no platform 
  specific code is used), and run them on the server with Clojure 
  and on the client with ClojureScript. 
  
  At the moment I copied most of the Clojure files and made some 
  modifications where necessary. The whole Hiccup testsuite runs 
  fine in the browser, as well in a headless v8 session. 
  
  However I have one last hurdle to take. Most macros I can use in 
  Clojure and in ClojureScript with some minor adjustments, except 
  the defelem macro in the hiccup.def namespace. To get this 
  one running in ClojureScript I had to change it's implementation 
  and move it to the hiccup.macro namespace. 
  
  The problem with this macro is, that it uses the alter-var-root 
  fn to add additional functionality to the given fn. As far as I 
  can tell there is no alter-var-root in ClojureScript. I got the 
  code running by using set! in the ClojureScript version. 
  
  The original Clojure macro: 
  
  https://github.com/r0man/hiccup/blob/clojurescript/src/clj/hiccup/def... 

  
  The ClojureScript macro: 
  
  https://github.com/r0man/hiccup/blob/clojurescript/src/clj/hiccup/mac... 

  
  Is anyone aware of a solution that would share the same code and 
  work in both cases? Are there plans to add alter-var-root to 
  ClojureScript as well? 
  
  Thanks, Roman.



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

[ANN] oauth-clj

2012-01-21 Thread r0man
Hi all,

I just released another OAuth library for Clojure on top of
clj-http, supporting version 1 and 2 of the OAuth protocol.

Roman.

https://github.com/r0man/oauth-clj
http://clojars.org/oauth-clj

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

Howto override toString of defrecord instances in ClojureScript?

2011-11-24 Thread r0man
Hello,

what's the preferred way to override the toString method of a
ClojureScript record? I could use set! to change the toString fn
of a record after it has been initialized like this:

(defrecord MyRecord [name])

(let [record (MyRecord. Hello World)]
  (set! record.toString (fn [] (:name (js* this
  (str record))

But I wonder if there is something more idiomatic? Can I change
the toString method in the prototype of the record directly? How
do get the prototype?

Thank you, Roman.

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

Re: Howto override toString of defrecord instances in ClojureScript?

2011-11-24 Thread r0man
Thank you, Baishampayan. That's exactly what I was looking for ...

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

Re: Google Maps in Clojurescript

2011-10-09 Thread r0man
Hi Sam,

this is how I use Google Maps with Clojurescript. In the html
page I load Google's Loader library, the Google Closure base.js
file and the deps.js file which is the one cljsc spit out.

(defhtml javascripts []
  (html
   (include-js (str https://www.google.com/jsapi?key=; (google-api-key)))
   (if (development?) (include-js /javascripts/goog/base.js))
   (include-js /javascripts/deps.js)
   (if (development?) (javascript-tag 
goog.require('burningswell.application');

After those have been loaded I require my application namespace,
which calls the start fn at the end of the file. Something like
this:

(defn ^:export start []
  (. js/google (load maps 3.6, (h/clj-js {:other_params 
sensor=false})))
  (. js/google
 (setOnLoadCallback
  (fn []
 (set! *map* (init-map (goog.dom/getElement map)))

(start)

I compile Clojurescript files with this command:

cljsc src/cljs '{:externs 
[closure-compiler/contrib/externs/maps/google_maps_api_v3_6.js 
closure-compiler/contrib/externs/google_loader_api.js] :output-dir 
resources/public/javascripts}'  resources/public/javascripts/deps.js

The important stuff is the externs option when using advanced
mode. This worked for me quiet well so far. I used this way
because I want to access the user's client location via Google's
loader API.

A simpler way is to include only the Google Maps javascript file
and it's extern file. That used to work also fine ...

Hope this helps, Roman.

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

Re: Google Maps in Clojurescript

2011-10-09 Thread r0man
Forgot to mention my init-map fn:

(defn init-map [element]
  (let [options (h/clj-js {:zoom 1 :mapTypeId 
google.maps.MapTypeId.ROADMAP})
parent-size (style/getSize (. element parentNode))
element-size (style/getSize element)
map (doto (google.maps.Map. element options)
  (. (setCenter (to-lat-lng *location*)))
  (. (setZoom 10)))]
(style/setSize element (. element-size width) (. parent-size height))
(events/listen
 viewport-monitor
 events/EventType.RESIZE
 (fn [event] (google.maps.event/trigger map resize)

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

How to replace c.c.mock when migrating to Clojure 1.3?

2011-09-23 Thread r0man
Hello,

I'm in the process of porting my code to Clojure 1.3. Those two
pages were really helpful on the way:

- http://dev.clojure.org/display/doc/Clojure+Contrib
- http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go

The only dependency I still couldn't get rid of is
clojure.contrib.mock. What's the recommended replacement for this
library? How is mocking done in Clojure 1.3 at all? In pre 1.3 I
could have used binding. But in Clojure 1.3 this doesn't work
anymore, because my fn under test is not defined to be dynamic?

What's the solution to this problem? Adding ^:dynamic to those
fns?

Thanks for your help, Roman.

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

Re: How to replace c.c.mock when migrating to Clojure 1.3?

2011-09-23 Thread r0man
Thx Stuart, that worked fine ...

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

Re: Cyclic load dependency

2011-07-18 Thread r0man
There was indeed a cyclic dependency, that didn't show up with clojure
1.2.0.
I fixed it and pushed an updated version using clojure 1.2.1 to
clojars.

Roman

On Jul 18, 12:07 pm, Ben Smith-Mannschott bsmith.o...@gmail.com
wrote:
 Clojure does not allow cyclic dependencies between namespaces.

 Java does allow cyclic dependencies between classes.

 I'm not familiar with appengine-clj. Are you certain that
 appengine.datastore is Clojure code, not Java code? If it's Java you
 should be using import.

 // Ben







 On Sat, Jul 16, 2011 at 18:14, Razvan Rotaru razvan.rot...@gmail.com wrote:
  Hi,

  I'm trying to use r0man / appengine-clj, and when :use-ing the
  datastore namespace I get a cyclic load dependency. Doesn't clojure
  allow such cyclic references?

  (use 'appengine.datastore)
  Cyclic load dependency: [ /appengine/datastore/entities ]-/appengine/
  datastore/query-[ /appengine/datastore/entities ]-/appengine/
  datastore
   [Thrown class java.lang.Exception]

  Restarts:
   0: [QUIT] Quit to the SLIME top level

  Backtrace:
   0: clojure.core$check_cyclic_dependency.invoke(core.clj:4817)
   1: clojure.core$load.doInvoke(core.clj:4912)
   2: clojure.lang.RestFn.invoke(RestFn.java:408)
   3: clojure.core$load_one.invoke(core.clj:4729)
   4: clojure.core$load_lib.doInvoke(core.clj:4766)
   5: clojure.lang.RestFn.applyTo(RestFn.java:142)
   6: clojure.core$apply.invoke(core.clj:542)
   7: clojure.core$load_libs.doInvoke(core.clj:4800)
   8: clojure.lang.RestFn.applyTo(RestFn.java:137)
   9: clojure.core$apply.invoke(core.clj:544)

  Cheers,
  Razvan

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