Re: I'm trying to make proper urls, but I seem to be failing at it.
No edit button so I have to post again, that first example should end with ;; (make-profile-url John Smith) = /John-Smith And to reiterate you decide what your url will look like in your template: a href=http://myapp.com/JohnSmith;View John Smith's Profile/a or a href=http://myapp.com/John-Smith;View John Smith's Profile/a or a href=http://myapp.com/john-smith;View John Smith's Profile/a Then compojure + your route handler respond to the browser requesting the link: ;; obviously this is ALL just psedo code of the important elements to give you an idea (GET /:username [username] (view-profile-page username)) ;; this route definition will handle any of the above links ;; assume you chose the last link type, in stack-overflow style. this means username from the route is john-smith (defn view-profile-page [username] (let [user (db/get-user-by-username username)] (render-template user))) (defn get-user-by-username [username] (let [no-dash (clojure.string/replace username #- ) ;; munge username to match what is in DB capitalized (capitalize-words no-dash)] (select-user-by-name capitalized))) So as you can see whatever link or browser request is called, compojure grabs that url param and passes it in. You then modify that param to fit what you expect and look it up in your DB. You were essentially working backwards I think. Hope that helps! -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Good quick reference screencasts
Found a good set of screencasts as quick references for functions, namespaces, collections, destructuring, sequences and conditional flow. Quick 1 to 2 min screencasts on each: http://www.pluralsight.com/training/Courses/TableOfContents/clojure-fundamentals-part-one And the more advanced for concurrency: http://www.pluralsight.com/training/Courses/TableOfContents/clojure-concurrency-tutorial The other really good resource I found so far as a beginner is: http://www.braveclojure.com/ And of course clojure-docs, the clojure cheat sheet and the doc function in the repl. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
ANN Langohr 2.7.1 is released
Langohr [1] is a small, feature complete Clojure client for RabbitMQ. Release notes: http://blog.clojurewerkz.org/blog/2014/03/11/langohr-2-dot-7-1-is-released/ 1. http://clojurerabbitmq.info -- MK http://github.com/michaelklishin http://twitter.com/michaelklishin -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [ANN] 1st public release of thi.ng geometry toolkit (CLJ CLJS)
Hey, Karsten great stuff and congrats! I haven't been following toxic closely for quite some time, sadly but does that mean it's been discontinued completely and you are working in clojure full time? :) What's your impression on working with big code base as above library in clojure vs java? Does clojure scales well? I'm particularly interested in functional vs OO approach and If any performance critical stuff was done in java? If you could share some thoughts would be great. Thanks, Kuba -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [ANN] 1st public release of thi.ng geometry toolkit (CLJ CLJS)
Brilliant work. Major kudos for writing a literate program. ~BG On Tue, Mar 11, 2014 at 3:02 AM, Karsten Schmidt toxmeis...@gmail.com wrote: It is my absolute pleasure to finally announce the first public release of the 2d/3d geometry library/toolkit: thi.ng/geom Having worked on this regularly since late 2011 as successor of my Java-based toxiclibs.org project, the new project has already undergone three complete overhauls as I've been improving my grasp of Clojure. The project currently consists of 26 namespaces and 6500+ lines of code. You can find all existing details, sources initial examples at: https://github.com/thi-ng/geom/blob/master/src/index.org Leiningen coords: [thi.ng/geom 0.2.0] (available from Clojars) This project is part of a bigger rapidly growing collection of Clojure libraries targeted at the wider computational/generative design context. All libraries in the thi.ng collection are (will be) developed in a literal programming format to also encourage their use in teaching contexts and generally try to improve the state of documentation managing source code. Clojure with its focus on isolated functionality is particular nice to work with in this sense and Org-mode has completely transformed my way of working. Since this is only the 1st release and I've planned a few more (potentially) breaking API changes I cannot currently accept major pull requests until the API is more solid (and once I'm less up against deadlines). In general though, I hope this project has a wide enough scope license to encourage further communal development. Lastly, if you're not too allergic to strong German accents, you can also watch (and follow along) a little live coding session I've done with Paul Kinlan @ Google Developers Live last month: http://youtu.be/tKIVJ2TaS2k?t=20m9s Happy coding! :) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- Baishampayan Ghose b.ghose at gmail.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [ANN] Stasis - not another static site framework
I just posted a quite long and detailed post/tutorial on using Stasis for static web sites, including integration testing of all pages, link checker ++ The post also shows off using Optimus for asset optimization, and Enlive and Hiccup for markup generation/manipulation. http://cjohansen.no/building-static-sites-in-clojure-with-stasis Christian kl. 11:16:48 UTC+1 torsdag 23. januar 2014 skrev Magnar Sveen følgende: Stasis A Clojure library of tools for developing static web sites. https://gist.github.com/magnars/32dbca91bdb0987ea4ba#another-static-site-framework-whyAnother static site framework? Why? Well, that's exactly it. I didn't want to use a framework. I don't like the restrained feeling I get when using them. I prefer coding things over messing around with configuration files. I want to - code my own pages - set up my own configuration - choose my own templating library - create my own damn stylesheets *Statis offers a few functions that are pretty useful when creating static web sites.* No more. There are no batteries included. If you want a framework that makes it really quick and easy to create a blog, you should take a look at these: - misaki https://github.com/liquidz/misaki is a Jekyll inspired static site generator in Clojure. - Madness http://algernon.github.io/madness/ is a static site generator, based on Enlive and Bootstrap. - Static http://nakkaya.com/static.html is a simple static site generator written in Clojure. - Ecstatic http://samrat.me/ecstatic/ creates static web pages and blog posts from Hiccup templates and Markdown. - incise https://github.com/RyanMcG/incise is an extensible static site generator written in Clojure. They generally come with a folder where you put your blog posts in some templating language, and a set of configuration options about how to set up your blog. They often generate code for you to tweak. https://gist.github.com/magnars/32dbca91bdb0987ea4ba#usageUsage The core of Stasis is two functions: serve-pages and export-pages. Both take a map from path to contents: (def pages {/index.html h1Welcome!/h1}) The basic use case is to serve these live on a local server while developing - and then exporting them as static pages to deploy on some server. https://gist.github.com/magnars/32dbca91bdb0987ea4ba#serving-live-pages-locallyServing live pages locally Stasis can create a Ring handler to serve your pages. (ns example (:require [stasis.core :as stasis])) (def app (stasis/serve-pages pages)) Like with any Ring app, you point to your app in project.clj: :ring {:handler example/app} and start it with lein ring server-headless. https://gist.github.com/magnars/32dbca91bdb0987ea4ba#exporting-the-pagesExporting the pages To export, just give Stasis some pages and a target directory: (defn export [] (stasis/export-pages pages target-dir)) When you've got this function, you can create an alias for leiningen: :aliases {build-site [run -m example/export]} and run lein build-site on the command line. No need for a lein plugin. https://gist.github.com/magnars/32dbca91bdb0987ea4ba#example-appsExample apps? The static page that prompted me to write Stasis is currently closed source, but I'm in the process of turning my 4 other static sites over. The simplest, and first to be done, is: - whattheemacsd.com (source) https://github.com/magnars/what-the-emacsd Uses Enlive https://github.com/cgrand/enlive for templating, and Optimus https://github.com/magnars/optimus for frontend optimization. I'm also working on the Emacs Rocks! http://emacsrocks.com/ webpage, where I'll use hiccup instead of Enlive. https://gist.github.com/magnars/32dbca91bdb0987ea4ba#is-it-stableIs it stable? It's still on a 0.x release, but I feel the API has jelled enough now to open source it. I don't expect any major changes at this point. I'll likely push it to 1.0 at the end of the month. https://gist.github.com/magnars/32dbca91bdb0987ea4ba#again-why-not-use-one-of-the-existing-frameworksAgain, why not use one of the existing frameworks? I think the existing frameworks are great if they fit your style. Stasis imposes no styles. There are very few decisions made for you - no markdown vs asciidoc, no enlive vs hiccup. No configuration options. You have to make them. So, yeah ... I think Stasis would be a great starting point if you want to create the 6th static site framework to go in that list at the top. :-) - Magnar -- 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
Quil for ClojureScript
Hello! I am a Java developer, and the author of 3Coffeehttps://github.com/divs1210/3Coffee, a 2D Game Engine (with custom inbuilt physics) that I wrote some 2 years back. I stumbled across Clojure while trying to solve one of the *many* threading issues I seemed to have with swing. I have been Lisping ever since. Check thishttp://pizzaforthought.blogspot.in/2014/02/on-art-of-programming.htmlout. The point is: I like designing high-level APIs, and have a fairly good understanding of Clojure (and working on it). I have worked with graphics-processing before, and would like to work on the ClojureScript port for Quil as a project for GSoC 2014. I have been busy with college all this while, but I'll start working on it ASAP. Will keep you posted. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [soft/philosophical] event handers in cljs
On 10/03/14 15:37, juan.facorro wrote: I have taken this approach as well, but I can can't seem to find a good answer to this question: When you create a bunch of elements with their corresponding channels to handle certain events, how do you handle the closing of those channels and the termination of the related *go* blocks once you remove the elements? I'm not a specialist of core.async (so anyone please correct me if I'm wrong) but here's what I understand. Go blocks aggregate into FSMs which can be garbage collected http://stackoverflow.com/questions/18800440/javascript-and-garbage-collection like any other objects. When parked go blocks are queued into the channel. So what it comes down to is being mindful of where you keep references to channels. More precisely, don't hold a reference to the channel beyond the scope of its producers and its reading go blocks. That probably means locality of readers (go blocks) is often preferable to a longer-lived go block. I guess it's the same mindfulness that goes on when keeping references to call-back handlers. See also this discussion: https://groups.google.com/forum/#!topic/clojure/_KzEoq0XcHQ https://groups.google.com/forum/#%21topic/clojure/_KzEoq0XcHQ From Timothy you'll read that go block are garbage collected: When go's are parked, they are put into a queue on the channel, thus when the channel is unreachable (besides inside the go block) both are collected, and the thread of execution is effectively terminated. From Brandon Bloom you'll read that: Querying the state of a channel at worst leads to race conditions and at best leads to bad design. You're only supposed to close a channel from the producer side. So if you're the only writer, then you know if you've closed the channel or not. If there are multiple writers, then need to be coordinated in some way. Typically, they would alt! against reading from a control channel and writing to the output channel. When you get a shutdown signal from the control channel, you stop writing. (...) It is a programming error to write a message to a closed channel. close is not a resource cleanup operation, it is a control signal. It flows in the same direction as the messages sent on the channel itself. If the receiver were allowed to close the channel, then the sender would have no way of avoiding a closed/write race condition. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [soft/philosophical] event handers in cljs
Hi François, That makes sense. I think I had read that discussion a while ago but hadn't really grokked it. Thanks! Juan On Tuesday, March 11, 2014 10:42:04 AM UTC-3, François Rey wrote: On 10/03/14 15:37, juan.facorro wrote: I have taken this approach as well, but I can can't seem to find a good answer to this question: When you create a bunch of elements with their corresponding channels to handle certain events, how do you handle the closing of those channels and the termination of the related *go* blocks once you remove the elements? I'm not a specialist of core.async (so anyone please correct me if I'm wrong) but here's what I understand. Go blocks aggregate into FSMs which can be garbage collectedhttp://stackoverflow.com/questions/18800440/javascript-and-garbage-collectionlike any other objects. When parked go blocks are queued into the channel. So what it comes down to is being mindful of where you keep references to channels. More precisely, don't hold a reference to the channel beyond the scope of its producers and its reading go blocks. That probably means locality of readers (go blocks) is often preferable to a longer-lived go block. I guess it's the same mindfulness that goes on when keeping references to call-back handlers. See also this discussion: https://groups.google.com/forum/#!topic/clojure/_KzEoq0XcHQ From Timothy you'll read that go block are garbage collected: When go's are parked, they are put into a queue on the channel, thus when the channel is unreachable (besides inside the go block) both are collected, and the thread of execution is effectively terminated. From Brandon Bloom you'll read that: Querying the state of a channel at worst leads to race conditions and at best leads to bad design. You're only supposed to close a channel from the producer side. So if you're the only writer, then you know if you've closed the channel or not. If there are multiple writers, then need to be coordinated in some way. Typically, they would alt! against reading from a control channel and writing to the output channel. When you get a shutdown signal from the control channel, you stop writing. (...) It is a programming error to write a message to a closed channel. close is not a resource cleanup operation, it is a control signal. It flows in the same direction as the messages sent on the channel itself. If the receiver were allowed to close the channel, then the sender would have no way of avoiding a closed/write race condition. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [ANN] Jig
Dear Malcolm. I'm still having trouble seeing the intended flow, and I have the feeling I'm missing something. My first question is why I would create two separate components C and A, instead of just having one component A that both installs a channel in the system map and starts a thread for pushing updates to it when the external resource changes? More importantly, it's not clear to me what should happen with the updates that are sent over the channel. To make things concrete let's say the resource is a configuration file specifying how to access an external database (url, login and credentials, ...). In order to access the database, I create a database component D providing public functions (fetch-data ...) and (store-data ...) etc. These functions need access to an up-to-date db-spec or connection, which in turn depends on the config values sent over the configuration update channel. Now I see three possibilities: 1) Component D subscribes to the config update channel and keeps a private state containing an up-to-date db-spec which in turn is accessed by the public fetch and store functions I don't think this is the way to go because I thought the whole purpose was to keep all state in a single place (i.e. system)? This brings me to possibility 2: 2) Component D, upon receiving a config update, updates the system global var root, and the fetch and store functions in turn access the global system to get an up-to-date db-spec I thought this was the way to go, but I'm confused since the system is defined in the user namespace which is not supposed to exist in production? 3) Component D does not subscribe to the config update channel. Instead components that want to access the database should themselves subscribe to the config update channel and provide the store and fetch functions with an up-to-date db-spec. But then I feel that this simply pushes the problem one level up and that the db component does sufficiently encapsulate all the internals of accessing the database and maintaining an up-to-date connection etc.? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [ANN] Jig
update: I made mistake at the end of my previous post: I mean that the db component does NOT sufficiently encapsulate the internals of course... -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[ANN] Clojure 1.6.0-RC1
Clojure 1.6.0-RC1 is now available. Try it via - Download: http://central.maven.org/maven2/org/clojure/clojure/1.6.0-RC1 - Leiningen: [org.clojure/clojure 1.6.0-RC1] See the full change log here: https://github.com/clojure/clojure/blob/master/changes.md Clojure 1.6.0-RC1 has the following changes since 1.6.0-beta2: - [CLJ-1365] Add type hints for new collection hash functions - [CLJ-944] Compiler gives constant collections types which mismatch their runtime values Please give it a try and let us know your feedback! Alex -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [ANN] Kria, an async driver for Riak 2
I started Kria in January I think. It has tests, and I use in for (currently small) but real projects. It works great so far for me. I'd appreciate it if you try it out. On Fri, Mar 7, 2014 at 9:24 PM, dgrnbrg dsg123456...@gmail.com wrote: This is really exciting! One question I have is how mature is Kria? Given that riak 2 isn't yet out, I'm still curious as to what kinds of testing/burn in you've done? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
core.async is very slow for some cases, what to do?
Each go block is executed via thread pool. On a channel side, producers and consumers are also decoupled. Such decoupling costs around 10-20 us per async operation. For the cases when your async values are immediately available (e.g. from cache), or when you designed an async API just because your operations may block for a long but not necessary do, those are huge numbers. For example, I recently worked on a dependency injection containerhttps://github.com/dar-clojure/core which supports async computations. Asynchrony in one place means that all you API will be async everywhere. Natural way to go with implementation is to just wrap everything in a go block. However, after doing that I found that container became 50 times slower. 5 us overhead for a typical task turned into 250 us. As a solution I forked https://github.com/dar-clojure/async core.async and replaced channels with lightweight promises and removed thread pool dispatch from everywhere. Now async container implementation is only 5 times slower than its sync version, which is probably acceptable. I'd like to hear what others think about this issue, especially members of the core team. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: core.async is very slow for some cases, what to do?
I've also ran into situations as well where the context switching of the thread pool is prohibitive. I swapped out the thread pool with a single threaded executor and saw a big speed improvement. The downside is that you can not specify what thread pool a go block should be ran on. This means I had to hack the global thread pool like so: ;; hack for using a single thread (in-ns 'clojure.core.async.impl.exec.threadpool) (defonce thread-factory (conc/counted-thread-factory clj-sim-dispatch-%d false)) (defn sim-executor [] (Executors/newFixedThreadPool 1 thread-factory)) (defonce single-tp (sim-executor)) (def the-executor single-tp) (in-ns 'my-ns) I'd be curious to see if this hack gives you similar performance benefits as your promise fork. It would be nice if you could pass in an executor to a go-block to override the default global one to accommodate these different use cases. This would be similar to how you can now control the executors for futures. -Ben On 3/11/14, 11:39 AM, Эльдар Габдуллин wrote: Each go block is executed via thread pool. On a channel side, producers and consumers are also decoupled. Such decoupling costs around 10-20 us per async operation. For the cases when your async values are immediately available (e.g. from cache), or when you designed an async API just because your operations may block for a long but not necessary do, those are huge numbers. For example, I recently worked on a dependency injection container https://github.com/dar-clojure/core which supports async computations. Asynchrony in one place means that all you API will be async everywhere. Natural way to go with implementation is to just wrap everything in a go block. However, after doing that I found that container became 50 times slower. 5 us overhead for a typical task turned into 250 us. As a solution I forked https://github.com/dar-clojure/async core.async and replaced channels with lightweight promises and removed thread pool dispatch from everywhere. Now async container implementation is only 5 times slower than its sync version, which is probably acceptable. I'd like to hear what others think about this issue, especially members of the core team. -- 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 mailto:clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: core.async is very slow for some cases, what to do?
You can take the CSP out of core.async, but then it really isn't the same thing. Your version with promises still allows for async, but in the process removes most of the benefits of CSP. Timothy Baldridge On Tue, Mar 11, 2014 at 12:29 PM, Ben Mabey b...@benmabey.com wrote: I've also ran into situations as well where the context switching of the thread pool is prohibitive. I swapped out the thread pool with a single threaded executor and saw a big speed improvement. The downside is that you can not specify what thread pool a go block should be ran on. This means I had to hack the global thread pool like so: ;; hack for using a single thread (in-ns 'clojure.core.async.impl.exec.threadpool) (defonce thread-factory (conc/counted-thread-factory clj-sim-dispatch-%d false)) (defn sim-executor [] (Executors/newFixedThreadPool 1 thread-factory)) (defonce single-tp (sim-executor)) (def the-executor single-tp) (in-ns 'my-ns) I'd be curious to see if this hack gives you similar performance benefits as your promise fork. It would be nice if you could pass in an executor to a go-block to override the default global one to accommodate these different use cases. This would be similar to how you can now control the executors for futures. -Ben On 3/11/14, 11:39 AM, Эльдар Габдуллин wrote: Each go block is executed via thread pool. On a channel side, producers and consumers are also decoupled. Such decoupling costs around 10-20 us per async operation. For the cases when your async values are immediately available (e.g. from cache), or when you designed an async API just because your operations may block for a long but not necessary do, those are huge numbers. For example, I recently worked on a dependency injection containerhttps://github.com/dar-clojure/core which supports async computations. Asynchrony in one place means that all you API will be async everywhere. Natural way to go with implementation is to just wrap everything in a go block. However, after doing that I found that container became 50 times slower. 5 us overhead for a typical task turned into 250 us. As a solution I forked https://github.com/dar-clojure/async core.async and replaced channels with lightweight promises and removed thread pool dispatch from everywhere. Now async container implementation is only 5 times slower than its sync version, which is probably acceptable. I'd like to hear what others think about this issue, especially members of the core team. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- “One of the main causes of the fall of the Roman Empire was that–lacking zero–they had no way to indicate successful termination of their C programs.” (Robert Firth) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Clojure Jruby (Ruby on Rails) Interop
Rodrigo, Have you looked at hosting your JVM-based solution with Clojure and jRuby on Heroku? -Ramon On Thursday, October 24, 2013 9:59:56 PM UTC-4, rdelcueto wrote: Thanks for your response Jim. Is there any alternative solution to Openshift that supports the TB and Immutant combo, that you recommend? On Thursday, October 24, 2013 8:47:14 PM UTC-5, Jim Crossley wrote: Unfortunately not, Rodrigo. Frankly, TorqueBox on OpenShift is not a very happy experience, mostly due to bundler and very limited resources on the free OpenShift gears. Until we get those issues worked out, I don't want to encourage anyone to combine TB and Immutant on OpenShift. Also, we're kinda in a wait-and-see mode while the OpenShift guys integrate Docker, as container images should be a lot easier to work with than cartridges. So you're ahead of us at the moment. We expect to catch up, just not sure when. Jim On Thu, Oct 24, 2013 at 8:45 PM, rdelcueto rdel...@gmail.com wrote: Dear Jim, I just began playing with Immutant and TorqueBox. I realized the polyglot-openshift-quickstart* @ *GitHub is marked as obsolete. I found links to newer versions of immutant-quickstart and torquebox-quickstart, though as separate applications. Is there documentation or a tutorial on how to get TorqueBox and Immutant merged into a single OpenShift application, ala lein immutant overlay torquebox? Regards, On Monday, September 9, 2013 11:14:54 AM UTC-5, Jim Crossley wrote: Hi Rodrigo, I'm one of the developers of TorqueBox and Immutant. Your email prompted me to re-watch a screencast [1] I made in March showing how to use them together. I realized things have changed a little since then, so I added a few annotations to the video highlighting the differences. Hopefully enough to get you up and experimenting. As you've probably figured out, both TorqueBox and Immutant are integrated stacks, bundling some commodity services that most non-trivial applications need, e.g. scheduling, caching, and messaging. The intent of any integrated platform is to relieve administration burden. But that only works for you if the inherent choices within that stack fit the needs of your app. We think/hope default Immutant configuration and abstractions (e.g. queues, topics, request/respond) offers a good balance to fit a wide variety of apps. If simple integration between Ruby and Clojure apps is your chief goal, I think Immutant/TorqueBox is compelling, but I'm biased. I would definitely recommend using some sort of messaging broker, though, i.e. don't mix Clojure and Ruby in the same source file or project. Performance and security concerns are so application-specific I hate to make any generic statements about them other than, be fast and secure. ;-) But do feel free to bother us in #torquebox or #immutant on freenode with any questions about your particular app/needs. Thanks, Jim [1] http://immutant.org/news/2013/03/07/overlay-screencast/ On Sun, Sep 8, 2013 at 10:25 PM, rdelcueto rdel...@gmail.com wrote: Hi everyone, I'm about to start working on building a site for a startup company. We are a small team, and currently they've been coding the site using RoR (Ruby on Rails). I was thinking Clojure might be better suited for the task, specially because we'll need to implement a backend which is robust, scalable and secure, but also we'll need flexibility, which I think the RoR framework won't shine at all. At our team, we are two coders, non of us are proficient in Web Developing, and we have little experience with RoR, and I thought (I'm sure) maybe investing time learning Clojure will provide us with better tools. PROBLEM/QUESTION While searching for alternative solutions, I stumbled upon the Flightcaster case, we're they are using RoR to implement the site's frontend and Clojure for the system backend. I thought this was a very elegant solution, using each tool for what it's good at. Plus this way we can reuse what they've already implemented. I found a way to do this is by using Torquebox and Immutant, and using the messaging systems to communicate between Jruby and Clojure. Still I have no idea of how this works, and the performance and security implications it brings to the table. I found little information on the subject. I would appreciate if anyone could provide guidance, examples or documentation on the subject. Any reference to open source projects which use this hybrid language solutions on the JVM would be great to have. Is this the best way to solve the RoR interactions? Is there any other way? Thanks in advance and best regards, Rodrigo -- -- 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
Re: core.async is very slow for some cases, what to do?
Comparing CSP and promises is apples-to-oranges. I'd love to see a minimal sample of problematic code. On Tuesday, March 11, 2014 1:39:54 PM UTC-4, Эльдар Габдуллин wrote: Each go block is executed via thread pool. On a channel side, producers and consumers are also decoupled. Such decoupling costs around 10-20 us per async operation. For the cases when your async values are immediately available (e.g. from cache), or when you designed an async API just because your operations may block for a long but not necessary do, those are huge numbers. For example, I recently worked on a dependency injection containerhttps://github.com/dar-clojure/core which supports async computations. Asynchrony in one place means that all you API will be async everywhere. Natural way to go with implementation is to just wrap everything in a go block. However, after doing that I found that container became 50 times slower. 5 us overhead for a typical task turned into 250 us. As a solution I forked https://github.com/dar-clojure/async core.async and replaced channels with lightweight promises and removed thread pool dispatch from everywhere. Now async container implementation is only 5 times slower than its sync version, which is probably acceptable. I'd like to hear what others think about this issue, especially members of the core team. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: java.lang.IllegalArgumentException: More than one matching method found: submit - when letting an ExecutorService
In the let case, the *pool* will be tagged with the proper type so the ambiguity is detected. In the def case, the *pool* will be seen as an object and the compiler is just deferring to reflection at runtime to figure it out. If you turn on *warn-on-reflection*, you'll see a reflection warning in this case. Reflection is just picking the first one that matches in that case. If you type hinted the def case, you'd see the same error. On Saturday, July 16, 2011 6:13:11 AM UTC-5, Alf wrote: Hi guys. Experimenting a bit with code from The joy of Clojure, and I ran into a little problem. Trying to run this in the REPL gives the following error: user= (import [java.util.concurrent Executors]) java.util.concurrent.Executors user= (let [*pool* (Executors/newFixedThreadPool (+ 2 (.availableProcessors (Runtime/getRuntime] (defn dothreads! [f {thread-count :threads exec-count :times :or {thread-count 1 exec-count 1}}] (dotimes [t thread-count] (.submit *pool* #(dotimes [_ exec-count] (f)) java.lang.IllegalArgumentException: More than one matching method found: submit (NO_SOURCE_FILE:7) However if I define pool as a Var it seems to work fine: user= (import '(java.util.concurrent Executors)) java.util.concurrent.Executors user= (def *pool* (Executors/newFixedThreadPool (+ 2 (.availableProcessors (Runtime/getRuntime) #'user/*pool* user= (defn dothreads! [f {thread-count :threads exec-count :times :or {thread-count 1 exec-count 1}}] (dotimes [t thread-count] (.submit *pool* #(dotimes [_ exec-count] (f) #'user/dothreads! (from https://github.com/joyofclojure/book-source/blob/master/src/joy/mutation.clj ) ExecutorService has three submit methods, and two with one parameter, a Runnable and a Callable. Since Clojure functions are both, I understand the compiler error, but why does it work when *pool* is a Var? The let version works when I cast the function to Runnable or Callable, just wondering why there is a difference. Cheers, Alf -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: java.lang.IllegalArgumentException: More than one matching method found: submit - when letting an ExecutorService
Sorry for the deep storage reply - this was just referenced from a ticket and I didn't realize it was super old. :) On Tuesday, March 11, 2014 3:44:36 PM UTC-5, Alex Miller wrote: In the let case, the *pool* will be tagged with the proper type so the ambiguity is detected. In the def case, the *pool* will be seen as an object and the compiler is just deferring to reflection at runtime to figure it out. If you turn on *warn-on-reflection*, you'll see a reflection warning in this case. Reflection is just picking the first one that matches in that case. If you type hinted the def case, you'd see the same error. On Saturday, July 16, 2011 6:13:11 AM UTC-5, Alf wrote: Hi guys. Experimenting a bit with code from The joy of Clojure, and I ran into a little problem. Trying to run this in the REPL gives the following error: user= (import [java.util.concurrent Executors]) java.util.concurrent.Executors user= (let [*pool* (Executors/newFixedThreadPool (+ 2 (.availableProcessors (Runtime/getRuntime] (defn dothreads! [f {thread-count :threads exec-count :times :or {thread-count 1 exec-count 1}}] (dotimes [t thread-count] (.submit *pool* #(dotimes [_ exec-count] (f)) java.lang.IllegalArgumentException: More than one matching method found: submit (NO_SOURCE_FILE:7) However if I define pool as a Var it seems to work fine: user= (import '(java.util.concurrent Executors)) java.util.concurrent.Executors user= (def *pool* (Executors/newFixedThreadPool (+ 2 (.availableProcessors (Runtime/getRuntime) #'user/*pool* user= (defn dothreads! [f {thread-count :threads exec-count :times :or {thread-count 1 exec-count 1}}] (dotimes [t thread-count] (.submit *pool* #(dotimes [_ exec-count] (f) #'user/dothreads! (from https://github.com/joyofclojure/book-source/blob/master/src/joy/mutation.clj ) ExecutorService has three submit methods, and two with one parameter, a Runnable and a Callable. Since Clojure functions are both, I understand the compiler error, but why does it work when *pool* is a Var? The let version works when I cast the function to Runnable or Callable, just wondering why there is a difference. Cheers, Alf -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
ANN Elastisch 2.0.0-beta1 is released
Elastisch [1] is a small, feature complete Clojure client for ElasticSearch that provides both HTTP and native transports. 2.0 focuses on compatibility with and support for the new features in ElasticSearch 1.0. Release notes: http://blog.clojurewerkz.org/blog/2014/03/10/elastisch-2-dot-0-0-beta1-is-released/ 1. http://clojureelasticsearch.info -- MK http://github.com/michaelklishin http://twitter.com/michaelklishin -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Help a Startup use Clojure!
I'm about to be an early employee at a small startup. I will be the first technical hire and am a competent but not extraordinarily experienced developer. The founders know this and hired me based on soft as well as technical skills. I don't want to be the first technical employee and make a poor technology choice that chains this startup from the beginning. My goal is to convince the CEO and other early stage executives of the benefits of using Clojure in place of PHP. All the early founders have worked in places that use PHP, and I have worked as a PHP developer with some of them at other companies. For the past year I have used Clojure in my personal projects and am comfortable with the language. I expect the following objections: * What is the talent pool like (for Clojure) and can we outsource less important tasks to other developers. * What advantages does this technology offer over something like PHP (from a business perspective)? * How will you cope with technical challenges? I have my own opinions but I would love to hear the feedback of others. If you have good counter arguments to these or other objections you have heard in the past I would like to hear those. If you have been in my position I would love to hear about that experience as well. Also consider that these people are technical but not programmers. Any benefits have to make sense from a business perspective as well. Thank you for your help! -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Help a Startup use Clojure!
Some Observations: We took on a relatively inexperienced java developer, threw her into emacs, gave her 'Joy of Clojure', and she was able to make contributions within a month or two. It doesn't have to be Clojure-everything, maybe PHP would be a great fit for the front-end web/templating based on the experience pool, and Clojure could be used for backend web services where it can give the most bang for the buck. Clojure also means 'the JVM', so you open yourself up to that talent pool and large array of solutions: hadoop, storm, for example. Depending on your use-cases, you might need this flexibility eventually. Having deployment and dev experience on this platform from the get-go means you'll be ready when you need it. On Tue, Mar 11, 2014 at 5:09 PM, Jarrod Swart jcsw...@gmail.com wrote: I'm about to be an early employee at a small startup. I will be the first technical hire and am a competent but not extraordinarily experienced developer. The founders know this and hired me based on soft as well as technical skills. I don't want to be the first technical employee and make a poor technology choice that chains this startup from the beginning. My goal is to convince the CEO and other early stage executives of the benefits of using Clojure in place of PHP. All the early founders have worked in places that use PHP, and I have worked as a PHP developer with some of them at other companies. For the past year I have used Clojure in my personal projects and am comfortable with the language. I expect the following objections: * What is the talent pool like (for Clojure) and can we outsource less important tasks to other developers. * What advantages does this technology offer over something like PHP (from a business perspective)? * How will you cope with technical challenges? I have my own opinions but I would love to hear the feedback of others. If you have good counter arguments to these or other objections you have heard in the past I would like to hear those. If you have been in my position I would love to hear about that experience as well. Also consider that these people are technical but not programmers. Any benefits have to make sense from a business perspective as well. Thank you for your help! -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Help a Startup use Clojure!
Gary, Thanks for your observations. I agree it doesn't necessarily have to be all or nothing. I'm hoping to get as much as possible insight before I present to the founders. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Help a Startup use Clojure!
Jarrod, The book Clojure Programminghttp://www.amazon.com/Clojure-Programming-Chas-Emerick-ebook/dp/B007Q4T040has a chapter (19) dedicated to your very question. I think the most important piece of advice is Be Prudent by choosing where Clojure fits and by starting slow. Try to find small self-contained problems and solve them. This will demonstrate the language's usefulness far better than any logical argument could. On Tuesday, March 11, 2014 3:31:43 PM UTC-6, Jarrod Swart wrote: Gary, Thanks for your observations. I agree it doesn't necessarily have to be all or nothing. I'm hoping to get as much as possible insight before I present to the founders. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Help a Startup use Clojure!
Christopher, Absolutely I agree. I enjoyed that book very much. I think I misstated my question a bit in that I don't need to be convinced of the value, but rather how best to relay Clojure's benefits to non-technical business types. Thanks for your input. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Question about importing java classes to Clojure
Hello all, I am working on a program that needs to list all the files in a directory. I have read that Clojure doesn't yet have great support for this kind of task, and that it is better to import java.io.File to your namespace in order to use some of it's methods. Every time I have done this in Eclipse, I get the same error: No matching field found: getName for class java.lang.String (files.clj:0) My question: Is this a me problem, perhaps a syntax error, a java problem, or a Clojure problem? I have used java for quite a while, and think that I am importing the class correctly: (import 'java.io.File), or should I just be using Clojure.java.ioconfused in this case. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Help a Startup use Clojure!
On Mar 11, 2014, at 2:09 PM, Jarrod Swart jcsw...@gmail.com wrote: My goal is to convince the CEO and other early stage executives of the benefits of using Clojure in place of PHP. All the early founders have worked in places that use PHP, and I have worked as a PHP developer with some of them at other companies. For the past year I have used Clojure in my personal projects and am comfortable with the language. I'll play devil's advocate here (as someone who's gone up in front of those lovely VC folks when trying to get a startup off the ground)... What are you building? Why do _you_ think Clojure is a better choice than PHP? * What is the talent pool like (for Clojure) and can we outsource less important tasks to other developers. The talent pool for Clojure is much smaller than the talent pool for PHP. On the plus side, I'd expect competent Clojure developers to be, on average, much better developers than competent PHP developers. Outsourcing may be much harder and/or much more expensive for Clojure than PHP. * What advantages does this technology offer over something like PHP (from a business perspective)? The scalability of the JVM and the huge ecosystem of Java and JVM languages and libraries. But PHP developers will likely be much cheaper and just as plentiful (as Java/JVM developers - and far more plentiful than Clojure developers). And unless you happen to hit it enormously big, scalability may not be a real problem for you (and Facebook is a poster child for scalable PHP even tho' they've done a lot of weird stuff to get it there). If you're building an extensive web site / web application, PHP has much more maturity in that area and has well-established frameworks and content management systems, and a huge pool of (average to cheap) talent available. If I was your CEO or another early stage executive, I'd be pretty skeptical of using something as left field as Clojure for web development. If your core business is big data or AI or something else that relies on complex data / structure analysis, I'd be more sympathetic. Or if most of the core early team were already experienced with Clojure. But in the early stage, you'll need to move fast, pivot early and often, and be prepared to throw away a lot of demo / prototype code so picking something you're all comfortable with might well be a better business choice than some cool tech you might all like to use. Sean Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) signature.asc Description: Message signed with OpenPGP using GPGMail
Re: Question about importing java classes to Clojure
Hard to tell what your problem is with so little information to go on. Here's the code we use to get a directory listing: (defn- wildcard-filter Given a regex, return a FilenameFilter that matches. [re] (reify java.io.FilenameFilter (accept [_ dir name] (not (nil? (re-find re name)) (defn directory-list Given a directory and a regex, return a sorted seq of matching filenames. [dir re] (sort (.list (clojure.java.io/file dir) (wildcard-filter re On Mar 11, 2014, at 3:28 PM, Brandon Barret mrbarret...@gmail.com wrote: Hello all, I am working on a program that needs to list all the files in a directory. I have read that Clojure doesn't yet have great support for this kind of task, and that it is better to import java.io.File to your namespace in order to use some of it's methods. Every time I have done this in Eclipse, I get the same error: No matching field found: getName for class java.lang.String (files.clj:0) My question: Is this a me problem, perhaps a syntax error, a java problem, or a Clojure problem? I have used java for quite a while, and think that I am importing the class correctly: (import 'java.io.File), or should I just be using Clojure.java.ioconfused in this case. signature.asc Description: Message signed with OpenPGP using GPGMail
Re: Question about importing java classes to Clojure
Brandon Barret writes: Hello all, I am working on a program that needs to list all the files in a directory. I have read that Clojure doesn't yet have great support for this kind of task, and that it is better to import java.io.File to your namespace in order to use some of it's methods. Every time I have done this in Eclipse, I get the same error: No matching field found: getName for class java.lang.String (files.clj:0) My question: Is this a me problem, perhaps a syntax error, a java problem, or a Clojure problem? I have used java for quite a while, and think that I am importing the class correctly: (import 'java.io.File), or should I just be using Clojure.java.ioconfused in this case. Do you want to *recursively* list all files in the directory? If so, take a look at `file-seq': http://clojuredocs.org/clojure_core/clojure.core/file-seq Passed a java.io.File pointing to a directory, it gives you a sequence of file objects in it and all its subdirectories. To get a list of all files ending in .jar in the current directory: (filter #(.endsWith (str %) .jar) (file-seq (java.io.File. .))) -- Moritz Ulrich pgpGoeDqLQ_Op.pgp Description: PGP signature
Re: Question about importing java classes to Clojure
Hey Brandon, I had a really simple blog post about reading a directory of files that I never published, I updated it and hopefully it can help: http://jarrodswart.com/clojure-like-im-five-working-with-files/ Best, Jarrod -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Help a Startup use Clojure!
Sean, Thanks for the reply and insight. I completely agree on your points. We will be in a 12 week accelerator program so it is quite possible that this code business could fail. Our work is likely going to be more back-end API centric as a point of integration for other businesses rather than our own mega-app. I feel competent in my skill-set and due to learning Clojure the past year I've improved overall. I think speed of development would likely be the same or faster in Clojure. Writing a form, evaling for correctness and then moving on is far superior to the PHP equivalent. The only places I feel uneasy are in the deployment arena because with PHP it's usually just: scp files to server write a cron. Clojure gets a bit more involved and I sometimes feel that learning JVM idioms of Unix equivalents can be lackluster. For example I'm still unsure of the best way to do scheduled jobs in a Clojure app. I appreciate your input. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Help a Startup use Clojure!
Sean, Oops I didn't realize you were asking these questions: - What are you building? - An application for businesses to help leverage the power of crowds in non-traditional crowdsource environments. - The main use-case for many will be that of integration with-in their own applications and I suspect the application will be more API than App centric. Sorry for being vague but I'm still learning too. I will know more for sure when I actually have the meeting with the founders. - Why do _you_ think Clojure is a better choice than PHP? - Due to the limited number of developers (just me initially) I think Clojure presents a tool chain that is familiar and fast. Dynamic programming in a highly iterative development environment means that I can solve challenges that the business will face rather than challenges presented by the programming language. - Clojure is to programming what Lean\Agility are to business process - Wanting to work with a set of tools also goes a long way toward dealing with the other hardships of an early stage company. If I'm making less money and failure is a big part of the equation I want to enjoy what I'm doing. I think future hires would agree. - The heavy amounts of text we will deal with is much easier to handle with the JVM than with PHP. PHP support for UTF-* is fairly bad (compared to Golang or Clojure) and I have had enough personal trouble with it. - Again though we are not Big Data the first processing bottleneck will likely be dealing with large quantities of text. This is something that Clojure and the JVM have a lot more options for dealing with. - The JVM platform means that when it comes time to optimize for performance we have options rather than an app rewrite. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Question about importing java classes to Clojure
Jarrod, Thanks! I have heard of fs. Since I am new to Clojure, I was resistant to try it, but am going to look into it more tonight. Thanks! Brandon -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Question about importing java classes to Clojure
No problem, happy to help. Here is one way you might write the above with fs. I didn't check this I just typed it out so there may be a few tiny bugs. (defn jar? [filename] (if (= (fs/extension filename) jar) true false)) (defn list-paths [path-str] (println Files in path-str) (let [listing (fs/glob path-str)] (doseq [l listing] (if (fs/directory? l) (print directory: l) (print - l)) (println (if jar? w n)) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
expectations 2.0 has been released
expectations is a minimilist's unit testing framework website: http://jayfields.com/expectations/ github: https://github.com/jaycfields/expectations changelog: https://github.com/jaycfields/expectations/blob/master/CHANGELOG.md some large changes that will hopefully result in even more concise and maintainable tests. feedback always welcome. Jay -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Question about importing java classes to Clojure
Sean, I am getting closer. Sorry about that. Here is my (rudimentary) code. My goal is to print the contents of a directory, and from that, print one of two things based on the results ( an if/then, if you will). I am running into a few problems though. (defn list-paths [directory] (println Files in (.getName directory)) (doseq [f (.listFiles directory)] (if (.isDirectory f) (print directory: ) (print - )) (println (.getName f) (fn clj-check [directory] (if (.contains directory .jar) (println(w) (println (n (list-paths (File. home/documents/something) ---run it here My problems are twofold. When I run the function using the home folder for Eclipse, I get the directory output just fine, but in my second inner-function, I only get references to a location in memory when it is run, not the strings I want to print. Also, the directories work fine with my local IDE paths, but I cannot access anything else on my computer. I think I am missing something on both counts? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
求教:使用uberjar后,如何能覆盖log4j.properties
把项目用uberjar打包后,如何覆盖日志配置文件log4j.properties? 试了 java -cp resources -jar xxx.jar 貌似不能覆盖 -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Question about importing java classes to Clojure
On 12 March 2014 00:06, Brandon Barret mrbarret...@gmail.com wrote: (defn list-paths [directory] (println Files in (.getName directory)) (doseq [f (.listFiles directory)] (if (.isDirectory f) (print directory: ) (print - )) (println (.getName f) (fn clj-check [directory] (if (.contains directory .jar) (println(w) (println (n (list-paths (File. home/documents/something) ---run it here My problems are twofold. When I run the function using the home folder for Eclipse, I get the directory output just fine, but in my second inner-function, I only get references to a location in memory when it is run, not the strings I want to print. That's because you're defining an anonymous function, and then trying to print that function, instead of running it. From your code I'm not really sure what you're trying to do. Also, the directories work fine with my local IDE paths, but I cannot access anything else on my computer. I think I am missing something on both counts? You have home/documents/something, which is a relative path. Have you tried passing in an absolute path, i.e. with a preceding /? - James -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: 求教:使用uberjar后,如何能覆盖log4j.properties
试试启动参数 -Dlog4j.configuration 什么的呢,你可以搜一下 On Tue 11 Mar 2014 11:16:13 PM CST, sonic pan wrote: 把项目用uberjar打包后,如何覆盖日志配置文件log4j.properties? 试了 java -cp resources -jar xxx.jar 貌似不能覆盖 -- 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 mailto:clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: expectations 2.0 has been released
Looks great Jay - as you know I'm a big fan of Expectations. One big issue I see here is that by removing 'given' you've made adoption of 2.0 a bit all or nothing: to use 2.0, I must update our entire test base to rewrite all 'given' tests using the new syntax. Is there an intermediate version that has both 'given' _and_ the new syntax so folks can migrate piecemeal? Sean On Mar 11, 2014, at 6:28 PM, Jay Fields j...@jayfields.com wrote: expectations is a minimilist's unit testing framework website: http://jayfields.com/expectations/ github: https://github.com/jaycfields/expectations changelog: https://github.com/jaycfields/expectations/blob/master/CHANGELOG.md some large changes that will hopefully result in even more concise and maintainable tests. feedback always welcome. Jay signature.asc Description: Message signed with OpenPGP using GPGMail
Re: Clojure Jruby (Ruby on Rails) Interop
Hey Ramon, Back when I started coding my project ~6 months ago, I couldn't run Torquebox successfully in Heroku nor Openshift. I read about the Torquebox Lite project, but you loose most of the Torquebox magic. I know now, you can get the full Torquebox stack - {Stomp server Clustering} running on Heroku, but I wouldn't know how big can they scale, since the dyno/gear RAM is quite limited. From experience, I've experience that Torquebox with background jobs and messaging queues, can be quite RAM demanding on my development environment, I wouldn't know how it performs on a Heroku dyno. I also read tons of issues regarding Heroku's intelligent routing, back when I was looking for a hosting solution. So I finally opted for a VPS solution, which does need extra setup (compared to Heroku deployment), but having the extra CPU power +RAM, and running Torquebox with all it's bells and whistles running, was well worth loosing Heroku's perks. - Rodrigo On Tuesday, March 11, 2014 12:26:55 PM UTC-6, Ramon Long wrote: Rodrigo, Have you looked at hosting your JVM-based solution with Clojure and jRuby on Heroku? -Ramon On Thursday, October 24, 2013 9:59:56 PM UTC-4, rdelcueto wrote: Thanks for your response Jim. Is there any alternative solution to Openshift that supports the TB and Immutant combo, that you recommend? On Thursday, October 24, 2013 8:47:14 PM UTC-5, Jim Crossley wrote: Unfortunately not, Rodrigo. Frankly, TorqueBox on OpenShift is not a very happy experience, mostly due to bundler and very limited resources on the free OpenShift gears. Until we get those issues worked out, I don't want to encourage anyone to combine TB and Immutant on OpenShift. Also, we're kinda in a wait-and-see mode while the OpenShift guys integrate Docker, as container images should be a lot easier to work with than cartridges. So you're ahead of us at the moment. We expect to catch up, just not sure when. Jim On Thu, Oct 24, 2013 at 8:45 PM, rdelcueto rdel...@gmail.com wrote: Dear Jim, I just began playing with Immutant and TorqueBox. I realized the polyglot-openshift-quickstart* @ *GitHub is marked as obsolete. I found links to newer versions of immutant-quickstart and torquebox-quickstart, though as separate applications. Is there documentation or a tutorial on how to get TorqueBox and Immutant merged into a single OpenShift application, ala lein immutant overlay torquebox? Regards, On Monday, September 9, 2013 11:14:54 AM UTC-5, Jim Crossley wrote: Hi Rodrigo, I'm one of the developers of TorqueBox and Immutant. Your email prompted me to re-watch a screencast [1] I made in March showing how to use them together. I realized things have changed a little since then, so I added a few annotations to the video highlighting the differences. Hopefully enough to get you up and experimenting. As you've probably figured out, both TorqueBox and Immutant are integrated stacks, bundling some commodity services that most non-trivial applications need, e.g. scheduling, caching, and messaging. The intent of any integrated platform is to relieve administration burden. But that only works for you if the inherent choices within that stack fit the needs of your app. We think/hope default Immutant configuration and abstractions (e.g. queues, topics, request/respond) offers a good balance to fit a wide variety of apps. If simple integration between Ruby and Clojure apps is your chief goal, I think Immutant/TorqueBox is compelling, but I'm biased. I would definitely recommend using some sort of messaging broker, though, i.e. don't mix Clojure and Ruby in the same source file or project. Performance and security concerns are so application-specific I hate to make any generic statements about them other than, be fast and secure. ;-) But do feel free to bother us in #torquebox or #immutant on freenode with any questions about your particular app/needs. Thanks, Jim [1] http://immutant.org/news/2013/03/07/overlay-screencast/ On Sun, Sep 8, 2013 at 10:25 PM, rdelcueto rdel...@gmail.com wrote: Hi everyone, I'm about to start working on building a site for a startup company. We are a small team, and currently they've been coding the site using RoR (Ruby on Rails). I was thinking Clojure might be better suited for the task, specially because we'll need to implement a backend which is robust, scalable and secure, but also we'll need flexibility, which I think the RoR framework won't shine at all. At our team, we are two coders, non of us are proficient in Web Developing, and we have little experience with RoR, and I thought (I'm sure) maybe investing time learning Clojure will provide us with better tools. PROBLEM/QUESTION While searching for alternative solutions, I stumbled upon the Flightcaster case, we're they are using RoR to implement the site's frontend and Clojure for the system