Fork me on GitHub
#clojure
<
2016-10-13
>
rastandy07:10:27

hello everyone

rastandy07:10:39

searching fora some advice to use clojure.spec for web form validation and on-webpage error reporting

rastandy07:10:18

form validation is a breeze with clojure.spec, but attaching error messages to the various failed specs is not clear to me

rastandy07:10:25

does someone has advices on that?

robert-stuttaford08:10:49

you’ll need to write a translation layer; spec errors are for system / developer consumption

rastandy08:10:33

@robert-stuttaford right. So the trick could be to def specs and use their namespaced keyword as a key in a map of user readable errors

rastandy08:10:28

@robert-stuttaford I need to understand which spec helper function to use to get the keywords for the failing specs for a validation check

robert-stuttaford08:10:46

have a look at the output of explain-data. you should be able to leverage stuff in there to create the messaging behaviour you need

rastandy08:10:06

@robert-stuttaford oh, thanks, will do that

rastandy08:10:06

thanks 😄

dominicm12:10:14

@yogthos Do you have a particular plan for when you'll next release markdown-clj? We're also quite excited for the inhibition feature 🙂

dominicm12:10:28

(any blockers, etc.)

yogthos12:10:04

I was going to try find some time to fix a few issues, but I could release a version now with the current ones

dominicm12:10:21

@yogthos There's no real rush. Any issues in particular that you want fixed for .90?

dominicm12:10:26

I've noticed that some things don't work multi-line with markdown-clj. Bold/italics is another one.

dominicm12:10:03

Do you have any clues at where to start with this issue? I think I know, but confirmation is better than guessing.

dominicm12:10:24

Oh, derp. I totally misread the issue. Okay, this should be easier than I expected.

dominicm12:10:51

I'll take a look.

yogthos13:10:33

unfortunately, I haven’t had any time to dig into it, if you have an idea then I definitely appreciate you taking a look

yogthos13:10:26

the parser reads line by line, so any tags that are split between lines will not be parsed

yogthos13:10:04

it might make sense to do a bit of preprocessing to aggregate text in paragraphs into a single string before parsing

borkdude13:10:26

What’s the best channel to ask about clojure.java.jdbc (cc @seancorfield )?

yogthos13:10:48

@dominicm but yeah, let me know if you'd like me to push the current version out, and I can push an update with the fix later

dominicm13:10:38

@yogthos I'll ask if it turns out to be too difficult, but I have train time in the evening to work on things like this 🙂. I'd rather get things fixed, I know if I let you release it I won't get round to it nearly as quickly.

yogthos13:10:25

Sounds great!

donaldball13:10:54

There is a #sql channel fwiw

donaldball13:10:14

You may be interested in the postgresql savepoint feature depending on what you’re looking for out of your nested transactions: https://www.postgresql.org/docs/current/static/sql-savepoint.html

manderson14:10:41

On the topic of clojure/jdbc... I'm doing some research on implementing a system that reads from a stream (eg: like Kafka) and writes to a RDBMS. Currently, I'm constrained to not be able to use the new Kafka Connect, so will need to implement something myself. I have two concerns: 1) how to make the updates efficient: currently I'm thinking of using some kind of windowing to "batch" my update operations, and 2) best way to implement "upsert" functionality in a db-agnostic way. Anyone done anything like this before?

josh_tackett15:10:46

Is there a way to set the frequency at which carmine pub subs poll for a message?

gary16:10:19

anyone know when the speaker/talk list for the clojure conj is going to be out?

anmonteiro16:10:27

@gary the talk selection emails went out this last tuesday. I suspect they’ll put the speakers up once everyone confirms

gary16:10:39

@anmonteiro did you get selected?

anmonteiro16:10:39

nope, perhaps next time 🙂

seancorfield16:10:52

@borkdude Happy to field java.jdbc questions here — but I see you also found the mailing list, which is good for longer / in-depth questions.

Alex Miller (Clojure team)17:10:42

@gary Lynn will be posting it soon, still waiting on some responses

gary18:10:38

excellent

dpsutton18:10:34

you mean the speakers for conj?

verma19:10:19

@victord don’t think so

verma19:10:22

also those initial bindings are only evaluated the first time

victord19:10:05

It ends up that this 3rd argument wasn't necessary, thx

tom20:10:27

Is it possible to run a leiningen plugin as a task ends? I'd like to log error stack traces and want to capture stderr when they occur (such as when there's an error in the source code)

stand20:10:18

Is there any way to get a key from a map in a way that disregards namespace qualifiers? In other words, given

(def foom #:foo {:a 1 :b 2}
(def barm #:bar {:a 10 :b 20}
Can I get something like :*/a that will return 1 or 10?

naomarik21:10:18

@nathanmarz thanks immensely for specter, only needed to watch 9 mins of your youtube vid and you just saved me a huge headache already

idiomancy21:10:04

qq, is the output os calling str on a hash-map valid edn?

jrheard21:10:03

@idiomancy

user=> (edn/read-string (str {:foo identity}))

java.lang.RuntimeException: No reader function for tag object

jrheard21:10:30

“it depends” 🙂

idiomancy22:10:17

yeah, I was going to explicitly make the caveat "assuming no nested objects"

idiomancy22:10:47

but other than that we're good?

jrheard22:10:30

user=> (edn/read-string (str {:foo {:bar :baz}}))
{:foo {:bar :baz}}
nested objects seem fine, i meant to illustrate that if your map contains a function then edn/read-string will choke

jrheard22:10:03

[i don’t know much about the edn library, there might be other examples of situations where (str a-map) breaks edn/read-string, this is just the only one that’s come to my mind so far]

jrheard22:10:35

perhaps also if you’ve got e.g. a java class in there that clojure doesn’t know how to serialize into an edn-parseable format (i just tried java.util.Date and java.util.HashMap, they both work fine)

Alex Miller (Clojure team)22:10:21

You should use pr and it's variants to print data to a string