Re: Aw: Re: How to convert a VTK example from java to clojure?
Great, thanks a lot. Fixed the issues I had. However I wonder where 'wall-hack-method' lives now, as clojure-contrib has been split. This (old) thread suggests it has also been renamed to call-method https://groups.google.com/forum/?fromgroups=#!topic/clojure-dev/tKzqnJWpz-k So is this still included in one of the clojure-contrib libraries? On Tuesday, June 21, 2011 11:19:44 PM UTC+2, Aaron Cohen wrote: OK, I've gotten it working on my computer, and it turns out to be a slightly complicated problem. What is happening is that the vtk java files and your clojure code are using different classloaders (clojure uses its own classloader). System/loadLibrary is kind of crippled in that it always loads the library into the ClassLoader of the _invoking class's_ classLoader. I was hoping it would use the Thread's context classloader, but it does not. There isn't any straightforward way to load a library using a particular classloader either, so you have 2 options. 1) Make a java class that exposes a loadLibrary method. This java class will be in the same classLoader as VTK and as a result, loadLibrary calls from there will be visible to VTK. public class Loader { public static void loadLibrary(String lib) { // Hack to load a library outside of Clojure's classloader System.loadLibrary(lib); } } 2) Expose the package-private Runtime/loadLibrary0 method and call it. ; This function is in clojure-contrib, reproduced here for convenience (defn wall-hack-method Calls a private or protected method. params is a vector of class which correspond to the arguments to the method obj is nil for static methods, the instance object otherwise the method name is given as a symbol or a keyword (something Named) [class-name method-name params obj args] (- class-name (.getDeclaredMethod (name method-name) (into-array Class params)) (doto (.setAccessible true)) (.invoke obj (into-array Object args (defn load-lib [class lib] Loads a native library in the same classLoader as \class\ was loaded in. \lib\ is a string with the OS-appropriate name of the library. For instance, to load libvtk.so on Linux, lib should be \vtk\ (wall-hack-method java.lang.Runtime loadLibrary0 [Class String] (Runtime/getRuntime) class lib)) ; Load vtkCommonJava library in the same classLoader as vtkConeSource (load-lib vtkConeSource vtkCommonJava) I actually think clojure should probably add a method to its RT class that does option 1 above, that way there's a straightforward way to load native libraries in the correct classloader. --Aaron On Tue, Jun 21, 2011 at 4:10 PM, Antonio Recio amdx...@gmail.comjavascript: wrote: All the vtk libraries that I need are in /usr/local/lib/vtk-5.9/ and are executable. Java and c++ examples work fine. -- 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 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: [GSoC 2013] core.logic CLP(Prob)
Fantastic - thanks for pointing these out. On Friday, 26 April 2013 08:43:07 UTC+1, Zack Maril wrote: Nils also wrote his work up: http://ozk.unizd.hr/proceedings/index.php/els/article/view/102/106 -Zack On Friday, April 26, 2013 6:33:55 AM UTC+4, Maximilien Rzepka wrote: For the sake of completion ;) Nils Bertschinger's work https://github.com/bertschi/ProbClojureNice https://groups.google.com/forum/?fromgroups=#!topic/clojure/9NhsFga4D9s Le mercredi 24 avril 2013 11:34:14 UTC+2, Zack Maril a écrit : Lately, I've been on a bit of a jag into probabilistic programming with Clojure, specifically embedding Church inside of Clojure. The results so far are promising from a syntactic level, but, like David said, getting it to actually work is another matter entirely. I wanted to share what I've been able to get working so far and some of the potential challenges of embedding Church in Clojure. https://gist.github.com/zmaril/5447488 The above gist is a self contained Clojure program that implements, among other things, `query-by-rejection` and `flip`. With these two functions, we can already do most of what Church seems to do. What's missing from a functionality standpoint is support for various distributions and some useful functions related to tolerance (and, of course, a good MCMC/Gibbs implementation). What's been gained is, via some careful macro writing, the ability to reuse code, specifically to reuse memoized functions. One of the key ideas behind Church is that memoization allows one to express complicated scenarios very concisely. So, to code up a randomized persistent trait (like a person's eye color), you simply define a memoized function that takes in a person and returns their eye color. Every time a new world is generated, the memoized function gets recreated. But within the world (or current experiment), the trait persists and can be referenced again in various places without too much hassle. Note that a new memoized function must be created for each experiment, i.e. you can't just memoize the function outside the query and bring that back in. Within the gist above, binding is used to carefully rebind any function provided in the :memobound clause for each experiment. By declaring a var to be dynamic, we can write queries that are pretty short but all rely on the same logic. From a syntactic standpoint, it took about one evening of work to cut down the length of most of the Church examples by at least half. From a speed standpoint, Church is way, way ahead of the above. Sampling via rejection is quite slow compared to modern methods like MCMC or Gibbs. It might not even be possible to do the dynamic rebinding of memoized functions mentioned above and get as fast as Church is. I really don't know. Here's one of the first papers on Church: http://www.stanford.edu/~ngoodman/papers/churchUAI08_rev2.pdf The paper is about five years old now, but section 4.1 goes into how Church was first implemented with a MCMC. The key idea they introduce here is the computation trace. I won't try to summarize it here because I don't fully understand it yet. If it means what I think it means though, then it should be possible to build and keep track of the computation trace thanks to the JVM and Clojure. My intuition says that a very dedicated student could probably produce a Clojure library to catch Church in terms of speed by the end of the summer, simply by emulating what they have done and letting pmap take care of the rest. -Zack On Wednesday, April 24, 2013 12:48:56 AM UTC+4, David Nolen wrote: On Tue, Apr 23, 2013 at 2:10 PM, Radosław Piliszek radzi...@gmail.comwrote: 1) Is this place the best to discuss this? Yes. 2) Are there some set goals that CLP(Prob) should achieve? (,,Basic support of CLP(Prob).'' does not express it too well! :-P ) This seems like a pretty challenging one as there are a variety of possible approaches. Basic support for CLP(Prob) could very well mean *several* prototypes. That said the probabilistic Prolog variants are probably worthy of the most study as core.logic is closest to that model. 3) Is there any API sketch that should be followed? Is it still yet to be discussed? And, most importantly, how would you see CLP(Prob) fit in core.logic's ecosystem? There is no API sketch. It's extremely important to survey the links, try out existing implementations, assess their advantages / disadvantages and devise a syntax (or several) that works reasonably well with what we've already established in core.logic. Of the projects listed this is probably the most experimental and research-y. I think if anyone seriously wants to take this on they have to be extremely focused / self-directed and be willing to put in a *considerable* amount of time. I'm of course willing to help in whatever way I can as far as implementation
Re: style questions -- clojure newbie
I agree with using the trush operator since that certainly is a pipeline. A few comments though: (fn [image] [(:size image) (:#text image)]) Can be changed to: (juxt :size :#text) I wouldn't do api/get in search, the function is much easier to test if you keep it pure. Setup unittests with example data. Get every test working, and then just feed it live-data and voila. No ban from last-fm for spamming their servers ;) On Tue, Apr 23, 2013 at 11:19 PM, Steven Degutis sbdegu...@gmail.comwrote: I'm also quite new to Clojure, but here are some very superficial changes I would make to your code, without actually giving much thought to your algorithms: (defn- transform-album-images [images] (into {} (for [image images] [(:size image) (:#text image)]))) (defn- transform-album [album] (- (select-keys album [:name :artist :image]) (update-in [:image] transform-album-images) (clojure.set/rename-keys { :image :images }))) (defn search [term] (let [albums (- (api/get {:method album.search :album term}) (get-in [:results :albummatches :album] []) (vector))] {:albums (map transform-album albums)})) -Steven On Tue, Apr 23, 2013 at 4:12 PM, Huey Petersen eys...@gmail.com wrote: Howdy, I'm a clojure fan but quite new to writing clojure. I'm writing my first app and had a few style questions. I'm doing a web service call to the lastfm api. It returns some json like: { results: { albummatches: { album: [ { name: In The Future, artist: Black Mountain, image: [{ size: small, #text: http://example.com/image/url.jpg; }] } ] } } } One notes is that the 'album' key in the json can either be missing (0 results) a map itself (1 result) or the array (2+ results). I then want to turn it into structure like: { albums: [{ name: In The Future, artist: Black Mountain, images: { small: http://example.com/image/url.jpg; } }] } Here is the clojure code I came up with: (defn- transform-album-images [images] (into {} (map (fn [image] [(:size image) (:#text image)]) images))) (defn- transform-album [album] (let [album (select-keys album [:name :artist :image]) album (update-in album [:image] transform-album-images) album (clojure.set/rename-keys album { :image :images })] album)) (defn search [term] (let [albums (api/get {:method album.search :album term}) albums (get-in albums [:results :albummatches :album] []) albums (if (vector? albums) albums (vector albums)) albums (map transform-album albums)] {:albums albums})) My main question is whether this is at all 'idomatic' clojure. I have a few specific questions too. - I broke out two functions -- transform-album-images and transform-album -- because I wasn't sure how to squeeze them into the first function. They really have no purpose outside of the 'search' function though. I don't know why, but it kinda bugs me because it seems to detract from the main function 'search' as they have to appear above 'search'. - the (api/get ...) call talks to an external webservice. Everything else is a 'pure' function. Is including the (api/get) call inside the 'search' function bad? I'm a bit hazy on the write split from pure / non-pure code. I feel like transforming data between two representations with a side effect at each end is like 90% of code I write so I'd like to get a good feel for doing this in clojure :) Thanks for any tips. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you
Re: core.logic: Strange behaviour when using featurec with nested feature map (bug?).
Ok, ticket created: http://dev.clojure.org/jira/browse/LOGIC-132 - Martin Den torsdagen den 25:e april 2013 kl. 23:56:43 UTC+2 skrev David Nolen: Looks like a featurec bug, please file a ticket http://dev.clojure.org/jira/browse/LOGIC Thanks! David On Thu, Apr 25, 2013 at 5:53 PM, Martin Forsgren martin@gmail.comjavascript: wrote: Hi! I noticed something strange when using featurec with a nested feature map(I'm using core.logic 0.8.3). This works as expected: (run* [x y] (featurec x {:a {:b 1}}) (== y {:b 1}) (== x {:a y})) and returns: ([{:a {:b 1}} {:b 1}]) But with the last two goals swapped I get an exception: (run* [x y] (featurec x {:a {:b 1}}) (== x {:a y}) (== y {:b 1})) Throws: Exception clojure.core.logic.PMap@3c6f0bed is non-storable clojure.core.logic.LVar (logic.clj:647) clojure.core.logic/unify (logic.clj:231) clojure.core.logic/unify-with-pmap* (logic.clj:2601) clojure.core.logic.PMap (logic.clj:2614) clojure.core.logic/unify (logic.clj:232) clojure.core.logic/==/fn--2819 (logic.clj:1135) clojure.core.logic/composeg/fn--2745 (logic.clj:1029) clojure.core.logic/-featurec/reify--3655 (logic.clj:2646) clojure.core.logic/composeg/fn--2745 (logic.clj:1029) clojure.core.logic/composeg/fn--2745 (logic.clj:1030) clojure.core.logic/run-constraint/fn--3431 (logic.clj:2184) clojure.core.logic/fix-constraints (logic.clj:2211) I get the same exception when (== y {:b 1}) is left out: (run* [x y] (featurec x {:a {:b 1}}) (== x {:a y})) Any ideas why this is happening? - Martin -- -- 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.
Deploy manually created jar with lein2
Hi all, I'm trying to repack an existing Java lib with native dependecies and deploy it to Clojars. I need to repackage the original library so that its native parts are stored in a lein compatible layout. In the past (lein 1.x era) I had no problems with that, but I just can't get this to work under lein2. My steps for lein2 are: 1) Create a lein project folder with `lein new jogl-repack` 2) Edit the project file to only contain the bare minimum: (defproject org.clojars.toxi/jogl 2.0.0-rc11 :description blah blah :url http://jogamp.org/;) 3) Place the repackaged jogl-2.0.0-rc11.jar in the `target` subfolder of the project Attempting `lein install` with this setup generates the correct POM, but always overwrites my existing jar with a new one, only containing the manifest and project.clj... The same goes for `lein push`. Not good! Is there any way to avoid the regeneration of the jar file? What is the correct procedure to repackage an existing jar and deploy it with leiningen 2? There seems to be a gap in the documentation for this use case and I'd be happy to contribute a guide once I know the correct steps. A related question: Now that I managed to push such an empty jar to clojars, is there any way to replace or remove it? FWIW Here's an older (successful) example of that process: https://clojars.org/org.clojars.toxi/jogl But now I need to switch to a later version of JOGL and am really stumped... Thanks! K. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
What Slows Down clojure-hadoop?
Hi, I'm writing map-reduce job with Clojure, yet to find that it seems to be much slower than a Jave job. So I write a simple test case, and upload to gist: https://gist.github.com/jizhang/5466149 At the end of code, there is execution outputs, here are some significant stats: Average time taken by Map tasks: Java 7sec, Clojure 19sec CPU time spent (ms): Java 244,000, Clojure 1,145,440 I'm wondering what slows down the Clojure written map-reduce job. Am I using it wrong, or it's just an inappropriate senario. Any thoughts will be great. Thanks! Jerry -- -- 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.
Any tools that find all unused (:require [:refer]) in project?
Not sure what to even call such a tool, so google isn't helping. I suppose it would be kind of like Lint, but Eastwood doesn't seem to do this. -Steven -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Deploy manually created jar with lein2
Okay, since it's been a while since I last did this, I realised I'd mixed things up and `lein install/push` wasn't ever the right solution... But for future reference and those interested the correct steps for manually deploying jars are: Steps 1 2 from above, i.e.: 1) Create a lein project folder with `lein new jogl-repack` 2) Edit the project file to only contain the bare minimum: (defproject org.clojars.{your_clojars_username}/{libname} {version} :description blah blah :url http://...;) 3) copy the bundled jar into the project folder, ensure it's named {libname}-{version}.jar 3) lein pom 4) scp -i ~/.leiningen/id_rsa pom.xml {libname}-{version}.jar cloj...@clojars.org: Hth! On 26 April 2013 10:21, Karsten Schmidt toxmeis...@gmail.com wrote: Hi all, I'm trying to repack an existing Java lib with native dependecies and deploy it to Clojars. I need to repackage the original library so that its native parts are stored in a lein compatible layout. In the past (lein 1.x era) I had no problems with that, but I just can't get this to work under lein2. My steps for lein2 are: 1) Create a lein project folder with `lein new jogl-repack` 2) Edit the project file to only contain the bare minimum: (defproject org.clojars.toxi/jogl 2.0.0-rc11 :description blah blah :url http://jogamp.org/;) 3) Place the repackaged jogl-2.0.0-rc11.jar in the `target` subfolder of the project Attempting `lein install` with this setup generates the correct POM, but always overwrites my existing jar with a new one, only containing the manifest and project.clj... The same goes for `lein push`. Not good! Is there any way to avoid the regeneration of the jar file? What is the correct procedure to repackage an existing jar and deploy it with leiningen 2? There seems to be a gap in the documentation for this use case and I'd be happy to contribute a guide once I know the correct steps. A related question: Now that I managed to push such an empty jar to clojars, is there any way to replace or remove it? FWIW Here's an older (successful) example of that process: https://clojars.org/org.clojars.toxi/jogl But now I need to switch to a later version of JOGL and am really stumped... Thanks! K. -- -- 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: Any tools that find all unused (:require [:refer]) in project?
Sounds like you are looking for Slamhound: https://github.com/technomancy/slamhound As always, impeccably named by our own Phil Hagelberg. 2013/4/26 Steven Degutis sbdegu...@gmail.com Not sure what to even call such a tool, so google isn't helping. I suppose it would be kind of like Lint, but Eastwood doesn't seem to do this. -Steven -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- 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: Any tools that find all unused (:require [:refer]) in project?
Funny, I even saw that repo several times in the last few months, read the README, and still had no idea what it did. I'll look at it again, thanks. -Steven On Fri, Apr 26, 2013 at 7:18 AM, Herwig Hochleitner hhochleit...@gmail.com wrote: Sounds like you are looking for Slamhound: https://github.com/technomancy/slamhound As always, impeccably named by our own Phil Hagelberg. 2013/4/26 Steven Degutis sbdegu...@gmail.com Not sure what to even call such a tool, so google isn't helping. I suppose it would be kind of like Lint, but Eastwood doesn't seem to do this. -Steven -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: What Slows Down clojure-hadoop?
Hi, In reducer-reduce you iterate twice over the values compared to the java version, once in map (just to call .get), then in reduce. There are other issues probably, but this is one of the obvious ones. On Friday, April 26, 2013 12:05:33 PM UTC+2, Ji Zhang wrote: Hi, I'm writing map-reduce job with Clojure, yet to find that it seems to be much slower than a Jave job. So I write a simple test case, and upload to gist: https://gist.github.com/jizhang/5466149 At the end of code, there is execution outputs, here are some significant stats: Average time taken by Map tasks: Java 7sec, Clojure 19sec CPU time spent (ms): Java 244,000, Clojure 1,145,440 I'm wondering what slows down the Clojure written map-reduce job. Am I using it wrong, or it's just an inappropriate senario. Any thoughts will be great. Thanks! Jerry -- -- 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: What Slows Down clojure-hadoop?
Hi, The reduce is not a big problem, 'cause after all it'll only process 88 records. It's the mapper function that cost much more than the java version. One possibility I guess is that the Clojure startup time is slow. So tomorrow I'll try to reduce the mapper task count and see whether it helps. On Friday, April 26, 2013 8:23:04 PM UTC+8, Max Penet wrote: Hi, In reducer-reduce you iterate twice over the values compared to the java version, once in map (just to call .get), then in reduce. There are other issues probably, but this is one of the obvious ones. On Friday, April 26, 2013 12:05:33 PM UTC+2, Ji Zhang wrote: Hi, I'm writing map-reduce job with Clojure, yet to find that it seems to be much slower than a Jave job. So I write a simple test case, and upload to gist: https://gist.github.com/jizhang/5466149 At the end of code, there is execution outputs, here are some significant stats: Average time taken by Map tasks: Java 7sec, Clojure 19sec CPU time spent (ms): Java 244,000, Clojure 1,145,440 I'm wondering what slows down the Clojure written map-reduce job. Am I using it wrong, or it's just an inappropriate senario. Any thoughts will be great. Thanks! Jerry -- -- 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: What Slows Down clojure-hadoop?
Besides, correct me if I'm wrong, the clojure map function returns a lazy seq, and reduce consumes it, so there's actually only one loop, right? On Friday, April 26, 2013 8:23:04 PM UTC+8, Max Penet wrote: Hi, In reducer-reduce you iterate twice over the values compared to the java version, once in map (just to call .get), then in reduce. There are other issues probably, but this is one of the obvious ones. On Friday, April 26, 2013 12:05:33 PM UTC+2, Ji Zhang wrote: Hi, I'm writing map-reduce job with Clojure, yet to find that it seems to be much slower than a Jave job. So I write a simple test case, and upload to gist: https://gist.github.com/jizhang/5466149 At the end of code, there is execution outputs, here are some significant stats: Average time taken by Map tasks: Java 7sec, Clojure 19sec CPU time spent (ms): Java 244,000, Clojure 1,145,440 I'm wondering what slows down the Clojure written map-reduce job. Am I using it wrong, or it's just an inappropriate senario. Any thoughts will be great. Thanks! Jerry -- -- 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: What Slows Down clojure-hadoop?
Right! My bad. On Friday, April 26, 2013 2:44:21 PM UTC+2, Ji Zhang wrote: Besides, correct me if I'm wrong, the clojure map function returns a lazy seq, and reduce consumes it, so there's actually only one loop, right? On Friday, April 26, 2013 8:23:04 PM UTC+8, Max Penet wrote: Hi, In reducer-reduce you iterate twice over the values compared to the java version, once in map (just to call .get), then in reduce. There are other issues probably, but this is one of the obvious ones. On Friday, April 26, 2013 12:05:33 PM UTC+2, Ji Zhang wrote: Hi, I'm writing map-reduce job with Clojure, yet to find that it seems to be much slower than a Jave job. So I write a simple test case, and upload to gist: https://gist.github.com/jizhang/5466149 At the end of code, there is execution outputs, here are some significant stats: Average time taken by Map tasks: Java 7sec, Clojure 19sec CPU time spent (ms): Java 244,000, Clojure 1,145,440 I'm wondering what slows down the Clojure written map-reduce job. Am I using it wrong, or it's just an inappropriate senario. Any thoughts will be great. Thanks! Jerry -- -- 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: Any tools that find all unused (:require [:refer]) in project?
Very cool, and just what I need. Too bad it doesn't work. After using it, I get lots of java.lang.ClassNotFoundException when I try running my code. It's stripping away (:require [some.used.packages]) completely. Looks like Phil's probably just been too busy to keep up on the github-issues for slamhound. Perhaps one of the forks fixes it, though not likely :( -Steven On Fri, Apr 26, 2013 at 7:18 AM, Herwig Hochleitner hhochleit...@gmail.com wrote: Sounds like you are looking for Slamhound: https://github.com/technomancy/slamhound As always, impeccably named by our own Phil Hagelberg. 2013/4/26 Steven Degutis sbdegu...@gmail.com Not sure what to even call such a tool, so google isn't helping. I suppose it would be kind of like Lint, but Eastwood doesn't seem to do this. -Steven -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Aw: Re: How to convert a VTK example from java to clojure?
You no longer need any of this. All you should need is to use (clojure.lang.RT/loadLibrary vtkwhatever) That will ensure that the native libs end up in the correct classloader. On Fri, Apr 26, 2013 at 3:46 AM, Nils Blum-Oeste nblumoe...@googlemail.comwrote: Great, thanks a lot. Fixed the issues I had. However I wonder where 'wall-hack-method' lives now, as clojure-contrib has been split. This (old) thread suggests it has also been renamed to call-method https://groups.google.com/forum/?fromgroups=#!topic/clojure-dev/tKzqnJWpz-k So is this still included in one of the clojure-contrib libraries? On Tuesday, June 21, 2011 11:19:44 PM UTC+2, Aaron Cohen wrote: OK, I've gotten it working on my computer, and it turns out to be a slightly complicated problem. What is happening is that the vtk java files and your clojure code are using different classloaders (clojure uses its own classloader). System/loadLibrary is kind of crippled in that it always loads the library into the ClassLoader of the _invoking class's_ classLoader. I was hoping it would use the Thread's context classloader, but it does not. There isn't any straightforward way to load a library using a particular classloader either, so you have 2 options. 1) Make a java class that exposes a loadLibrary method. This java class will be in the same classLoader as VTK and as a result, loadLibrary calls from there will be visible to VTK. public class Loader { public static void loadLibrary(String lib) { // Hack to load a library outside of Clojure's classloader System.loadLibrary(lib); } } 2) Expose the package-private Runtime/loadLibrary0 method and call it. ; This function is in clojure-contrib, reproduced here for convenience (defn wall-hack-method Calls a private or protected method. params is a vector of class which correspond to the arguments to the method obj is nil for static methods, the instance object otherwise the method name is given as a symbol or a keyword (something Named) [class-name method-name params obj args] (- class-name (.getDeclaredMethod (name method-name) (into-array Class params)) (doto (.setAccessible true)) (.invoke obj (into-array Object args (defn load-lib [class lib] Loads a native library in the same classLoader as \class\ was loaded in. \lib\ is a string with the OS-appropriate name of the library. For instance, to load libvtk.so on Linux, lib should be \vtk\ (wall-hack-method java.lang.Runtime loadLibrary0 [Class String] (Runtime/getRuntime) class lib)) ; Load vtkCommonJava library in the same classLoader as vtkConeSource (load-lib vtkConeSource vtkCommonJava) I actually think clojure should probably add a method to its RT class that does option 1 above, that way there's a straightforward way to load native libraries in the correct classloader. --Aaron On Tue, Jun 21, 2011 at 4:10 PM, Antonio Recio amdx...@gmail.com wrote: All the vtk libraries that I need are in /usr/local/lib/vtk-5.9/ and are executable. Java and c++ examples work fine. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@**googlegroups.com For more options, visit this group at http://groups.google.com/**group/clojure?hl=enhttp://groups.google.com/group/clojure?hl=en -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit
Reducers newbie question
I was assuming that following code will fold in parallel, but it is reduced sequentially (require '[clojure.core.reducers :as r]) (defn test1 [x] (Thread/sleep 1000) (println (str Finished: x)) x) (def xxx (r/map test1 (range 100))) (r/fold + xxx) What am I doing wrong? Thanks. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[ANN] hamelito - bringing haml to enlive
Hello, I'd like to announce the availability of hamelito, a clojure library allowing you to use a subset of haml (http://www.haml.info) with enlive (http://github.com/cgrand/enlive). The source code is available under the EPL and is hosted at: http://github.com/ragnard/hamelito Artifacts are published to clojars: https://clojars.org/com.github.ragnard/hamelito Please see the readme for the latest available release, and updates on the project. We've been using hamelito at uSwitch for one of our internal clojure applications for a while and it's been working quite well. That said, I expect it to crash and burn for some more (or maybe less) exotic haml input. Any feedback, bug reports and/or code contributions are much appreciated. I've also started writing a few blog posts on my experience using enlive, one on hamelito in particular, which you might find relevant: http://ragnard.github.io/2013/04/19/exploring-enlive-haml.html Cheers, Ragnar -- -- 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: Reducers newbie question
Hi, Not sure what you are trying to do, but xxx is a lazy seq, thus it can only be consumed sequentially and fold falls back to reduce You need a vector. Las Sent from my phone On Apr 26, 2013 4:46 PM, Stanislav Yurin jusk...@gmail.com wrote: I was assuming that following code will fold in parallel, but it is reduced sequentially (require '[clojure.core.reducers :as r]) (defn test1 [x] (Thread/sleep 1000) (println (str Finished: x)) x) (def xxx (r/map test1 (range 100))) (r/fold + xxx) What am I doing wrong? Thanks. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- 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.
noob question about try/catch
I wrote a simple app that gets my data out of an old mysql database and puts it into mongodb. I have this function: (defn add-this-record-to-mongo [db record item-type] (println (str (:user db))) (println (str item-type)) (try (let [record (assoc record :item-type item-type) record (assoc record :community (:user db)) item-name (str (:community record) - (:item-type record) - (:id record)) record (assoc record :item-name item-name)] (mongo/persist-document-to-database record)) (catch java.sql.SQLException e (println (apply str e) Right now, when I run this app, it grabs the first 147,879 records and then dies with this exception: java.lang.RuntimeException: java.sql.SQLException: Cannot convert value '-00-00 00:00:00' from column 6 to TIMESTAMP. I thought I had written the try/catch blog so that this exception would be logged, but otherwise ignored. Instead, this exception stops my app cold -- the app stops. How do I get the app to ignore these exceptions? -- -- 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: noob question about try/catch
On Friday, April 26, 2013 8:01:45 AM UTC-7, larry google groups wrote: I thought I had written the try/catch blog so that this exception would be logged, but otherwise ignored. Instead, this exception stops my app cold -- the app stops. See http://clojure.org/special_forms#try , you're still responsible for the logic in the catch to ignore the exception. -- -- 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: What Slows Down clojure-hadoop?
Hi, I believe I can confirm that it's the startup time issue. I set mapred.job.reuse.jvm.num.tasks=-1 and the overall time is approximate to the pure java one. The best mapper task is the same time, 3sec. Before it is 10sec. The lowest task's difference is still 12sec (21sec - 9 sec). Since Clojure is well-known for its concurrency feature, running in the same JVM should be out of question. Besides, my company's hadoop team seems to cut the files into too small pieces, which result in too many mapper tasks. So the reuse is crucial for clojure. On Friday, April 26, 2013 6:05:33 PM UTC+8, Ji Zhang wrote: Hi, I'm writing map-reduce job with Clojure, yet to find that it seems to be much slower than a Jave job. So I write a simple test case, and upload to gist: https://gist.github.com/jizhang/5466149 At the end of code, there is execution outputs, here are some significant stats: Average time taken by Map tasks: Java 7sec, Clojure 19sec CPU time spent (ms): Java 244,000, Clojure 1,145,440 I'm wondering what slows down the Clojure written map-reduce job. Am I using it wrong, or it's just an inappropriate senario. Any thoughts will be great. Thanks! Jerry -- -- 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: growing a rest json/xml api
this page seems to have an answer to your question: http://stackoverflow.com/questions/9657897/how-to-distinguish-html-vs-xhr-xml-json-requests-in-compojure-ring haven't tried it my self though. Thomas On Thursday, April 25, 2013 4:21:28 AM UTC+1, Jorge Urdaneta wrote: Hi, can you point me out best practices/libraries to make a rest api with ring with json/xml output depending on Accepts request header? -- -- 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: noob question about try/catch
See http://clojure.org/special_forms#try , you're still responsible for the logic in the catch to ignore the exception. But I have caught the exceptions, so why do they kill my app? You link to this, which does not answer the question: The exprs are evaluated and, if no exceptions occur, the value of the last is returned. If an exception occurs and catch clauses are provided, each is examined in turn and the first for which the thrown exception is an instance of the named class is considered a matching catch clause. If there is a matching catch clause, its exprs are evaluated in a context in which name is bound to the thrown exception, and the value of the last is the return value of the function. If there is no matching catch clause, the exception propagates out of the function. Before returning, normally or abnormally, any finally exprs will be evaluated for their side effects. I catch the exception and log it. And then the exception kills the app? Why? On Friday, April 26, 2013 11:53:04 AM UTC-4, George Oliver wrote: On Friday, April 26, 2013 8:01:45 AM UTC-7, larry google groups wrote: I thought I had written the try/catch blog so that this exception would be logged, but otherwise ignored. Instead, this exception stops my app cold -- the app stops. See http://clojure.org/special_forms#try , you're still responsible for the logic in the catch to ignore the exception. -- -- 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: noob question about try/catch
On Apr 26, 2013, at 10:01 , larry google groups lawrencecloj...@gmail.com wrote: java.lang.RuntimeException: java.sql.SQLException: Cannot convert value '-00-00 00:00:00' from column 6 to TIMESTAMP. I believe Clojure is wrapping the java.sql.SQLException in a java.lang.RuntimeException because of reasons[1][2], so you'd need to catch java.lang.RuntimeException and examine the exception's cause property to get the real exception. [1] http://dev.clojure.org/jira/browse/CLJ-855 [2] https://groups.google.com/d/msg/clojure/I5l1YHVMgkI/nt8t9aHNVEYJ -- -- 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: noob question about try/catch
On Apr 26, 2013, at 11:55 , Michael Gardner gardne...@gmail.com wrote: I believe Clojure is wrapping the java.sql.SQLException in a java.lang.RuntimeException because of reasons[1][2], so you'd need to catch java.lang.RuntimeException and examine the exception's cause property to get the real exception. [1] http://dev.clojure.org/jira/browse/CLJ-855 [2] https://groups.google.com/d/msg/clojure/I5l1YHVMgkI/nt8t9aHNVEYJ …though I just noticed that JIRA issue was closed in 1.3, so unless you're still on 1.3 it doesn't actually explain why you're getting wrapped exceptions. -- -- 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.
conform to interface for related multi-methods?
I found that I want to have multiple multi-methods, but grouped together, much like an interface. Specifically, I have already-existing objects, which I want to call the method on, so just like defmulti/defmethod. But I basically want to group several of them together since they're very related, much like you would see in defprotocol. Is this possible in Clojure? Or do I have to just implement each of the defmethods independently as usual? -Steven -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Image analysis library recommendations
I had a look at incanter/processing meanwhile. But this does not offer very much for image analysis. However processing will become useful to modify/render images. Next I am going to evaluate OpenCV which recently got Java bindings. Setting it up wasn't as straight forward as I thought but in the end it did work and I was able to rewrite an example from OpenCV documentation in Clojure. Setup and this example are described in a new post on my bloghttp://nils-blum-oeste.net/image-analysis-with-clojure-up-and-running-with-opencv/#.UXqyFkAW3eU . I am going to post another update here once I did work a little more with OpenCV. Meanwhile, please share your experience with image analysis in clojure please. On Tuesday, April 23, 2013 8:54:20 PM UTC+2, Nils Blum-Oeste wrote: Hi, I would like to do some image analysis with clojure. So I am looking for good libraries for that. Most important would be a good support for image segmentation. Tresholding, histogram based methods, edge detection and region growing are among the things I would like to have. Support for real time image analysis is not needed, I want to transform static image files. Furthermore I am looking for a nice image import/export. This does not have to be the same library, but would be great if things work together nicely. Of course a pure clojure thing would be awesome, but using java interop would be okay too. I have some background in image analysis and don't need to have all the matrix stuff abstracted away. However, I don't want to rebuild all the necessary algorithms myself, but focus on getting the parametrization right and figuring out the best segmenation strategy instead. Currently I am evaluating incanter (also interested in this is a general data analysis tool) and I wanted to have a look at OpenCV. If someone could recommend good libraries would be great. I really appreciate any hints, recommendations and shared experience. Thanks and cheers Nils -- -- 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: Image analysis library recommendations
Thx Cedric! Indeed I am using ClojureJVM. Getting images from filesystem isn't a big deal. Of course javax.imageio does a good job here, like you said! Also I am not intersted (yet) in meta information of the images. My concern about image IO was more about not having to transform back and forth data between differents types and formats during import, processing and export. Good to know that exif data is at hand though, thanks! On Tuesday, April 23, 2013 11:47:49 PM UTC+2, Cedric Greevey wrote: On Tue, Apr 23, 2013 at 2:54 PM, Nils Blum-Oeste nblum...@googlemail.comjavascript: wrote: Furthermore I am looking for a nice image import/export. This does not have to be the same library, but would be great if things work together nicely. If you're using ClojureJVM, at least, you have this already (and even the capacity to add format plugins!). Check out javax.imageio. One plugin in particular you might want to get is the TIF plugin. It adds both .tif image format support *and* the ability to extract exif metadata from any format that supports it, including jpeg. It's handy if you want to get the info that cameras put in jpegs they take, or the keywords, caption, and rating that Windows users can give to jpegs using the default Windows picture previewer. Sadly, there's no simple getKeywords function or similar, though; you need to do a bit of hacking to retrieve particular exif metadata fields, and a bit of Googling to find out what those are. On the other hand, creating a wrapper library in Clojure to provide a much nicer interface to the exif metadata might be worthwhile -- perhaps a function to read the metadata from an image file and return a Clojure map with meaningful keys and the corresponding values that were found in the image, such as {:focal-length 3.50 mm :keywords [tree pine white pine Pinus strobus Appalachia Pennsylvania nature] :caption White pine growing at 1780ft elevation in the central Appalachia :date-taken java.util.Date whatever} -- -- 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: Reducers newbie question
Some additional pointers here (this is a little old though); http://www.thebusby.com/2012/07/tips-tricks-with-clojure-reducers.html On Fri, Apr 26, 2013 at 11:51 PM, László Török ltoro...@gmail.com wrote: Hi, Not sure what you are trying to do, but xxx is a lazy seq, thus it can only be consumed sequentially and fold falls back to reduce You need a vector. Las Sent from my phone On Apr 26, 2013 4:46 PM, Stanislav Yurin jusk...@gmail.com wrote: I was assuming that following code will fold in parallel, but it is reduced sequentially (require '[clojure.core.reducers :as r]) (defn test1 [x] (Thread/sleep 1000) (println (str Finished: x)) x) (def xxx (r/map test1 (range 100))) (r/fold + xxx) What am I doing wrong? Thanks. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Reducers newbie question
+1 ! I use 'fold-into-vec' regularly :) Jim On 26/04/13 18:07, Alan Busby wrote: Some additional pointers here (this is a little old though); http://www.thebusby.com/2012/07/tips-tricks-with-clojure-reducers.html On Fri, Apr 26, 2013 at 11:51 PM, László Török ltoro...@gmail.com mailto:ltoro...@gmail.com wrote: Hi, Not sure what you are trying to do, but xxx is a lazy seq, thus it can only be consumed sequentially and fold falls back to reduce You need a vector. Las Sent from my phone On Apr 26, 2013 4:46 PM, Stanislav Yurin jusk...@gmail.com mailto:jusk...@gmail.com wrote: I was assuming that following code will fold in parallel, but it is reduced sequentially (require '[clojure.core.reducers :as r]) (defn test1 [x] (Thread/sleep 1000) (println (str Finished: x)) x) (def xxx (r/map test1 (range 100))) (r/fold + xxx) What am I doing wrong? Thanks. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com mailto: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 mailto:clojure%2bunsubscr...@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 mailto:clojure%2bunsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com mailto: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 mailto:clojure%2bunsubscr...@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 mailto:clojure%2bunsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- 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.
login with friend, but username blank, despite keyword-params middleware in place
I have tried putting (friend/authenticate) at the beginning and end of this block: (def app (- app-routes (wrap-session {:cookie-name timeout-session :cookie-attrs {:max-age 90}}) (wrap-cookies) (wrap-multipart-params) (wrap-params) (wrap-nested-params) (wrap-keyword-params) (friend/authenticate {:workflows [(workflows/interactive-form)] :credential-fn (partial creds/bcrypt-credential-fn users) :login-uri /login :unauthorized-redirect-uri /login :default-landing-uri /admin}))) and: (def app (- app-routes (friend/authenticate {:workflows [(workflows/interactive-form)] :credential-fn (partial creds/bcrypt-credential-fn users) :login-uri /login :unauthorized-redirect-uri /login :default-landing-uri /admin}) (wrap-session {:cookie-name timeout-session :cookie-attrs {:max-age 90}}) (wrap-cookies) (wrap-multipart-params) (wrap-params) (wrap-nested-params) (wrap-keyword-params) )) but that doesn't seem to matter. I defined my one user in the namespace as: (def users {admin {:username admin :password (creds/hash-bcrypt 47010thave) :roles #{::admin}}}) If I point my broswer here: localhost:3/admin I get redirected to here: localhost:3/admin I then fill in this form: form action=/login method=POSTUsername: input type=text name= username /br /Password: input type=password name=password /br / input type=submit name=submit value=submit /br //form If I print the request to the terminal, the form params are all blank: {:ssl-client-cert nil, :remote-addr 0:0:0:0:0:0:0:1, :scheme :http, :query-params {username , login_failed Y, nil}, :session {}, :cemerick.friend/auth-config {:unauthorized-redirect-uri /login, :allow-anon? true, :default-landing-uri /admin, :login-uri /login, :credential-fn #core$partial$fn__4070 clojure.core$partial$fn__4070@1627fd1, :workflows [#workflows$interactive_form$fn__4503 cemerick.friend.workflows$interactive_form$fn__4503@28ee2be9], :unauthenticated-handler #Var@557db906: #friend$default_unauthenticated_handler cemerick.friend$default_unauthenticated_handler@114e8c69, :unauthorized-handler #Var@3d93cfcb: #friend$default_unauthorized_handler cemerick.friend$default_unauthorized_handler@1aaad63a}, :form-params {}, :multipart-params {}, :request-method :get, :query-string login_failed=Yusername=, :route-params {}, :content-type nil, :cookies {timeout-kiosk {:value timeout-kiosk3312112}}, :uri /login, :server-name localhost, :params { nil, login_failed Y, username }, :headers {user-agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537\ .31, cookie timeout-kiosk=timeout-kiosk3312112, accept-charset ISO-8859-1,utf-8;q=0.7,*;q=0.3, accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8, host localhost:30001, referer http://localhost:30001/login?login_failed=Yusername=;, cache-control max-age=0, accept-encoding gzip,deflate,sdch, accept-language en-US,en;q=0.8, connection keep-alive}, :content-length nil, :server-port 30001, :character-encoding nil, :body #HttpInput org.eclipse.jetty.server.HttpInput@25796d08} I have defined the routes like this: (defroutes app-routes (ANY / request (home-page request)) (GET /login request (login request)) (friend/logout (ANY /logout request (ring.util.response/redirect /))) (GET /serve-file/:file-id request (serve-file request)) (GET /home/:slides-id request (home-page request)) (GET /action/:action-to-perform request (action request)) (GET /admin request (friend/authorize #{::admin} (admin request))) (GET /admin/list/:item-type [item-type] (admin-list item-type)) (GET /admin/edit/:item-type request (admin-forms request)) (GET /admin/edit/:item-type/:item-name request (admin-forms request)) (POST /admin/edit/:item-type/:item-name request (admin-process-form-input request)) (POST /admin/edit/:item-type request (admin-process-form-input request)) (GET /admin/delete/:item-type/:item-name request (admin-delete-ask-for-confirmation request)) (POST /admin/delete/:item-type/:item-name request (admin-delete-finalized request)) (GET /admin/clone/:item-type/:item-name request (admin-clone-this-item request)) (GET /admin/preview/:item-type/:item-name request (admin-preview request)) (GET /admin/upload request (admin-upload request)) (route/resources /) (route/not-found Page not found)) And the login function looks like this: (defn login [request] (println (pp/pprint request)) 2013-03-01 - the default name of the function expected by the Friend authorization library.
cannot read foo.xml from the top level of a jar!
Hello everyone, I hope you're all doing well... Can anyone enlighten my as to why I cannot read anything from the top directory of a jar? The jar in question is on the classpath and the foo.xml file is located at the top directory...tries clojure.java.io/resource tried .getResourceAsStream from the classloader + the Class object... any ideas? thanks, Jim -- -- 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: Image analysis library recommendations
Maybe the opencv stack can do something for you: http://opencv.org/ It's got java bindings. cheers 2013/4/26 Nils Blum-Oeste nblumoe...@googlemail.com Thx Cedric! Indeed I am using ClojureJVM. Getting images from filesystem isn't a big deal. Of course javax.imageio does a good job here, like you said! Also I am not intersted (yet) in meta information of the images. My concern about image IO was more about not having to transform back and forth data between differents types and formats during import, processing and export. Good to know that exif data is at hand though, thanks! On Tuesday, April 23, 2013 11:47:49 PM UTC+2, Cedric Greevey wrote: On Tue, Apr 23, 2013 at 2:54 PM, Nils Blum-Oeste nblum...@googlemail.com wrote: Furthermore I am looking for a nice image import/export. This does not have to be the same library, but would be great if things work together nicely. If you're using ClojureJVM, at least, you have this already (and even the capacity to add format plugins!). Check out javax.imageio. One plugin in particular you might want to get is the TIF plugin. It adds both .tif image format support *and* the ability to extract exif metadata from any format that supports it, including jpeg. It's handy if you want to get the info that cameras put in jpegs they take, or the keywords, caption, and rating that Windows users can give to jpegs using the default Windows picture previewer. Sadly, there's no simple getKeywords function or similar, though; you need to do a bit of hacking to retrieve particular exif metadata fields, and a bit of Googling to find out what those are. On the other hand, creating a wrapper library in Clojure to provide a much nicer interface to the exif metadata might be worthwhile -- perhaps a function to read the metadata from an image file and return a Clojure map with meaningful keys and the corresponding values that were found in the image, such as {:focal-length 3.50 mm :keywords [tree pine white pine Pinus strobus Appalachia Pennsylvania nature] :caption White pine growing at 1780ft elevation in the central Appalachia :date-taken java.util.Date whatever} -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: cannot read foo.xml from the top level of a jar!
Did you put / at the beginning of the string to resource? Because you shouldn't. You should call it like this: (resource foo.xml). Jonathan On Fri, Apr 26, 2013 at 8:47 PM, Jim - FooBar(); jimpil1...@gmail.comwrote: Hello everyone, I hope you're all doing well... Can anyone enlighten my as to why I cannot read anything from the top directory of a jar? The jar in question is on the classpath and the foo.xml file is located at the top directory...tries clojure.java.io/resourcetried .getResourceAsStream from the classloader + the Class object... any ideas? thanks, Jim -- -- 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+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/**group/clojure?hl=enhttp://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com . For more options, visit https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out . -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to 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: cannot read foo.xml from the top level of a jar!
tried both... nothing worked... :( Jim On 26/04/13 20:16, Jonathan Fischer Friberg wrote: Did you put / at the beginning of the string to resource? Because you shouldn't. You should call it like this: (resource foo.xml). Jonathan On Fri, Apr 26, 2013 at 8:47 PM, Jim - FooBar(); jimpil1...@gmail.com mailto:jimpil1...@gmail.com wrote: Hello everyone, I hope you're all doing well... Can anyone enlighten my as to why I cannot read anything from the top directory of a jar? The jar in question is on the classpath and the foo.xml file is located at the top directory...tries clojure.java.io/resource http://clojure.java.io/resource tried .getResourceAsStream from the classloader + the Class object... any ideas? thanks, Jim -- -- 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 mailto: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 mailto:clojure%2bunsubscr...@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 mailto:clojure%2bunsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- 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: What Slows Down clojure-hadoop?
this doesn't quite make sense: Since Clojure is well-known for its concurrency feature, running in the same JVM should be out of question. All the concurrency features built in to clojure are concerned with things that happen in the same process, unless you consider things like 'making it easier to use queues' to be those kinds of features that affect multi-process stuff. A concurrency focus doesn't say anything about philosophy of processes/threads or anything like that. MapReduce is dictating the process model here which goes against the grain of what java's good at doing, with the assumption that you'll be working with a *lot* of data and won't care. Something that takes 21 seconds isn't optimal use of mapreduce. Try it with something that takes a few minutes at least. However, you can help startup time in a number of ways, AOT compilation can help a bit, as well as judicious use of third-party code and keeping class dependencies low. On Fri, Apr 26, 2013 at 12:02 PM, Ji Zhang zhangj...@gmail.com wrote: Hi, I believe I can confirm that it's the startup time issue. I set mapred.job.reuse.jvm.num.tasks=-1 and the overall time is approximate to the pure java one. The best mapper task is the same time, 3sec. Before it is 10sec. The lowest task's difference is still 12sec (21sec - 9 sec). Since Clojure is well-known for its concurrency feature, running in the same JVM should be out of question. Besides, my company's hadoop team seems to cut the files into too small pieces, which result in too many mapper tasks. So the reuse is crucial for clojure. On Friday, April 26, 2013 6:05:33 PM UTC+8, Ji Zhang wrote: Hi, I'm writing map-reduce job with Clojure, yet to find that it seems to be much slower than a Jave job. So I write a simple test case, and upload to gist: https://gist.github.com/**jizhang/5466149https://gist.github.com/jizhang/5466149 At the end of code, there is execution outputs, here are some significant stats: Average time taken by Map tasks: Java 7sec, Clojure 19sec CPU time spent (ms): Java 244,000, Clojure 1,145,440 I'm wondering what slows down the Clojure written map-reduce job. Am I using it wrong, or it's just an inappropriate senario. Any thoughts will be great. Thanks! Jerry -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: cannot read foo.xml from the top level of a jar!
Have a look at this code. It might shed some light on your problem. https://github.com/lprefontaine/Boing/blob/1.3.0/src/boing/resource.clj We are using it with 1.3 but it should work under 1.5.x Feel free to copy it and try it, it's standalone without dependencies other than Clojure. As far as we know it's problem free. Luc P. tried both... nothing worked... :( Jim On 26/04/13 20:16, Jonathan Fischer Friberg wrote: Did you put / at the beginning of the string to resource? Because you shouldn't. You should call it like this: (resource foo.xml). Jonathan On Fri, Apr 26, 2013 at 8:47 PM, Jim - FooBar(); jimpil1...@gmail.com mailto:jimpil1...@gmail.com wrote: Hello everyone, I hope you're all doing well... Can anyone enlighten my as to why I cannot read anything from the top directory of a jar? The jar in question is on the classpath and the foo.xml file is located at the top directory...tries clojure.java.io/resource http://clojure.java.io/resource tried .getResourceAsStream from the classloader + the Class object... any ideas? thanks, Jim -- -- 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 mailto: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 mailto:clojure%2bunsubscr...@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 mailto:clojure%2bunsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Softaddictslprefonta...@softaddicts.ca sent by ibisMail from my ipad! -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [ANN] hamelito - bringing haml to enlive
Nice work! Happy to see you exercising haml-spec. Will definitely be using this next time I reach for a templating library. On Friday, April 26, 2013 10:46:32 AM UTC-4, Ragnar Dahlén wrote: Hello, I'd like to announce the availability of hamelito, a clojure library allowing you to use a subset of haml (http://www.haml.info) with enlive (http://github.com/cgrand/enlive). The source code is available under the EPL and is hosted at: http://github.com/ragnard/hamelito Artifacts are published to clojars: https://clojars.org/com.github.ragnard/hamelito Please see the readme for the latest available release, and updates on the project. We've been using hamelito at uSwitch for one of our internal clojure applications for a while and it's been working quite well. That said, I expect it to crash and burn for some more (or maybe less) exotic haml input. Any feedback, bug reports and/or code contributions are much appreciated. I've also started writing a few blog posts on my experience using enlive, one on hamelito in particular, which you might find relevant: http://ragnard.github.io/2013/04/19/exploring-enlive-haml.html Cheers, Ragnar -- -- 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] Immutant 0.10.0 released
Well, we had hoped to begin our 1.0 beta cycle with this release, but we decided we changed enough stuff that we wanted to put out one more alpha first, mainly because we think it's wrong to introduce any API changes with the first beta. The details of what we changed are here: http://bit.ly/immutant0100 Big items on the horizon are ritz integration, zero-downtime deploys, and our old friend, websockets, but we likely won't hold up the beta for those. # What is Immutant? Immutant is an application server for Clojure. It's an integrated platform built on JBoss AS7 that aims to reduce the incidental complexity in real-world applications. It provides support for Ring handlers, asynchronous messaging, caching, scheduled jobs, XA transactions, clustering, and highly-available daemon services. Thanks, Jim -- -- 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: Image analysis library recommendations
I recently came across BoofCV http://boofcv.org/ (http://boofcv.org/), an all Java library that is still being developed but looks already well featured. Never tried it though, let us know how that goes if you do. Cheers On Tuesday, April 23, 2013 8:54:20 PM UTC+2, Nils Blum-Oeste wrote: I would like to do some image analysis with clojure. So I am looking for good libraries for that. -- -- 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: noob question about try/catch
What does your code look like that queries MySQL? The above code writes to MongoDB which is not going to throw SQLException anyway. On Fri, Apr 26, 2013 at 8:01 AM, larry google groups lawrencecloj...@gmail.com wrote: I wrote a simple app that gets my data out of an old mysql database and puts it into mongodb. I have this function: (defn add-this-record-to-mongo [db record item-type] (println (str (:user db))) (println (str item-type)) (try (let [record (assoc record :item-type item-type) record (assoc record :community (:user db)) item-name (str (:community record) - (:item-type record) - (:id record)) record (assoc record :item-name item-name)] (mongo/persist-document-to-database record)) (catch java.sql.SQLException e (println (apply str e) Right now, when I run this app, it grabs the first 147,879 records and then dies with this exception: java.lang.RuntimeException: java.sql.SQLException: Cannot convert value '-00-00 00:00:00' from column 6 to TIMESTAMP. I thought I had written the try/catch blog so that this exception would be logged, but otherwise ignored. Instead, this exception stops my app cold -- the app stops. How do I get the app to ignore these exceptions? -- -- 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. -- 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: Image analysis library recommendations
Maybe my hobby project Clisk can be of some use: https://github.com/mikera/clisk It's Clojure based and geared towards image generation but does have some capabilities for image analysis and processing, particularly if you are interesting in warping / filtering etc. On Wednesday, 24 April 2013 02:54:20 UTC+8, Nils Blum-Oeste wrote: Hi, I would like to do some image analysis with clojure. So I am looking for good libraries for that. Most important would be a good support for image segmentation. Tresholding, histogram based methods, edge detection and region growing are among the things I would like to have. Support for real time image analysis is not needed, I want to transform static image files. Furthermore I am looking for a nice image import/export. This does not have to be the same library, but would be great if things work together nicely. Of course a pure clojure thing would be awesome, but using java interop would be okay too. I have some background in image analysis and don't need to have all the matrix stuff abstracted away. However, I don't want to rebuild all the necessary algorithms myself, but focus on getting the parametrization right and figuring out the best segmenation strategy instead. Currently I am evaluating incanter (also interested in this is a general data analysis tool) and I wanted to have a look at OpenCV. If someone could recommend good libraries would be great. I really appreciate any hints, recommendations and shared experience. Thanks and cheers Nils -- -- 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: What Slows Down clojure-hadoop?
Hi Gary, Thanks for the correction. It was a spur-of-the-moment statement. And I find out that when reusing JVM, Clojure also needs to be paid attention to. For instance, I define an atom in the mapper namespace to use as a counter. It turns out that the next mapper task run in this JVM will inherit the value. So I need to reset! it in the mapper-setup function. Also I tried :aot :all, it doesn't help. I guess it's the clojure.core namespace that takes a lot of startup time. As for the short running process of each mapper task, it's really an issue. Our hadoop team seems to cut the inputs into too small parts, so the number of mapper task is corresponding to the splits. Thus reusing JVM or use CombineFileInputFormat may help with this situation. After all, Clojure's not slow. I'm happy again~ On Saturday, April 27, 2013 3:58:01 AM UTC+8, Gary Trakhman wrote: this doesn't quite make sense: Since Clojure is well-known for its concurrency feature, running in the same JVM should be out of question. All the concurrency features built in to clojure are concerned with things that happen in the same process, unless you consider things like 'making it easier to use queues' to be those kinds of features that affect multi-process stuff. A concurrency focus doesn't say anything about philosophy of processes/threads or anything like that. MapReduce is dictating the process model here which goes against the grain of what java's good at doing, with the assumption that you'll be working with a *lot* of data and won't care. Something that takes 21 seconds isn't optimal use of mapreduce. Try it with something that takes a few minutes at least. However, you can help startup time in a number of ways, AOT compilation can help a bit, as well as judicious use of third-party code and keeping class dependencies low. On Fri, Apr 26, 2013 at 12:02 PM, Ji Zhang zhan...@gmail.comjavascript: wrote: Hi, I believe I can confirm that it's the startup time issue. I set mapred.job.reuse.jvm.num.tasks=-1 and the overall time is approximate to the pure java one. The best mapper task is the same time, 3sec. Before it is 10sec. The lowest task's difference is still 12sec (21sec - 9 sec). Since Clojure is well-known for its concurrency feature, running in the same JVM should be out of question. Besides, my company's hadoop team seems to cut the files into too small pieces, which result in too many mapper tasks. So the reuse is crucial for clojure. On Friday, April 26, 2013 6:05:33 PM UTC+8, Ji Zhang wrote: Hi, I'm writing map-reduce job with Clojure, yet to find that it seems to be much slower than a Jave job. So I write a simple test case, and upload to gist: https://gist.github.com/**jizhang/5466149https://gist.github.com/jizhang/5466149 At the end of code, there is execution outputs, here are some significant stats: Average time taken by Map tasks: Java 7sec, Clojure 19sec CPU time spent (ms): Java 244,000, Clojure 1,145,440 I'm wondering what slows down the Clojure written map-reduce job. Am I using it wrong, or it's just an inappropriate senario. Any thoughts will be great. Thanks! Jerry -- -- 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.
clojure dependencies
I have this code. (defproject jsql 1.0.0-SNAPSHOT :description FIXME: write :dependencies [[org.clojure/clojure 1.4.0]])(use 'clojure.java.jdbc) My question is where do the dependencies locate? I would put the files in the c:\clojure-1.4.0 How does clojure know where they are? Are they in c:\clojure-1.4.0\org\clojure folder? -- -- 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: Strange Loop 2013 CFP
Strange Loop is a developer-focused conference that encompasses past (the history of computing), present (deep dives on today's technology), and future (what's next). Strange Loop will take place in St. Louis from Sept 18-20th. The Strange Loop 2013 Call for Presentations is now open! https://thestrangeloop.com/sessions-page/call-for-presentations The call ends **May 9th** and speakers will be notified by May 17th. Strange Loop covers airfare and hotel for all speakers (see the CFP page for more detail). This open call is looking for 40 minute sessions, 3 hr workshops, and talks for the co-located Emerging Languages Camp. Desired topics include programming languages, distributed systems, databases, web, and mobile. Check out last year's archive to get an idea for what Strange Loop is all about! http://thestrangeloop.com/archive/2012 If you have any questions, contact i...@thestrangeloop.com. Alex Miller -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: clojure dependencies
On Fri, Apr 26, 2013 at 5:04 PM, jayvandal jayvan...@gmail.com wrote: I have this code. (defproject jsql 1.0.0-SNAPSHOT :description FIXME: write :dependencies [[org.clojure/clojure 1.4.0]]) That would be your project.clj file, in a Leiningen-created project folder. When you run: lein repl Leiningen will download the dependencies and start a REPL for you to use. (use 'clojure.java.jdbc) This will not work unless your dependencies include the java.jdbc library, like this: :dependencies [[org.clojure/clojure 1.4.0] [org.clojure/java.jdbc 0.2.3]] That will tell Leiningen to fetch Clojure 1.4.0 and java.jdbc 0.2.3 (and put them in your local ~/.m2/ Maven repository cache. When Leiningen starts the REPL - or runs a program - it sets up the classpath for the JVM to include all of the necessary JARs from the cache. My question is where do the dependencies locate? I would put the files in the c:\clojure-1.4.0 You don't need to install Clojure when you use Leiningen. -- 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.