This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-10-13
Channels
- # admin-announcements (48)
- # alda (1)
- # aws (24)
- # beginners (4)
- # boot (103)
- # cider (69)
- # clojure (111)
- # clojure-art (5)
- # clojure-dev (35)
- # clojure-greece (2)
- # clojure-nl (3)
- # clojure-russia (1)
- # clojure-shanghai (1)
- # clojurescript (220)
- # clojurescript-ios (1)
- # clojurewerkz (3)
- # community-development (3)
- # core-logic (5)
- # cursive (5)
- # datomic (24)
- # devcards (21)
- # editors (3)
- # funcool (1)
- # hoplon (20)
- # ldnclj (47)
- # ldnproclodo (1)
- # liberator (1)
- # off-topic (7)
- # om (21)
- # onyx (36)
- # reagent (1)
- # ring-swagger (2)
- # spacemacs (38)
- # yada (17)
I have a hashmap representing a user, {:email …, :password …, etc} and when I run validations, I add :validation-errors to contain the errors. It kind of bothers me that fields, such as email, and validation-errors are at the same level. Is there a better design I could use here?
So you’d rather have something like {:email {:value “
?
If you’re displaying validation errors on individual fields that’s probably better but if you’re batching them up the top of a form or something then your initial approach might be better.
I’m happy having all the validation errors in a hashmap by field name. My problem is the mix of fields and a map of validation errors.
lfn3: I’m too new to Clojure to know whether that’s good or bad design. Metadata, as far as I could see, are used to tell the compiler stuff. I’m not sure how it’ll be serialized either through my API.
validation errors do feel like metadata (data about data), so, I’m very tempted.
I was also tempted to use something else than keywords for keys that are not fields.
If it’s an api then serializing that might be tricky. I don’t think most serialization libs do metadata.
Yeah, I doubt it. From what I can see, not even keywords are respected.
Yes. Something is keywordizing the keys on the server side. Not sure what yet.
@cfleming: would it be possible to teach Cursive to start a nREPL it cljs mode? I'm working on an nREPL implementation but that currently has issues with Cursive attempting to eval some Clojure when connecting.
I want an object with arbitrary methods. IIRC, it could be done by using Object
instead of protocol, i.e.:
(deftype ProcessingMock []
Object
(sketchPath [_ ^String fileName])
(createInput [_ ^String fileName]))
but I get error
#error {
:cause Can't define method not in interfaces: sketchPath
:via
[{:type clojure.lang.Compiler$CompilerException
:message java.lang.IllegalArgumentException: Can't define method not in interfaces: sketchPath, compiling:(batofdanfa/core.clj:74:1)
:at [clojure.lang.Compiler analyzeSeq Compiler.java 6730]}
{:type java.lang.IllegalArgumentException
:message Can't define method not in interfaces: sketchPath
:at [clojure.lang.Compiler$NewInstanceMethod parse Compiler.java 8082]}]
...
aha, thanks. what is the best way to achive initial goal in CLJ? or I'm to write small java class for that?
if i use defprotocol, i guess methods will not be accessible from java code just by name. so, need to write some Java lines anyway. thanks for the help!
Is there a good resource to really grok quoting-and-unquoting combinations in macros?
Is buddy.hashers/encrypt good enough for storing passwords on a web site?
if i want to create an Java float[] array to pass it to Java function which will mutate it, is (float-array 1024)
right solution?
1.8.0-beta1 is available https://groups.google.com/d/msg/clojure/hwpvICDYfug/U4310U5WCwAJ
@alexmiller: congrats
thanks to all the contributors! :)
since we are now in beta, the door is effectively closed on any enhancements and we will be finishing up a small number of remaining tickets targeted at 1.8. We hope to release around conj timeframe but depends on pace of the remaining fixes.
@tcrawley: it’s bcrypt+sha512 with with a random salt and 12 iterations.
bcrypt has a work-factor
tcrayford: I don’t know if the iterations apply to bcrypt, sha512, or both: http://funcool.github.io/buddy-hashers/latest/#advanced-options
How do I access session in a compojure-api handle?
@pupeno (GET* "" req ... (:session req))
I’m not using GET, I’m using GET*.
I don’t see how to get to the raw request, or how to add to the response either.
@pupeno GET* works the same as GET except for restructuring metadata
Oh… let me see.
So the second element is the req destructuring form
trying out 1.8.0-beta1, anyone seen: Reflection warning, clojure/pprint/pretty_writer.clj:419:12 - call to method write can't be resolved (target class is unknown).
?
@gtrak: that's an issue introduced in the pprint reflection ticket - there has been some discussion on it already and there (should) soon be a ticket to address
there was some code drift between patch testing and patch application
from what prior version?
@alexmiller: upgrading from 1.7.0
probably just the compiler sync change mainly
Everyone: I am soliciting application-level performance data on 1.7.0 vs 1.8.0-beta1. Anything long-running or real services would be useful info.
Does anybody know how secure is Ring's cookie session storage?
though I don’t use environ, just config.edn file (with additional config-loca.edn for local stuff) for configuration
@thheller: I still have your email queued for a response too, sorry - things are a bit hectic
@viesti: you might like immuconf for config if you're headed down that path https://github.com/levand/immuconf
That sentence is a change in topic to talking about the transducer - it is no longer referring to the example above.
maybe a para change is warranted there
@alexmiller: I see. I think that even with a separate paragraph it still has some potential for confusion.
@alexmiller: thanks for the great book besides the critique, really enjoying it
sure. if you feel strongly about it, there is an errata page where you can file it here: https://pragprog.com/titles/vmclojeco/errata
not sure when there will be an ebook update but presumably that will happen eventually
@alexmiller: cool, filed Thanks again. 👏
is this also known with 1.8?
clojure.pprint.proxy$java.io.Writer$IDeref$PrettyFlush$4923d848
cannot be cast to clojure.pprint.PrettyFlush
pretty_writer.clj: 391 clojure.pprint/pretty-writer/fn
nil: -1 clojure.pprint.proxy$java.io.Writer$IDeref$PrettyFlush$4923d848/flush
core.clj: 3602 clojure.core/flush
core.clj: -1 clojure.core/flush
core.clj: 3613 clojure.core/prn
core.clj: -1 clojure.core/prn
not known issue to me
I’m having a really weird issue: java.lang.IllegalAccessError: tried to access method clojure.lang.RT.classForNameNonLoading
It’s leiningen code that’s failing, and I compile the code using the lein standalone build. What’s weird is that one lein namespace loads successfully, but then a pomegranate one that it pulls in does not.
Adding to the weirdness, this works perfectly in my debug IDE instance, but in my main one it fails.
the only way I can understand that error is a clj >=1.7 aot classfile loaded by clj <=1.6
@bronsa: Ok, thanks. I’ll see if I can figure it out. That class comes from lein 2.5.3, which I’m pretty sure AOTs with 1.6. I’m using the lein jar to compile against. That said, their build is pretty funky, I don’t know the details of how it works.
@cfleming: Do you know if there’s a better way than reflection to get the arity of an anonymous function at runtime?
@lfn3: I don’t think so. If you have a var you can get it from the var metadata, but if all you have is an IFn/AFn then AFAIK you can’t.
@cfleming: Yeah that’s what it seems like according to google as well. Probably what I’m trying to do is silly in any case. I’ll give it some more thought.