Re: JDBC Connection auto-commit?: [ANN] clojure.java.jdbc 0.7.0 Beta1
Sean Corfieldwrites: > Of course. The :auto-commit? parameter has to be passed to > with-db-connection so that connections and their state are properly > scoped, so that connections don’t “randomly” change their behavior > half way through a with-db-connection block because a _query_ > (something that should be an inherently read-only operation!) happened > to _mutate_ the surrounding state. That could produce very surprising > behavior and be very hard to debug. Thanks for the explanation. I can understand your reasoning now, though I still disagree. -- Cheers Ralf -- 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: JDBC Connection auto-commit?: [ANN] clojure.java.jdbc 0.7.0 Beta1
Ralf Schmitt <r...@systemexit.de> writes: >> (into [] (take 2) (jdbc/query db query {:fetch-size 500 :auto-commit? >> false})) > > Sorry, this one works. will test with reducible-query tomorrow. reducible-query also works (and it also ignores the :auto-commit? parameter when wrapped inside a with-db-connection). -- Cheers Ralf -- 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: JDBC Connection auto-commit?: [ANN] clojure.java.jdbc 0.7.0 Beta1
Sean Corfieldwrites: >> The fact that the code currently sets the flag when opening the >> connection is an implementation detail. It should not leak into the API > > On the contrary – it is important to identify the scope of the connection and > the scope of when auto-commit is on/off. But why do you think it is okay to ignore the option I pass in? What is wrong with setting the auto commit flag on an existing connection? > > And you still haven’t answered my question about whether this code (without > with-db-connection) works now (with Beta 5): > > (into [] (take 2) (jdbc/query db query {:fetch-size 500 :auto-commit? false})) Sorry, this one works. will test with reducible-query tomorrow. -- Cheers Ralf -- 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: JDBC Connection auto-commit?: [ANN] clojure.java.jdbc 0.7.0 Beta1
Sean Corfieldwrites: > You said: > > But when the database is already connected like in > > (jdbc/with-db-connection [db db] > (jdbc/query db > query > {:result-set-fn (fn [coll] (doall (take 2 coll))) > :fetch-size 100 > :auto-commit? false})) > > streaming is not turned on. > > Well, of course not: you didn’t tell with-db-connection to do it: > > (jdbc/with-db-connection [db db {:auto-commit? false}] > (jdbc/query db > query > {:result-set-fn (fn [coll] (doall (take 2 coll))) > :fetch-size 100 })) I think the current behaviour is terrible. I'm passing in {:auto-commit? false}, so please turn off auto commit on the database connection that is being used. The fact that the code currently sets the flag when opening the connection is an implementation detail. It should not leak into the API. Honestly, I don't care if java.jdbc is reusing an existing connection or if it's opening a new connection. Why should it matter in this case? I can use jdbc/query with an existing connection or with a map. It didn't matter until today. Now it surprisingly does. When using functions that receive a db parameter (which may or may not have an open connection attached to it), what are you going to do when you notice that you need streaming? Check if it's using an open connection and call .setAutoCommit on it, and pass {:auto-commit? false} if it's a map? Sorry, but then java.jdbc didn't help me in any way setting up a streaming query. Instead java.jdbc made things *worse* by ignoring my perfectly fine looking option (which has been working when I passed in map) and now tries to burn my laptop with the help from java's garbage collector before throwing a MemoryError. > You have to pass the option into the call that would create the connection. I may not know if (jdbc/query db ...) creates a new connection. I'm not even sure what db is. But I'm sure I want to run a query with streaming results. The fact that I have to set an attribute on the connection object instead of the PreparedStatement is again an implementation detail. Let me pass the required options for streaming when running the query, not when opening the connection. -- Cheers Ralf -- 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: JDBC Connection auto-commit?: [ANN] clojure.java.jdbc 0.7.0 Beta1
Ralf Schmitt <r...@systemexit.de> writes: > Sean Corfield <s...@corfield.org> writes: > >> The :auto-commit? option is supported in 0.7.0-beta5 which should hit >> Maven Central by tomorrow (or maybe late tonight). Please let me know >> if it solves the streaming problem. > > yes, it does work. Thanks. Sorry, but that's not entirely true. db is map/db-spec for a postgresql database in the following code: The following does work: (jdbc/query db query {:result-set-fn (fn [coll] (doall (take 2 coll))) :fetch-size 100 :auto-commit? false}) But when the database is already connected like in (jdbc/with-db-connection [db db] (jdbc/query db query {:result-set-fn (fn [coll] (doall (take 2 coll))) :fetch-size 100 :auto-commit? false})) streaming is not turned on. -- Cheers Ralf -- 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: JDBC Connection auto-commit?: [ANN] clojure.java.jdbc 0.7.0 Beta1
Sean Corfieldwrites: > The :auto-commit? option is supported in 0.7.0-beta5 which should hit > Maven Central by tomorrow (or maybe late tonight). Please let me know > if it solves the streaming problem. yes, it does work. Thanks. -- Cheers Ralf -- 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: JDBC Connection auto-commit?: [ANN] clojure.java.jdbc 0.7.0 Beta 1
Sean Corfieldwrites: > Rather than doing something that requires a dependency on specific JDBC > driver classes, it seems that if an :auto-commit option in the db-spec were > honored by get-connection you would get what you needed: > > (into [] (take 2) (jdbc/reducible-query (assoc config/db :auto-commit > false) query {:fetch-size 500})) > > You can already pass additional options into the DriverManager/getConnection > call as properties (from the db-spec) but autocommit does not appear to be > supported in that format. > > Actually, it would be cleaner if get-connection had a 2-arity accepting > db-spec and opts, and then everything could pass opts into get-connection and > you could do: > > (into [] (take 2) (jdbc/reducible-query config/db query {:fetch-size > 500 :auto-commit false })) That would work, but I have to look at which database driver is being used here when creating the reducible-query. I would have to pass the right options depending on the database driver being used instead of passing a {:use-streaming? true} as options. In my case config/db is really read from a config.edn file and may point to a mysql, postgresql or sqlite database. The extend-protocol form would be provided by the user's code, not by java.jdbc, so there's no dependency on a specific JDBC driver class. Anyway I could live with both solutions. And I'm aware of the fact that an additional protocol to turn on streaming also introduces additional complexity. Being able to pass the :auto-commit option would already be a nice improvement since I could get rid of the outer jdbc/with-db-connection. I hope I've made my point clear. I'm going to trust your best judgement on this issue from now on. Thanks again for your work on java.jdbc. -- Cheers Ralf -- 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.java.jdbc 0.7.0 Beta 1
Sean Corfieldwrites: >> The required steps to setup streaming are different from database to >> database and I guess they may change with the driver version being used. > > This is really the crux of the problem here – I’m not sure what java.jdbc can > do generically to make this much easier. Please take a look at the attachment or https://gist.github.com/schmir/6e03b3d649950d0108a06bf6fd653dec This is using the robert.hooke library to hook into prepare-statement. That hook calls into a protocol function if streaming is required. This protocol function can be defined by users for the database they are using. I think it would be really nice for clojure.java.jdbc to provide this functionality. -- Cheers Ralf -- 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. (ns soka-trb.jdbc-streaming "streaming results in clojure.java.jdbc, when {:use-streaming? true} is passed as option hooks into jdbc/prepare-statements and calls turn-on-streaming Users need to extend the TurnOnStreaming protocol for their databases " (:require [clojure.java.jdbc :as jdbc] [robert.hooke])) (defprotocol TurnOnStreaming (turn-on-streaming [con opts])) (extend-protocol TurnOnStreaming org.sqlite.SQLiteConnection (turn-on-streaming [con opts] opts) org.postgresql.jdbc.PgConnection (turn-on-streaming [con opts] (.setAutoCommit con false) (if (pos? (get opts :fetch-size 0)) opts (assoc opts :fetch-size 1000))) com.mysql.jdbc.JDBC4Connection (turn-on-streaming [con opts] (assoc opts :fetch-size Integer/MIN_VALUE))) (defn prepare-statement ([f con sql] (prepare-statement f con sql {})) ([f ^java.sql.Connection con ^String sql {:keys [return-keys result-type concurrency cursors fetch-size max-rows timeout use-streaming?] :as opts}] (if use-streaming? (f con sql (turn-on-streaming con opts)) (f con sql opts (defn add-hook [] (robert.hooke/add-hook #'jdbc/prepare-statement #'prepare-statement))
Re: [ANN] clojure.java.jdbc 0.7.0 Beta 1
Sean Corfieldwrites: > Did you try this: > > (jdbc/with-db-connection [conn config/db] > (.setAutoCommit (jdbc/db-find-connection conn) false) > (into [] (take 2) (jdbc/reducible-query conn query {:fetch-size 500})) > > (I don’t have your sort of data set to test on with PostgreSQL) Hi Sean, that didn't work, i.e. I got an OutOfMemoryError. Even if it did, it uses a lot of boilerplate code and looks rather 'pale' in comparison to (into [] (take 2) (jdbc/reducible-query conn query {:use-streaming? true})) It would also be nice from a callers perspective since he does not need to know if the query should use streaming; it would be part of the options passed to reducible-query. I think it would make sense to add support for streaming into java.jdbc. I'm not sure if this is feasible. The required steps to setup streaming are different from database to database and I guess they may change with the driver version being used. I think you would need some functionality to let the user hook into the process of setting up a connection for streaming. Though java.jdbc could provide those hooks for some commonly used databases. -- Cheers Ralf -- 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.java.jdbc 0.7.0 Beta 1
Sean Corfieldwrites: > A new function, reducible-query, has been added that accepts a db-spec > and a SQL/parameters vector, and returns a “reducible collection”. The > query doesn’t actually run until you reduce it. At that point, it sets > up the PreparedStatement, runs the query, and processes the ResultSet > – by creating an interim “reducible collection” version of that result > set and delegating your reduce operation to that. The connection is > automatically closed when reduction completes, either by processing > the entire result set or by returning a ‘reduced’ value. How does one force the jdbc driver to return results lazily when using reducible-query? Currently I'm using the following code to force postgresql into streaming mode: (jdbc/with-db-connection [conn config/db] (.setAutoCommit (jdbc/db-find-connection conn) false) (jdbc/query conn query {:fetch-size 500 :result-set-fn (fn [coll] (doall (take 2 coll)))})) (config/db is map describing a postgresql connection, query is an sql query) This works as expected. Trying to to the same with reducible-query with something like: (into [] (take 2) (jdbc/reducible-query config/db query {:fetch-size 500})) results in a 'GC overhead limit exceeded' error. The postgresql driver isn't streaming the results, but instead returns the whole result in one large response. I don't have the ability to call .setAutoCommit on the connection in that case. I would very much like an easy way to turn on streaming (e.g. by passing {:use-streaming? true} as an option). Do you have any plans for that? Thanks for your work on java.jdbc. -- Cheers Ralf -- 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: Let and For Doesn't Execute - Where Is My Misunderstanding?
Kevin Kleinfelterwrites: > I'm stumped by the behavior of the following code fragment. Can someone > help me understand what's happening? > > *This code*: > (println "Holding:" (:class holding)) > (let [t (:class holding)] > (for [x t] (println "here" x)) > (for [x t] (println "there" x > > *Produces this output*: > holding: {:fundname Mutual Fund 1, :value 123.45, :class [{:class sell-me, > :percent 100}]} > class: [{:class sell-me, :percent 100}] > Holding: [{:class sell-me, :percent 100}] > there {:class sell-me, :percent 100} > > Why doesn't the 'for' with "here" print anything? 'for' is lazy. the result isn't realized anywhere. the second 'for' is realized because you print the result in the REPL (at least that is what I assume). try (doseq [x t] ...) -- Cheers, Ralf -- 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] Virgil 0.1.6
Zach Tellmanwrites: > I figured it was worth reminding everyone that this library > exists: https://github.com/ztellman/virgil. Hi Zach, thanks for the reminder. I've read about Virgil some weeks ago, and today I thought I could use this project, but couldn't remember the name. I'm using it with around 8k lines of java code and so far everything seems to work. Thanks for your work on this project! -- Cheers Ralf -- 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: Problem with buddy.core.keys/private-key in uberjar
Ray Millerwrites: > This works as expected when invoked with `lein run`, but if I create an > uberjar with `lein do clean, uberjar` and invoke with `java -jar ...` I get > the following exception: > > Exception in thread "main" org.bouncycastle.openssl.PEMException: Unable to > create OpenSSL PBDKF: PBKDF-OpenSSL SecretKeyFactory not available > at org.bouncycastle.openssl.jcajce.PEMUtilities.getKey(Unknown Source) Please read the following for an explanation and solution: https://github.com/xsc/pandect#uberjars-and-bouncycastle -- Cheers Ralf -- 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: Serialising/deserialising mixed Clojure and Java datastructures
"'Simon Brooke' via Clojure"writes: > I'm working on some complex analysis where it takes about twelve hours to > construct the model to be analysed. Once it's constructed I'm doing various > interactive things to explore it, but I can't currently persist it in a > form in which it can be read back in, so that when the REPL session ends it > is lost and I need to run the construction process again. > > When I was creating the system I had thought, airily, 'well, Clojure is > Lisp so all I need to do is spit the structure out to a file and slurp it > back in again'. Unfortunately, of course, Clojure is only mostly Lisp. > > My problem is clj-time objects, both date-time and interval. These are > essentially Joda time objects, and when they are printed, what you get is a > string representation of an object reference. When the reader reads it > back, what you have is a string: I've had the same problem a few weeks ago. I've started using nippy [1] for serialization and can only recommend it. [1] https://github.com/ptaoussanis/nippy -- Cheers Ralf -- 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] excel-templates 0.3.2 release available
Tom Faulhaberwrites: > I want to thank the users who submitted bug reports. The pull requests and > nice, clear bug reports made most of the problems easy to fix. > > *What is Excel Templates anyway?* > > Excel Templates is a library that lets you build beautiful spreadsheets > from pure Clojure data. I gave a talk on it at Clojure/West last year where > you can see it in action: https://www.youtube.com/watch?v=qnJs79W0BDo > > I'm always interested in feedback or new ideas for this library. > Hi Tom, many thanks for your work on this wonderful library. I'm using it with great success! It's a very nice way to produce Excel sheets. -- Cheers Ralf -- 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 some direction on writing my .Net build script using clojure
Erlis Vidalwrites: > Hi all, > > I would like to start using clojure at my workplace and I think I've found > a great opportunity. I need to write the build script for our .Net solution > and it will great if I can use clojure for this task. > > What I would like to know is if we (the community) have something that is > suitable for this task. > > Currently the build scripts are written in Powershell and they use a > library (Psake) that makes easy to invoke MSBuild, this is what I consider > I need to be able to write the script. > > I was researching and I found boot-clj and the idea behind it is similar to > the idea behind Psake. > > So guys, do you think boot-clj is the way to go or do you think I should be > looking into a different tool? I'm just guessing here, but I don't think boot will help you much. Have a look at Fake: https://fsharp.github.io/FAKE/ I've never used it, but I think it may be more suitable for building .net programs. -- Cheers Ralf -- 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 there a way I can use a co-worker's uberjar without unpacking it to ./.m2?
Alex Millerwrites: > Something like this can work but you need to have the proper path in the > local maven_repository. You have the repository named local. Inside the > repo, every artifact has a groupID (the first part of the dependency), the > artifactID, and the version. If you had a dependency like: > > [SSAM "0.1.0"] > > the jar should be at: > > /Users/rollio/projects/rollio/nlp-housing/maven_repository/SSAM/SSAM/0.1.0/SSAM-0.1.0.jar > > where under the repo, it's at groupID/artifactID/artifactID-version.jar > > You don't need to specify that SSAM is in local - Maven will check all > repos for it and find it in local. > > I've gotten this to work before and it's definitely possible. I feel like > I'm forgetting some other detail though. I'm not sure if you need a pom.xml > or any of the other repo metadata in that directory structure. lein-localrepo helps with installing jar files into the local maven repository: https://github.com/kumarshantanu/lein-localrepo -- Cheers Ralf -- 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: ANSI in Eclipse CounterClockwise REPL
Roy Riggswrites: > Just started teaching myself Clojure, there's one thing that seems to elude > me. I'd like to be able to pretty print output from my project in the > REPL. Clearly it already supports coloring text somehow, but I can't > figure out how to do it myself and haven't been able to figure out the > trick. Any ANSI libraries I've used, all just print out the escape codes > and they aren't actually interpreted. Thanks! You may use the following Eclipse plugin: http://mihai-nita.net/2013/06/03/eclipse-plugin-ansi-in-console/ -- Cheers Ralf -- 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 there a way I can use a co-worker's uberjar without unpacking it to ./.m2?
Lawrence Krubnerwrites: >> lein-localrepo helps with installing jar files into the >> local maven repository > > But they give examples like this: > > lein localrepo install foo-1.0.6.jar com.example/foo 1.0.6 > > If I had that info I probably would not need to ask any questions > here. I'm using lein localrepo to install a jar file with a completely made up version and group id. you just need to use the same values in project.clj. -- Cheers Ralf -- 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 on introducing a Java dev to Clojure
Johanna Belanger johanna.belan...@gmail.com writes: Could anyone tell me how they got from enterprise Java to Clojure? Maybe the following links provide some useful information: http://blog.juxt.pro/posts/selling-clojure.html http://www.pitheringabout.com/?p=693 http://www.lispcast.com/convince-your-boss-to-use-clojure -- Cheers Ralf -- 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: Code Review
Sven Richter sver...@googlemail.com writes: HI, I just posted a question to stackoverflows code review page:http://codereview.stackexchange.com/questions/90809/remove-lines-from-a-2d-vec-in-clojure As there is not much traffic regarding clojure I also double post to this list in the hope to get some good answers. You might respond here or there, whatever you like best. I have some code here that I am very unhappy with. The task I am trying to accomplish is this. Given a 2d vec like this: [[0 2 0] [1 3 5] [3 3 0]] which can contain positive ints including zero I want to remove all _lines_ that are greater zero. Whereas the definition of _line_ is the following: A _line_ is represented by the position n in every vec inside the 2d vec. So my example above has three lines: [0 1 3], [2 3 3] and [0 5 0]. The line that I want to remove from it according to my algortihm is **[2 3 3]** because every element is greater than zero. So my 2d vec would now look like this: [[0 0] [1 5] [3 0]] And finally I want to pad the vecs to their original size filling them with zero for every removed line, so that it looks finally like this: [[0 0 0] [0 1 5] [0 3 0]] You want to transpose the matrix before working with it. The following code should do what you want: (def v [[0 2 0] [1 3 5] [3 3 0]]) (defn transpose [v] (apply map vector v)) (defn all-positive? [line] (every? pos? line)) (defn remove-non-zero-lines [lines] (let [removed (remove all-positive? lines) zero-line (vec (repeat (count (first lines)) 0))] (concat (repeat (- (count lines) (count removed)) zero-line) removed))) (defn doit [v] (- v transpose remove-non-zero-lines transpose)) -- Cheers Ralf -- 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] authenticator 0.1.1
Hi, I've released authenticator 0.1.1. authenticator is a small Clojure library that can be used to easily implement a java.net.Authenticator. Please visit https://github.com/schmir/authenticator for more information. -- Cheers Ralf -- 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: Auto reloading of dependencies with cider
Mark P pierh...@gmail.com writes: What do other people generally do here? I suspect there is a commandline way of getting lein to do this for me. Is that what people do? Or do people just make sure they do C-c C-k in each relevant buffer? (But isn't this error prone - ie if you forget to do this in some buffer that you've changed?) Take a look at tools.namespace [1], which handles reloading your namespaces. Also please read http://dev.solita.fi/2014/03/18/pimp-my-repl.html. [1] https://github.com/clojure/tools.namespace -- Cheers Ralf -- 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 can I improve this?
Colin Yates colin.ya...@gmail.com writes: This and Jonas' are my current favourites, for what that's worth. Keep the suggestions coming! here's another one that uses reductions. formatter would need to be adapted a bit, since it currently also adds _0 for the first name seen: (defn count-name [name-count name] (assoc name-count name (inc (get name-count name 0 (defn uniquify ([s] (uniquify s (fn [item duplicates] (str item _ duplicates ([s formatter] (map (fn [name name-count] (formatter name (get name-count name 0))) s (reductions count-name {} s -- -- 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] es-nozzle 0.3.0 - elasticsearch document ingestion
{ es-nozzle is not a clojure library. But es-nozzle is implemented and extendable in clojure. That's why I'm posting it here, read on! } Hi all, on behalf of brainbot technologies AG I'm proud to release es-nozzle 0.3.0 as open source today. This is the first public release. es-nozzle is a scalable open source framework for connecting source content repositories like file systems or mail servers to ElasticSearch clusters. The framework supports source-repository security policies in ElasticsSearch and therefore enables users to create open source Enterprise Search solutions based on es-nozzle and ElasticSearch. The architecture allows for scalable and fault tolerant synchronization setups that complement the scalability of ElasticSearch clusters. Professional development and production support is available through brainbot technologies AG, a company specialized in search solutions which created the framework. Links === documentation: http://brainbot.com/es-nozzle/doc/ prebuilt distribution: http://brainbot.com/es-nozzle/download/es-nozzle-0.3.0.zip source code: https://github.com/brainbot-com/es-nozzle Contact: http://brainbot.com / es-noz...@brainbot.com (or use the elasticsearch mailing list) We're excited to get feedback about this release, so please give it a shot and let us know about your experience. -- Cheers Ralf Schmitt -- -- 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] iniconfig 0.2.0 released
Hi all, I've just uploaded iniconfig 0.2.0 to Clojars. iniconfig is minimal Clojure library designed to read ini files. It uses the number sign '#' as comment character and allows multi-line values. iniconfig and it's documentation can be found on github: https://github.com/brainbot-com/clj-iniconfig -- Cheers Ralf -- -- 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.