Re: spec error output in web context
Am Sonntag, 9. Juni 2019 16:15:38 UTC+2 schrieb Alex Miller: > > > > On Sun, Jun 9, 2019 at 8:43 AM 'Sven Richter' via Clojure < > clo...@googlegroups.com > wrote: > >> >> I also tried to catch the exception and *(-> ex Throwable->map >> clojure.main/ex-triage clojure.main/ex-str) *as you suggested, which >> works. But like I said, I would not want to check for exceptions during >> production that are only thrown during development. >> > > The generic question here is "what happens when my web request handler > throws an unexpected exception?" An exception can be thrown in either dev > or prod. "spec" errors are not special in this regard. Yes, you happen to > be doing some extra checking in dev, but in either case you want to > properly handle exceptions. The error handling chain above will give you > better output for all exceptions, not just spec. > > I would like to respectfully disagree here. The docs explicitly state that it is not advised to use *instrument* in production. So in production I will never see the same error messages regarding spec as in development, at least regarding to *fdef*. So what is a useful exception during development with a useful output in production it might become visible just a few functions down the stack becoming a NullpointerException, for instance. This is especially true in cases like my one, when I consume a third-party web service where the interface is prone to change. >> Do you know of a different way? Maybe a middleware would be feasible that >> is only added during development? >> > > The question of how to handle exceptions in immutant is an immutant > question. If you read the docstring of immutant.web/run, it tells you how > to do it for ring handlers: > >For ring handlers, the actual writing of the response happens after >your hander returns. If an exception occurs on the write (the most >common case being an IOException because the client has gone away), >the default behavior is to log the exception. > > *If you would like to be able to handle that exception yourself, you can > return a function in the ring response under :write-error-handler.* > This function will >be called with the exception, the request map, and the response map >if an exception occurs when writing the response. Note that this >handler can't actually affect the response. > *If you would prefer a global handler, see > immutant.web.middleware/wrap-write-error-handling*. > I should have looked up the immutant docs myself. Unfortunately I was totally unaware of the different possible outcomes of spec errors. Anyway, thank you very much again for your explanations, I think I got it all together now and learned something new today :-) -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/clojure/9a930376-1bb8-480e-bda1-c834a9bd421e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: spec error output in web context
Hi Alex, I tracked it down to a minimal example with an explanation here: https://gist.github.com/sveri/1aaad9b12a8ec90d243206ab3b6073e3 The short version is. Running a specced function in the clj repl will produce meaningful output, while running in the web context with immutant will print a stacktrace with the ExceptionInfo exception. I also tried to catch the exception and *(-> ex Throwable->map clojure.main/ex-triage clojure.main/ex-str) *as you suggested, which works. But like I said, I would not want to check for exceptions during production that are only thrown during development. Do you know of a different way? Maybe a middleware would be feasible that is only added during development? What does the clj repl do to produce that output? Thank you for your time, Sven Am Samstag, 8. Juni 2019 20:52:27 UTC+2 schrieb Alex Miller: > > > > On Saturday, June 8, 2019 at 1:41:59 AM UTC-5, Sven Richter wrote: >> >> >> >> Am Freitag, 7. Juni 2019 15:35:41 UTC+2 schrieb Alex Miller: >>> >>> How do you start the web server? >>> >> I use component to startup immutant web, I also tried with http-kit, but >> that didnt make a difference. >> > > What I mean is, what command do you use? Are using "lein ring server" or > something like that? > > >> >> Who is printing the error? >>> >> I think thats the key point here, right now I dont know as I never >> bothered to figure out who prints the stacktraces. >> > > I don't think you're going to be able to improve this without > understanding the answer to that question. > > >> >> >>> There are functions available in clojure.main to replicate the message >>> from the repl - you can call them yourself. >>> >>> See https://clojure.org/reference/repl_and_main#_error_printing for >>> more on error triage and the functions like Throwable>map, >>> clojure.main/ex-triage, and clojure.main/ex-str. This chain of functions is >>> what the REPL uses to produce the message below >>> >> >> >> Thanks, I will try that, but that would mean I will have to catch every >> potential ExceptionInfo error and check if its a spec error which is pretty >> cumbersome, especially as I only want to see these outputs during >> development (instrument is turned off in production). >> > > The triage process knows how to print a good message for any error, not > just a spec instrumentation error. There shouldn't be any conditional > needed. > > >> >> 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. To view this discussion on the web visit https://groups.google.com/d/msgid/clojure/d667e44b-397f-4a34-9c95-a0ab9adc4f54%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: spec error output in web context
Am Freitag, 7. Juni 2019 15:35:41 UTC+2 schrieb Alex Miller: > > How do you start the web server? > I use component to startup immutant web, I also tried with http-kit, but that didnt make a difference. Who is printing the error? > I think thats the key point here, right now I dont know as I never bothered to figure out who prints the stacktraces. > There are functions available in clojure.main to replicate the message > from the repl - you can call them yourself. > > See https://clojure.org/reference/repl_and_main#_error_printing for more > on error triage and the functions like Throwable>map, > clojure.main/ex-triage, and clojure.main/ex-str. This chain of functions is > what the REPL uses to produce the message below > Thanks, I will try that, but that would mean I will have to catch every potential ExceptionInfo error and check if its a spec error which is pretty cumbersome, especially as I only want to see these outputs during development (instrument is turned off in production). 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. To view this discussion on the web visit https://groups.google.com/d/msgid/clojure/d2dfbe5b-8aac-4680-a3f9-9086bfd83b8a%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
spec error output in web context
Hi, I just recently found out that the spec error reporting is different in different environments. I have the following functions: (defn search-page [{:keys [off-url off-user off-password]} search] (let [products (off/search-products search) products-with-nutriments (mapv #(off/add-nutriments % off/nutriments-to-extract) (:products products))] (layout/render "off/search.html" {:products products-with-nutriments :search search}))) (defn off-routes [config] (routes (GET "/off/search" [] (search-page config "toast" where off/add-nutriments is a specced function. Now when the spec of that function fails and I call *search-page* from the REPL I get this output: Execution error - invalid arguments to off/add-nutriments at (core.clj:9). "" - failed: #{"kJ" "kcal" "kCal" "g" "mg"} at: [:product :nutriments :clojure.spec.alpha/pred :sugars_unit] spec: :off/unit "" - failed: #{"kJ" "kcal" "kCal" "g" "mg"} at: [:product :nutriments :clojure.spec.alpha/pred :fat_unit] spec: :off/unit "" - failed: #{"kJ" "kcal" "kCal" "g" "mg"} at: [:product :nutriments :clojure.spec.alpha/pred :salt_unit] spec: :off/unit {:salt "3.5", :sugars_unit "", :energy-kcal "201.81514210652017", :energy_unit "kcal", :energy_value 202, :proteins_value "17.6", :proteins_unit "", :carbohydrates_unit "", :saturated-fat_value "8.2", :fat 12, :energy 845, :salt_value "3.5", :saturated-fat_unit "", :fat_100g 12, :sugars_value 6, :sodium_100g "1.37795275590551", :carbohydrates_value 6, :proteins_100g "17.6", :fat_unit "", :saturated-fat "8.2", :sugars_100g 6, :sodium "1.37795275590551", :sugars 6, :carbohydrates 6, :energy_100g 845, :salt_100g "3.5", :saturated-fat_100g "8.2", :salt_unit "", :carbohydrates_100g 6, :proteins "17.6", :fat_value 12} - failed: nil? at: [:product :nutriments :clojure.spec.alpha/nil] spec: :off/nutriments which is nice and readable. Whereas when I run the *search-page* from the started web server through the */off/search* route I get a stacktrace and a very unreadable output: clojure.lang.ExceptionInfo: Call to #'de.sveri.getless.service.off/add-nutriments did not conform to spec. {:clojure.spec.alpha/problems ({:path [:product :nutriments :clojure.spec.alpha/nil], :pred nil?, :val {:salt "3.5", :sugars_unit "", :energy-kcal "201.81514210652017", :energy_unit "kcal", :energy_value 202, :proteins_value "17.6", :proteins_unit "", :carbohydrates_unit "", :saturated-fat_value "8.2", :fat 12, :energy 845, :salt_value "3.5", :saturated-fat_unit "", :fat_100g 12, :sugars_value 6, :sodium_100g "1.37795275590551", :carbohydrates_value 6, :proteins_100g "17.6", :fat_unit "", :saturated-fat "8.2", :sugars_100g 6, :sodium "1.37795275590551", :sugars 6, :carbohydrates 6, :energy_100g 845, :salt_100g "3.5", :saturated-fat_100g "8.2", :salt_unit "", :carbohydrates_100g 6, :proteins "17.6", :fat_value 12}, :via [:de.sveri.getless.service.off/nutriments], :in [0 :nutriments]} {:path [:product :nutriments :clojure.spec.alpha/pred :sugars_unit], :pred #{"kJ" "kcal" "kCal" "g" "mg"}, :val "", :via [:de.sveri.getless.service.off/nutriments :de.sveri.getless.service.off/unit], :in [0 :nutriments :sugars_unit]} {:path [:product :nutriments :clojure.spec.alpha/pred :fat_unit], :pred #{"kJ" "kcal" "kCal" "g" "mg"}, :val "", :via [:de.sveri.getless.service.off/nutriments :de.sveri.getless.service.off/unit], :in [0 :nutriments :fat_unit]} {:path [:product :nutriments :clojure.spec.alpha/pred :salt_unit], :pred #{"kJ" "kcal" "kCal" "g" "mg"}, :val "", :via [:de.sveri.getless.service.off/nutriments :de.sveri.getless.service.off/unit], :in [0 :nutriments :salt_unit]}), :clojure.spec.alpha/spec #object[clojure.spec.alpha$regex_spec_impl$reify__2509 0x302765e4 "clojure.spec.alpha$regex_spec_impl$reify__2509@302765e4"], :clojure.spec.alpha/value ({:image_thumb_url "https://static.openfoodfacts.org/images/products/20987664/front_de.3.100.jpg;, :_keywords ["schmelzkase" "light" "toast"], :image_small_url "https://static.openfoodfacts.org/images/products/20987664/front_de.3.200.jpg;, :nutriments {:salt "3.5", :sugars_unit "", :energy-kcal "201.81514210652017", :energy_unit "kcal", :energy_value 202, :proteins_value "17.6", :proteins_unit "", :carbohydrates_unit "", :saturated-fat_value "8.2", :fat 12, :energy 845, :salt_value "3.5", :saturated-fat_unit "", :fat_100g 12, :sugars_value 6, :sodium_100g "1.37795275590551", :carbohydrates_value 6, :proteins_100g "17.6", :fat_unit "", :saturated-fat "8.2", :sugars_100g 6, :sodium "1.37795275590551", :sugars 6, :carbohydrates 6, :energy_100g 845, :salt_100g "3.5", :saturated-fat_100g "8.2", :salt_unit "", :carbohydrates_100g 6, :proteins "17.6", :fat_value 12}, :ingredients_text "", :rev 10, :lang "de", :ingredients [], :id "20987664", :code "20987664", :product_name_de "Toast Light Schmelzkäse", :nutrition_data_per "100g", :quantity "250 g", :product_name "Toast Light Schmelzkäse"} #object[clojure.core$partial$fn__5841
Poll and opinions about Clojurescript UI / html templates
Hi, I am the author of closp (https://github.com/sveri/closp), a leiningen template for web development. As always over the years I am changing stuff while working on my private stuff and I wonder what the opinions about the UI is. Currently every template that comes with closp is server side generated via hiccup. I myself have always been a proponent of server side generation for known reasons (less resources used on client side, less bandwith used for initial page load, etc). But I am currently working on a project where I create a SPA using re-frame and I wonder if people would prefer a leiningen template to come with a clojurescript UI instead of server side generated html templates. So I would like to gather as much opinions as possible, here is a poll: https://doodle.com/poll/bvw2zkrfe9ue6hxg for voting and of course direct feedback in this ML is welcome too. 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: spec - s/gen validation error
So I tried some more and figured out that its the ::autoinc key that causes this: (s/def ::column (s/keys :req-un [::name ::type] :opt-un [::null ::max-length ::required ::pk ::autoinc this one ::unique ::default ::refs ::fk-name])) When I comment that key, no error occurs, if I uncomment it, spec validation errors repeatedly. The only connection I see is that I remove exactly this k/v pair from the map in my specced function: (s/fdef remove-autoinc-columns :args (s/cat :cols (s/spec ::schem/columns)) :ret ::schem/columns) (defn remove-autoinc-columns [cols] (remove #(= true (:autoinc %)) cols)) But still, as it is an optional key I dont see why it should cause errors? Thanks, Sven Am Montag, 30. Mai 2016 07:38:19 UTC+2 schrieb Sven Richter: > > Hi, > > So I looked at generating specs for tests and I hit an error I just dont > understand / neither can fix it. This is my code: > > (s/def ::column-types #{:int :varchar :boolean :text :time :date > :char :binary :smallint :bigint :decimal > :float :double :real :timestamp}) > > (s/def ::name (s/and string? #(not= "" %))) > (s/def ::boolean (s/or :t true? :f false?)) > > (s/def ::type ::column-types) > (s/def ::null ::boolean) > (s/def ::max-length (s/and integer? #(< 0 %))) > (s/def ::required ::boolean) > (s/def ::pk ::boolean) > (s/def ::autoinc ::boolean) > (s/def ::unique ::boolean) > (s/def ::default (s/or :string string? :boolean ::boolean)) > (s/def ::refs ::none-empty-string) > (s/def ::fk-name ::none-empty-string) > > (s/def ::column (s/keys :req-un [::name ::type] > :opt-un [::null ::max-length ::required ::pk > ::autoinc ::unique ::default > ::refs ::fk-name])) > (s/def ::columns (s/cat :column (s/+ ::column))) > > ;function > (s/fdef remove-autoinc-columns :args (s/cat :cols (s/spec columns)) > :ret ::schem/columns) > (defn remove-autoinc-columns [cols] > (vec (remove #(= true (:autoinc %)) cols))) > > > > ; generative test > (defspec remove-autoinc-column 100 > (prop/for-all [columns (s/gen ::schem/columns)] >(= (h/remove-autoinc-columns columns > > ; will fail with something along the lines of: > ERROR in (remove-autoinc-column) (core.clj:4617) > Uncaught exception, not in assertion. > expected: nil > actual: clojure.lang.ExceptionInfo: Call to > #'de.sveri.clospcrud.helper/remove-autoinc-columns did not conform to spec: > val: () fails spec: :de.sveri.clospcrud.spec.clospcrud/columns at: [:ret > :column] predicate: :de.sveri.clospcrud.spec.clospcrud/column, > Insufficient input > :clojure.spec/args (({:name "QpJ50qrS1m24V", :type :varchar, :unique > true, :required false, :autoinc true, :null true, :pk true, :max-length 14, > :fk-name "Tp9tG8hwUXK0"})) > > I cannot see where the error is coming from, I generate data according to > a spec which I pass to a function that takes this spec exactly. > > Any ideas? > > 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.
spec - s/gen validation error
Hi, So I looked at generating specs for tests and I hit an error I just dont understand / neither can fix it. This is my code: (s/def ::column-types #{:int :varchar :boolean :text :time :date :char :binary :smallint :bigint :decimal :float :double :real :timestamp}) (s/def ::name (s/and string? #(not= "" %))) (s/def ::boolean (s/or :t true? :f false?)) (s/def ::type ::column-types) (s/def ::null ::boolean) (s/def ::max-length (s/and integer? #(< 0 %))) (s/def ::required ::boolean) (s/def ::pk ::boolean) (s/def ::autoinc ::boolean) (s/def ::unique ::boolean) (s/def ::default (s/or :string string? :boolean ::boolean)) (s/def ::refs ::none-empty-string) (s/def ::fk-name ::none-empty-string) (s/def ::column (s/keys :req-un [::name ::type] :opt-un [::null ::max-length ::required ::pk ::autoinc ::unique ::default ::refs ::fk-name])) (s/def ::columns (s/cat :column (s/+ ::column))) ;function (s/fdef remove-autoinc-columns :args (s/cat :cols (s/spec columns)) :ret ::schem/columns) (defn remove-autoinc-columns [cols] (vec (remove #(= true (:autoinc %)) cols))) ; generative test (defspec remove-autoinc-column 100 (prop/for-all [columns (s/gen ::schem/columns)] (= (h/remove-autoinc-columns columns ; will fail with something along the lines of: ERROR in (remove-autoinc-column) (core.clj:4617) Uncaught exception, not in assertion. expected: nil actual: clojure.lang.ExceptionInfo: Call to #'de.sveri.clospcrud.helper/remove-autoinc-columns did not conform to spec: val: () fails spec: :de.sveri.clospcrud.spec.clospcrud/columns at: [:ret :column] predicate: :de.sveri.clospcrud.spec.clospcrud/column, Insufficient input :clojure.spec/args (({:name "QpJ50qrS1m24V", :type :varchar, :unique true, :required false, :autoinc true, :null true, :pk true, :max-length 14, :fk-name "Tp9tG8hwUXK0"})) I cannot see where the error is coming from, I generate data according to a spec which I pass to a function that takes this spec exactly. Any ideas? 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: clojure spec fdef
Do you refer to this section? "When regex ops are combined, they describe a single sequence. If you need to include a nested sequential collection, you must use an explicit call to spec to start a new nested regex context. For example to describe a sequence like [:names ["a" "b"] :nums [1 2 3]], you need nested regular expressions to describe the inner sequential data:" If so, I did read it, but did not connect it inner seqs, but instead always thought it was about regexes, which in my head is something totally different than function definitions and their arguments. Anyway, I am trying to provide useful feedback here, you all have done a great job! Thanks, Sven Am Donnerstag, 26. Mai 2016 14:53:13 UTC+2 schrieb Alex Miller: > > There is an example like this in the Sequence section and a bit on this > issue in particular. > > On Thursday, May 26, 2016 at 7:08:44 AM UTC-5, Sven Richter wrote: >> >> Ah thanks, that worked, not quite as I expected. Up until this point it >> was pretty straightforward for me, thats been my fist bummer. >> >> Do you have an example for this in the guide? I did not fully read it, >> but I think I scrolled through everything that used fdefs. >> >> Best Regards, >> Sven >> >> Am Donnerstag, 26. Mai 2016 12:21:15 UTC+2 schrieb Alex Miller: >>> >>> It's a little tricky but you want: >>> >>> (s/fdef remove-autoinc-columns :args (s/cat :cols (s/spec ::columns))) >>> >>> Here the args data is ([{:foo "some_t"}]) and while you have an s/cat >>> for :args and an s/cat in ::columns, those will be combined into the same >>> regex so that's basically the same thing as ::columns. You need to force a >>> new level of regex context and the s/spec will do that. >>> >>> On Thursday, May 26, 2016 at 4:32:52 AM UTC-5, Sven Richter wrote: >>>> >>>> Hi, >>>> >>>> I already asked this in the spec channel on slack, but got no response >>>> yet. >>>> >>>> I have this simple spec definition: >>>> >>>> (s/def ::foo string?) >>>> >>>> >>>> >>>> (s/def ::column (s/keys :req-un [::foo])) >>>> >>>> >>>> >>>> (s/def ::columns (s/cat :col (s/* (s/spec ::column >>>> >>>> ;(s/def ::columns (s/cat :col (s/* ::column))) >>>> >>>> >>>> >>>> (defn remove-autoinc-columns [cols] >>>> >>>> (vec (remove #(= true (:autoinc %)) cols))) >>>> >>>> >>>> >>>> (s/fdef remove-autoinc-columns :args (s/cat :cols ::columns) >>>> >>>> :ret ::columns) >>>> >>>> >>>> >>>> >>>> $(remove-autoinc-columns [{:foo "some_t"}]) >>>> >>>> ===> ExceptionInfo Call to >>>> #'de.sveri.clospcrud.s-play/remove-autoinc-columns did not conform to spec: >>>> >>>> At: [:args] val: ([{:foo "some_t"}]) fails predicate: (cat :cols >>>> :de.sveri.clospcrud.s-play/columns), Extra input >>>> >>>> :clojure.spec/args ([{:foo "some_t"}]) >>>> >>>> clojure.core/ex-info (core.clj:4617) >>>> >>>> >>>> On the other hand, running this: >>>> (s/conform ::columns [{:foo "some_t"}]) >>>> => {:col [{:foo "some_t"}]} >>>> works. >>>> >>>> So something is broken within the fdefs argument definition. >>>> >>>> I dont see my mistake here, can somone else reproduce / fix this? >>>> >>>> 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: clojure spec fdef
Ah thanks, that worked, not quite as I expected. Up until this point it was pretty straightforward for me, thats been my fist bummer. Do you have an example for this in the guide? I did not fully read it, but I think I scrolled through everything that used fdefs. Best Regards, Sven Am Donnerstag, 26. Mai 2016 12:21:15 UTC+2 schrieb Alex Miller: > > It's a little tricky but you want: > > (s/fdef remove-autoinc-columns :args (s/cat :cols (s/spec ::columns))) > > Here the args data is ([{:foo "some_t"}]) and while you have an s/cat for > :args and an s/cat in ::columns, those will be combined into the same regex > so that's basically the same thing as ::columns. You need to force a new > level of regex context and the s/spec will do that. > > On Thursday, May 26, 2016 at 4:32:52 AM UTC-5, Sven Richter wrote: >> >> Hi, >> >> I already asked this in the spec channel on slack, but got no response >> yet. >> >> I have this simple spec definition: >> >> (s/def ::foo string?) >> >> >> >> (s/def ::column (s/keys :req-un [::foo])) >> >> >> >> (s/def ::columns (s/cat :col (s/* (s/spec ::column >> >> ;(s/def ::columns (s/cat :col (s/* ::column))) >> >> >> >> (defn remove-autoinc-columns [cols] >> >> (vec (remove #(= true (:autoinc %)) cols))) >> >> >> >> (s/fdef remove-autoinc-columns :args (s/cat :cols ::columns) >> >> :ret ::columns) >> >> >> >> >> $(remove-autoinc-columns [{:foo "some_t"}]) >> >> ===> ExceptionInfo Call to >> #'de.sveri.clospcrud.s-play/remove-autoinc-columns did not conform to spec: >> >> At: [:args] val: ([{:foo "some_t"}]) fails predicate: (cat :cols >> :de.sveri.clospcrud.s-play/columns), Extra input >> >> :clojure.spec/args ([{:foo "some_t"}]) >> >> clojure.core/ex-info (core.clj:4617) >> >> >> On the other hand, running this: >> (s/conform ::columns [{:foo "some_t"}]) >> => {:col [{:foo "some_t"}]} >> works. >> >> So something is broken within the fdefs argument definition. >> >> I dont see my mistake here, can somone else reproduce / fix this? >> >> 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.
clojure spec fdef
Hi, I already asked this in the spec channel on slack, but got no response yet. I have this simple spec definition: (s/def ::foo string?) (s/def ::column (s/keys :req-un [::foo])) (s/def ::columns (s/cat :col (s/* (s/spec ::column ;(s/def ::columns (s/cat :col (s/* ::column))) (defn remove-autoinc-columns [cols] (vec (remove #(= true (:autoinc %)) cols))) (s/fdef remove-autoinc-columns :args (s/cat :cols ::columns) :ret ::columns) $(remove-autoinc-columns [{:foo "some_t"}]) ===> ExceptionInfo Call to #'de.sveri.clospcrud.s-play/remove-autoinc-columns did not conform to spec: At: [:args] val: ([{:foo "some_t"}]) fails predicate: (cat :cols :de.sveri.clospcrud.s-play/columns), Extra input :clojure.spec/args ([{:foo "some_t"}]) clojure.core/ex-info (core.clj:4617) On the other hand, running this: (s/conform ::columns [{:foo "some_t"}]) => {:col [{:foo "some_t"}]} works. So something is broken within the fdefs argument definition. I dont see my mistake here, can somone else reproduce / fix this? 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: leiningen dependency management
Hi, Thanks for your responses. I will go and try the :provided profile and see how it works out. Thanks, Sven Am Samstag, 9. April 2016 02:51:15 UTC+2 schrieb Daniel Ziltener: > > Hi Sven, > > When you're sure the project depending your library does also has a > dependency on a third library, it's best to use the ":provided" profile, > rather than declaring it in the :dev profile. In your case there are two > possible solutions: > 1. the dependency higher up wins. So if you declare the schema dependency > above the dependency on A, this should work. > 2. modify the dependency vector in B's profile.clj so that it's something > like [A "0.1.0" :exclusions [schema]]. See > https://github.com/technomancy/leiningen/blob/stable/sample.project.clj#L48 > for an example. > > I hope this helps you. > zilti > > Am Freitag, 8. April 2016 21:36:50 UTC+2 schrieb Sven Richter: >> >> Hi, >> >> I have a library A that I use in project B. Now, library A makes use of >> plumatics schema, as well as project B. I wonder what the best practice is >> here. >> Include schema in library A's dependencies? Or only declare a >> dev-dependency on schema in library A? >> >> If I declare a dev-dependency I require every project that depends on >> library A to include schema as a dependency, otherwise it will not work (I >> have seen that with database libs for instance). I find that a bit unlucky, >> because one might end up referring a lot of libs that other libraries >> depend on. >> >> Or, include it as a direct dependency in library A. But then strange >> things may happen as I had it with schema. Library A included schema v >> 1.0.5 and project B schema v 1.0.3. >> Now when I executed code in project B I had a weird schema error saying >> that something in the schema is wrong, during compile time. In the end it >> turned out that I have to require schema v 1.0.5 in project B too to make >> it work. This is even more troublesome, as I make every project, that >> depends on my library, depend on a transitive dependency in a specific >> version. >> >> Looking at gradle for instance there is a configuration called >> 'providedCompile' which means it is used for compilation of the library, >> but not a transitive dependency if I include that library. Is there >> something similar for leiningen? >> >> Best Regards, >> 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.
leiningen dependency management
Hi, I have a library A that I use in project B. Now, library A makes use of plumatics schema, as well as project B. I wonder what the best practice is here. Include schema in library A's dependencies? Or only declare a dev-dependency on schema in library A? If I declare a dev-dependency I require every project that depends on library A to include schema as a dependency, otherwise it will not work (I have seen that with database libs for instance). I find that a bit unlucky, because one might end up referring a lot of libs that other libraries depend on. Or, include it as a direct dependency in library A. But then strange things may happen as I had it with schema. Library A included schema v 1.0.5 and project B schema v 1.0.3. Now when I executed code in project B I had a weird schema error saying that something in the schema is wrong, during compile time. In the end it turned out that I have to require schema v 1.0.5 in project B too to make it work. This is even more troublesome, as I make every project, that depends on my library, depend on a transitive dependency in a specific version. Looking at gradle for instance there is a configuration called 'providedCompile' which means it is used for compilation of the library, but not a transitive dependency if I include that library. Is there something similar for leiningen? Best Regards, 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: Jolin / ragtime seeding a postgres database
Thanks to the help of a friendly slack user I figured out what the problem is. The SERIAL type does not support providing data on inserts, so: INSERT INTO tags ("name", "id") VALUES ('Java', '1') should be: INSERT INTO tags ("name") VALUES ('Java') Then everything works as expected. Coming from mysql, H2 this is a bit suprising, I feel almost like 10 years ago when trying to fit CSS styles into different browsers. Sven. Am Montag, 14. März 2016 10:53:38 UTC+1 schrieb Sven Richter: > > Hi, > > I am using joplin (which depends on ragtime) migrate and seed my > postgresql database. One of my migration files looks like this: > > CREATE TABLE tags ( > id SERIAL PRIMARY KEY, > name VARCHAR(150)) > --;; > INSERT INTO tags ("name", "id") VALUES > ('Java', '1') > > Running a migration creates the table and inserts the entry. But what it > does not do is to set the next value of the primary key column. Trying to > add a new row will result in a "duplicate primary key error". I am not sure > what ragtime is doing here exactly, Also this did not happen with H2 or > SQLITE IIRC from other projects. > One solution is to set the counter manually by running: > > SELECT setval('tags_id_seq', 1); > > It works from the postgres console, but running this as part of the > migration does not work, I get an exception: PGSQLException: Statement > returned a result, but none was expected. > > Anyone experienced something similar? Any ideas how to solve it? > > 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: Jolin / ragtime seeding a postgres database
Hi Erik, I thought about using UUIDs too for some time, but decided against it for now. So I guess this is not really a solution for me. But thanks for the hint :-) Sven. Am Montag, 14. März 2016 10:57:09 UTC+1 schrieb Erik Assum: > > Just doing some of the same, but I have a table def like > > CREATE TABLE ghost_channel (id UUID PRIMARY KEY DEFAULT > uuid_generate_v4(), name text > Which seems to generate keys for me. > > Maybe you could do something like that with your sequence as well? > > Erik. > > On 14. mar. 2016, at 10.53, 'Sven Richter' via Clojure < > clo...@googlegroups.com > wrote: > > > > Hi, > > > > I am using joplin (which depends on ragtime) migrate and seed my > postgresql database. One of my migration files looks like this: > > > > CREATE TABLE tags ( > > id SERIAL PRIMARY KEY, > > name VARCHAR(150)) > > --;; > > INSERT INTO tags ("name", "id") VALUES > > ('Java', '1') > > > > Running a migration creates the table and inserts the entry. But what it > does not do is to set the next value of the primary key column. Trying to > add a new row will result in a "duplicate primary key error". I am not sure > what ragtime is doing here exactly, Also this did not happen with H2 or > SQLITE IIRC from other projects. > > One solution is to set the counter manually by running: > > > > SELECT setval('tags_id_seq', 1); > > > > It works from the postgres console, but running this as part of the > migration does not work, I get an exception: PGSQLException: Statement > returned a result, but none was expected. > > > > Anyone experienced something similar? Any ideas how to solve it? > > > > Thanks, > > Sven > > > > -- > > 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 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.
Jolin / ragtime seeding a postgres database
Hi, I am using joplin (which depends on ragtime) migrate and seed my postgresql database. One of my migration files looks like this: CREATE TABLE tags ( id SERIAL PRIMARY KEY, name VARCHAR(150)) --;; INSERT INTO tags ("name", "id") VALUES ('Java', '1') Running a migration creates the table and inserts the entry. But what it does not do is to set the next value of the primary key column. Trying to add a new row will result in a "duplicate primary key error". I am not sure what ragtime is doing here exactly, Also this did not happen with H2 or SQLITE IIRC from other projects. One solution is to set the counter manually by running: SELECT setval('tags_id_seq', 1); It works from the postgres console, but running this as part of the migration does not work, I get an exception: PGSQLException: Statement returned a result, but none was expected. Anyone experienced something similar? Any ideas how to solve it? 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] Graclj 0.1.0 -- New Gradle Plugin for Clojure
I wanted to thank you for stepping up on this. As gradle is getting more and more used in a lot of environments a working clojure plugin for gradle would be awesome. Best Regards, Sven Am Montag, 15. Februar 2016 03:11:00 UTC+1 schrieb Andrew Oberstar: > > I just released the first version of Graclj, which is a new Gradle plugin > for Clojure. The goal is to make something that feels native to Gradle, > while giving the creature comforts Clojurians are used to from lein or > boot. For those familiar with Gradle, this targets their new (and still > evolving) software model support. > > Current features include: > > - Packaging Clojure code into JARs > - AOT compilation > - clojure.test execution > - Publishing to any repo supported by Gradle (including Clojars) > > I wouldn't suggest dropping your current build tool yet, but if you'd like > to try it out, you can walk through the learning-graclj repo. I'd welcome > any feedback on the plugin or documentation. > > Source: https://github.com/graclj/graclj > Documentation: > https://github.com/graclj/learning-graclj/tree/learning-0.1.0 > > Thanks, > Andrew Oberstar > > -- 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: [ClojureScript] Re: [ANN] modern-cljs - 17th tutorial - REPLing with Enlive
Hi Yuri, I followed to the CLJ bug and as far as I understood Alex said that clojure is not related to this. This is also my thinking. NTF has different semantics regarding file locking than linux. And I guess that's the problem, probably the adzerk team never tried it on windows themselves. Despite that I just gave it a try with 1.8.0-RC4 and the same error occurs. Best Regards, Sven Am Samstag, 26. Dezember 2015 14:55:30 UTC+1 schrieb Yuri Steinschreiber: > > From what I understand by looking at the Boot file access bugs, they are > actually Clojure problems (open file leaks) fixed in 1.8, so you might want > to give it a try using 1.8 Release Candidate. > > Cheers……..Yuri > > > *From: *'Sven Richter' via ClojureScript > *Sent: *Friday, December 25, 2015 1:08 PM > *To: *Clojure > *Cc: *clojur...@googlegroups.com > *Subject: *Re: [ClojureScript] Re: [ANN] modern-cljs - 17th tutorial - > REPLing with Enlive > > > > Hm, > > Thats interesting, the first time I tried boot (when it was officially > anounced) on W7 it did not work for me (one of the already existing issues > hit me). > As I read this announcement here I tried it again, before writing my > answer. > What I did was to to install the latest boot and clone: > https://github.com/martinklepsch/tenzing and then run boot dev in the > repl. > After changing the only cljs file the File*Access*Exception occured. Again > this was on W7. > > Maybe they changed something within the file access code in W10. > > Still I want to argue that a lot of business runs on Windows, especially > development environments. Especially given the fact the the JVM runs on > many different platforms I would prefer that also the clojure tooling runs > on these platforms. > > Of course this is only my opinion, but still I am concerned about that > move. > > Best Regards, > Sven > > Am Freitag, 25. Dezember 2015 18:02:28 UTC+1 schrieb Sean Corfield: > > Sven Richter wrote on Wednesday, December 23, 2015 at 11:33 PM: > > While I appreciate everyones work and also like boots approach to building > clojure libs I want to remind you that boot still does not work on windows. > > > > I’ve been using Boot extensively on Windows 10 for the last few weeks and > it seems to work pretty flawlessly. The only glitch I’ve seen is in Git > Bash where `boot repl` hangs (it works perfectly in the regular CMD window). > > > > Whilst my main development setup is OS X — and I agree that the Clojure > ecosystem in general favors *nix-like environments — I’ve done almost all > my Boot learning on my Windows 10 laptop while watching TV in the evenings, > including developing the boot-expectations library (to run Expectations in > a pod in Boot), before embarking on using Boot on OS X for work (we have > almost completed a switch from Leiningen to Boot — I’m expecting it to be > fully complete on dev/QA today). > > > > Sean > > > > -- > Note that posts from new members are moderated - please be patient with > your first post. > --- > You received this message because you are subscribed to the Google Groups > "ClojureScript" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojurescrip...@googlegroups.com . > To post to this group, send email to clojur...@googlegroups.com > . > Visit this group at https://groups.google.com/group/clojurescript. > > > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- 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: [ClojureScript] Re: [ANN] modern-cljs - 17th tutorial - REPLing with Enlive
Hm, Thats interesting, the first time I tried boot (when it was officially anounced) on W7 it did not work for me (one of the already existing issues hit me). As I read this announcement here I tried it again, before writing my answer. What I did was to to install the latest boot and clone: https://github.com/martinklepsch/tenzing and then run boot dev in the repl. After changing the only cljs file the File*Access*Exception occured. Again this was on W7. Maybe they changed something within the file access code in W10. Still I want to argue that a lot of business runs on Windows, especially development environments. Especially given the fact the the JVM runs on many different platforms I would prefer that also the clojure tooling runs on these platforms. Of course this is only my opinion, but still I am concerned about that move. Best Regards, Sven Am Freitag, 25. Dezember 2015 18:02:28 UTC+1 schrieb Sean Corfield: > > Sven Richter wrote on Wednesday, December 23, 2015 at 11:33 PM: > > While I appreciate everyones work and also like boots approach to building > clojure libs I want to remind you that boot still does not work on windows. > > > I’ve been using Boot extensively on Windows 10 for the last few weeks and > it seems to work pretty flawlessly. The only glitch I’ve seen is in Git > Bash where `boot repl` hangs (it works perfectly in the regular CMD window). > > Whilst my main development setup is OS X — and I agree that the Clojure > ecosystem in general favors *nix-like environments — I’ve done almost all > my Boot learning on my Windows 10 laptop while watching TV in the evenings, > including developing the boot-expectations library (to run Expectations in > a pod in Boot), before embarking on using Boot on OS X for work (we have > almost completed a switch from Leiningen to Boot — I’m expecting it to be > fully complete on dev/QA today). > > Sean > > -- 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] modern-cljs - 17th tutorial - REPLing with Enlive
Also I just added a new doc issue: https://github.com/boot-clj/boot/issues/368 Am Donnerstag, 24. Dezember 2015 09:12:16 UTC+1 schrieb Sven Richter: > > Hi Mimmo, > > No problem, I was afraid that you are not aware of it. I guess a lot of > people are not. In fact there have been windows issues made aware to the > developers of boot for a long time: > https://github.com/boot-clj/boot/issues?utf8=%E2%9C%93=is%3Aissue+is%3Aopen+windows > > If they work on them or not is their decision. Like I said, I don't care > about OS either, in fact I have been a linux proponent since the mid > 90-ies, but not everyone is and we should be aware of that. > > Of course you also have to decide for yourself how you handle that, now > you know the consequences. > > Have a merry christmas too, > Sven > > Am Donnerstag, 24. Dezember 2015 09:02:30 UTC+1 schrieb Magomimmo: >> >> Hi Sven, >> it was not my intention to exclude anyone. It's just that I never used >> windows in my life (if I exclude a short period in which I used VisualJ++ >> because was amazingly faster than the Sun counterpart Java IDE (around >> 1997). >> >> I'll appreciate any contribution from anyone skilled in that OS, because >> I don't even have a windows OS to test boot and I did not even known that >> boot does not run on windows, considering that in the readme you can read >> about it. >> >> https://github.com/boot-clj/boot#windows >> >> So, sorry about that. This is something the boot maintainers should work >> on. >> >> that said, I think that even windows users could use boot via a virtual >> machine or a Linux containers (e.g. docker). >> >> To me the OS is just a commodity, as it is the JVM too. I just don't care >> about them until they create me a problem. >> >> Have great holidays! >> >> mimmo >> >> On Thursday, December 24, 2015 at 8:33:50 AM UTC+1, Sven Richter wrote: >> > Hi, >> > >> > While I appreciate everyones work and also like boots approach to >> building clojure libs I want to remind you that boot still does not work on >> windows. >> > Therefore you are excluding every windows user from your tutorial. >> > >> > I am not sure if I was into clojure as I am today if some of the >> tutorials just would not have worked when I started learning it. >> > >> > I don't know how many people here are using windows vs linux, also I >> don't want to start an OS war, but I know for sure that there is a lot of >> business developers that are using windows only and by moving more and more >> to boot we are closing a gate here as long as boot does not support >> windows. >> > >> > Best Regards, >> > Sven >> > >> > Am Sonntag, 20. Dezember 2015 18:47:14 UTC+1 schrieb Magomimmo: >> > Hi all, >> > >> > I just published the 17th tutorial- REPLing with Enlive - of >> the modern-cljs series. >> > It has been realy easy to port the first edition of the tutorial, which >> was based on leiningen/cljsbuild, to boot build tool (release 4.2.3 at the >> moment). I'm really impressed by the signal/noise ratio of boot vs. >> leiningen/cljsbuild and it has been really easy as well to create >> a TDD environment which includes live coding with the REPL (both a CLJ REPL >> and a CLJS REPL). There is still room for improvement to better support a >> tight TDD worflow (i.e. dinamically filter test nameaspaces in the test and >> the test-cljs tasks). I'm pretty sure the boot community will quickly fix >> that issue. >> > >> https://github.com/magomimmo/modern-cljs/blob/master/doc/second-edition/tutorial-17.md >> >> > HIH >> > mimmo >> > -- 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] modern-cljs - 17th tutorial - REPLing with Enlive
Hi Mimmo, No problem, I was afraid that you are not aware of it. I guess a lot of people are not. In fact there have been windows issues made aware to the developers of boot for a long time: https://github.com/boot-clj/boot/issues?utf8=%E2%9C%93=is%3Aissue+is%3Aopen+windows If they work on them or not is their decision. Like I said, I don't care about OS either, in fact I have been a linux proponent since the mid 90-ies, but not everyone is and we should be aware of that. Of course you also have to decide for yourself how you handle that, now you know the consequences. Have a merry christmas too, Sven Am Donnerstag, 24. Dezember 2015 09:02:30 UTC+1 schrieb Magomimmo: > > Hi Sven, > it was not my intention to exclude anyone. It's just that I never used > windows in my life (if I exclude a short period in which I used VisualJ++ > because was amazingly faster than the Sun counterpart Java IDE (around > 1997). > > I'll appreciate any contribution from anyone skilled in that OS, because I > don't even have a windows OS to test boot and I did not even known that > boot does not run on windows, considering that in the readme you can read > about it. > > https://github.com/boot-clj/boot#windows > > So, sorry about that. This is something the boot maintainers should work > on. > > that said, I think that even windows users could use boot via a virtual > machine or a Linux containers (e.g. docker). > > To me the OS is just a commodity, as it is the JVM too. I just don't care > about them until they create me a problem. > > Have great holidays! > > mimmo > > On Thursday, December 24, 2015 at 8:33:50 AM UTC+1, Sven Richter wrote: > > Hi, > > > > While I appreciate everyones work and also like boots approach to > building clojure libs I want to remind you that boot still does not work on > windows. > > Therefore you are excluding every windows user from your tutorial. > > > > I am not sure if I was into clojure as I am today if some of the > tutorials just would not have worked when I started learning it. > > > > I don't know how many people here are using windows vs linux, also I > don't want to start an OS war, but I know for sure that there is a lot of > business developers that are using windows only and by moving more and more > to boot we are closing a gate here as long as boot does not support > windows. > > > > Best Regards, > > Sven > > > > Am Sonntag, 20. Dezember 2015 18:47:14 UTC+1 schrieb Magomimmo: > > Hi all, > > > > I just published the 17th tutorial- REPLing with Enlive - of > the modern-cljs series. > > It has been realy easy to port the first edition of the tutorial, which > was based on leiningen/cljsbuild, to boot build tool (release 4.2.3 at the > moment). I'm really impressed by the signal/noise ratio of boot vs. > leiningen/cljsbuild and it has been really easy as well to create > a TDD environment which includes live coding with the REPL (both a CLJ REPL > and a CLJS REPL). There is still room for improvement to better support a > tight TDD worflow (i.e. dinamically filter test nameaspaces in the test and > the test-cljs tasks). I'm pretty sure the boot community will quickly fix > that issue. > > > https://github.com/magomimmo/modern-cljs/blob/master/doc/second-edition/tutorial-17.md > > > HIH > > mimmo > -- 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] modern-cljs - 17th tutorial - REPLing with Enlive
Hi, While I appreciate everyones work and also like boots approach to building clojure libs I want to remind you that boot still does not work on windows. Therefore you are excluding every windows user from your tutorial. I am not sure if I was into clojure as I am today if some of the tutorials just would not have worked when I started learning it. I don't know how many people here are using windows vs linux, also I don't want to start an OS war, but I know for sure that there is a lot of business developers that are using windows only and by moving more and more to boot we are closing a gate here as long as boot does not support windows. Best Regards, Sven Am Sonntag, 20. Dezember 2015 18:47:14 UTC+1 schrieb Magomimmo: > > Hi all, > I just published the 17th tutorial- REPLing with Enlive - of > the modern-cljs series. > It has been realy easy to port the first edition of the tutorial, which > was based on leiningen/cljsbuild, to boot build tool (release 4.2.3 at > the moment). I'm really impressed by the signal/noise ratio of boot vs. > leiningen/cljsbuild and it has been really easy as well to create a TDD > environment > which includes live coding with the REPL (both a CLJ REPL and a CLJS > REPL). There is still room for improvement to better support a tight TDD > worflow (i.e. dinamically filter test nameaspaces in the test and the > test-cljs tasks). I'm pretty sure the boot community will quickly fix > that issue. > > https://github.com/magomimmo/modern-cljs/blob/master/doc/second-edition/tutorial-17.md > HIH > mimmo > -- 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: Streamlining dev environment startup
It definitly is compatible. It just takes some manual work. Like I said, I started myself with the luminus template and implement components + other stuff into it. You can definitly do it and I also recommend it for the sole reason that a change to the routes in compojure will lead to a restart of the repl. You can circumvent that by reloading the code base. It may have changed in the last two years, but then I am not up to date. Best Regards, Sven Am Mittwoch, 2. Dezember 2015 22:05:58 UTC+1 schrieb Webdev Tory Anderson: > > Maybe I spoke too soon when mentioning incompatibility between Luminus and > Reloaded. I look forward to taking a closer look at your work! > > On Wednesday, December 2, 2015 at 1:49:20 AM UTC-7, Sven Richter wrote: >> >> Hi, >> >> I based a template on luminus myself and added some stuff. It also >> contains predefined components so you don't have to add it yourself. >> You can look how its done here: >> https://github.com/sveri/closp/tree/master/resources/leiningen/new/closp/clj/components >> >> Best Regards, >> Sven >> >> Am Dienstag, 1. Dezember 2015 17:43:41 UTC+1 schrieb Colin Yates: >>> >>> The general idea is to use the ‘reloaded’ pattern, so rather than `lein >>> run` you would have a function which starts and stop the system. You still >>> need to run figwheel and mongo (yay for document databases) as separate >>> processes, although I tend to do those in straight terminals rather than >>> emacs shells as they live longer than my emacs does. >>> >>> You can find more about the reloaded pattern and a prescripted approach >>> to structuring your app here: https://github.com/stuartsierra/component. >>> >>> I think it is fairly common to have: >>> - your major building blocks as components >>> - a specific dev namespace which is only on the :dev profile >>> - fns in that namespace to start/stop components or the entire system >>> >>> There are some libraries which build on the component library: >>> https://github.com/danielsz/system for example. >>> >>> HTH. >>> >>> On 1 Dec 2015, at 16:26, Webdev Tory Anderson <web...@toryanderson.com> >>> wrote: >>> >>> I recently read something hinting at ways of streamlining the startup >>> process for the dev environment, so I'm hoping you good folks can give me >>> some tips. I'm developing a web app in Linux, Clojurescript/Clojure >>> (incidentally using the Luminus architecture). I use emacs (that part's >>> non-negotiable; sorry). The cumbersome startup process I usually have goes >>> like this: >>> >>> M-x shell >>>> mongod # start the mongo daemon >>>> >>>> M-x shell >>>> lein run # start the app and server >>>> >>>> M-x shell >>>> lein figwheel #start CLJS development >>>> >>>> (open a .clj file) >>>> C-c M-c # (cider-connect) >>>> # insert localhost, port num, which proj. to connect to >>>> >>>> >>> This is usually bearable since I only have to do it once or twice a >>> week, but it's definitely the sort of redundancy that would be nice to >>> eliminate. The "lein run" is good to have foregrounded because I can see >>> timbre statements and cleanly reboot when necessary. Figwheel, at the >>> moment, has to be foregrounded because that's where the figwheel prompt >>> ends up (I'd love to have that in Cider somehow, though). >>> >>> Any recommendations on how to chop some of these steps off? >>> >>> >>> >>> -- >>> 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 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: Streamlining dev environment startup
Hi, I based a template on luminus myself and added some stuff. It also contains predefined components so you don't have to add it yourself. You can look how its done here: https://github.com/sveri/closp/tree/master/resources/leiningen/new/closp/clj/components Best Regards, Sven Am Dienstag, 1. Dezember 2015 17:43:41 UTC+1 schrieb Colin Yates: > > The general idea is to use the ‘reloaded’ pattern, so rather than `lein > run` you would have a function which starts and stop the system. You still > need to run figwheel and mongo (yay for document databases) as separate > processes, although I tend to do those in straight terminals rather than > emacs shells as they live longer than my emacs does. > > You can find more about the reloaded pattern and a prescripted approach to > structuring your app here: https://github.com/stuartsierra/component. > > I think it is fairly common to have: > - your major building blocks as components > - a specific dev namespace which is only on the :dev profile > - fns in that namespace to start/stop components or the entire system > > There are some libraries which build on the component library: > https://github.com/danielsz/system for example. > > HTH. > > On 1 Dec 2015, at 16:26, Webdev Tory Anderson> wrote: > > I recently read something hinting at ways of streamlining the startup > process for the dev environment, so I'm hoping you good folks can give me > some tips. I'm developing a web app in Linux, Clojurescript/Clojure > (incidentally using the Luminus architecture). I use emacs (that part's > non-negotiable; sorry). The cumbersome startup process I usually have goes > like this: > > M-x shell >> mongod # start the mongo daemon >> >> M-x shell >> lein run # start the app and server >> >> M-x shell >> lein figwheel #start CLJS development >> >> (open a .clj file) >> C-c M-c # (cider-connect) >> # insert localhost, port num, which proj. to connect to >> >> > This is usually bearable since I only have to do it once or twice a week, > but it's definitely the sort of redundancy that would be nice to eliminate. > The "lein run" is good to have foregrounded because I can see timbre > statements and cleanly reboot when necessary. Figwheel, at the moment, has > to be foregrounded because that's where the figwheel prompt ends up (I'd > love to have that in Cider somehow, though). > > Any recommendations on how to chop some of these steps off? > > > > -- > 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 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] ring-transit-middleware 0.1.1
Hi Atamert, Thanks for your work. I am curious. What is the difference to ring-transit (https://github.com/jalehman/ring-transit). Both libraries seem to have the same goal. Best Regards, Sven Am Samstag, 31. Oktober 2015 14:30:21 UTC+1 schrieb Atamert Ölçgen: > > Hi, > > I've just released ring-transit-middleware 0.1.1 to clojars. > > - It has sane defaults, most of the time you just need to wrap with > ring.middleware.transit/wrap-transit > - Allows customisation (see API docs) > - Is Aleph-aware (handles deferred responses) > > https://github.com/muhuk/ring-transit-middleware > > Your feedback & contributions are welcome. > > > -- > Kind Regards, > Atamert Ölçgen > > ◻◼◻ > ◻◻◼ > ◼◼◼ > > www.muhuk.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: Clojure Dev Environment
Hi Miguel, When I started clojure and web development I faced the same questions for some long time. Also it took me a lot to figure out how to have the best developer experience (regarding web stuff). All my findings boil down into this leiningen template: https://github.com/sveri/closp It delivers * two different environments (development and production) * figwheel for clojurescript during development (no need to restart) * a combination of components and ring dev environment for not having to restart the JVM While figwheel delivers everything needed for cljs side it was not so easy for clojure development. The trickiest part was to make the reloading of namespaces work in a web environment, I tried several libraries, but none gave the full experience. So I chose to integrate Stuart Sierras component library. This wayI finally gained hot code deployment where it works, templates reloading (selmer templates) and a manual restarting option, which I only need when I change compojure routes. Manual restart does not mean to restart the server, but running a "restart" function which will just reload all changed namespace and pick up changed routes. You might want to try it out or just look at this namespace: https://github.com/sveri/closp/tree/master/resources/leiningen/new/closp/clj/components plus https://github.com/sveri/closp/blob/master/resources/leiningen/new/closp/clj/user.clj I do all this using a command line for fighweel and cursive with a repl started inside cursive for the server environment. Best Regards, Sven PS: It might be that the template does not compile currently, if so, you just have to adopt the namespace that the compiler complains about. I will fix that in the next version. Am Montag, 5. Oktober 2015 12:00:37 UTC+2 schrieb Miguel Ping: > > Hi Guys, > > I've been doing some personal clj for a while, but I never quite grokked > the whole REPL thing. I normally use Lighttable and/or Cursive as editors, > I can set up breakpoints and debug the code, but for web I'd like to know > how seasoned developers work. > AFAIK people fire up the repl and "do everything from there" but I still > don't understand some parts: > > - do you code functions in the repl and copy them to respective files? > - do you edit files directly and hook them into the repl? > - how do you set breakpoints? > - can you do hot-replacement easily? I always see a bunch of stack traces > while using lein and ring with reload flags > - is there an article or screencast explaining the "feel" of this? > > My current worfklow is just starting > lein ring server and developing, > but my general impression is that I need to restart it sometimes. > > As I understand it, the repl workflow is very much a lisp thing. > Thanks! > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
map over a Map with conditional conj
Hi, I find myself repeating a certain pattern from time to time. I have a map like this: {:answer_correct_1 2 :answer_correct_3 4 :foo bar} There is a hidden index answer_correct_idx which might range from 1 to x. So, what I want is to iterate over the map and produce a vec of maps given some other fields like this: [{:id 123 :answer_correct_1 2} {:id 123 :answer_correct_3 4} ...] The pattern that I use then is reduce like this: (reduce (fn [a b] (let [id-correct (keyword (str answer_correct_ b))] (if (id-correct params) (conj a {:question_id q-id :user_id user-id :answer_id (id-correct params)}) a))) [] (range 1 11)) If have an if condition inside the reduce and then either conj or return the unchanged vec. This works. But I wondered if there is a higher abstraction for it and a very nice guy on slack proposed this: (let [-id (comp keyword (partial str answer_correct_))] (map (partial hash-map :question_id q-id :user_id user-id :answer_id) (keep (partial get params) (map -id (range 1 11) It also works, but, regarding readibility I don't think it's easier to get (this is subjective of course). Are there other ways to achieve the same? Maybe something a bit more dense? 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: map over a Map with conditional conj
Hi Moe, Thanks, i didn't know about :when and :let in for. That is my favorite so far, small and readable, looks good. Sven Am Dienstag, 25. August 2015 11:17:23 UTC+2 schrieb Moe Aboulkheir: Sven, To me, the keep version would be a lot more readable if it were creating a literal map in a fn. I think (for) is almost always the right thing. It's not as fun to write, but much easier to read: (for [i (range 1 11) :let [id (keyword (str answer_correct_ i))] :when (params id)] {:question_id q-id :user_id user-id :answer_id (params id)}) It's possible to shrink the reduce, but I prefer the above. (reduce (fn [acc i] (let [id-correct (- i (str answer_correct_) keyword params)] (cond- acc id-correct (conj {:question_id q-id :user_id user-id :answer_id id-correct})) )) [] (range 1 11)) Take care, Moe On Tue, Aug 25, 2015 at 9:42 AM, Sven Richter sve...@googlemail.com javascript: wrote: Hi, I find myself repeating a certain pattern from time to time. I have a map like this: {:answer_correct_1 2 :answer_correct_3 4 :foo bar} There is a hidden index answer_correct_idx which might range from 1 to x. So, what I want is to iterate over the map and produce a vec of maps given some other fields like this: [{:id 123 :answer_correct_1 2} {:id 123 :answer_correct_3 4} ...] The pattern that I use then is reduce like this: (reduce (fn [a b] (let [id-correct (keyword (str answer_correct_ b))] (if (id-correct params) (conj a {:question_id q-id :user_id user-id :answer_id (id-correct params)}) a))) [] (range 1 11)) If have an if condition inside the reduce and then either conj or return the unchanged vec. This works. But I wondered if there is a higher abstraction for it and a very nice guy on slack proposed this: (let [-id (comp keyword (partial str answer_correct_))] (map (partial hash-map :question_id q-id :user_id user-id :answer_id) (keep (partial get params) (map -id (range 1 11) It also works, but, regarding readibility I don't think it's easier to get (this is subjective of course). Are there other ways to achieve the same? Maybe something a bit more dense? Thanks, Sven -- 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 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.
Code Review
HI, I just posted a question to stackoverflows code review page:http://codereview.stackexchange.com/questions/90809/remove-lines-from-a-2d-vec-in-clojure As there is not much traffic regarding clojure I also double post to this list in the hope to get some good answers. You might respond here or there, whatever you like best. I have some code here that I am very unhappy with. The task I am trying to accomplish is this. Given a 2d vec like this: [[0 2 0] [1 3 5] [3 3 0]] which can contain positive ints including zero I want to remove all _lines_ that are greater zero. Whereas the definition of _line_ is the following: A _line_ is represented by the position n in every vec inside the 2d vec. So my example above has three lines: [0 1 3], [2 3 3] and [0 5 0]. The line that I want to remove from it according to my algortihm is **[2 3 3]** because every element is greater than zero. So my 2d vec would now look like this: [[0 0] [1 5] [3 0]] And finally I want to pad the vecs to their original size filling them with zero for every removed line, so that it looks finally like this: [[0 0 0] [0 1 5] [0 3 0]] This is what I came up with: (defn in? true if seq contains elm [seq elm] (some #(= elm %) seq)) (defn not-in? true if seq does not contain elm [seq elm] (not (in? seq elm))) (defn all-greater-zero-at Given a 2-d vec [[0 1] [0 2]] return true if all elements at 'at' are greater than zero [v at] (not-in? (map #(if ( (nth % at) 0) true false) v) false)) (defn to-be-removed Returns a seq of positions to be removed (0 3 4) [v width] (reduce (fn [a b] (if (all-greater-zero-at v b) (conj a b) a)) [] (range width))) (defn remove-at Removes an element from a 1d vec [v at] (into [] (concat (subvec v 0 at) (subvec v (+ at 1) (count v) (defn insert-at inserts an element into a 1d vec [v elm at] (into [] (concat (subvec v 0 at) elm (subvec v at (count v) (defn remove-and-replace-all-at [v at] (map #(insert-at (remove-at % at) [0] at) v)) (defn replace-full-by-zero [v width] (reduce (fn [a b] (remove-and-replace-all-at a b)) v (to-be-removed v width))) (defn remove-zeros [v at] (reduce (fn [a b] (conj a (remove-at b at))) [] v)) (defn fill-with-zeros Takes a 2d vec and pads ith with zeros up to width [v width] (map #(into [] (concat (take (- width (count (first v))) (repeat 0)) %)) v)) (defn clean-grid removes all full lines [fbz tbr] (loop [acc fbz tbr tbr i 0] (if (empty? tbr) acc (recur (remove-zeros acc (- (first tbr) i)) (rest tbr) (inc i) (defn remove-full-lines [v width] (let [fbz (replace-full-by-zero v width) tbr (to-be-removed v width) cleaned-grid (clean-grid fbz tbr)] (into [] (fill-with-zeros cleaned-grid width This seems like a lot of code for such a simple algorithm and I assume there are a lot of better ways to do that, but just did not come up with a better one, so, please, go ahead and fix it, if you want to :-) Best Regards, 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: Code Review
Thanks to both of you, this looks more like what I am used to with clojure. The transpose function is the trick here :-) Best Regards, Sven Am Freitag, 15. Mai 2015 10:35:11 UTC+2 schrieb Ray Miller: If I've understood the problem correctly, you can simplify the code by implementing a transpose function: (defn transpose [xs] (apply map vector xs)) Then define a wanted? function for filtering the lines you want to include: (defn wanted? [xs] (some zero? xs)) ...and a helper function to left-pad a vector with zeroes: (defn lpad [n xs] (vec (concat (repeat (- n (count xs)) 0) xs))) So your main function would look something like: (defn process [xs] (let [n (count (first xs))] (vec (map (partial lpad n) (transpose (filter wanted? (transpose xs))) On 15 May 2015 at 09:01, Sven Richter sve...@googlemail.com javascript: wrote: HI, I just posted a question to stackoverflows code review page: http://codereview.stackexchange.com/questions/90809/remove-lines-from-a-2d-vec-in-clojure As there is not much traffic regarding clojure I also double post to this list in the hope to get some good answers. You might respond here or there, whatever you like best. I have some code here that I am very unhappy with. The task I am trying to accomplish is this. Given a 2d vec like this: [[0 2 0] [1 3 5] [3 3 0]] which can contain positive ints including zero I want to remove all _lines_ that are greater zero. Whereas the definition of _line_ is the following: A _line_ is represented by the position n in every vec inside the 2d vec. So my example above has three lines: [0 1 3], [2 3 3] and [0 5 0]. The line that I want to remove from it according to my algortihm is **[2 3 3]** because every element is greater than zero. So my 2d vec would now look like this: [[0 0] [1 5] [3 0]] And finally I want to pad the vecs to their original size filling them with zero for every removed line, so that it looks finally like this: [[0 0 0] [0 1 5] [0 3 0]] This is what I came up with: (defn in? true if seq contains elm [seq elm] (some #(= elm %) seq)) (defn not-in? true if seq does not contain elm [seq elm] (not (in? seq elm))) (defn all-greater-zero-at Given a 2-d vec [[0 1] [0 2]] return true if all elements at 'at' are greater than zero [v at] (not-in? (map #(if ( (nth % at) 0) true false) v) false)) (defn to-be-removed Returns a seq of positions to be removed (0 3 4) [v width] (reduce (fn [a b] (if (all-greater-zero-at v b) (conj a b) a)) [] (range width))) (defn remove-at Removes an element from a 1d vec [v at] (into [] (concat (subvec v 0 at) (subvec v (+ at 1) (count v) (defn insert-at inserts an element into a 1d vec [v elm at] (into [] (concat (subvec v 0 at) elm (subvec v at (count v) (defn remove-and-replace-all-at [v at] (map #(insert-at (remove-at % at) [0] at) v)) (defn replace-full-by-zero [v width] (reduce (fn [a b] (remove-and-replace-all-at a b)) v (to-be-removed v width))) (defn remove-zeros [v at] (reduce (fn [a b] (conj a (remove-at b at))) [] v)) (defn fill-with-zeros Takes a 2d vec and pads ith with zeros up to width [v width] (map #(into [] (concat (take (- width (count (first v))) (repeat 0)) %)) v)) (defn clean-grid removes all full lines [fbz tbr] (loop [acc fbz tbr tbr i 0] (if (empty? tbr) acc (recur (remove-zeros acc (- (first tbr) i)) (rest tbr) (inc i) (defn remove-full-lines [v width] (let [fbz (replace-full-by-zero v width) tbr (to-be-removed v width) cleaned-grid (clean-grid fbz tbr)] (into [] (fill-with-zeros cleaned-grid width This seems like a lot of code for such a simple algorithm and I assume there are a lot of better ways to do that, but just did not come up with a better one, so, please, go ahead and fix it, if you want to :-) Best Regards, Sven -- 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
Re: Clojure needs a web framework with more momentum
Hi, I had a short chat with Dmitri (the owner of luminus) and we both agreed that this is a good plan. I just don't have much time right now (family things), but as soon as there is more I will develop a prototype, integrating the features of closp and closp-crud into luminus and make them available as a luminus profile. Best Regards, Sven Am Mittwoch, 6. Mai 2015 18:08:03 UTC+2 schrieb Sven Pedersen: Hey Sven, It looks to me like you could really polish the +auth part and integrate most of that part of closp into Luminus. I'd be happy to help with that. Then you could make a +closp that depends on +auth and build the UI parts, etc. Having a working +auth with a default db configuration, possibly with both yesql and korma as back end options, would make auth/authz trivial to set up. Then you could also focus on what makes closp unique. --Sven On Tuesday, May 5, 2015 at 1:27:21 AM UTC-4, Sven Richter wrote: Hi Dmitri, When I was building closp I was taking luminus as the base for it with some minor adoptions. I just had a look at the website of luminus and saw the massive amount of work you put into the documentation again. If that sounds reasonable for you I'd like to try to move closp and closp-crud to luminus as an opionated part of it. So if you call lein new luminus projectname +closp you will basically get what you get now with closp. You can look here for the additions: https://github.com/sveri/closp. I would like to maintain that branch. I am not sure if that will work out the way I think, but I'd like to evaluate it at least. It would be nice to have a common base and a common documentation for it. Best Regards, Sven Am Dienstag, 5. Mai 2015 02:38:41 UTC+2 schrieb Dmitri: As others have pointed out the comparison isn't really valid. Luminus intentionally aims to leverage existing libraries that are maintained independently whenever possible. I've been doing web dev with Clojure for the past 4 years and overall I do prefer the approach of using composable libraries over monolithic frameworks. With the Clojure web stack it's much easier to tell what's actually happening during the request/response lifecycle as things tend to be explicit. With frameworks like Rails a lot of stuff happens implicitly and requires a lot of in depth knowledge to work with effectively. However, there are a some downsides to the libraries over frameworks approach as well. The biggest issue is that it's difficult to track what libraries are actively maintained and which ones play nicely together. Since most libraries are maintained by individuals it's common for them to become abandoned. Another problem is that each app becomes a unique snowflake since there aren't a lot of established patterns for structuring them. Finally, security is an issue for Clojure web apps as a lot of it done in rather ad hoc fashion. While this works great for people who are well versed in the Clojure web ecosystem it's a huge barrier for newcomers. I think that the best way to address the problem is via organizations where related projects are maintained by groups of contributors. This helps discovery of projects, and it helps spread the burden of maintenance for them. This approach is already working in the wild on GitHub with Ring, Reagent, and Luminus orgs. Meanwhile, Leiningen templates are a great way to provide reasonable defaults for different types of applications and can be used to address issues such as security. Also, I'm certainly open to contributions for Luminus. I moved it to an org recently and new members would be very welcome. :) On Saturday, May 2, 2015 at 4:43:53 PM UTC-4, g vim wrote: I recently did some research into web frameworks on Github. Here's what I found: FRAMEWORK LANG CONTRIBUTORS COMMITS LuminusClojure28678 CaribouClojure 2275 BeegoGolang991522 PhoenixElixir 1241949 YesodHaskell 1303722 LaravelPHP2684421 PlayScala 4176085 SymfonyPHP113020914 RailsRuby 269151000 One could conclude from this that the Clojure community isn't that interested in web development but the last Clojure survey suggests otherwise. Clojure's library composition approach to everything only goes so far with large web applications, as Aaron Bedra reminded us in March last year: www.youtube.com/watch?v=CBL59w7fXw4 . Less manpower means less momentum and more bugs. Furthermore, I have a hunch that Clojure's poor adoption as indicated by Indeed.com maybe due to this immaturity in the web framework sphere. Why is it that Elixir, with a much smaller community and lifespan than Clojure's, has managed
Re: Clojure needs a web framework with more momentum
So, what I gather from this discussion are the following points. Clojure needs a webframework that is - fully documented - easy for beginners to use - opinionated about the libraries - structured - composable - has something nice like django's admin backend - a vibrant community support - a shopping card (whereas I would see that fit into an external library) I agree that we have almost everything we need in the form of single libraries. And I think a mix of leiningen templates and plugins is the way to go here. The reason for the last statement is my experience with django. The admin UI is awesome and it fullfills 95% of your needs, but for the rest of it to make it work I had to start hacking my local django source, which is PITA obv. I would refrain from doing some magic that only works in a specific context, but instead just generate code that is put into a fixed structure and works. The advantage is, one can change the code all the time if one needs to. All in all this is basically the direction I want to go with closp and closp-crud. The intention is not to have a webframework, but to automatize steps that need to be done manually otherwise. I am open for everything in that area, as long as it stays in the limits I stated above, so, if someone wants to join, he is welcome. I would also go the other way around and put efforts into someone elses project, if that makes sense. Am Montag, 4. Mai 2015 07:43:43 UTC+2 schrieb puzzler: On Sat, May 2, 2015 at 11:12 PM, Sven Richter sve...@googlemail.com javascript: wrote: Reading through all the discussion I don't get which features you are actually missing. I love luminus and did a lot with it, however, for me it was missing some standard stuff, that's why I put together closp, which is just another leiningen template providing some more features out of the box. I'd consider adding even more features if you would become more specific in terms of features. For me, one of the killer features that keeps me coming back to Python/Django for web development is the auto-generated admin interface that lets non-programmers add new content to the database. Clojure's Caribou is the only Clojure system I've seen to offer something similar, but as I recall, Caribou is no longer being actively developed. -- 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 needs a web framework with more momentum
Am Montag, 4. Mai 2015 14:09:35 UTC+2 schrieb Sean Johnson: On Monday, May 4, 2015 at 4:41:02 AM UTC-4, Sven Richter wrote: All in all this is basically the direction I want to go with closp and closp-crud. The intention is not to have a webframework, but to automatize steps that need to be done manually otherwise. One potential problem with this web framework as app template approach is upgrade-ability. When 2.0 of your framework comes out, what happens to an app generated from 1.0 that wants to benefit from the new capabilities? I thought about it and all that came to my mind that there simply won't be an upgrade path. Once you generated your code / templates / whatever you are done and up to yourself. Having a supported upgrade path might be 1. to much for one or two persons to handle 2. Incompatible to the generate everything approach as one would have to make sure that old code, enriched with user code (which can be anything), still works with new code in whatever feature context that might be. It's not a showstopper to the approach. It's just something to think hard about. I've taken a couple of long lived Rails apps from Rails 1 to Rails 4 and while there have been breaking changes with each major version change (and some minor versions) in general it's pretty easy to keep up with the latest versions and there are copious docs (even whole ebooks in some cases) to walk developers through the changes. I am curious, why did you upgrade your application over such a long time? Was this a product that got added new features over many years? Or was it more a it's easy to do, so let's just stay up to date in case we might need it? Best Regards, 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: Clojure needs a web framework with more momentum
While I totally agree with you on the topic of composing things to solve a problem at hand I think you are talking about a different audience here than the audience such a framework is aiming for. You are talking about experienced developers that know how to solve problems, that know advantages and disadvantages of certain patterns and tools. I think these people can be found in the intermediat to above layer of programmer experience. All the rest will be stuck and overwhelmed by the choices that are offered (not only in clojure, but in many languages). So they are looking for a set of good documentation and an opinionated path to a valuable product that fullfills most of their needs. Several years ago I was happy to find django and be productive in a short amount of time without having to think of which templating language to choose, but then, like I wrote above, I was hitting a hard edge which led me to search more. Still, I finished my project some years, which I may have never done without some guidance and the very good documentation of the django project. Best Regards, Sven Am Montag, 4. Mai 2015 16:24:22 UTC+2 schrieb tbc++: The thing that bugs me the most about these sort of conversations about best practices is that they often present a set of solutions without first analyzing the problem at hand. If I came to this mailing list and asked I want to write a websever in Clojure..what should I use?. The response would most likely be Ring + Compojure. Okay, not bad options, but that recommendation has been given with absolutely no analysis of what I'm trying to accomplish. What if I need async? What if I need web sockets? What sort of connection load am I expecting? Will my system handle mostly persistent connections (like websockets or SSE), or will it be more canned (and cacheable) data? If someone recommends Ring to me, I may be pigeonholed into some system I'll have to refactor later. Perhaps the best option is Aleph or Pedestal. That's the real issue with canned responses like rails tutorial. They assume my needs match your needs and match the needs of most people. That's just not the best way to go about doing software development. And it's a problem I've seen in so many areas of computing. I've lost countless hundreds of hours of my life to frameworks that default to bulky serialization formats (like XML or JSON), or frameworks that assume LAN connections to the servers, or frameworks that assume I won't be using multi-threading, or frameworks that assume I won't try to load 10k rows on a single page, or frameworks that assume any number of things. The thing I love the most about the Clojure community is that, more than any other community I've been a part of, they try to ask you to think before you jump. So what I would recommend is more of a set of guidelines, and matrices. List all the frameworks/libraries on one axis, and features on another, and start commenting. Make a page like this: ( http://en.wikipedia.org/wiki/Comparison_of_video_container_formats) Mention that Ring is well supported by the community, but doesn't work well with fully async servers, mention that Aleph does all the async you need, but is a bit non-standard. Mention that data.json is pure Clojure, but cheshire is most likely faster. Just present the options, and let the users make up their own minds. You don't understand the needs of all of your users. So don't try to solve their problems, instead present them with options and let them make up their own minds. I guarantee you that whatever tech you recommend to someone, the won't like some aspect of it, so better to present them with all the options and let them choose, then they can only blame themselves if it doesn't work out exactly like they expected. On Mon, May 4, 2015 at 7:34 AM, Ernie de Feria ernie@gmail.com javascript: wrote: I would like to echo the sentiment expressed by several posters in this thread, but with a slight twist. A few years back I picked up Ruby and Ruby on Rails as the language/framework to create a website with moderate complexity and functionality. I did this without any prior experience with the language of framework. What allowed me to quickly pick up both was the excellent documentation around the language and framework. For example, with the information from http://guides.rubyonrails.org and the canonical application built in https://www.railstutorial.org one can acquire the necessary knowledge to develop highly functional websites. Branching out to leverage non-canonical libraries/products then becomes a fairly easy exercise (MongoDB instead of MySQL, Mongoid instead of ActiveRecords, etc.). What allows that to happen is the momentum built around the Rails ecosystem via community participation and documentation. We have recently started to build our back end infrastructure in Clojure. Many
Re: Clojure needs a web framework with more momentum
Hi Dmitri, When I was building closp I was taking luminus as the base for it with some minor adoptions. I just had a look at the website of luminus and saw the massive amount of work you put into the documentation again. If that sounds reasonable for you I'd like to try to move closp and closp-crud to luminus as an opionated part of it. So if you call lein new luminus projectname +closp you will basically get what you get now with closp. You can look here for the additions: https://github.com/sveri/closp. I would like to maintain that branch. I am not sure if that will work out the way I think, but I'd like to evaluate it at least. It would be nice to have a common base and a common documentation for it. Best Regards, Sven Am Dienstag, 5. Mai 2015 02:38:41 UTC+2 schrieb Dmitri: As others have pointed out the comparison isn't really valid. Luminus intentionally aims to leverage existing libraries that are maintained independently whenever possible. I've been doing web dev with Clojure for the past 4 years and overall I do prefer the approach of using composable libraries over monolithic frameworks. With the Clojure web stack it's much easier to tell what's actually happening during the request/response lifecycle as things tend to be explicit. With frameworks like Rails a lot of stuff happens implicitly and requires a lot of in depth knowledge to work with effectively. However, there are a some downsides to the libraries over frameworks approach as well. The biggest issue is that it's difficult to track what libraries are actively maintained and which ones play nicely together. Since most libraries are maintained by individuals it's common for them to become abandoned. Another problem is that each app becomes a unique snowflake since there aren't a lot of established patterns for structuring them. Finally, security is an issue for Clojure web apps as a lot of it done in rather ad hoc fashion. While this works great for people who are well versed in the Clojure web ecosystem it's a huge barrier for newcomers. I think that the best way to address the problem is via organizations where related projects are maintained by groups of contributors. This helps discovery of projects, and it helps spread the burden of maintenance for them. This approach is already working in the wild on GitHub with Ring, Reagent, and Luminus orgs. Meanwhile, Leiningen templates are a great way to provide reasonable defaults for different types of applications and can be used to address issues such as security. Also, I'm certainly open to contributions for Luminus. I moved it to an org recently and new members would be very welcome. :) On Saturday, May 2, 2015 at 4:43:53 PM UTC-4, g vim wrote: I recently did some research into web frameworks on Github. Here's what I found: FRAMEWORK LANG CONTRIBUTORS COMMITS LuminusClojure28678 CaribouClojure 2275 BeegoGolang991522 PhoenixElixir 1241949 YesodHaskell 1303722 LaravelPHP2684421 PlayScala 4176085 SymfonyPHP113020914 RailsRuby 269151000 One could conclude from this that the Clojure community isn't that interested in web development but the last Clojure survey suggests otherwise. Clojure's library composition approach to everything only goes so far with large web applications, as Aaron Bedra reminded us in March last year: www.youtube.com/watch?v=CBL59w7fXw4 . Less manpower means less momentum and more bugs. Furthermore, I have a hunch that Clojure's poor adoption as indicated by Indeed.com maybe due to this immaturity in the web framework sphere. Why is it that Elixir, with a much smaller community and lifespan than Clojure's, has managed to put 4 times as much mindshare into its main web framework when its module output, as measured by modulecounts.com, is a tiny fraction of Clojure's? gvim -- 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 needs a web framework with more momentum
Hi, Reading through all the discussion I don't get which features you are actually missing. I love luminus and did a lot with it, however, for me it was missing some standard stuff, that's why I put together closp, which is just another leiningen template providing some more features out of the box. I'd consider adding even more features if you would become more specific in terms of features. For the rest I agree with what is mostly said here, the beauty of clojure lies in the nature of small composable building blocks and the same goes for frameworks, so, basically it's all there, one just has to put it together. And to not have to put it together by hand time and time again there are leiningen templates. Best Regards, Sven Am Samstag, 2. Mai 2015 22:43:53 UTC+2 schrieb g vim: I recently did some research into web frameworks on Github. Here's what I found: FRAMEWORK LANG CONTRIBUTORS COMMITS LuminusClojure28678 CaribouClojure 2275 BeegoGolang991522 PhoenixElixir 1241949 YesodHaskell 1303722 LaravelPHP2684421 PlayScala 4176085 SymfonyPHP113020914 RailsRuby 269151000 One could conclude from this that the Clojure community isn't that interested in web development but the last Clojure survey suggests otherwise. Clojure's library composition approach to everything only goes so far with large web applications, as Aaron Bedra reminded us in March last year: www.youtube.com/watch?v=CBL59w7fXw4 . Less manpower means less momentum and more bugs. Furthermore, I have a hunch that Clojure's poor adoption as indicated by Indeed.com maybe due to this immaturity in the web framework sphere. Why is it that Elixir, with a much smaller community and lifespan than Clojure's, has managed to put 4 times as much mindshare into its main web framework when its module output, as measured by modulecounts.com, is a tiny fraction of Clojure's? gvim -- 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 needs a web framework with more momentum
Hi, Am Sonntag, 3. Mai 2015 11:38:14 UTC+2 schrieb g vim: On 03/05/2015 05:24, Sean Corfield wrote: On Sat, May 2, 2015 at 8:18 PM, Mark Engelberg mark.en...@gmail.com javascript: mailto:mark.en...@gmail.com javascript: wrote: Clojure is great for creating new, disruptive web models, but what's the easiest path to creating something that can be done trivially with, say, Drupal or Django? The question tho' is why you'd want to use Clojure for something that is already trivially solved with free packaged software for widely used scripting languages where cheap, plentiful developers are falling over themselves to help... :) Clojure doesn't have to be the solution for every problem. It certainly doesn't need to be the solution for low-value problems... Forgive me if that sounds a little elitist. What if I want to do what Django can do but in Clojure? If Clojure is a better option there should be something which can do more than Django. If my only choice is library composition by definition it doesn't do what Django does well, ie. a fully-structured setup out of the box with a predictable, best of breed set of technologies. There are many businesses, large and small, who will only go with a well-established web framework with a vibrant community. Sadly, Clojure's preference for protecting its niche means it will never be an option for these opportunities, hence its poor showing in job listings. Do we, as a community, want to be paid for what we do? Again I am missing some exact requests on what can be done in django that cannot be done in clojure? This by no means an offense, I am just curious about your experiences. Best Regards, 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: Clojure needs a web framework with more momentum
Hi Colin, Regarding payment I'd choose something like stripe or whatever fits your needs and look for a clojure api or wrapper around a java api. Implementing payment stuff yourself might get you in a lot of legal trouble anyhwere in the world. However, I'd agree that there may be the need for better documentation on integration of all the libraries, whereas I have to say that luminus does a pretty good job for what it offers, regarding the documentation. Best Regards, Sven Am Sonntag, 3. Mai 2015 08:21:31 UTC+2 schrieb Colin Fleming: Because, in my case, I'm going to need a website shortly that I can use to sell Cursive. I'd really like to use Clojure for that. I could use Rails or Django which would make the site itself trivial, except I don't know either of them and then I'm stuck maintaining something in a language and framework I have no interest in and don't understand how to deploy or maintain. Or I could do it in Clojure which means that I understand the libraries, frameworks, deployment and monitoring inside and out, except I now have to implement a shopping cart and integrations with payments gateways etc. Neither of these are great options for me. On 3 May 2015 at 16:24, Sean Corfield se...@corfield.org javascript: wrote: On Sat, May 2, 2015 at 8:18 PM, Mark Engelberg mark.en...@gmail.com javascript: wrote: Clojure is great for creating new, disruptive web models, but what's the easiest path to creating something that can be done trivially with, say, Drupal or Django? The question tho' is why you'd want to use Clojure for something that is already trivially solved with free packaged software for widely used scripting languages where cheap, plentiful developers are falling over themselves to help... :) Clojure doesn't have to be the solution for every problem. It certainly doesn't need to be the solution for low-value problems... -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to 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 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] closp 0.1.11 and closp-crud 0.1.0
Yesterday I release a new version of closp which includes closp-crud. You can find the change list of closp at the bottom of the readme: https://github.com/sveri/closp I also released closp-crud, which is a leiningen CRUD plugin generating SQL files, HTML templates and clojure database and routes code for the operations. I provided some documentation on how to get running here: https://github.com/sveri/closp-crud I also made a 12 minute introduction video on how to use that plugin and setting up closp before: http://www.twitch.tv/sveri80/v/4298695 Disclaimer: The audio is not the best and I have some hiccups with an already running figwheel process that must have crashed somewhere. So, live debugging is included Best Regards, Sven. PS: Is there a way to crosspost to the clojurescript group? -- 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: Generating .clj files with content
Thanks everyone for your help. The route that I choose to go is a mix of selmer for the predefined mostly static things and quoting with pprints code-dispatch. Very useful, didn't know that :-) Best Regards, Sven Am Donnerstag, 9. April 2015 21:45:41 UTC+2 schrieb Devin Walters (devn): To Leon's point above, that looks like: 12345678910111213 (require '[clojure.pprint :as pp]) (pp/with-pprint-dispatch pp/code-dispatch (pp/pprint (read-string (defn foo [xs] (apply str (reverse (str (apply + (for [y (filter (fn [x] (= x 1)) xs)] (inc y)) = nil (defn foo [xs] (apply str (reverse (str (apply + (for [y (filter (fn [x] (= x 1)) xs)] (inc y))) On Thu, Apr 9, 2015 at 2:34 PM, Leon Grapenthin grapent...@gmail.com javascript: wrote: You can use https://clojure.github.io/clojure/clojure.pprint-api.html#clojure.pprint/with-pprint-dispatch with https://clojure.github.io/clojure/clojure.pprint-api.html#clojure.pprint/code-dispatch to achieve that. On Wednesday, April 8, 2015 at 8:14:02 PM UTC+2, Sven Richter wrote: Hi, @Tassilo Thank you. Your example works nicely the way I imagined it. However, I want to generate human readable code and I want line breaks and nice formatting and things. I will also try a templating language. lein-template uses moustache or something. I will see how that works out. Thanks everyone for your suggestions, Sven Am Mittwoch, 8. April 2015 19:25:23 UTC+2 schrieb James Reeves: On 8 April 2015 at 14:20, Sven Richter sve...@googlemail.com wrote: I want to create clojure source files with some code and a namespace and everything else what is useful for some source code. What I am looking for is a templating language for clojure code, is there something like this already? What would be the most idiomatic way to do that besides just writing strings into a file? What's the purpose? If it's just to generate some Clojure code that will never be read by a human, then you can use Clojure's backtick syntax with the pr-str function. If it's to generate human-readable code, then you're probably best using a text templating language. You may also want to look at Leiningen templates or lein-generate. - James -- 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 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.typed question (maybe a bug?)
Hm, Is it possible that core.typed may be influenced by the repl state? New day and a new try I got these both working: (t/ann dt-hiccup [(t/HVec [Keyword (t/U Keyword (t/HVec [Keyword Number])) t/Any t/Any *]) - html-form-group]) (defmulti dt-hiccup (t/fn [col :- (t/HVec [Keyword (t/U Keyword (t/HVec [Keyword Number])) t/Any t/Any *])] (if (vector? (second col)) (first (second col)) (second col and (t/ann dt-hiccup [(t/HVec [Keyword (t/U Keyword (t/HVec [Keyword Number])) t/Any t/Any *]) - html-form-group]) (defmulti dt-hiccup (t/fn [col :- (t/HVec [Keyword (t/U Keyword (t/HVec [Keyword Number])) t/Any t/Any *])] (let [[_ s] col] (if (vector? s) (first s) s Which are the same basically regarding type declarations. Sorry for making such a noise, maybe a simple repl restart would have fixed this. Thanks, Sven Am Donnerstag, 16. April 2015 22:43:41 UTC+2 schrieb Sven Richter: Hi, I tried both destructuring and the nth form instead of second and first. None of which worked. However, if I change the Union to Intersection in (t/HVec [Keyword (t/U Keyword (t/HVec [Keyword Number])) t/Any t/Any *]) it works for the definition of the multimethod. Does that make sense? I thought Union was either one type or the other. Thanks, Sven Am Donnerstag, 16. April 2015 21:44:25 UTC+2 schrieb Ambrose Bonnaire-Sergeant: I don't think second's type is is smart enough. Try using nth or destructuring instead: (let [[f s] v] (if (vector? s) (first s) s)) or (if (vector? (nth v 1)) (first (nth v 1)) s) Thanks, Ambrose On Thu, Apr 16, 2015 at 3:39 PM, Sven Richter sve...@googlemail.com wrote: Hi, I have this code: (defalias html-label (t/HVec [Keyword (t/HMap :mandatory {:for String}) String])) (defalias html-form (t/HVec [Keyword (t/HMap :mandatory {:id String}) t/Any *])) (defalias html-form-group (t/HVec [html-label html-form])) (t/ann dt-hiccup [(HVec [Keyword (U Keyword (HVec [Keyword Number])) t/Any t/Any *]) - html-form-group]) (defmulti dt-hiccup (t/fn [col :- pt/et-column] (if (vector? (second col)) (first (second col)) (second col And here comes the error message when checking this function: Type Error (leiningen/td_to_hiccup.clj:25:34) Polymorphic function first could not be applied to arguments: Polymorphic Variables: x Domains: (t/HSequential [x t/Any *]) (t/Option (t/EmptySeqable x)) (t/NonEmptySeqable x) (t/Option (clojure.lang.Seqable x)) Arguments: (t/U Keyword (t/HVec [clojure.lang.Keyword java.lang.Number])) Ranges: x :object {:path [(Nth 0)], :id 0} nil x (t/Option x) in: (first (second col)) in: (first (second col)) ExceptionInfo Type Checker: Found 1 error clojure.core/ex-info (core. clj:4403) My assumption is that the check (if (vector? (second col will return only true if it is this type: (HVec [Keyword Number]). However, I have the impression that core.typed does not resolve the if expression properly. Or maybe I am missing something completely. Any hints or recommendations? Thanks, Sven -- 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 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.typed question (maybe a bug?)
I added your explanation the the wiki of core.typed: https://github.com/clojure/core.typed/wiki/Intersection-vs.-Union I hope that is fine for you. Am Donnerstag, 16. April 2015 23:25:42 UTC+2 schrieb Ambrose Bonnaire-Sergeant: It might help thinking in terms of Java interfaces, Foo and Bar. (definterface Foo (foo [])) (definterface Bar (bar [])) (I Foo Bar) is a value that extends both Foo and Bar. (deftype IImp [] Foo (foo [this]) Bar (bar [this])) (-IImp) is of type Foo, Bar, (I Foo Bar) and (U Foo Bar). Assuming we assign (-IImp) the type (I Foo Bar), we can call these safely: (let [i :- (I Foo Bar), (-IImp)] (.foo i) (.bar i)) A type that just implements Foo is not a Bar, so we can't claim it's a Foo *and* a Bar. (deftype UImp [] Foo (foo [this])) (-UImp) is of type Foo, and (U Foo Bar). Assuming we assign (-UImp) the type (U Foo Bar), the same operations now must cast at runtime. (let [i :- (U Foo Bar), (-UImp)] (if (instance? Foo) (.foo i) (.bar i)) Thanks, Ambrose On Thu, Apr 16, 2015 at 5:15 PM, Sven Richter sve...@googlemail.com javascript: wrote: I meant when I change: (t/HVec [Keyword (t/U Keyword (t/HVec [Keyword Number])) t/Any t/Any *]) to (t/HVec [Keyword (t/I Keyword (t/HVec [Keyword Number])) t/Any t/Any *]) ^^ to ^^ Still I think that making an intersection of it is wrong conceptually. Thanks, Sven Am Donnerstag, 16. April 2015 23:08:30 UTC+2 schrieb Ambrose Bonnaire-Sergeant: I don't see an intersection, what do you mean? Thanks, Ambrose On Thu, Apr 16, 2015 at 4:43 PM, Sven Richter sve...@googlemail.com wrote: Hi, I tried both destructuring and the nth form instead of second and first. None of which worked. However, if I change the Union to Intersection in (t/HVec [Keyword (t/U Keyword (t/HVec [Keyword Number])) t/Any t/Any *]) it works for the definition of the multimethod. Does that make sense? I thought Union was either one type or the other. Thanks, Sven Am Donnerstag, 16. April 2015 21:44:25 UTC+2 schrieb Ambrose Bonnaire-Sergeant: I don't think second's type is is smart enough. Try using nth or destructuring instead: (let [[f s] v] (if (vector? s) (first s) s)) or (if (vector? (nth v 1)) (first (nth v 1)) s) Thanks, Ambrose On Thu, Apr 16, 2015 at 3:39 PM, Sven Richter sve...@googlemail.com wrote: Hi, I have this code: (defalias html-label (t/HVec [Keyword (t/HMap :mandatory {:for String }) String])) (defalias html-form (t/HVec [Keyword (t/HMap :mandatory {:id String}) t/Any *])) (defalias html-form-group (t/HVec [html-label html-form])) (t/ann dt-hiccup [(HVec [Keyword (U Keyword (HVec [Keyword Number])) t/Any t/Any *]) - html-form-group]) (defmulti dt-hiccup (t/fn [col :- pt/et-column] (if (vector? (second col)) (first (second col)) (second col And here comes the error message when checking this function: Type Error (leiningen/td_to_hiccup.clj:25:34) Polymorphic function first could not be applied to arguments: Polymorphic Variables: x Domains: (t/HSequential [x t/Any *]) (t/Option (t/EmptySeqable x)) (t/NonEmptySeqable x) (t/Option (clojure.lang.Seqable x)) Arguments: (t/U Keyword (t/HVec [clojure.lang.Keyword java.lang.Number]) ) Ranges: x :object {:path [(Nth 0)], :id 0} nil x (t/Option x) in: (first (second col)) in: (first (second col)) ExceptionInfo Type Checker: Found 1 error clojure.core/ex-info (core .clj:4403) My assumption is that the check (if (vector? (second col will return only true if it is this type: (HVec [Keyword Number]). However, I have the impression that core.typed does not resolve the if expression properly. Or maybe I am missing something completely. Any hints or recommendations? Thanks, Sven -- 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
Re: core.typed question (maybe a bug?)
Now thats a really nice explanation of union versus intersection in termes of types. Thank you very much for that, Sven Am Donnerstag, 16. April 2015 23:25:42 UTC+2 schrieb Ambrose Bonnaire-Sergeant: It might help thinking in terms of Java interfaces, Foo and Bar. (definterface Foo (foo [])) (definterface Bar (bar [])) (I Foo Bar) is a value that extends both Foo and Bar. (deftype IImp [] Foo (foo [this]) Bar (bar [this])) (-IImp) is of type Foo, Bar, (I Foo Bar) and (U Foo Bar). Assuming we assign (-IImp) the type (I Foo Bar), we can call these safely: (let [i :- (I Foo Bar), (-IImp)] (.foo i) (.bar i)) A type that just implements Foo is not a Bar, so we can't claim it's a Foo *and* a Bar. (deftype UImp [] Foo (foo [this])) (-UImp) is of type Foo, and (U Foo Bar). Assuming we assign (-UImp) the type (U Foo Bar), the same operations now must cast at runtime. (let [i :- (U Foo Bar), (-UImp)] (if (instance? Foo) (.foo i) (.bar i)) Thanks, Ambrose On Thu, Apr 16, 2015 at 5:15 PM, Sven Richter sve...@googlemail.com javascript: wrote: I meant when I change: (t/HVec [Keyword (t/U Keyword (t/HVec [Keyword Number])) t/Any t/Any *]) to (t/HVec [Keyword (t/I Keyword (t/HVec [Keyword Number])) t/Any t/Any *]) ^^ to ^^ Still I think that making an intersection of it is wrong conceptually. Thanks, Sven Am Donnerstag, 16. April 2015 23:08:30 UTC+2 schrieb Ambrose Bonnaire-Sergeant: I don't see an intersection, what do you mean? Thanks, Ambrose On Thu, Apr 16, 2015 at 4:43 PM, Sven Richter sve...@googlemail.com wrote: Hi, I tried both destructuring and the nth form instead of second and first. None of which worked. However, if I change the Union to Intersection in (t/HVec [Keyword (t/U Keyword (t/HVec [Keyword Number])) t/Any t/Any *]) it works for the definition of the multimethod. Does that make sense? I thought Union was either one type or the other. Thanks, Sven Am Donnerstag, 16. April 2015 21:44:25 UTC+2 schrieb Ambrose Bonnaire-Sergeant: I don't think second's type is is smart enough. Try using nth or destructuring instead: (let [[f s] v] (if (vector? s) (first s) s)) or (if (vector? (nth v 1)) (first (nth v 1)) s) Thanks, Ambrose On Thu, Apr 16, 2015 at 3:39 PM, Sven Richter sve...@googlemail.com wrote: Hi, I have this code: (defalias html-label (t/HVec [Keyword (t/HMap :mandatory {:for String }) String])) (defalias html-form (t/HVec [Keyword (t/HMap :mandatory {:id String}) t/Any *])) (defalias html-form-group (t/HVec [html-label html-form])) (t/ann dt-hiccup [(HVec [Keyword (U Keyword (HVec [Keyword Number])) t/Any t/Any *]) - html-form-group]) (defmulti dt-hiccup (t/fn [col :- pt/et-column] (if (vector? (second col)) (first (second col)) (second col And here comes the error message when checking this function: Type Error (leiningen/td_to_hiccup.clj:25:34) Polymorphic function first could not be applied to arguments: Polymorphic Variables: x Domains: (t/HSequential [x t/Any *]) (t/Option (t/EmptySeqable x)) (t/NonEmptySeqable x) (t/Option (clojure.lang.Seqable x)) Arguments: (t/U Keyword (t/HVec [clojure.lang.Keyword java.lang.Number]) ) Ranges: x :object {:path [(Nth 0)], :id 0} nil x (t/Option x) in: (first (second col)) in: (first (second col)) ExceptionInfo Type Checker: Found 1 error clojure.core/ex-info (core .clj:4403) My assumption is that the check (if (vector? (second col will return only true if it is this type: (HVec [Keyword Number]). However, I have the impression that core.typed does not resolve the if expression properly. Or maybe I am missing something completely. Any hints or recommendations? Thanks, Sven -- 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
Re: core.typed question (maybe a bug?)
I meant when I change: (t/HVec [Keyword (t/U Keyword (t/HVec [Keyword Number])) t/Any t/Any *]) to (t/HVec [Keyword (t/I Keyword (t/HVec [Keyword Number])) t/Any t/Any *]) ^^ to ^^ Still I think that making an intersection of it is wrong conceptually. Thanks, Sven Am Donnerstag, 16. April 2015 23:08:30 UTC+2 schrieb Ambrose Bonnaire-Sergeant: I don't see an intersection, what do you mean? Thanks, Ambrose On Thu, Apr 16, 2015 at 4:43 PM, Sven Richter sve...@googlemail.com javascript: wrote: Hi, I tried both destructuring and the nth form instead of second and first. None of which worked. However, if I change the Union to Intersection in (t/HVec [Keyword (t/U Keyword (t/HVec [Keyword Number])) t/Any t/Any *]) it works for the definition of the multimethod. Does that make sense? I thought Union was either one type or the other. Thanks, Sven Am Donnerstag, 16. April 2015 21:44:25 UTC+2 schrieb Ambrose Bonnaire-Sergeant: I don't think second's type is is smart enough. Try using nth or destructuring instead: (let [[f s] v] (if (vector? s) (first s) s)) or (if (vector? (nth v 1)) (first (nth v 1)) s) Thanks, Ambrose On Thu, Apr 16, 2015 at 3:39 PM, Sven Richter sve...@googlemail.com wrote: Hi, I have this code: (defalias html-label (t/HVec [Keyword (t/HMap :mandatory {:for String}) String])) (defalias html-form (t/HVec [Keyword (t/HMap :mandatory {:id String}) t /Any *])) (defalias html-form-group (t/HVec [html-label html-form])) (t/ann dt-hiccup [(HVec [Keyword (U Keyword (HVec [Keyword Number])) t /Any t/Any *]) - html-form-group]) (defmulti dt-hiccup (t/fn [col :- pt/et-column] (if (vector? (second col)) (first (second col)) (second col And here comes the error message when checking this function: Type Error (leiningen/td_to_hiccup.clj:25:34) Polymorphic function first could not be applied to arguments: Polymorphic Variables: x Domains: (t/HSequential [x t/Any *]) (t/Option (t/EmptySeqable x)) (t/NonEmptySeqable x) (t/Option (clojure.lang.Seqable x)) Arguments: (t/U Keyword (t/HVec [clojure.lang.Keyword java.lang.Number])) Ranges: x :object {:path [(Nth 0)], :id 0} nil x (t/Option x) in: (first (second col)) in: (first (second col)) ExceptionInfo Type Checker: Found 1 error clojure.core/ex-info (core. clj:4403) My assumption is that the check (if (vector? (second col will return only true if it is this type: (HVec [Keyword Number]). However, I have the impression that core.typed does not resolve the if expression properly. Or maybe I am missing something completely. Any hints or recommendations? Thanks, Sven -- 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 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 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
core.typed question (maybe a bug?)
Hi, I have this code: (defalias html-label (t/HVec [Keyword (t/HMap :mandatory {:for String}) String])) (defalias html-form (t/HVec [Keyword (t/HMap :mandatory {:id String}) t/Any *])) (defalias html-form-group (t/HVec [html-label html-form])) (t/ann dt-hiccup [(HVec [Keyword (U Keyword (HVec [Keyword Number])) t/Any t/Any *]) - html-form-group]) (defmulti dt-hiccup (t/fn [col :- pt/et-column] (if (vector? (second col)) (first (second col)) (second col And here comes the error message when checking this function: Type Error (leiningen/td_to_hiccup.clj:25:34) Polymorphic function first could not be applied to arguments: Polymorphic Variables: x Domains: (t/HSequential [x t/Any *]) (t/Option (t/EmptySeqable x)) (t/NonEmptySeqable x) (t/Option (clojure.lang.Seqable x)) Arguments: (t/U Keyword (t/HVec [clojure.lang.Keyword java.lang.Number])) Ranges: x :object {:path [(Nth 0)], :id 0} nil x (t/Option x) in: (first (second col)) in: (first (second col)) ExceptionInfo Type Checker: Found 1 error clojure.core/ex-info (core.clj: 4403) My assumption is that the check (if (vector? (second col will return only true if it is this type: (HVec [Keyword Number]). However, I have the impression that core.typed does not resolve the if expression properly. Or maybe I am missing something completely. Any hints or recommendations? 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: core.typed question (maybe a bug?)
Hi, I tried both destructuring and the nth form instead of second and first. None of which worked. However, if I change the Union to Intersection in (t/HVec [Keyword (t/U Keyword (t/HVec [Keyword Number])) t/Any t/Any *]) it works for the definition of the multimethod. Does that make sense? I thought Union was either one type or the other. Thanks, Sven Am Donnerstag, 16. April 2015 21:44:25 UTC+2 schrieb Ambrose Bonnaire-Sergeant: I don't think second's type is is smart enough. Try using nth or destructuring instead: (let [[f s] v] (if (vector? s) (first s) s)) or (if (vector? (nth v 1)) (first (nth v 1)) s) Thanks, Ambrose On Thu, Apr 16, 2015 at 3:39 PM, Sven Richter sve...@googlemail.com javascript: wrote: Hi, I have this code: (defalias html-label (t/HVec [Keyword (t/HMap :mandatory {:for String}) String])) (defalias html-form (t/HVec [Keyword (t/HMap :mandatory {:id String}) t/Any *])) (defalias html-form-group (t/HVec [html-label html-form])) (t/ann dt-hiccup [(HVec [Keyword (U Keyword (HVec [Keyword Number])) t/Any t/Any *]) - html-form-group]) (defmulti dt-hiccup (t/fn [col :- pt/et-column] (if (vector? (second col)) (first (second col)) (second col And here comes the error message when checking this function: Type Error (leiningen/td_to_hiccup.clj:25:34) Polymorphic function first could not be applied to arguments: Polymorphic Variables: x Domains: (t/HSequential [x t/Any *]) (t/Option (t/EmptySeqable x)) (t/NonEmptySeqable x) (t/Option (clojure.lang.Seqable x)) Arguments: (t/U Keyword (t/HVec [clojure.lang.Keyword java.lang.Number])) Ranges: x :object {:path [(Nth 0)], :id 0} nil x (t/Option x) in: (first (second col)) in: (first (second col)) ExceptionInfo Type Checker: Found 1 error clojure.core/ex-info (core. clj:4403) My assumption is that the check (if (vector? (second col will return only true if it is this type: (HVec [Keyword Number]). However, I have the impression that core.typed does not resolve the if expression properly. Or maybe I am missing something completely. Any hints or recommendations? Thanks, Sven -- 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 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.
Generating .clj files with content
Hi, I want to create clojure source files with some code and a namespace and everything else what is useful for some source code. What I am looking for is a templating language for clojure code, is there something like this already? What would be the most idiomatic way to do that besides just writing strings into a file? Best Regards, 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: Generating .clj files with content
Hi, @Tassilo Thank you. Your example works nicely the way I imagined it. However, I want to generate human readable code and I want line breaks and nice formatting and things. I will also try a templating language. lein-template uses moustache or something. I will see how that works out. Thanks everyone for your suggestions, Sven Am Mittwoch, 8. April 2015 19:25:23 UTC+2 schrieb James Reeves: On 8 April 2015 at 14:20, Sven Richter sve...@googlemail.com javascript: wrote: I want to create clojure source files with some code and a namespace and everything else what is useful for some source code. What I am looking for is a templating language for clojure code, is there something like this already? What would be the most idiomatic way to do that besides just writing strings into a file? What's the purpose? If it's just to generate some Clojure code that will never be read by a human, then you can use Clojure's backtick syntax with the pr-str function. If it's to generate human-readable code, then you're probably best using a text templating language. You may also want to look at Leiningen templates or lein-generate. - 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: Use reduce or something appropriate instead of loop / recur
Thank you very much. I had the feeling I should reduce over the tree-path, but was not able to come up with something good like you did. Best Regards, Sven Am Dienstag, 24. März 2015 22:58:18 UTC+1 schrieb Francis Avila: Notice that get-in-via is simply reduce: (defn get-in-via [m via ks] (reduce (fn [m' k] (via m' k)) m ks)) Same as: (defn get-in-via [m via ks] (reduce via m ks)) Same as: (reduce via m ks) So once you write your step function, traversal is taken care of by the reduction. On Tuesday, March 24, 2015 at 4:55:23 PM UTC-5, Francis Avila wrote: Separate out traversal from selection to make this clearer. We make a generic traversal function get-in-via. It accepts a via function which takes the current result and some value which determines the next result, and returns the next result. (defn get-in-via [m via ks] (reduce (fn [m' k] (via m' k)) m ks)) Here is a via function that follows folder paths. This is a single step of the reduction. (defn via-folderpath [items foldername] (- items (filter #(and (= (:type %) :folder) (= (:name %) foldername))) (first) :children)) Example of use: (get-in-via ffs via-folderpath [sub2 sub21]) ;= [{:name lein-env, :type :file}] On Tuesday, March 24, 2015 at 4:22:21 PM UTC-5, Sven Richter wrote: Hi, I wrote a function to trackdown a path in a vector containing nested maps: (defn get-files-from-folder-path [ffs folder-path] (filter #(= :file (:type %)) (loop [tree-path-position 0 acc [] fof ffs] (let [folder (first (filter #(and (= :folder (:type %)) (= (nth folder-path tree-path-position nil) (:name %))) fof))] (if (not (:children folder)) acc (recur (inc tree-path-position) (if (= (+ tree-path-position 1) (count folder-path)) (concat acc (:children folder)) acc) (:children folder))) And these are the inputs: (def ffs [{:type :folder, :name sub1, :children [{:type :file, :name datomic-data.edn}]} {:type :folder, :name sub2, :children [{:type :file, :name foo (1).csv} {:type :folder, :name sub21, :children [{:type :file, :name lein-env}]}]}]) (def tree-path [sub2 sub21]) And I call it like this: (get-files-from-folder-path ffs tree-path) Is there a way to use reduce for that? I was stuck because I think I have to reduce on two lists here, but reduce only takes one to start with, thats why I chose the loop / recur route. Which works but it looks ugly to me and I am afraid in one week I want understand it anymore. Thanks Regards, 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.
Use reduce or something appropriate instead of loop / recur
Hi, I wrote a function to trackdown a path in a vector containing nested maps: (defn get-files-from-folder-path [ffs folder-path] (filter #(= :file (:type %)) (loop [tree-path-position 0 acc [] fof ffs] (let [folder (first (filter #(and (= :folder (:type %)) (= (nth folder-path tree-path-position nil) (:name %))) fof))] (if (not (:children folder)) acc (recur (inc tree-path-position) (if (= (+ tree-path-position 1) (count folder-path)) (concat acc (:children folder)) acc) (:children folder))) And these are the inputs: (def ffs [{:type :folder, :name sub1, :children [{:type :file, :name datomic-data.edn}]} {:type :folder, :name sub2, :children [{:type :file, :name foo (1).csv} {:type :folder, :name sub21, :children [{:type :file, :name lein-env}]}]}]) (def tree-path [sub2 sub21]) And I call it like this: (get-files-from-folder-path ffs tree-path) Is there a way to use reduce for that? I was stuck because I think I have to reduce on two lists here, but reduce only takes one to start with, thats why I chose the loop / recur route. Which works but it looks ugly to me and I am afraid in one week I want understand it anymore. Thanks Regards, 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: Is Caribou Dormant ?
I am glad you like it. It is still pretty young, so like I said, just open issues if you need more. Best Regards, Sven Am Samstag, 28. Februar 2015 16:22:41 UTC+1 schrieb g vim: On 27/02/2015 07:26, Sven Richter wrote: Hi, Please have a look at: https://github.com/sveri/closp/ and tell me what you are missing. You might as well open feature / pull requests and I will consider adding them. Best Regards, Sven Great work, Sven. Just what I was looking for. Next - THE BOOK :) gvim -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Is Caribou Dormant ?
Hi, Please have a look at: https://github.com/sveri/closp/ and tell me what you are missing. You might as well open feature / pull requests and I will consider adding them. Best Regards, Sven Am Donnerstag, 26. Februar 2015 05:22:57 UTC+1 schrieb g vim: Caribou was Clojure's Rails so I'm sad to see it wither. I think Clojure adoption continues to suffer from the lack of a full-featured, strongly-backed web framework like Play and Rails. I don't see why support for a big framework can't co-exist with lightweight library composition options. The Ruby community embraces diversity from Sinatra all the way up to Rails with plenty of variety in between. Different projects developers require different approaches and there are many advantages in using a large, strongly supported web framework. See Aaron Bedra's excellent video - www.youtube.com/watch?v=CBL59w7fXw4 - for more on this. gvim On 25/02/2015 23:36, Geraldo Lopes de Souza wrote: Hi, I'm checking Caribou, and wanna know if anyone is using it. It appears that it is a dormant project by the looks of the last update https://github.com/caribou/caribou Thanks in advance, Geraldo Lopes de Souza -- 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] Buddy 0.4.0: Security library for clojure.
Hi, What I like about buddy is that I can define access rules like this: https://funcool.github.io/buddy-auth/latest/#access-rules It gives me the ability to have the rules in one place and adjust them with patterns as I wish, it reminds me of shiro and I really like that approach. Best Regards, Sven Am Montag, 23. Februar 2015 02:25:43 UTC+1 schrieb Dave Sann: buddy-auth vs friend? What is the difference/motivation? On Monday, 23 February 2015 06:32:22 UTC+11, g vim wrote: On 22/02/2015 11:36, Andrey Antukh wrote: Documentation: https://funcool.github.io/buddy-core/latest/ https://funcool.github.io/buddy-auth/latest/ https://funcool.github.io/buddy-hashers/latest/ https://funcool.github.io/buddy-sign/latest/ Great addition to Clojure web development security. For new users might I suggest adding a namespace table to -core, -hashers and -sign as with -auth? gvim -- 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: No such var during runtime
Hm, I cannot imagine how this might come into play, but in the end. I don't know. I just set the clojure version of closp to 1.7.0-alpha5, built a new jar and it still works for me. I just cannot find a way to reproduce it on my local workstation, neither on my second one where I do code from time to time. Thanks, Sven Am Samstag, 21. Februar 2015 08:07:26 UTC+1 schrieb Sean Corfield: Could it perhaps be this bug at work? http://dev.clojure.org/jira/browse/CLJ-1604 Sean On Feb 20, 2015, at 1:31 PM, Sven Richter sve...@googlemail.com javascript: wrote: A user reported an error for closp which I cannot make sense of: java.lang.RuntimeException: No such var: t-cli/parse-opts, compiling:(leiningen/new/closp.clj:102:52) This is the issue: https://github.com/sveri/closp/issues/1 The code is here: https://github.com/sveri/closp/blob/master/src/leiningen/new/closp.clj Interpreting the error message I would say that t-cli is not required in the namespace, but looking at line 6 I see this: [clojure.tools.cli :as t-cli]. Also I can execute the same command again and again and it just works. Any ideas what might be causing this? -- 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.
No such var during runtime
Hi, A user reported an error for closp which I cannot make sense of: java.lang.RuntimeException: No such var: t-cli/parse-opts, compiling:(leiningen/new/closp.clj:102:52) This is the issue: https://github.com/sveri/closp/issues/1 The code is here: https://github.com/sveri/closp/blob/master/src/leiningen/new/closp.clj Interpreting the error message I would say that t-cli is not required in the namespace, but looking at line 6 I see this: [clojure.tools.cli :as t-cli]. Also I can execute the same command again and again and it just works. Any ideas what might be causing this? 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.
Injecting html code into selmer
Hi, I wonder if this is even possible. I have a string :foo-string bfoo/b and I pass this string to selmer: (render templ.html {foo-string bfoo/b}) Now in the templ.html I do this: {{foo-string|safe}} which injects this into the html: bfoo/b But what I need is plain html like this inside the template: bfoo/b Is that even possible? 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] closp - leiningen template combining luminus and chestnut + some more features
Hi alan, Luminus provides a bit more options regarding server / database and cljs. However, this is something I explicitely do not want. What I want is to have one path that fulfills a given featureset. I know this does not fit everyones flavour, but I think the overhead of having multiple different options is not worth the gain. For instance, switching to a different database is just providing another jdbc string + a different dependency, as long as it is supported by jdbc. The same goes for auth, just remove the middleware and the auth.clj file and replace it by something different. I really do like feature expressions (at least what I have seen so far) and would replace cljx by it as soon as it is released. I am a bit shy to go for clojure 1.7.x-alpha releases, maybe a beta release would be ok for me. Best Regards, Sven Am Donnerstag, 12. Februar 2015 04:11:31 UTC+1 schrieb Alan Moore: Nice - thanks! I was thinking it would be cool to create a meta-lein template that would allow the user to specify which libraries (or features?) to include and the template would (magic happens here) pull in each library and make the needed mods to the base template. Obviously this would require each library to specify the stuff they need done to get integrated/merged into the base template (add these dependencies to project.clj, add these html snippets, etc.) Opportunities for conflicts abound and versioning issues, etc. probably make this too hard. I'm not sure it is worth doing due to the open ended nature of libraries/fiddly bits but it sure would be handy. I remember seeing a project on github that does something like this using a library approach (not via a lein template) but I can't remember the name of it... Also, did you look into using feature expressions instead of cljx? Thanks again for this template! I'm going to give it a spin right now... Alan -- 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] closp - leiningen template combining luminus and chestnut + some more features
Thanks for adding the link, some day I will even forget my head. Am Donnerstag, 12. Februar 2015 00:41:42 UTC+1 schrieb martin_clausen: Link: https://github.com/sveri/closp On Wednesday, February 11, 2015 at 11:59:20 AM UTC+1, Sven Richter wrote: Hi, I took some time to put together a leiningen template which combines the awesome proecjts luminus and chestnut and adds some more features to start development sideprojects for the web without much hassle. The rationale behind this is that I found myself adding these features again and again for every new project and I wanted to stop that. Features: * H2 database on filesystem as a default * Ragtime for database migrations * Selmer as templating solution * http-kit as a server * cljx support * Figwheel with clojurescript live reloading * Reloading support for templates and clojure code * Configuration with nomad * User management with login/logout/registration with email activation (provided by postal) * Authentication provided by buddy * reagent and datascript on frontend side * Ring Antiforgery middleware * Clojure miniprofiler example * Componentized application * Datascript with reagent example * Booststrap css styles As always I am happy about any kind of feedback, pull requests or whatever comes to your mind. Best Regagrds, 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.
[ANN] closp - leiningen template combining luminus and chestnut + some more features
Hi, I took some time to put together a leiningen template which combines the awesome proecjts luminus and chestnut and adds some more features to start development sideprojects for the web without much hassle. The rationale behind this is that I found myself adding these features again and again for every new project and I wanted to stop that. Features: * H2 database on filesystem as a default * Ragtime for database migrations * Selmer as templating solution * http-kit as a server * cljx support * Figwheel with clojurescript live reloading * Reloading support for templates and clojure code * Configuration with nomad * User management with login/logout/registration with email activation (provided by postal) * Authentication provided by buddy * reagent and datascript on frontend side * Ring Antiforgery middleware * Clojure miniprofiler example * Componentized application * Datascript with reagent example * Booststrap css styles As always I am happy about any kind of feedback, pull requests or whatever comes to your mind. Best Regagrds, 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: 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: Clojure-Miniprofiler, a web application profiling tool
Hi Tom, I am not arguing about the performance impact here, however, it's nice to know there hardly is one. My only concern is that the code reader has to mentally parse away the trace calls, which puts a small burden on him and which might be less if it was in some kind of a macro, fn or metadata. However, I am still a clojure beginner and this was just one thing that came to my mind when I saw it :-) Thanks, Sven Am Samstag, 7. Februar 2015 22:16:04 UTC+1 schrieb tcrayford: Hi Sven, So typically I'd put that stuff *much* lower in the database layer - ideally as a wrapper around whatever database driver you're using, but that kind of idea is roughly right. I am considering releasing a set of libraries for miniprofiler that let it wrap e.g. a jdbc driver, redis clients, and so on. This is a clear case where having an interface or a protocol at the low level of the database driver really helps. That way you'd just import the library, tell it to wrap the connection and use it yourself. Would that be useful? Which database are you using? When miniprofiler isn't on, it has pretty minimal performance impact (apart from the fact that you're adding more code to your methods which can have implications for the JIT) - it's just a binding load and a nil? check, which is pretty quick. I leave that code in production for my app, and have done since July. Pushing the profiling information as low in the stack as possible, and leaving it on in production is a powerful combination - typically you never think about profiling or tracing whilst writing your code, but it's always there, even in production where you need it. Hope that helps, Tom On Saturday, 7 February 2015 08:21:31 UTC, Sven Richter wrote: Hi, I just tried it and it looks really useful if one wants to track down speed bumps in web apps. I wonder if I understand the usege correctly, right now I did something like this: (defn admin-page [params] (let [users (cjmp/trace all users (db/get-all-users (get params :filter)))] (layout/render user/admin.html (merge {:users users :roles available-roles} params I think this blows the code and one has to remove / add the trace function everytime one wants to profile the code. Maybe it would be an improvement if one could add some metadata to functions which then would be profiled only in dev mode for example? Best Regards, Sven Am Mittwoch, 4. Februar 2015 14:21:28 UTC+1 schrieb tcrayford: Ack, minor date error there. I've been running Clojure Miniprofiler in production since July 2014, and it's proved both very stable, and extremely useful. On Wednesday, 4 February 2015 13:16:43 UTC, tcrayford wrote: Clojure Miniprofiler is a simple, but effective profiling tool for your web application. It tells you what is slow about a web page both in production (for admins only), and in development, as you load the page. It's a port of the original .Net library to Clojure, utilizing the JavaScript and UI code that was originally written there. Read more about it here: http://yellerapp.com/opensource/clojure-miniprofiler.html And a sample performance debugging session is detailed here: http://yellerapp.com/posts/2015-02-04-miniprofiler.html I've been running Clojure Miniprofiler in production since July 2015, and it's proved both very stable, and extremely useful. -- 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.
Combining reloaded workflow in web dev with dynamic var approach
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: Clojure-Miniprofiler, a web application profiling tool
That sounds really nice, exactly the way one wants it too I think :-) Am Sonntag, 8. Februar 2015 20:37:43 UTC+1 schrieb tcrayford: Hi Sven, Right, but you want to push miniprofiler further down the app than that. For example, with datomic I have a yeller.datomic.instrumented namespace that exports the same vars as datomic.api, but wraps them in miniprofiler tracing. From the point of view of my application code, the only thing that changes is that you require a different namespace, which is significantly easier than littering trace calls everywhere. Does that help? Tom On Sunday, 8 February 2015 08:57:12 UTC, Sven Richter wrote: Hi Tom, I am not arguing about the performance impact here, however, it's nice to know there hardly is one. My only concern is that the code reader has to mentally parse away the trace calls, which puts a small burden on him and which might be less if it was in some kind of a macro, fn or metadata. However, I am still a clojure beginner and this was just one thing that came to my mind when I saw it :-) Thanks, Sven Am Samstag, 7. Februar 2015 22:16:04 UTC+1 schrieb tcrayford: Hi Sven, So typically I'd put that stuff *much* lower in the database layer - ideally as a wrapper around whatever database driver you're using, but that kind of idea is roughly right. I am considering releasing a set of libraries for miniprofiler that let it wrap e.g. a jdbc driver, redis clients, and so on. This is a clear case where having an interface or a protocol at the low level of the database driver really helps. That way you'd just import the library, tell it to wrap the connection and use it yourself. Would that be useful? Which database are you using? When miniprofiler isn't on, it has pretty minimal performance impact (apart from the fact that you're adding more code to your methods which can have implications for the JIT) - it's just a binding load and a nil? check, which is pretty quick. I leave that code in production for my app, and have done since July. Pushing the profiling information as low in the stack as possible, and leaving it on in production is a powerful combination - typically you never think about profiling or tracing whilst writing your code, but it's always there, even in production where you need it. Hope that helps, Tom On Saturday, 7 February 2015 08:21:31 UTC, Sven Richter wrote: Hi, I just tried it and it looks really useful if one wants to track down speed bumps in web apps. I wonder if I understand the usege correctly, right now I did something like this: (defn admin-page [params] (let [users (cjmp/trace all users (db/get-all-users (get params :filter)))] (layout/render user/admin.html (merge {:users users :roles available-roles} params I think this blows the code and one has to remove / add the trace function everytime one wants to profile the code. Maybe it would be an improvement if one could add some metadata to functions which then would be profiled only in dev mode for example? Best Regards, Sven Am Mittwoch, 4. Februar 2015 14:21:28 UTC+1 schrieb tcrayford: Ack, minor date error there. I've been running Clojure Miniprofiler in production since July 2014, and it's proved both very stable, and extremely useful. On Wednesday, 4 February 2015 13:16:43 UTC, tcrayford wrote: Clojure Miniprofiler is a simple, but effective profiling tool for your web application. It tells you what is slow about a web page both in production (for admins only), and in development, as you load the page. It's a port of the original .Net library to Clojure, utilizing the JavaScript and UI code that was originally written there. Read more about it here: http://yellerapp.com/opensource/clojure-miniprofiler.html And a sample performance debugging session is detailed here: http://yellerapp.com/posts/2015-02-04-miniprofiler.html I've been running Clojure Miniprofiler in production since July 2015, and it's proved both very stable, and extremely useful. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: ANN: Clojure-Miniprofiler, a web application profiling tool
Hi, I just tried it and it looks really useful if one wants to track down speed bumps in web apps. I wonder if I understand the usege correctly, right now I did something like this: (defn admin-page [params] (let [users (cjmp/trace all users (db/get-all-users (get params :filter)))] (layout/render user/admin.html (merge {:users users :roles available-roles} params I think this blows the code and one has to remove / add the trace function everytime one wants to profile the code. Maybe it would be an improvement if one could add some metadata to functions which then would be profiled only in dev mode for example? Best Regards, Sven Am Mittwoch, 4. Februar 2015 14:21:28 UTC+1 schrieb tcrayford: Ack, minor date error there. I've been running Clojure Miniprofiler in production since July 2014, and it's proved both very stable, and extremely useful. On Wednesday, 4 February 2015 13:16:43 UTC, tcrayford wrote: Clojure Miniprofiler is a simple, but effective profiling tool for your web application. It tells you what is slow about a web page both in production (for admins only), and in development, as you load the page. It's a port of the original .Net library to Clojure, utilizing the JavaScript and UI code that was originally written there. Read more about it here: http://yellerapp.com/opensource/clojure-miniprofiler.html And a sample performance debugging session is detailed here: http://yellerapp.com/posts/2015-02-04-miniprofiler.html I've been running Clojure Miniprofiler in production since July 2015, and it's proved both very stable, and extremely useful. -- 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: Multi purpose webframework deciding between serverside generated templates and cljs SPA approach
Hi Torsten, I may add this some time in the future, bu for now I always used form based login, so some sort of a combination of SPA and traditional framework. Did you see this series: http://rundis.github.io/blog/2015/buddy_auth_part2.html This seems to go into the direction you are looking for, maybe it is helpful. Best Regards, Sven Am Freitag, 30. Januar 2015 11:46:33 UTC+1 schrieb Torsten Uhlmann: I'm currently wrapping my head around single page apps with authentication / authorization, so I would be interested in seeing a spa approach. Thanks for publishing, whatever way you choose. 2015-01-30 11:11 GMT+01:00 Sven Richter sve...@googlemail.com javascript:: Hi, I am working on taking luminus and chestnut templates some steps further by additionally providing authentication and user management + some crud generation for entities plus whatever comes to my mind. Now, I am a bit undecided, I am working on a view that lists available users plus some editing. The original plan was to do it with server side templating and form submissions, however, as I also plan provide some headstart with reagent I could do the same in an SPA approach with ajax requests to the server. Of course, what fits better is almost always a question of the specific project, but I would be interested what the general feeling for this is in the clojure community. What would other people prefer? What would make sense? Anything one would have to think of that I may have forgot? Btw. who wants to follow, this is the github page: https://github.com/sveri/closp Thanks, Sven -- 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. -- AGYNAMIX(R). Passionate Software. Inh. Torsten Uhlmann | Buchenweg 5 | 09380 Thalheim Phone: +49 3721 273445 Fax: +49 3721 273446 Mobile: +49 151 12412427 Web:http://www.agynamix.de Author of Lift Web Applications How-To http://www.packtpub.com/lift-web-applications/book -- 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.
Multi purpose webframework deciding between serverside generated templates and cljs SPA approach
Hi, I am working on taking luminus and chestnut templates some steps further by additionally providing authentication and user management + some crud generation for entities plus whatever comes to my mind. Now, I am a bit undecided, I am working on a view that lists available users plus some editing. The original plan was to do it with server side templating and form submissions, however, as I also plan provide some headstart with reagent I could do the same in an SPA approach with ajax requests to the server. Of course, what fits better is almost always a question of the specific project, but I would be interested what the general feeling for this is in the clojure community. What would other people prefer? What would make sense? Anything one would have to think of that I may have forgot? Btw. who wants to follow, this is the github page: https://github.com/sveri/closp 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: Copy binary files in leiningen template
After searching through github I found this method unpack: https://github.com/tailrecursion/hlisp-template/blob/65b89bd257eca86c4ce76b82066a0b059323cdfb/src/leiningen/new/hlisp.clj which does the trick. In the end it manually copies from the jar file to a local folder. I wonder if there is a simpler way to do this? Thanks, Sven Am Sonntag, 25. Januar 2015 23:34:27 UTC+1 schrieb Sven Richter: Hm, I don't understand this, it seems like everyone is doing it like this: https://github.com/stammi/slides2-lein-template/blob/97c2df63b3fbddf0b09e8b501efce75ef4cb233e/src/leiningen/new/slides2_lein_template.clj (l. 15) And I get a copied file when I do that in my new application, but I cannot open it. It is not recognized as a gif file. Any Ideas what might be wrong here? You can find the complete source here: https://github.com/sveri/closp/blob/master/src/leiningen/new/closp.clj Thanks, Sven Am Sonntag, 25. Januar 2015 18:18:10 UTC+1 schrieb Sven Richter: Hi, I am creating a new leiningen template. Now I do have a binary file (gif) which I want to copy. I tried several things like: [resources/public/img/browser_carousel_small.jpg (io/resource loading.gif)] for instance, but none of it worked. Sometimes I got it copied, but it was not readable as an image and could not be opened. What is the correct way to copy binary files within a leiningen template? 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.
Copy binary files in leiningen template
Hi, I am creating a new leiningen template. Now I do have a binary file (gif) which I want to copy. I tried several things like: [resources/public/img/browser_carousel_small.jpg (io/resource loading.gif)] for instance, but none of it worked. Sometimes I got it copied, but it was not readable as an image and could not be opened. What is the correct way to copy binary files within a leiningen template? 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: Copy binary files in leiningen template
Hm, I don't understand this, it seems like everyone is doing it like this: https://github.com/stammi/slides2-lein-template/blob/97c2df63b3fbddf0b09e8b501efce75ef4cb233e/src/leiningen/new/slides2_lein_template.clj (l. 15) And I get a copied file when I do that in my new application, but I cannot open it. It is not recognized as a gif file. Any Ideas what might be wrong here? You can find the complete source here: https://github.com/sveri/closp/blob/master/src/leiningen/new/closp.clj Thanks, Sven Am Sonntag, 25. Januar 2015 18:18:10 UTC+1 schrieb Sven Richter: Hi, I am creating a new leiningen template. Now I do have a binary file (gif) which I want to copy. I tried several things like: [resources/public/img/browser_carousel_small.jpg (io/resource loading.gif)] for instance, but none of it worked. Sometimes I got it copied, but it was not readable as an image and could not be opened. What is the correct way to copy binary files within a leiningen template? 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: Dynamically creating defrecord
Thank you all for your answers and insights. As it often turns out, I don't need them. Clara rules also exposes other ways to pass data into rules. Best Regards, Sven On Sunday, January 18, 2015 at 3:34:17 AM UTC+1, Sean Corfield wrote: On Jan 17, 2015, at 3:04 PM, Matching Socks phill...@gmail.com javascript: wrote: And defstruct has not been deprecated in the API documentation. Technically true but when you see comments like these out there it’s reasonable to assume that structs should be avoided: We intentionally omit ... struct-maps, which are deprecated -- Prismatic Engineering Practices -- https://github.com/Prismatic/eng-practices/blob/master/clojure/20130926-data-representation.md#data-types I consider structs to be effectively deprecated so I don't use them at all. -- Alex Miller -- http://stackoverflow.com/questions/4575170/where-should-i-use-defrecord-in-clojure/4576143#4576143 Incidentally, unless you need to stick to Clojure 1.1, you might want to use 1.2's defrecord in preference to defstruct -- in fact, the latter is deprecated in 1.2. -- Michał Marczyk -- http://stackoverflow.com/questions/4288360/clojures-macro-define-a-binding-whose-name-is-composed-from-an-argument/4288738#4288738 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) -- 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.
Dynamically creating defrecord
Hi, I am trying to create record definitions dynamically during runtime. What I would like to do is something like this: (defn mk-rec [record-name namespace arg-list] (eval '(do (ns namespace) (defrecord record-name arg-list And then call it like this: (mk-rec A ns [a b c]) (-ns.A 1 2 3 ) I am trying out different things, but struggle to get it right or find some tutorial for it. So if anyone is willing to share some working code I'd be really happy. 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: Newbie's confusion
Hi, Developing with cursive for almost half a year now, I still do use Lighttable (http://lighttable.com/) a lot. I find it especially useful for learning clojure as it delivers the most instant feedback I can think of by giving back results directly in the editor. So go and give it a shot, as a Java dev you will like it :-) Best Regards, Sven Am Freitag, 5. Dezember 2014 10:41:25 UTC+1 schrieb Laye Zhou: Hi, I started learning Clojure this week and I'm a bit confused about the general development process in the Clojure world. When I write Java there is a main method as the entry of the program, and in the IntelliJ IDEA it's kind of easy to run or debug the program by just clicking the Run or Debug. When I write Clojure code, this process of editing, compiling, debuting/running seems so different because I need to setup a Java application in IDEA + Cursive to start clojure.main -m main-namespace and there is no way to just click that Run button. Is it right I need to enable Compile all namespaces in the Clojure settings in IDEA? And since now we're equipped with REPL, I wonder what is the best way I can debug/run the program before I really build the project. Thank you. -- 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] freactive - high performance, pure Clojurescript, declarative DOM library
Hi, I am currently trying to make drag and drop work with freactive, but fail so far. This is my code: [:thead [:tr (for [col (first (:content struct))] [:td [:div {:draggable true :on-drag-start (fn [e] (println dragged)) :on-drag-over (fn [e] (.preventDefault e)) :on-drag-enter (fn [e] (.preventDefault e)) :on-drop (fn [e] (.preventDefault e)(println dropped)) :on-drag-end (fn [_] (println drag end))} col] ])]] But nothing happens, no matter what I try. Are there any restrictions? Should this be done in a different way? Best Regards, Sven Am Montag, 17. November 2014 03:20:29 UTC+1 schrieb Aaron Craelius: freactive (pronounced f reactive for functional reactive) is a new high performance, pure Clojurescript, declarative DOM library: https://github.com/aaronc/freactive It has a syntax very similar to that of Reagent and was in fact inspired by Reagent, Om, and others. I came up with it when I was doing some DOM programming after having spending a fair amount of time working with JavaFX (see my soon to be announced library fx-clj: https://github.com/aaronc/fx-clj). I thought Om and Reagent were very nice to work with (and actually inspired some what I did with fx-clj), but I felt from my desktop GUI experience, that I could take things a few steps further. freactive's main advantages over existing solutions are probably built-in animations support and slightly higher performance. Here are it's goals from the README: Provide a simple, intuitive API that should be almost obvious to those familiar with Clojure (inspiration from reagent)Allow for high-performance rendering good enough for animated graphics based on a purely declarative syntaxAllow for reactive binding of any attribute, style property or child node Allow for coordinated management of state via cursors (inspiration from om)Provide deeply-integrated animation supportAllow for cursors based on paths as well as lenses Provide a generic items view component for efficient viewing of large data sets Minimize unnecessary triggering of update eventsCoordinate all updates via requestAnimationFrame wherever possibleBe easy to debug Be written in pure Clojurescript Provide support for older browsers via polyfills (not yet implemented) Any feedback is welcome!! I'm not sure I like the name freactive - but it was the best I could think of at the time. Suggestions for alternative names are welcome. -- 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: [ClojureScript] Re: [ANN] freactive - high performance, pure Clojurescript, declarative DOM library
Thank you, I have done so here: https://github.com/aaronc/freactive/issues/25 Best Regards, Sven Am Montag, 1. Dezember 2014 18:56:27 UTC+1 schrieb Aaron: There are no restrictions on events and attributes (although some attributes may need a special handler if they don't work properly with setAttribute - please submit an issue on github). Looking at your code, maybe the issue is the event handler names - I believe the DOM events are called dragstart, dragend, etc. without a hyphen. On Mon, Dec 1, 2014 at 10:39 AM, Sven Richter sve...@googlemail.com javascript: wrote: Hi, I am currently trying to make drag and drop work with freactive, but fail so far. This is my code: [:thead [:tr (for [col (first (:content struct))] [:td [:div {:draggable true :on-drag-start (fn [e] (println dragged)) :on-drag-over (fn [e] (.preventDefault e)) :on-drag-enter (fn [e] (.preventDefault e)) :on-drop (fn [e] (.preventDefault e)(println dropped)) :on-drag-end (fn [_] (println drag end))} col] ])]] But nothing happens, no matter what I try. Are there any restrictions? Should this be done in a different way? Best Regards, Sven Am Montag, 17. November 2014 03:20:29 UTC+1 schrieb Aaron Craelius: freactive (pronounced f reactive for functional reactive) is a new high performance, pure Clojurescript, declarative DOM library: https://github.com/aaronc/freactive It has a syntax very similar to that of Reagent and was in fact inspired by Reagent, Om, and others. I came up with it when I was doing some DOM programming after having spending a fair amount of time working with JavaFX (see my soon to be announced library fx-clj: https://github.com/aaronc/fx-clj). I thought Om and Reagent were very nice to work with (and actually inspired some what I did with fx-clj), but I felt from my desktop GUI experience, that I could take things a few steps further. freactive's main advantages over existing solutions are probably built-in animations support and slightly higher performance. Here are it's goals from the README: Provide a simple, intuitive API that should be almost obvious to those familiar with Clojure (inspiration from reagent)Allow for high-performance rendering good enough for animated graphics based on a purely declarative syntaxAllow for reactive binding of any attribute, style property or child node Allow for coordinated management of state via cursors (inspiration from om)Provide deeply-integrated animation supportAllow for cursors based on paths as well as lenses Provide a generic items view component for efficient viewing of large data sets Minimize unnecessary triggering of update eventsCoordinate all updates via requestAnimationFrame wherever possibleBe easy to debug Be written in pure Clojurescript Provide support for older browsers via polyfills (not yet implemented) Any feedback is welcome!! I'm not sure I like the name freactive - but it was the best I could think of at the time. Suggestions for alternative names are welcome. -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to a topic in the Google Groups ClojureScript group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojurescript/99myJ9vLeKQ/unsubscribe. To unsubscribe from this group and all its topics, send an email to clojurescrip...@googlegroups.com javascript:. To post to this group, send email to clojur...@googlegroups.com javascript:. Visit this group at http://groups.google.com/group/clojurescript. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- 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] FFDC - A template for chestnut / friend / friendui / datomic and reactive
Hi: This is the github repo: https://github.com/sveri/ffdc From the Readme: This is a template (not a leiningen) combining several projects to get started with. Included are: - friend with friendui - datomic pro (should be easily replacable by datomic free edition) - chestnut template with all the nice reloading stuff - freactive instead of om - secretary for cljs routing - Bootstrap - JQuery - And some other things This is what I currently basically use when starting a new project. It is runnable like this. There might be some errors, so issues and pull requests are welcome. Any other hints regarding code style, etc too. Best Regards, 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] freactive - high performance, pure Clojurescript, declarative DOM library
Hi, I have been playing around and like it so far. I experience some behavior here where I wonder if it is intended or if I am doing something wrong. I have a main-page which I mount like this: (dom/mount! root (main-page)) and which looks like this: (defn main-page [] [... [:div#content [(rx ((sess/get :current-page)))]]... it loads the current page into the content div, this works. Now I have one page which looks like this: (defn sub-page [] [:div ; ... some forms [(rx (di-table))]]) (defn di-table [] [:table [:tbody (for [di (sess/get :dis)] [:tr [:td (:name di)] [:td (:host di)] [:td (str (:port di))] [:td [:button {:id (:id di) :on-click #(delete-docker-instance (:id di))} Delete]]])]]) It works as it rerenders when I change the state, however, it rerenders the whole page and not only the table, which I wouldn't expect. Is it possible to only rerender the table? I am using 0.1.0 Best Regards, Sven Am Montag, 17. November 2014 03:20:40 UTC+1 schrieb Aaron: freactive (pronounced f reactive for functional reactive) is a new high performance, pure Clojurescript, declarative DOM library: https://github.com/aaronc/freactive It has a syntax very similar to that of Reagent and was in fact inspired by Reagent, Om, and others. I came up with it when I was doing some DOM programming after having spending a fair amount of time working with JavaFX (see my soon to be announced library fx-clj: https://github.com/aaronc/fx-clj). I thought Om and Reagent were very nice to work with (and actually inspired some what I did with fx-clj), but I felt from my desktop GUI experience, that I could take things a few steps further. freactive's main advantages over existing solutions are probably built-in animations support and slightly higher performance. Here are it's goals from the README: - Provide a *simple, intuitive API https://github.com/aaronc/freactive/#hello-world* that should be almost obvious to those familiar with Clojure (inspiration from reagent https://github.com/reagent-project/reagent) - Allow for *high-performance https://github.com/aaronc/freactive/#performance* rendering *good enough for animated graphics http://aaronc.github.io/freactive/dom-perf* based on a purely declarative syntax - Allow for *reactive binding of any attribute, style property or child node* - Allow for *coordinated management of state via cursors https://github.com/aaronc/freactive/#cursors* (inspiration from om https://github.com/swannodette/om) - Provide *deeply-integrated animation https://github.com/aaronc/freactive/#animations* support - Allow for cursors based on paths as well as *lenses* - Provide a generic items view component https://github.com/aaronc/freactive/#items-view for *efficient viewing of large data sets* - *Minimize unnecessary triggering of update events* - Coordinate all updates via *requestAnimationFrame* wherever possible - Be easy to debug https://github.com/aaronc/freactive/#debugging-reactive-expressions - Be written in *pure Clojurescript* - Provide support for older browsers via polyfills (not yet implemented) Any feedback is welcome!! I'm not sure I like the name freactive - but it was the best I could think of at the time. Suggestions for alternative names are welcome. -- 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.test.check with fixtures
Hi, thank you, I just wanted to make sure I am not missing some functionality. Best Regards, Sven Am Mittwoch, 5. November 2014 23:29:54 UTC+1 schrieb Ashton Kemerling: You can use fixtures from Clojure.test, but each spec from the perspective of clojure.test includes multiple runs. So I use fixtures :once to do any global setup, and then farm out to a setup function for anything that needs to be done before each test run. --Ashton Sent from my iPhone On Nov 5, 2014, at 3:27 PM, Sven Richter sve...@googlemail.com javascript: wrote: Hi, Is there a way to use clojure.test.check's defspec with fixtures? Like (use-fixtures :each (partial wrap-setup setup teardown)) in clojures test library? How do other people execute setup and teardowns with clojure.test.check? Best Regards, Sven -- 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 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.
clojure.test.check with fixtures
Hi, Is there a way to use clojure.test.check's defspec with fixtures? Like (use-fixtures :each (partial wrap-setup setup teardown)) in clojures test library? How do other people execute setup and teardowns with clojure.test.check? Best Regards, 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: where do I think the wrong way
Hi Roelof, Just a general advice, for figuring out how small things like these work and why they don't work I find Lighttable (http://lighttable.com/) an awesome IDE. This is the best thing available to learn clojure (combined with a good book or online resource of course) and I would have to have IDEs with an instant inline REPL for different languages too while learning these. However, what I usually did (and still sometimes do) is fire up Lighttable, open a barebone namespace, insert this function: (defn add-author [book new-author] (assoc book (conj :authors new-author))) and (add-author little-schemer {:name Gerald J. Sussman}) then evaluate both and just see what happens. Most of the times something failed and then it's easy to take one step back and just evaluate simpler things like: (conj :authors {:name Gerald J. Sussman}) or whatever the smallest example might be. This helps tremendously in learning and understanding what works and what doesn't work. Disclaimer: This post is not here to say: RTFM and stop posting questions, but it is here to show you a better way learning a language. So I hope you don't get me wrong and enjoy the funny clojure ride. Best Regards, Sven Am Mittwoch, 29. Oktober 2014 12:01:18 UTC+1 schrieb Roelof Wobben: Hello, For a exercise I have to add something to the end of a existing map. So I thought this would work : (defn add-author [book new-author] (assoc book (conj :authors new-author))) and call the function with : (add-author little-schemer {:name Gerald J. Sussman}) then I see this error message : ClassCastException clojure.lang.Keyword cannot be cast to clojure.lang.IPersistentCollection clojure.core/conj (core.clj:83) Roelof -- 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: multimethod, record, type, and protocol pitfalls?
Hi Daniel, When running through tutorials and blog posts it did not occur to me that the functions of a defprotocol are namespaced to where they are defined. Meaning, calling these functions I have to use their original namespace. It is obvious when one reads the official documentation, but one does not always do this first, so that wsa one pitfall I ran into. Best Regards, Sven Am Sonntag, 26. Oktober 2014 16:48:29 UTC+1 schrieb Daniel Higginbotham: What's difficult when it comes to understanding multimethods, records, types, and protocols? I'm writing a chapter on multimethods, records, types, and protocols for the book Clojure for the Brave and True, and I'd love to hear about what kinds of pitfalls I should be sure to cover :) Thanks! Daniel -- 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: Demoralising experience trying to install on Win 7
Hi, Just as Jony said and I tried to make clear, there is an relativ easy way to get started (I did this a few hours ago on a new W7 installation) 1. set JAVA_HOME path 2. Download: leiningen-win-installer-1.0 from http://leiningen-win-installer.djpowell.net/ 3. Download wget from http://gnuwin32.sourceforge.net/packages/wget.htm 4. Add bin folder of wget to the windows path 5. Open cmd line - insert lein repl It will fail suggesting to run lein self-install 6. Run lein self-install It will download and install all necessary things. That's it. Best Regards, Sven Am Samstag, 25. Oktober 2014 13:18:02 UTC+2 schrieb Geoff Caplan: Hi folks Thanks for the suggestions! 1. Sven - yes, I have the SDK for Java 8 and JAVA_HOME is set correctly 2. Divyansh - thanks - Clooj works on my box, but as you say it's hardly a long-term solution... 3. Phillip - I've tried the installer, as I said, but it doesn't work. And it's still targeting Leiningen 1. It's linked from the Leiningen homepage but seems like a dead project. Not a great introduction to Clojure... 4. Laurent - thanks for the link to the standalone - didn't realise that existed. Not an Eclipse fan - was going to try Light Table and fall back on Emacs if I didn't like it. Just installed and it's as slow and cumbersome as I expected, but I guess I could limp along with it if I absolutely had to... If there's any senior member of the community reading this - Windows still owns almost 90% of the desktop. The Leiningen site and the Clojure Getting Started page give essentially no help to Windows users, and Googling hasn't turned up a solution either. I'm no sysadmin but I'm a reasonably sophisticated developer and I'm stuck. Can you really afford to ignore this huge group? As I said, the Haskell community is light-years ahead of you here. So I would still very much appreciate a solution that would enable me to choose my editor freely... -- 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: Demoralising experience trying to install on Win 7
Hi, I experience one problem too with leining 2.5.0 (not sure if it happened before already). The upgrade to leiningen 2.5.0 from 2.4.x was broken. The same happened yesterday when I tried to install leiningen in a new environment on windows 7. Not sure what the exact output of leiningen during installation is, however, when it's done I open a cmd line and type: lein repl. This fails with an error message and a suggestion I should do lein self-install. This will fail too as I have wget missing on my system. After installing wget and putting it into the path lein self-install can finish it's job and everything works again. After developing for almost one year now in my spare time on windows 7 with clojure this was the only broken thing I experienced. I tried pedestal once and think that it does not support windows explicitly, however, for the few days I played around with it I did not see any windows specific errors. So rest assured, you will have a good time developing on windows. In the end it just becomes bytecode that runs on a lot of platforms. Aside from that, did you set the JAVA_HOME variable for your user? You have JDK 7 or 8 installed, IIRC JDK 6 is not supported anymore. Best Regards, Sven Am Samstag, 25. Oktober 2014 03:44:42 UTC+2 schrieb Geoff Caplan: Hi Wanting to get Clojure running on a Win 7 machine with no diskspace for dual boot. It's been a demoralising experience. I tried the Win installer linked from the Leiningen website. It failed to download the Leiningen 1 jar - the shell simply flashed open and crashed. Dug around the git site and found a recent .bat file that's supposed to work with the latest Leiningen 2. Again, the shell flashed and crashed. Then manually downloaded the latest Leiningen 2 preview. Again running lein simply flashes and crashes the shell. There's been a recent open issue on Windows installation but it's supposed to be fixed. The lein.bat file is on my path and has exec permissions. I have Java 8 SDK installed and healthy. Not sure where I go from here - any advice much appreciated. I'm dithering between Clojure and Haskell for my next project. The Haskell community provide a well-maintained batteries-included Windows install for GHCi - I was in the Repl 60 seconds after visiting their site. I've been struggling with Leiningen for an hour and getting nowhere. It seems a great pity that the Clojure community seem to be ignoring those of us who are stuck with Windows - it must be having a negative effect on the uptake of the language. I see that this has been an issue for years, but hasn't been addressed. I'm more drawn to Clojure than to Haskell, but if I can't get it running I'll be forced to go elsewhere. Please 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.
Invalidating a session for a given user
Hi, I wonder if it's possible to invalidate a ring session for a given arbitrary user (not the logged in one)? Sometimes, when applying administrative tasks regarding user management in a web application it might be useful to have the user to relog. Another posiibility might be to be able to update the session of an user, but I am not sure if this is considered secure, or how it might be done at all. Any pointers / hints on how to approach such issues? Best Regards, 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: Invalidating a session for a given user
Yea, I thought about this too, however, I am not using a database right now, but just the in memory session store. Best Regards, Sven Am Donnerstag, 23. Oktober 2014 15:54:41 UTC+2 schrieb James Reeves: If you're using a database to store your sessions, you can just remove the entry that's associated with a particular user. - James On 23 October 2014 14:45, Sven Richter sve...@googlemail.com javascript: wrote: Hi, I wonder if it's possible to invalidate a ring session for a given arbitrary user (not the logged in one)? Sometimes, when applying administrative tasks regarding user management in a web application it might be useful to have the user to relog. Another posiibility might be to be able to update the session of an user, but I am not sure if this is considered secure, or how it might be done at all. Any pointers / hints on how to approach such issues? Best Regards, Sven -- 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 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: Testing existing java code with clojure tests from ant / gradle
Hi, that looks really nice, exactly what I need. I just wonder, how do you integrate the clojure source code into your projects? For example, using gradle, is it enough to have a src/test/clj folder and include the clojure jar in the gradle build as a dependency? How did you do that? Best Regards, Sven Am Donnerstag, 16. Oktober 2014 12:06:09 UTC+2 schrieb Mikera: I wrote cljunit (https://github.com/mikera/cljunit) to address precisely this problem. cljunit lets you run any clojure.test tests using a simple JUnit test wrapper. This means you get Eclipse integration etc. for free, and it can integrate nicely with any build tools that have JUnit support. On Wednesday, 15 October 2014 20:17:05 UTC+8, Sven Richter wrote: Hi, I have the opportunity to start some clojure here in our office, we are a pure java team right now and as I am the only working on this currently I would like to run some tests in clojure. Of course, these tests will have to test existing java code. So ideally, what I would like to do is to take existing projects and add some unit tests. These existing projects are build with gradle or ant (we are switching to gradle, however, our main libs will be built with ant for some time). That means that theses tests will have to be run during the gradle / ant build. Additionally, as we are developing in eclipse, the tests also have to be part of the existing test suites. Is that possible at all? Are there any examples out there that do something similar? I would like to keep the barrier of using the tests as low as possible (I am not talking about the development of the tests). Thanks for every comment, hint, whatever, 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.
Testing existing java code with clojure tests from ant / gradle
Hi, I have the opportunity to start some clojure here in our office, we are a pure java team right now and as I am the only working on this currently I would like to run some tests in clojure. Of course, these tests will have to test existing java code. So ideally, what I would like to do is to take existing projects and add some unit tests. These existing projects are build with gradle or ant (we are switching to gradle, however, our main libs will be built with ant for some time). That means that theses tests will have to be run during the gradle / ant build. Additionally, as we are developing in eclipse, the tests also have to be part of the existing test suites. Is that possible at all? Are there any examples out there that do something similar? I would like to keep the barrier of using the tests as low as possible (I am not talking about the development of the tests). Thanks for every comment, hint, whatever, 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: jetty restart failing
Am Montag, 15. September 2014 00:20:21 UTC+2 schrieb Wilker: I felt that was too much for me, but I'm digging into his source codes to learn more, and he seems to do a more robust way to shut down the server: https://github.com/juxt/modular/blob/master/modules/netty/src/modular/netty.clj This looks interesting. I just had a look into the jetty ring adapter source code and did not find a decidated stop method. Maybe it's time for a feature request? His version seems to work, but it's for Netty... I'm actually starting to consider switch to Netty just because of that. Yea, not being able to restart without having to load up the jvm again and again is really a time stealer. I am curious, why don't you use http-kit? Or why did you decide for jetty / netty? What I think is weird about that, is that if that was the case, a new (start) should work after a few seconds, but it doesn't... Jetty seems to hang on an never closes... For that my guess is that some pending operation is going on preventing it from shutting down at all... A fix could be a way to force Jetty to close and wait until it's actually closed. Maybe it's also an idea to look into the actual jetty source code and find out how they do stop the server, maybe there is a way to call that code from clojure and see what's going on there. Best Regards, Sven Thanks for the help. --- Wilker Lúcio http://about.me/wilkerlucio/bio Woboinc Consultant +55 81 82556600 On Sun, Sep 14, 2014 at 6:29 PM, Sven Richter sve...@googlemail.com javascript: wrote: Hi Wilker, I have been going the same way and never really found out why this happens (I am using http-kit instead of jetty). However, one thing that I did not knew was that a refresh will delete references of vars. So if you keep your stop function somewhere and call refresh before the stop function you will not be able to stop jetty anymore and hence, when you try to start it, it is already running. I implemented my own component library, having the same problems, especially when I was using a lot of protocols / records (may have been just a coincidence) and finally found about the hara.component library. I am using this one now and seem to have less problems. But, to be honest, I cannot believe that stuarts component library is the problem, but my way of using it or coding. Of course I'd be interested too to hear other opinions. Best Regards, Sven Am Sonntag, 14. September 2014 01:32:44 UTC+2 schrieb Wilker: I forgot to post before, here is the actual error: BindException Address already in use sun.nio.ch.Net.bind0 (Net.java:-2) Also, adding a (Thread/sleep 1000) seems to increase the success rate, but would be nice to be able to really wait on Jetty to shutdown instead of using arbitrary sleep. Thanks. --- Wilker Lúcio http://about.me/wilkerlucio/bio Woboinc Consultant +55 81 82556600 On Sat, Sep 13, 2014 at 8:20 PM, Wilker wilke...@gmail.com wrote: Hi, I'm trying to apply the ideas from the component library: https://github.com/stuartsierra/component My problems is being about stop/start the Jetty server, for that purpose I created this component: (defrecord WebServer [app port join? jetty log] component/Lifecycle (start [c] (log Starting jetty server...) (let [jetty (jetty/run-jetty (:handler app) {:port port :join? join?})] (log Server started at port port) (assoc c :jetty jetty))) (stop [c] (when (:jetty c) (log Stopping jetty...) (.stop (:jetty c)) (log Server stopped.)) (assoc c :jetty nil))) (defn webserver-component ([port] (webserver-component port true)) ([port join?] (map-WebServer {:port port :join? join?}))) It works, sometimes, but often I get this when I try to reset: Error starting #ExceptionInfo clojure.lang.ExceptionInfo: Error in component :server in system com.stuartsierra.component.SystemMap calling #'com.stuartsierra.component/start {:reason :com.stuartsierra.component/component-function-threw-exception, :function #'com.stuartsierra.component/start, :system-key :server, :component #cadegp.components.web_server.WebServer{:app #cadegp.components.web_app.CadegpApp{:conn #cadegp.components.database.Database{:uri datomic:free://localhost:4334/cadegp, :connection #Connection {:db-id cadegp-48d87324-7849-4255-b798-865b02ee9d9d, :index-rev 0, :basis-t 1176, :next-t 1177, :unsent-updates-queue 0, :pending-txes 0}}, :handler #reload$wrap_reload$fn__1728 ring.middleware.reload$wrap_reload$fn__1728@6608b223, :handler-ext #user$wrap_dev_handler user$wrap_dev_handler@7e174cba}, :port 8000, :join? false, :jetty nil, :log #core$println clojure.core$println@7a2c3090}, :system #SystemMap} Seems that it tries to start the server before it have time to shut it down. Any of you had a similar issue or know how to work around
Re: jetty restart failing
Hi Wilker, I have been going the same way and never really found out why this happens (I am using http-kit instead of jetty). However, one thing that I did not knew was that a refresh will delete references of vars. So if you keep your stop function somewhere and call refresh before the stop function you will not be able to stop jetty anymore and hence, when you try to start it, it is already running. I implemented my own component library, having the same problems, especially when I was using a lot of protocols / records (may have been just a coincidence) and finally found about the hara.component library. I am using this one now and seem to have less problems. But, to be honest, I cannot believe that stuarts component library is the problem, but my way of using it or coding. Of course I'd be interested too to hear other opinions. Best Regards, Sven Am Sonntag, 14. September 2014 01:32:44 UTC+2 schrieb Wilker: I forgot to post before, here is the actual error: BindException Address already in use sun.nio.ch.Net.bind0 (Net.java:-2) Also, adding a (Thread/sleep 1000) seems to increase the success rate, but would be nice to be able to really wait on Jetty to shutdown instead of using arbitrary sleep. Thanks. --- Wilker Lúcio http://about.me/wilkerlucio/bio Woboinc Consultant +55 81 82556600 On Sat, Sep 13, 2014 at 8:20 PM, Wilker wilke...@gmail.com javascript: wrote: Hi, I'm trying to apply the ideas from the component library: https://github.com/stuartsierra/component My problems is being about stop/start the Jetty server, for that purpose I created this component: (defrecord WebServer [app port join? jetty log] component/Lifecycle (start [c] (log Starting jetty server...) (let [jetty (jetty/run-jetty (:handler app) {:port port :join? join?})] (log Server started at port port) (assoc c :jetty jetty))) (stop [c] (when (:jetty c) (log Stopping jetty...) (.stop (:jetty c)) (log Server stopped.)) (assoc c :jetty nil))) (defn webserver-component ([port] (webserver-component port true)) ([port join?] (map-WebServer {:port port :join? join?}))) It works, sometimes, but often I get this when I try to reset: Error starting #ExceptionInfo clojure.lang.ExceptionInfo: Error in component :server in system com.stuartsierra.component.SystemMap calling #'com.stuartsierra.component/start {:reason :com.stuartsierra.component/component-function-threw-exception, :function #'com.stuartsierra.component/start, :system-key :server, :component #cadegp.components.web_server.WebServer{:app #cadegp.components.web_app.CadegpApp{:conn #cadegp.components.database.Database{:uri datomic:free://localhost:4334/cadegp, :connection #Connection {:db-id cadegp-48d87324-7849-4255-b798-865b02ee9d9d, :index-rev 0, :basis-t 1176, :next-t 1177, :unsent-updates-queue 0, :pending-txes 0}}, :handler #reload$wrap_reload$fn__1728 ring.middleware.reload$wrap_reload$fn__1728@6608b223, :handler-ext #user$wrap_dev_handler user$wrap_dev_handler@7e174cba}, :port 8000, :join? false, :jetty nil, :log #core$println clojure.core$println@7a2c3090}, :system #SystemMap} Seems that it tries to start the server before it have time to shut it down. Any of you had a similar issue or know how to work around that? Thanks. --- Wilker Lúcio http://about.me/wilkerlucio/bio Woboinc Consultant +55 81 82556600 -- 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: using Stuarts component library correctly
Hi, Following the tips I removed the middleware wrappers, separated the handler and created closures over the routes. Now, when I do a reset after every change I am having a nice experience. So it was not much that was missing. Thanks everybody for your help, Sven Am Sonntag, 10. August 2014 21:11:12 UTC+2 schrieb Matt Mitchell: Here's some relevant info about tools.namespace and protocols: https://github.com/clojure/tools.namespace#warnings-for-protocols - Matt On Saturday, August 9, 2014 6:04:03 PM UTC-4, Sven Richter wrote: Hi, First I would like to thank everybody for your answers and hints. I setup a small project you can find here: https://github.com/sveri/component_test You can run it with lein repl and then calling (go). I have three questions/problems for this one: 1. Did I separate the handler and the server correctly (I was trying to follow your advices)? 2. In scheduler.clj I defined a protocol (additionally to the lifecycle protocol) and a record implementing that protocol. I create a new instance of that record and pass it down to the handler and there to the routes. Now, when I open a webpage and go to http://localhost:3000/sched everything works fine. Next I edit the add-job function in scheduler.cljs to print something different like this: (add-job [this] (println new sys out)) Just a small change is enough. If you go to the webpage again and try to reload it an exception will be thrown: Sat Aug 09 23:52:28 CEST 2014 [worker-3] ERROR - GET /sched java.lang.IllegalArgumentException: No implementation of method: :add-job of protocol: #'component-test.scheduler/ISched found for class: component_test.schedul er.Sched at clojure.core$_cache_protocol_fn.invoke(core_deftype.clj:544) at component_test.scheduler$eval6553$fn__6554$G__6544__6559.invoke(scheduler.clj:6) at component_test.routes$sched_in.invoke(routes.clj:8) at component_test.routes$home_routes$fn__3312.invoke(routes.clj:19) at compojure.core$make_route$fn__2331.invoke(core.clj:99) at compojure.core$if_route$fn__2315.invoke(core.clj:45) ... I dont really understand why that happens and any hints regarding what I am doing wrong would be great. And this leads to my last question. 3. After having an exception I will usually try to reset the system with: (reset), but in this case (and many different other cases) I will just get another error: component-test.user= (reset) :reloading (component-test.scheduler component-test.routes component-test.server component-test.handler component-test.core component-test.user component-test.c ore-test) ;; Starting HTTP-Kit server on port 3000 BindException Address already in use: bind sun.nio.ch.Net.bind0 (Net.java:-2) And now all I can do is exit the repl and start it again to get my code running. This is exactly what I dont want to do all the time and the problem I thought would be solved by the component library, so once more, every hint you have for me will be valuable about what I can do and what not. Best Regards, Sven Am Freitag, 8. August 2014 13:16:49 UTC+2 schrieb Sven Richter: Hi, I am trying to integrate Stuarts component library into my application. I am not sure if I use it correctly or do something else wrong or just have a wrong mindset. So I will explain how I am currently using it and the problem I see with it. I have three components: database, a scheduler and web application (note that my example is simplified to get faster to the point). These components are built like this: (component/system-map :database (db db-uri) :scheduler (component/using (scheduler) [:database]) :web-app (component/using (web-app) [:database :scheduler] )) And in my web-app I do something like this: (start [component] (let [db-conn (get-in web-app [:database :db-conn])] (assoc component :server (run-server (make-handler web-app db-conn) {:port port} And make-handler is a middleware that associates the database component into the request map. Now as I added the scheduler to my system it occured to me that I will have to associate the scheduler into the request map too to access it and I might have to do that for every other component that is coming along the road. So basically I am tying my web-app to to all these components and I am tying some components to other components (like scheduler component to the database component). And by tying this things together this way they do depend on each other and I cannot move them anymore. This came to my mind as I started thinking about microservices. So let's say I want to convert the scheduler into a restful microservice, it's hard to pass in a database connection into it via HTTP, so it seems like it's not decoupled enough. Does
Re: using Stuarts component library correctly
Hi Alan, that's right, I did not call (reset) before reloading the page. But that's what happens sometimes, you change some things, don't call reset and then an exception will be thrown. Afterwards the state seems to be broken and nothing works anymore. In this special case, when I change the implementation of (add-job), call reset and then reload the page no exception appears, and I can see the change. And your second remark is true too, the server was not shutdown, because of the exception I guess, when I try to call (stop) explicitly I get this error: component-test.user= (stop) ;; Shutting down HTTP-Kit server NullPointerException component-test.server.Server (server.clj:15) component-test.user= I mean, it's ok, one could say you have to call (reset) after every change, but sometimes one makes mistakes while coding and then you will get an exception too, which leads to a needed repl restart. And I just wonder if there is some way to get around that. Best Regards, Sven Am Sonntag, 10. August 2014 04:30:57 UTC+2 schrieb Alan Moore: On Saturday, August 9, 2014 3:04:03 PM UTC-7, Sven Richter wrote: Hi, I setup a small project you can find here: https://github.com/sveri/component_test You can run it with lein repl and then calling (go). 2. In scheduler.clj I defined a protocol (additionally to the lifecycle protocol) and a record implementing that protocol. I create a new instance of that record and pass it down to the handler and there to the routes. Now, when I open a webpage and go to http://localhost:3000/sched everything works fine. Next I edit the add-job function in scheduler.cljs to print something different like this: (add-job [this] (println new sys out)) Just a small change is enough. If you go to the webpage again and try to reload it an exception will be thrown: Sat Aug 09 23:52:28 CEST 2014 [worker-3] ERROR - GET /sched java.lang.IllegalArgumentException: No implementation of method: :add-job of protocol: #'component-test.scheduler/ISched found for class: component_test.schedul er.Sched at clojure.core$_cache_protocol_fn.invoke(core_deftype.clj:544) at component_test.scheduler$eval6553$fn__6554$G__6544__6559.invoke(scheduler.clj:6) at component_test.routes$sched_in.invoke(routes.clj:8) at component_test.routes$home_routes$fn__3312.invoke(routes.clj:19) at compojure.core$make_route$fn__2331.invoke(core.clj:99) at compojure.core$if_route$fn__2315.invoke(core.clj:45) ... It just looks like the code didn't get relaoded. I dont really understand why that happens and any hints regarding what I am doing wrong would be great. And this leads to my last question. 3. After having an exception I will usually try to reset the system with: (reset), but in this case (and many different other cases) I will just get another error: component-test.user= (reset) :reloading (component-test.scheduler component-test.routes component-test.server component-test.handler component-test.core component-test.user component-test.c ore-test) ;; Starting HTTP-Kit server on port 3000 BindException Address already in use: bind sun.nio.ch.Net.bind0 (Net.java:-2) The server isn't being shut down by the reset or anything else as far as I can see. The log message ;; Shutting down HTTP-Kit server doesn't appear anywhere in the output you supplied so I'm not sure the server's stop lifecycle method is being called and in any case it doesn't appear to actually shut down the server - it just calls (server)... whatever that does... I'm not sure. Good luck. Alan -- 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: using Stuarts component library correctly
Hi, First I would like to thank everybody for your answers and hints. I setup a small project you can find here: https://github.com/sveri/component_test You can run it with lein repl and then calling (go). I have three questions/problems for this one: 1. Did I separate the handler and the server correctly (I was trying to follow your advices)? 2. In scheduler.clj I defined a protocol (additionally to the lifecycle protocol) and a record implementing that protocol. I create a new instance of that record and pass it down to the handler and there to the routes. Now, when I open a webpage and go to http://localhost:3000/sched everything works fine. Next I edit the add-job function in scheduler.cljs to print something different like this: (add-job [this] (println new sys out)) Just a small change is enough. If you go to the webpage again and try to reload it an exception will be thrown: Sat Aug 09 23:52:28 CEST 2014 [worker-3] ERROR - GET /sched java.lang.IllegalArgumentException: No implementation of method: :add-job of protocol: #'component-test.scheduler/ISched found for class: component_test.schedul er.Sched at clojure.core$_cache_protocol_fn.invoke(core_deftype.clj:544) at component_test.scheduler$eval6553$fn__6554$G__6544__6559.invoke(scheduler.clj:6) at component_test.routes$sched_in.invoke(routes.clj:8) at component_test.routes$home_routes$fn__3312.invoke(routes.clj:19) at compojure.core$make_route$fn__2331.invoke(core.clj:99) at compojure.core$if_route$fn__2315.invoke(core.clj:45) ... I dont really understand why that happens and any hints regarding what I am doing wrong would be great. And this leads to my last question. 3. After having an exception I will usually try to reset the system with: (reset), but in this case (and many different other cases) I will just get another error: component-test.user= (reset) :reloading (component-test.scheduler component-test.routes component-test.server component-test.handler component-test.core component-test.user component-test.c ore-test) ;; Starting HTTP-Kit server on port 3000 BindException Address already in use: bind sun.nio.ch.Net.bind0 (Net.java:-2) And now all I can do is exit the repl and start it again to get my code running. This is exactly what I dont want to do all the time and the problem I thought would be solved by the component library, so once more, every hint you have for me will be valuable about what I can do and what not. Best Regards, Sven Am Freitag, 8. August 2014 13:16:49 UTC+2 schrieb Sven Richter: Hi, I am trying to integrate Stuarts component library into my application. I am not sure if I use it correctly or do something else wrong or just have a wrong mindset. So I will explain how I am currently using it and the problem I see with it. I have three components: database, a scheduler and web application (note that my example is simplified to get faster to the point). These components are built like this: (component/system-map :database (db db-uri) :scheduler (component/using (scheduler) [:database]) :web-app (component/using (web-app) [:database :scheduler] )) And in my web-app I do something like this: (start [component] (let [db-conn (get-in web-app [:database :db-conn])] (assoc component :server (run-server (make-handler web-app db-conn) {:port port} And make-handler is a middleware that associates the database component into the request map. Now as I added the scheduler to my system it occured to me that I will have to associate the scheduler into the request map too to access it and I might have to do that for every other component that is coming along the road. So basically I am tying my web-app to to all these components and I am tying some components to other components (like scheduler component to the database component). And by tying this things together this way they do depend on each other and I cannot move them anymore. This came to my mind as I started thinking about microservices. So let's say I want to convert the scheduler into a restful microservice, it's hard to pass in a database connection into it via HTTP, so it seems like it's not decoupled enough. Does that make sense? Am I using it wrong? Is it ok to pass all kind of dependencies into the request map and shove it around in the web application? Any other suggestions / remarks? Best Regards, 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
using Stuarts component library correctly
Hi, I am trying to integrate Stuarts component library into my application. I am not sure if I use it correctly or do something else wrong or just have a wrong mindset. So I will explain how I am currently using it and the problem I see with it. I have three components: database, a scheduler and web application (note that my example is simplified to get faster to the point). These components are built like this: (component/system-map :database (db db-uri) :scheduler (component/using (scheduler) [:database]) :web-app (component/using (web-app) [:database :scheduler] )) And in my web-app I do something like this: (start [component] (let [db-conn (get-in web-app [:database :db-conn])] (assoc component :server (run-server (make-handler web-app db-conn) {:port port} And make-handler is a middleware that associates the database component into the request map. Now as I added the scheduler to my system it occured to me that I will have to associate the scheduler into the request map too to access it and I might have to do that for every other component that is coming along the road. So basically I am tying my web-app to to all these components and I am tying some components to other components (like scheduler component to the database component). And by tying this things together this way they do depend on each other and I cannot move them anymore. This came to my mind as I started thinking about microservices. So let's say I want to convert the scheduler into a restful microservice, it's hard to pass in a database connection into it via HTTP, so it seems like it's not decoupled enough. Does that make sense? Am I using it wrong? Is it ok to pass all kind of dependencies into the request map and shove it around in the web application? Any other suggestions / remarks? Best Regards, 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.
[ANN] friendui 0.3.3
Hi, I just released friendui 0.3.3. I added two callback functions where one can add additional logic after a successful signup|activation. It's fairly easy to add more, so, if the need for this exists, just add an issue to github. I also added two more projects: https://github.com/sveri/friendui-datomic and https://github.com/sveri/clojure-commons Both together provide a full implementation for friendui usage with datomic as a storage, so, if someone is interested in how this works he might have a look at it. It's by far not the best code written, but it may help to get started. Best Regards, 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: reloading enlive templates
Hi Curtis, this solution works as expected, thank you very much. Best Regards, Sven Am Donnerstag, 3. Juli 2014 18:30:03 UTC+2 schrieb Curtis Summers: I'm using ring.middleware.force-reload to always reload the namespaces that reference my enlive templates. (only in dev, of course) https://github.com/citizenparker/ring-middleware-force-reload Hope that helps, Curtis On Wednesday, July 2, 2014 3:14:16 PM UTC-5, Sven Richter wrote: Hi, I am trying to reload my enlive templates with a watcher, how it was suggested in this issue: https://github.com/cgrand/enlive/issues/6 I am calling this function of start of my application: (watcher/watcher [resources/] (watcher/rate 50) ; poll every 50ms (watcher/on-change (fn [file] (do (println file changed: file) ;(use 'de.sveri.clj.adspread :reload) ;as soon as I uncomment this, the anonymous function is not called anymore But just like I stated in the comment, as soon as I try to reload a namespace the anonymous function is not executed anymore, whereas without the (use ...) call it gets executed on file change. I also tried to call (reload 'namespace) but that did not work either. Any ideas on how to fix this or make enlive templates reload on change? Best Regards, 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.
reloading enlive templates
Hi, I am trying to reload my enlive templates with a watcher, how it was suggested in this issue: https://github.com/cgrand/enlive/issues/6 I am calling this function of start of my application: (watcher/watcher [resources/] (watcher/rate 50) ; poll every 50ms (watcher/on-change (fn [file] (do (println file changed: file) ;(use 'de.sveri.clj.adspread :reload) ;as soon as I uncomment this, the anonymous function is not called anymore But just like I stated in the comment, as soon as I try to reload a namespace the anonymous function is not executed anymore, whereas without the (use ...) call it gets executed on file change. I also tried to call (reload 'namespace) but that did not work either. Any ideas on how to fix this or make enlive templates reload on change? Best Regards, 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] friendui 0.3.0
Hi Frozen, Currently there is only the option to send mail via sendmail or dont send a mail at all. If you turn it off you can use your application to send an activation email, as the activation id is provided in create-user method of the storage protocol. Of course you can add issues or pull requests to friend-ui. I will work on them as time comes at my hand. Best Regards, Sven Am Freitag, 27. Juni 2014 22:11:43 UTC+2 schrieb Frozenlock: Looks nice! I'll try to think to use it in my next project. One little problem I can see is the sendmail requirement. Isn't there a way to add a remote SMTP? (Like with the postal library?) On Wednesday, June 25, 2014 4:05:38 PM UTC-4, Sven Richter wrote: Hi, I just wanted to announce friendui 0.3.0. https://github.com/sveri/friend-ui/ I did a major rework and removed the dependency to datomic. Instead one can implement a storage protocal with whatever storage one prefers. Feedback is welcome. Best Regards, 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.
[ANN] friendui 0.3.0
Hi, I just wanted to announce friendui 0.3.0. https://github.com/sveri/friend-ui/ I did a major rework and removed the dependency to datomic. Instead one can implement a storage protocal with whatever storage one prefers. Feedback is welcome. Best Regards, 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.
Integrating clojurescript and clojure in one library
Hi, While working on the admin interface of friend-ui (https://groups.google.com/forum/#!searchin/clojure/friend-ui/clojure/QoJHPFXjDuc/IbBsHmOLNdIJ) I got the idea to add some cljs (om / kioo) to my library and then provide both, the compiled js and the compiled java code in one jar. Now, it works partially, I can generate both of them and pack them with lein jar into one jar file. But whenever I want to use the generated js (provided by the friendui jar) files in a different project the ring server cannot find them. Now I wonder if my approach to pack to different things into one library does make sense or even works somehow. I got the feeling that it's wrong, but I would like to hear some opinions about it. Best Regards, 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.
[ANN] friendui 0.2.0 released
Hi, I just released friendui into the wild: https://github.com/sveri/friend-ui/. Friendui is a wrapper around cemericks friend and datomic. This is the first time I am contributing something to the clojure community, mainly because I just started using clojure some months ago. If someone finds this useful, then please go ahead and use it or add some feature requests to it. I would be happy about any feedback, but especially feedback regarding the clojure code, so if someone is bored and got some time, just go ahead, I would really like to learn more about best practices and newbie mistakes. Best Regards, 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] Session 0.1.3 - A live-coding environment for Clojure
Hi, This looks pretty awesome. Do you plan to integrate some authentication mechanism. I just imagined running session on my server and being able to access it from everywhere around the world, always having a repl available instantly. But obv. I dont want everybody to access it. Best Regards, Sven Am Montag, 24. März 2014 13:12:48 UTC+1 schrieb kovasb: Session is a live coding environment, built on Datomic and Om. repo: https://github.com/kovasb/session video: https://vimeo.com/89899023 blog post: https://medium.com/p/1a12997a5f70 I've been working on Session for some time, but have held off on a formal announcement for the simple reason that it was not clear that its design was capable of delivering on its ambitious goals. Om, and the principles behind it, are a game-changer for projects like Session. After rewriting Session in Om, its pretty clear that this is going to work. Om was the missing piece. As reflected in the version number, Session is still very alpha. But with foundational issues finally out of the way, I'm happy to announce this as an active project rapidly moving forward. Shout-out to my KTC studio-mates David Nolen and Tims Gardner, who've been very helpful getting to this point. Here's to hoping this thread won't be filled with bug reports about installation issues :) -Kovas -- 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: noir.session clojure.lang.Var$Unbound cannot be cast to java.util.concurrent.Future
I think I tracked the problem down. In my handler I define my routes, which calls enlive/deftemplate, which is a macro. Now, if I understand this right, the macro will be called at compile time, when noir.session is not available yet. Is that right? How can I get around this? Am Sonntag, 23. März 2014 23:23:39 UTC+1 schrieb Sven Richter: Hi Sean, I am using a luminusweb project. So yes, noir.session gets initialized and is working. I was testing that before to get a feeling for noir.session at all. So could this be a timing issue? Trying to access the session before it is initialized? Thanks, Sven Am Sonntag, 23. März 2014 23:14:33 UTC+1 schrieb Sean Corfield: Looks like the Noir session isn't initialized. Have you added the wrap-noir-session middleware? Sean On Mar 23, 2014, at 2:54 PM, Sven Richter sve...@googlemail.com wrote: I have an error message that I just dont understand. This is what I am trying to do: (ns service) (defn get-id [] (session/get :id)) (ns http) (defn get-it [] (parse-string (:body (client/get (str base-url rest/api/2/search?jql=issuetype=Eposstatus!=closedmaxResults=1000JSESSIONID= (service/get-id)) ;this is there the error occurs :accept :json} Now, when I startup ring I get the following error: Exception in thread main java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to java.util.concurrent.Future at clojure.core$deref_future.invoke(core.clj:2108) at clojure.core$deref.invoke(core.clj:2129) at noir.session$get.invoke(session.clj:24) at lweb.services.jira$get_jira_session_id.invoke(jira.clj:17) at lweb.services.epic$get_epics.invoke(epic.clj:19) at lweb.services.epic$get_epic_sp_map.invoke(epic.clj:40) at lweb.services.epic$eval10850.invoke(epic.clj:43) -- 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.