Re: Help needed with Component library
You nailed it Steve. thanks for the insight :) On Tue, Feb 10, 2015 at 12:13 PM, Steve Ashton ashton.steve...@gmail.com wrote: In main.clj, it looks like you aren't keeping a reference to the started app. So when you call stop, you are actually stopping the version of the system which doesn't have the jetty server set. Try changing this: (defn -main [ args] (component/start app) (component/stop app)) to this: (defn -main [ args] (- app (component/start) (component/stop))) Now, that will immediately start then stop your app, which isn't useful in the long run. Here's how I've managed the system in one of my apps: https://github.com/sashton/event-loupe/blob/master/src/clj/event_loupe/core.clj And here is how start/stop/restart it in the repl: https://github.com/sashton/event-loupe/blob/master/repl/user.clj On Tuesday, February 10, 2015 at 8:35:44 AM UTC-5, Gilberto Garcia wrote: I get the same error because the key :jetty-server = nil so, (:jetty-server this) will return nil what turns into (.stop nil) note that if I print 'this' after assoc'ing :jetty-server in the start lifecycle I see the jetty server associated with the key :jetty-server for some reason I'm loosing the reference for the jetty server between start and stop phases. On Tue, Feb 10, 2015 at 10:35 AM, Chris Ford christop...@gmail.com wrote: What happens if you try: (.stop (:jetty-server this)) instead of: (.stop jetty-server) I'm not at a repl right now, but maybe your stop method is closing over the value of jetty-server that's passed in when the record was constructed? On 10 February 2015 at 22:58, Gilberto Garcia giba...@gmail.com wrote: Here it goes https://gist.github.com/ggarciajr/e5f1c0f1072c63705ac4 Note that the :jetty-server is nil and it should hold the jetty server so it can be stopped in the stop phase. #toro_tokens_rest.components.ring.Ring{:port 3000, :database #toro_tokens_rest.components.database.Database{:path /tmp/dev-leveldb}, :jetty-server nil} So, I bet I'm doing something wrong. On Tue, Feb 10, 2015 at 9:45 AM, Chris Ford christop...@gmail.com wrote: Perhaps it would help if you posted a gist of the stacktrace you encounter? On 10 February 2015 at 20:29, Gilberto Garcia giba...@gmail.com wrote: Hi All, I'm new to clojure and I'm trying to create a simple rest api to create and manages to token. I'm trying to use Stuart's component library but I'm having problems when trying to stop a component because one of the component's map attribute is nil, so, when I try to stop the jetty server I get a NPE. I bet that I'm doing something wrong and I'm failing to find what is wrong due to my lack of clojure knowledge/experience. Any help is appreciated. Repo: https://github.com/ggarciajr/toro-tokens-rest/tree/adding- functionality Branch: adding-functionality Thanks in advance -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received
Re: Combining reloaded workflow in web dev with dynamic var approach
Hi, Thank you for the hint. I was taking some more time to look at other products and finally saw that luminus just uses ring.server.standalone/serve which supports auto reload for templates and clj code. So I just created two different components, one for development and one for runtime which uses http-kit. This way I don't need the dynamic var at all. Best Regards, Sven Am Montag, 9. Februar 2015 15:20:20 UTC+1 schrieb Steve Ashton: I've had the same question. What I've come up with is to introduce a new middleware in the the dev-system, which wraps the both the creation of the app handler and calling the handler with the request map. The prod-system would still refer directly to a single instance of the app handler. Now in dev-mode, on every request, a new handler is both created and executed. There is a potential performance impact of re-creating the app ring handlers, but I haven't noticed any issues yet, and this is only for development mode, so I'm not too concerned about it. The improved repl experience is valuable to me. Using your code: (defn app [] (app-handler [home-routes user-routes base-routes] :middleware (load-middleware) :ring-defaults (mk-defaults false) :access-rules [] :formats [:json-kw :edn :transit-json])) (defn dev-system [] (component/system-map :web (new-web-server (env :http-port) (fn [] (fn [req] ((app) req) (defn prod-system [] (component/system-map :web (new-web-server (env :http-port) (app))) On Sunday, February 8, 2015 at 1:37:40 PM UTC-5, Sven Richter wrote: Hi, This is something that I am struggling for some time and I still don't know how to solve it. For dynamic reloading in web development there is this common pattern: (def app (app-handler [home-routes user-routes base-routes] :middleware (load-middleware) :ring-defaults (mk-defaults false) :access-rules [] :formats [:json-kw :edn :transit-json])) (defn get-handler [] (- #'app (wrap-file resources) (wrap-file-info))) This works nice, but does not give me components. With components I would do something like this: (defn app [] (app-handler [home-routes user-routes base-routes] :middleware (load-middleware) :ring-defaults (mk-defaults false) :access-rules [] :formats [:json-kw :edn :transit-json])) (defn dev-system [] (component/system-map :web (new-web-server (env :http-port) (app))) Reloading all components takes a bit more time and ceremony than just having it all reloaded by itself. (I don't wanna say it takes long, but for me this are 2 keystrokes more + ~1 second wait time versus no keystrokes and almost no wait time with dynamic var reloading). Is there a way to combine both approaches to get the best of both worlds? Thanks, Sven -- 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: ClojureScript 0.0-2814, Nashorn REPL, async testing, and much more
According to GitHub, ClojureScript now has 104 contributors to Clojure's 102 - and has had more commits since around December. Congrats to all involved! -- 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] Immutant 2.0.0-beta2
That's really great! I can vouch for the stability of beta1. Been running for a small app in production, handling filtered twitter stream data. Never have looked at it since it was started some months ago (except for a VM restart once). To be fair, there's no high load on this app, but it handles all the stuff it is designed for very well. Sente support is pretty exciting too. I had to choose between http-kit and immutant - I went with immutant because of other reasons and handled my simple websocket requirement directly in Clojurescript/JS. I'll hopefully find some time soon to try out sente instead. Best, Ravindra On Wed, Feb 11, 2015 at 3:19 AM, Jim Crossley jcrossl...@gmail.com wrote: Hi all, We released Beta 2 of The Deuce today: http://immutant.org/news/2015/02/09/announcing-2-beta2/ We introduced some breaking changes, specifically around WebSockets, but we like the new API, as it now directly supports HTTP streams, including Server-Sent Events. See the Asynchrony section in the guide for more details: http://immutant.org/documentation/2.0.0-beta2/apidoc/guide-web.html This work mostly came out of Toby's recent efforts to integrate Immutant with Sente: https://github.com/ptaoussanis/sente We thought we were going to release a 2.0 final last November, because that's when WildFly 9 was expected to be released. But that hasn't happened yet. So now we're saying some time in the Spring. Regardless, we feel like beta2 is pretty stable ('course we thought that about beta1 too!) so we'd appreciate the feedback, especially if the new async features interest you. 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/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.
Help needed with Component library
Hi All, I'm new to clojure and I'm trying to create a simple rest api to create and manages to token. I'm trying to use Stuart's component library but I'm having problems when trying to stop a component because one of the component's map attribute is nil, so, when I try to stop the jetty server I get a NPE. I bet that I'm doing something wrong and I'm failing to find what is wrong due to my lack of clojure knowledge/experience. Any help is appreciated. Repo: https://github.com/ggarciajr/toro-tokens-rest/tree/adding-functionality Branch: adding-functionality Thanks in advance -- 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 needed with Component library
Perhaps it would help if you posted a gist of the stacktrace you encounter? On 10 February 2015 at 20:29, Gilberto Garcia giba@gmail.com wrote: Hi All, I'm new to clojure and I'm trying to create a simple rest api to create and manages to token. I'm trying to use Stuart's component library but I'm having problems when trying to stop a component because one of the component's map attribute is nil, so, when I try to stop the jetty server I get a NPE. I bet that I'm doing something wrong and I'm failing to find what is wrong due to my lack of clojure knowledge/experience. Any help is appreciated. Repo: https://github.com/ggarciajr/toro-tokens-rest/tree/adding-functionality Branch: adding-functionality Thanks in advance -- 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 needed with Component library
Here it goes https://gist.github.com/ggarciajr/e5f1c0f1072c63705ac4 Note that the :jetty-server is nil and it should hold the jetty server so it can be stopped in the stop phase. #toro_tokens_rest.components.ring.Ring{:port 3000, :database #toro_tokens_rest.components.database.Database{:path /tmp/dev-leveldb}, :jetty-server nil} So, I bet I'm doing something wrong. On Tue, Feb 10, 2015 at 9:45 AM, Chris Ford christophertf...@gmail.com wrote: Perhaps it would help if you posted a gist of the stacktrace you encounter? On 10 February 2015 at 20:29, Gilberto Garcia giba@gmail.com wrote: Hi All, I'm new to clojure and I'm trying to create a simple rest api to create and manages to token. I'm trying to use Stuart's component library but I'm having problems when trying to stop a component because one of the component's map attribute is nil, so, when I try to stop the jetty server I get a NPE. I bet that I'm doing something wrong and I'm failing to find what is wrong due to my lack of clojure knowledge/experience. Any help is appreciated. Repo: https://github.com/ggarciajr/toro-tokens-rest/tree/adding-functionality Branch: adding-functionality Thanks in advance -- 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. -- 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: Extending the LispReader with embeded language lorms
@Luc: I see your points. Thanks for the reply. Just to make it clear: all I suggest is to integrate https://github.com/henrik42/extended-lisp-reader/blob/master/src/extended_lisp_reader/core.clj into clojure.core - i.e. make #[...]-forms and the delegation to user code official. The rest of my lib is just examples of how this feature *could* be used. So we're talking about ~15 lines of code. But again - this might open up a way that we do not want to go in the end. Time will tell. -- 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 needed with Component library
I get the same error because the key :jetty-server = nil so, (:jetty-server this) will return nil what turns into (.stop nil) note that if I print 'this' after assoc'ing :jetty-server in the start lifecycle I see the jetty server associated with the key :jetty-server for some reason I'm loosing the reference for the jetty server between start and stop phases. On Tue, Feb 10, 2015 at 10:35 AM, Chris Ford christophertf...@gmail.com wrote: What happens if you try: (.stop (:jetty-server this)) instead of: (.stop jetty-server) I'm not at a repl right now, but maybe your stop method is closing over the value of jetty-server that's passed in when the record was constructed? On 10 February 2015 at 22:58, Gilberto Garcia giba@gmail.com wrote: Here it goes https://gist.github.com/ggarciajr/e5f1c0f1072c63705ac4 Note that the :jetty-server is nil and it should hold the jetty server so it can be stopped in the stop phase. #toro_tokens_rest.components.ring.Ring{:port 3000, :database #toro_tokens_rest.components.database.Database{:path /tmp/dev-leveldb}, :jetty-server nil} So, I bet I'm doing something wrong. On Tue, Feb 10, 2015 at 9:45 AM, Chris Ford christophertf...@gmail.com wrote: Perhaps it would help if you posted a gist of the stacktrace you encounter? On 10 February 2015 at 20:29, Gilberto Garcia giba@gmail.com wrote: Hi All, I'm new to clojure and I'm trying to create a simple rest api to create and manages to token. I'm trying to use Stuart's component library but I'm having problems when trying to stop a component because one of the component's map attribute is nil, so, when I try to stop the jetty server I get a NPE. I bet that I'm doing something wrong and I'm failing to find what is wrong due to my lack of clojure knowledge/experience. Any help is appreciated. Repo: https://github.com/ggarciajr/toro-tokens-rest/tree/adding-functionality Branch: adding-functionality Thanks in advance -- 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. -- 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. -- 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 -
[RFC] Testing ClojureScript code with clojurescript.test and Karma
We at CircleCI have been running our clojurescript.test tests with Karma lately, with great results. Easy access to Chrome devtools for unit tests is great, and it provides great community plugins like junit-formatted xml output (which CircleCI understands). You can read about how it works in our blog post on the topic http://blog.circleci.com/testing-clojurescript-code-with-clojurescript-test-and-karma/?utm_campaign=clojurescript-karma-blogutm_medium=postutm_source=clojure-mailing-listutm_content=announce. The main caveat is that at the moment our karma-cljs.test adapter is hardcoded to call circle.karma.run_tests_for_karma as an entry point to the ClojureScript side of things. We also use a bit of a hack to load all of the test namespaces when {:optimizations :none} is used. That said, we're curious if there is much community interest in running ClojureScript tests this way. If so, we can look into making things more generic and robust. Thanks! -The CircleCI 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: Serving files from outside a ring uberjar
See https://github.com/ring-clojure/ring/wiki/Static-Resources You should be able to pass '.' signifying the directory your application was started in (that might NOT be the same place as the jar). viper110110 viper110...@gmail.com writes: I would like to be able to serve up files from a folder after the jar has been built. Ideally I could take a parameter in to the jar with the target directory, but I could also settle for putting the jar in the directory with the files or hardcoding a target directory near the jar. This is so that I can change the files without having to rebuild the application. -- 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. signature.asc Description: PGP signature
Re: Extending the LispReader with embeded language lorms
Hi Henrik, There is a long-standing philosophical position in Clojure that it should not be possible to write programs that cannot be read by other users. Because of this position, I do not believe there is any chance of this moving forward in Clojure itself. Tagged literals allow creating new data that can still be read and interpreted even if a reader is not available so they give a certain measure of this capability without crossing that line. Alex On Tuesday, February 10, 2015 at 6:03:56 AM UTC-6, henrik42 wrote: @Luc: I see your points. Thanks for the reply. Just to make it clear: all I suggest is to integrate https://github.com/henrik42/extended-lisp-reader/blob/master/src/extended_lisp_reader/core.clj into clojure.core - i.e. make #[...]-forms and the delegation to user code official. The rest of my lib is just examples of how this feature *could* be used. So we're talking about ~15 lines of code. But again - this might open up a way that we do not want to go in the end. Time will tell. -- 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.
Why STM read are not cached?
Hello Clojure developers I am currently doing my masters thesis about Clojure as a paraller programming language. I have studied Clojures STM from the source and I have a next question about the implementation. If this is a wrong place to ask this question I apologize beforehand. Read operations in transaction can fault if the refs history queue doesnt have a val which is older than running transaction. That can happen if other transactions commit between the start of the transaction and dereferencing. LockingTransaction.java seems to have ref cache which is updated in write operations (alter). line 107: final HashMapRef, Object vals = new HashMapRef, Object(); This is updated when calling doSet method (lines 424 - 436). LockingTransaction doGet-method (lines 397-422) seem to work as next: - Check vals-map with ref as a key, return if found - check if ref is unbound, if so throw exception - check if refs tvals list have value which is older than running transaction. If found return that value else retry transaction. According the code succesful read from the refs history is not cached. This means that if transaction have two same read operations there is a possibility that latter read may fault. I have tested that with next program. (def a (ref 1)) (ref-max-history a 0) (ref-min-history a 0) (def counter(atom 0)) (defn readtrans[] ( dosync (swap! counter inc) (deref a) (Thread/sleep 2000) (deref a) (swap! counter inc)) ) (defn writetrans[] ( dosync (Thread/sleep 100) (ref-set a 2)) ) (do (def readfuture (future (readtrans))) (def writefuture (future (writetrans Atom counter is 3 after running the code. Code works as: - readfuture increments counter and reads ref - readfuture is suspended - writefuture alters ref - readfuture wakes and tries to read the value again - fault and retry - readfuture runs again and increments counter twice. This could be averted if the reads were cached as well as writes. Is there some reason why reads are not cached like writes? Yours, Heikki Hämäläinen -- 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.
Serving files from outside a ring uberjar
I would like to be able to serve up files from a folder after the jar has been built. Ideally I could take a parameter in to the jar with the target directory, but I could also settle for putting the jar in the directory with the files or hardcoding a target directory near the jar. This is so that I can change the files without having to rebuild the application. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: How to profile a clojure program?
I would think you could just use a normal profiler with some mental translations. The translations between Clojure vars/namespaces and Java classes are in most cases pretty straightforward. A function foo in namespace core becomes class core$foo, function bar becomes core$bar, etc. Then there's some extra noise you'll see like invoke and doInvoke to call functions. I've used the YourKit profiler a bit and it wasn't too difficult for my purposes at least. On Sunday, February 8, 2015 at 8:24:05 PM UTC+2, Giovanni Gherdovich wrote: Hello, I am trying to use a java profiler (jvisualvm) to see why my clojure program is so slow. But I now realize that the profiler has no notion of my clojure program; I have clojure functions foo and bar, and would like to know how much they contribute to the overall execution time. jvisualvm is only telling me what java methods are called; it says I use cons and assoc a lot, but that's not exactly what I need. I also know about Java Mission Control and YourKit. I haven't tried them but I guess the same applies. Any suggestion on how to get the call tree with timing of my program from the clojure point of view? Cheers, GGhh -- 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] Immutant 2.0.0-beta2
Hi all, We released Beta 2 of The Deuce today: http://immutant.org/news/2015/02/09/announcing-2-beta2/ We introduced some breaking changes, specifically around WebSockets, but we like the new API, as it now directly supports HTTP streams, including Server-Sent Events. See the Asynchrony section in the guide for more details: http://immutant.org/documentation/2.0.0-beta2/apidoc/guide-web.html This work mostly came out of Toby's recent efforts to integrate Immutant with Sente: https://github.com/ptaoussanis/sente We thought we were going to release a 2.0 final last November, because that's when WildFly 9 was expected to be released. But that hasn't happened yet. So now we're saying some time in the Spring. Regardless, we feel like beta2 is pretty stable ('course we thought that about beta1 too!) so we'd appreciate the feedback, especially if the new async features interest you. 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/d/optout.
Re: Extending the LispReader with embeded language lorms
For a competent English speaker/reader, Infinite Jest is hard to read because it's dense and elliptical c. c. For that same reader, Tintin in the original French is hard to read because it's in French. I think that's a relevant distinction to make in this context. Extensibility is nice, but there comes a point where, for all intents and purposes, a piece of code stops being Clojure and starts being something else. On Tuesday, February 10, 2015 at 3:12:46 PM UTC-5, Gary Verhaegen wrote: I *think* Alex means read in the very specific and technical sense of a Lisp reader, i.e. a piece of program that turns a stream of characters into data structures in memory, and then I guess the other users are all of the other programs, beside the Clojure compiler itself, that may want to analyze or manipulate Clojure code. I certainly hope he's not proposing to excommunicate abybody writing hard to understand code on occasion. ;-) On Tuesday, 10 February 2015, Ben Wolfson wol...@gmail.com javascript: wrote: On Tue, Feb 10, 2015 at 11:29 AM, Alex Miller a...@puredanger.com wrote: Hi Henrik, There is a long-standing philosophical position in Clojure that it should not be possible to write programs that cannot be read by other users. What does that mean? -- Ben Wolfson Human kind has used its intelligence to vary the flavour of drinks, which may be sweet, aromatic, fermented or spirit-based. ... Family and social life also offer numerous other occasions to consume drinks for pleasure. [Larousse, Drink entry] -- 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: Extending the LispReader with embeded language lorms
I *think* Alex means read in the very specific and technical sense of a Lisp reader, i.e. a piece of program that turns a stream of characters into data structures in memory, and then I guess the other users are all of the other programs, beside the Clojure compiler itself, that may want to analyze or manipulate Clojure code. I certainly hope he's not proposing to excommunicate abybody writing hard to understand code on occasion. ;-) On Tuesday, 10 February 2015, Ben Wolfson wolf...@gmail.com wrote: On Tue, Feb 10, 2015 at 11:29 AM, Alex Miller a...@puredanger.com javascript:_e(%7B%7D,'cvml','a...@puredanger.com'); wrote: Hi Henrik, There is a long-standing philosophical position in Clojure that it should not be possible to write programs that cannot be read by other users. What does that mean? -- Ben Wolfson Human kind has used its intelligence to vary the flavour of drinks, which may be sweet, aromatic, fermented or spirit-based. ... Family and social life also offer numerous other occasions to consume drinks for pleasure. [Larousse, Drink entry] -- 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 javascript:_e(%7B%7D,'cvml','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 javascript:_e(%7B%7D,'cvml','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 javascript:_e(%7B%7D,'cvml','clojure%2bunsubscr...@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: Extending the LispReader with embeded language lorms
For the sake of completeness, in this context other users is not limited to humans: what about IDE support? Refactoring tools? Code analysis? You have to balance the potential extra complexities with the benefit, which to me seems to be very sparse: how often do you actually need to embed large swaths of CSV in your code? How big of an effort is it to load it from another file? (Even as EDN, if you have much data, it is better to load it from an external file than try to compile it.) I understand that csv is just an example, but again, if your goal is to shield users from parentheses, isn't it better to go through the relatively small effort of loading a separate file, so dsl users do not even have to know the system is in Clojure? If you are thinking of embedded dsls for the application developer, the Clojure community seems to have settled on data-based dsls, where data essentially means EDN. If you are targetting non-coder users, and do not want to try the EDN route, i would suggest external files with instaparse (though language design is hard). Anyway, regardless of whether a completely extensible language syntax is a good idea in principle, I do not think you will find much support in this community. It just does not mesh well with the idiomatic way to do things around here. (And what would you say to someone who wants to embed J code, where brackets are not often matched?) On Tuesday, 10 February 2015, Alex Miller a...@puredanger.com wrote: Hi Henrik, There is a long-standing philosophical position in Clojure that it should not be possible to write programs that cannot be read by other users. Because of this position, I do not believe there is any chance of this moving forward in Clojure itself. Tagged literals allow creating new data that can still be read and interpreted even if a reader is not available so they give a certain measure of this capability without crossing that line. Alex On Tuesday, February 10, 2015 at 6:03:56 AM UTC-6, henrik42 wrote: @Luc: I see your points. Thanks for the reply. Just to make it clear: all I suggest is to integrate https://github.com/henrik42/extended-lisp-reader/blob/ master/src/extended_lisp_reader/core.clj into clojure.core - i.e. make #[...]-forms and the delegation to user code official. The rest of my lib is just examples of how this feature *could* be used. So we're talking about ~15 lines of code. But again - this might open up a way that we do not want to go in the end. Time will tell. -- 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 javascript:_e(%7B%7D,'cvml','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 javascript:_e(%7B%7D,'cvml','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 javascript:_e(%7B%7D,'cvml','clojure%2bunsubscr...@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: Extending the LispReader with embeded language lorms
On Tue, Feb 10, 2015 at 11:29 AM, Alex Miller a...@puredanger.com wrote: Hi Henrik, There is a long-standing philosophical position in Clojure that it should not be possible to write programs that cannot be read by other users. What does that mean? -- Ben Wolfson Human kind has used its intelligence to vary the flavour of drinks, which may be sweet, aromatic, fermented or spirit-based. ... Family and social life also offer numerous other occasions to consume drinks for pleasure. [Larousse, Drink entry] -- 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: Serving files from outside a ring uberjar
If you're using Compojure, you can use compjure.route/files for that (as opposed to compojure.route/resources which looks inside the jar). As Moritz said, you still have to be a bit wary about the file path, as it will be relative to the current directory of the JVM, not relative to the JAR file location. On Tuesday, 10 February 2015, Moritz Ulrich mor...@tarn-vedra.de wrote: See https://github.com/ring-clojure/ring/wiki/Static-Resources You should be able to pass '.' signifying the directory your application was started in (that might NOT be the same place as the jar). viper110110 viper110...@gmail.com javascript:; writes: I would like to be able to serve up files from a folder after the jar has been built. Ideally I could take a parameter in to the jar with the target directory, but I could also settle for putting the jar in the directory with the files or hardcoding a target directory near the jar. This is so that I can change the files without having to rebuild the application. -- 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 javascript:; 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 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+unsubscr...@googlegroups.com javascript:;. 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 javascript:; 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 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+unsubscr...@googlegroups.com javascript:;. 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.
Is this the good way to write get-percentage
I needed a function to get the percentage as an int. Input is place and total-count. I want the normal definition (which is the default) and a high and low variant. I came up with the following code: (defn get-percentage ([place total-count] (get-percentage :normal place total-count)) ([mode place total-count] (let [percentage (/ (* place 100.0) total-count)] (condp = mode :high (int (Math/ceil percentage)) :low (int (Math/floor percentage)) :normal (int (Math/round percentage)) (throw (Exception. ERROR: get-percentage [:high|:low|:normal] PLACE TOTAL_COUNT)) Is this a good version, or could it be done better? -- Cecil Westerhof -- 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: boltzmann 0.1.1 - a deep-learning library
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hey, On 06.01.2015 05:04, Mike Anderson wrote: On Tuesday, 6 January 2015 04:27:55 UTC+8, Christian Weilbach wrote: On 05.01.2015 03:34, Mike Anderson wrote: Very cool stuff! Like yours! I wish nurokit was EPLed, then I could have had a look at it and try to include it there. Have libraries like this high commercial value? I thought the knowledge to apply them and tune them to the problem is still more expensive, this is why I picked EPL. Also GPL and EPL don't seem to be compatible due to my recherche (which is a pity, because I like the GPL). I think there isn't much commercial value in the library itself - there are many free libraries for machine learning that work just fine. Nobody with enough skill to use the library is going to pay you for something they can get for free. The commercial value is all around : - Building a solution that solves a business problem *using* the library - Integrating with other applications/services (Clojure shines here because of the JVM ecosystem) - Professional services / consulting Ok, thx. I'd like to move into this direction. I notice that you are specialising the RBM to a specific matrix implementation (Clatrix / JBlas) in the file jblas.clj. Are you sure you need to do that? Part of the beauty of core.matrix is that you should be able to write your algorithms in an implementation-independent manner and still get the performance benefits of the optimised implementation when you need it. I started with core.matrix operations and clatrix and then tried to eliminate all overhead showing up in the VisualVM sampling profiler. In my experiments the protocol overhead in this inner loop in `cond-prob-batch` was something like 10% or so, but I am not sure whether I did something wrong. In the mean time I have benchmarked my cryptographic hash function, which also uses protocols, and sometimes I have seen protocol overhead and sometimes not, maybe it was related to tiered compilation and the JIT sometimes not optimizing it, but this is only guessing. 10% protocol overhead sounds like you must be doing quite a lot of protocol calls. The usual trick to minimise this is to ensure that a single protocol call does a lot of work (i.e. work on whole arrays at a time rather than individual elements). If you do that, then the protocol overhead should be negligible. I only do a matrix-multiplication and element-wise calculation of the sigmoid activation: https://github.com/ghubber/boltzmann/blob/master/src/boltzmann/jblas.clj#L40 I have not done any inlining without a profiler proving significant performance benefits, but I can recheck at some point. If you replace all the jBlas method calls with core.matrix fns in `cond-prob-batch` (3), which is quick to do, do you see a performance difference? I really like core.matrix, or in general sound, light protocols and then implementations. Yesterday I found an improved fork for clj-hdf5 for instance, which implements some of core.matrix protocols and fixed that to read double matrices for me, potentially this even allows to read tensors bigger than memory partially then. (1) So I didn't want to inline jBlas, but really use core.matrix. This internal inlining seemed to be some compromise, since it still allows to use clatrix when dealing with the jblas implementation (otherwise it was just a mini-batch implementation). For deep learning most interesting was GPU support in core.matrix for typical BLAS routines, e.g. with jCuBLAS or clBLAS, but I just couldn't start work on this yet. You then have to be very careful not to access some memory, but if this could work with core.matrix protocols it was a major win. It should certainly be possible to wrap GPU matrix support in a core.matrix implementation, indeed I think there have been a couple of proof of concept attempts already. I personally have in the back of my mind a GPU-accelerated extension to Vectorz (i.e. GPU-backed subclasses of AMatrix and AVector), using something like jCuBLAS. Then the full core.matrix support would come for free via vectorz-clj. Would possibly be the easiest way to get comprehensive GPU array programming support in Clojure. Cool. Maybe we could also just wrap the NDarray library of deeplearning4j, then we could wrap their API and use a industry-level deep-learning solution as Shriphani Palakodety suggested. While I still don't think it is nice to implement machine learning algorithms as giant frameworks in Java, but I'd prefer to have them hackable in Clojure, it makes sense to start with some state-of-the-art. I also don't see enough drive behind Clojure ml-libraries to make them compete with Java ones atm. boltzmann's CPU version is for me 1/3 to 1/4th training speed of theano (which again is 1/5 of its GPU version on my older gaming laptop). Theano uses a symbolic compute graph
Re: Help needed with Component library
Hi, I've been messing around with the component library too recently, It's probably worth printing out the defrecord (the Ring one) to see if the values are being populated by the start function. You could just do this in the repl using clojure/pprint.pprint. I also do (assoc this :jetty nil) instead of (dissoc this :jetty-server) as the dissoc will stop it being a defrecord. I hope that helps, Guy On Tuesday, February 10, 2015 at 9:30:06 AM UTC, Gilberto Garcia wrote: Hi All, I'm new to clojure and I'm trying to create a simple rest api to create and manages to token. I'm trying to use Stuart's component library but I'm having problems when trying to stop a component because one of the component's map attribute is nil, so, when I try to stop the jetty server I get a NPE. I bet that I'm doing something wrong and I'm failing to find what is wrong due to my lack of clojure knowledge/experience. Any help is appreciated. Repo: https://github.com/ggarciajr/toro-tokens-rest/tree/adding-functionality Branch: adding-functionality Thanks in advance -- 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 needed with Component library
On 10 February 2015 at 11:36, guy.bar...@signal.uk.com wrote: I also do (assoc this :jetty nil) instead of (dissoc this :jetty-server) as the dissoc will stop it being a defrecord. dissoc only turns the record into a map if you remove one of its core fields: user= (defrecord Foo [x]) user.Foo user= (def f (map-Foo {:x 1 :y 2})) #'user/f user= f #user.Foo{:x 1, :y 2} user= (dissoc f :y) #user.Foo{:x 1} user= (dissoc f :x) {:y 2} Keys that hold temporary objects, like server instances or connections, should probably not be core fields. - 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: New Member Initiation
Hi Shubham, See also this list of novice-friendly Clojure projects, it may be a good starting point for contribution: https://github.com/marcuscreo/clojure-learning-resources https://github.com/marcuscreo/clojure-learning-resources Regards, Akos On 10 Feb 2015, at 00:56, Christopher Small metasoar...@gmail.com wrote: Hi Shubham Welcome to the Clojure community :-) Have you already been programming for a while? Are you new to functional programming, or programming in LISPs? Or just new to Clojure, and interested in learning more and helping develop things within the community. There are a lot of resources and directions you could be pointed in by folks here, depending on what your background is and what your interests are, so clarifying a bit would be helpful. In general though, if you're interested in contributing to open source Clojure projects, as a way of giving something to the community, I'd recommend learning a bit about some of the various things going on in Clojure, thinking about what things interest you, and finding projects related to that which are still in active development. Once you have a few projects in mind you'd like to contribute to, if the project is on Github, it will frequently have issues up about work that needs to be done. You can pick something and start hacking on it. Many project maintainers will be happy to chat with you over things, and help guide you in working on the issues, pointing you to resources, etc. It's always easiest to contribute towards something that interests you, so the first step is really learning more about the community and what's out there. Good luck Chris On Sunday, February 8, 2015 at 10:48:38 AM UTC-8, Shubham Jain wrote: Hey Guys, I do apologize if i am wasting your time but am doing so only so that i can use my time to help you guys with all the hard work you are doing. To introduce myself, My name is Shubham Jain, an undergrad from the university BITS Pilani India. I really want to contribute to the helping with the development of the dialect. I am new to open source community so know very little about and was hoping that you guys can help me with it. I really want to utilize my time in a way that i can develop my skill set as well as do some greater good. . P,S, Really looking forward to your reply. -- 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 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 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 needed with Component library
What happens if you try: (.stop (:jetty-server this)) instead of: (.stop jetty-server) I'm not at a repl right now, but maybe your stop method is closing over the value of jetty-server that's passed in when the record was constructed? On 10 February 2015 at 22:58, Gilberto Garcia giba@gmail.com wrote: Here it goes https://gist.github.com/ggarciajr/e5f1c0f1072c63705ac4 Note that the :jetty-server is nil and it should hold the jetty server so it can be stopped in the stop phase. #toro_tokens_rest.components.ring.Ring{:port 3000, :database #toro_tokens_rest.components.database.Database{:path /tmp/dev-leveldb}, :jetty-server nil} So, I bet I'm doing something wrong. On Tue, Feb 10, 2015 at 9:45 AM, Chris Ford christophertf...@gmail.com wrote: Perhaps it would help if you posted a gist of the stacktrace you encounter? On 10 February 2015 at 20:29, Gilberto Garcia giba@gmail.com wrote: Hi All, I'm new to clojure and I'm trying to create a simple rest api to create and manages to token. I'm trying to use Stuart's component library but I'm having problems when trying to stop a component because one of the component's map attribute is nil, so, when I try to stop the jetty server I get a NPE. I bet that I'm doing something wrong and I'm failing to find what is wrong due to my lack of clojure knowledge/experience. Any help is appreciated. Repo: https://github.com/ggarciajr/toro-tokens-rest/tree/adding-functionality Branch: adding-functionality Thanks in advance -- 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. -- 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: ANN: ClojureScript 0.0-2814, Nashorn REPL, async testing, and much more
Cut 0.0-2816. The only change is a fix for reader metadata leakage around `reify`. David On Mon, Feb 9, 2015 at 7:47 PM, David Nolen dnolen.li...@gmail.com wrote: ClojureScript, the Clojure compiler that emits JavaScript source code. README and source code: https://github.com/clojure/clojurescript New release version: 0.0-2814 Leiningen dependency information: [org.clojure/clojurescript 0.0-2814] There are numerous enhancements in this release including: a Nashorn REPL, Node.js 0.12 support, cljs.test async testing support, `cljs.closure/watch`, extra JSDoc annotation support, unified source mapping on client/server (thus REPLs!), and many small fixes. I'm particularly excited about unified source mapping as this means we get a much better debugging experience on newer targets (for us) like iOS, see https://github.com/omcljs/ambly ## 0.0-2814 ### Enhancements * add simple source directory `cljs.closure/watch` watcher using java.nio * CLJS-1022: Concatenate foreign dependencies safely * CLJS-988: Support async testing in cljs.test * CLJS-1018: Add support for cljs.core/*e Modify the JavaScript that is sent for evaluation to wrap in a try and then catch any exception thrown, assign it to *e, and then rethrow. * CLJS-1012: Correct behavior when *print-length* is set to 0 * Added new :closure-extra-annotations compiler option allowing to define extra JSDoc annotation used by closure libraries. * Mirrored source map support APIs on server/client * Unified source mapping support in REPLs * Nashorn REPL (thanks Pieter van Prooijen) ### Fixes * CLJS-1023: regression, macro-autoload-ns? and ns-dependents need to throw on cyclic dependencies * fix require with browser REPL, set base path to goog/ * CLJS-1020: off by one error in REPL source map support * Node.js 0.12 support * browser REPL needs to respect :output-dir * CLJS-1006: Implicit dependency of clojure.browser.repl on cljs.repl * CLJS-1005: Browser REPL creates 'out' directory no matter what * CLJS-1003: fix cljs.test run-tests do-report :summary issues * CLJS-1003: Cannot pass custom env to run-tests * Windows Node.js REPL issues -- 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 needed with Component library
In main.clj, it looks like you aren't keeping a reference to the started app. So when you call stop, you are actually stopping the version of the system which doesn't have the jetty server set. Try changing this: (defn -main [ args] (component/start app) (component/stop app)) to this: (defn -main [ args] (- app (component/start) (component/stop))) Now, that will immediately start then stop your app, which isn't useful in the long run. Here's how I've managed the system in one of my apps: https://github.com/sashton/event-loupe/blob/master/src/clj/event_loupe/core.clj And here is how start/stop/restart it in the repl: https://github.com/sashton/event-loupe/blob/master/repl/user.clj On Tuesday, February 10, 2015 at 8:35:44 AM UTC-5, Gilberto Garcia wrote: I get the same error because the key :jetty-server = nil so, (:jetty-server this) will return nil what turns into (.stop nil) note that if I print 'this' after assoc'ing :jetty-server in the start lifecycle I see the jetty server associated with the key :jetty-server for some reason I'm loosing the reference for the jetty server between start and stop phases. On Tue, Feb 10, 2015 at 10:35 AM, Chris Ford christop...@gmail.com javascript: wrote: What happens if you try: (.stop (:jetty-server this)) instead of: (.stop jetty-server) I'm not at a repl right now, but maybe your stop method is closing over the value of jetty-server that's passed in when the record was constructed? On 10 February 2015 at 22:58, Gilberto Garcia giba...@gmail.com javascript: wrote: Here it goes https://gist.github.com/ggarciajr/e5f1c0f1072c63705ac4 Note that the :jetty-server is nil and it should hold the jetty server so it can be stopped in the stop phase. #toro_tokens_rest.components.ring.Ring{:port 3000, :database #toro_tokens_rest.components.database.Database{:path /tmp/dev-leveldb}, :jetty-server nil} So, I bet I'm doing something wrong. On Tue, Feb 10, 2015 at 9:45 AM, Chris Ford christop...@gmail.com javascript: wrote: Perhaps it would help if you posted a gist of the stacktrace you encounter? On 10 February 2015 at 20:29, Gilberto Garcia giba...@gmail.com javascript: wrote: Hi All, I'm new to clojure and I'm trying to create a simple rest api to create and manages to token. I'm trying to use Stuart's component library but I'm having problems when trying to stop a component because one of the component's map attribute is nil, so, when I try to stop the jetty server I get a NPE. I bet that I'm doing something wrong and I'm failing to find what is wrong due to my lack of clojure knowledge/experience. Any help is appreciated. Repo: https://github.com/ggarciajr/toro-tokens-rest/tree/adding-functionality Branch: adding-functionality Thanks in advance -- 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 javascript: 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/d/optout. -- 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 javascript: 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/d/optout. -- 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 javascript: 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