Fork me on GitHub
#clojure
<
2016-04-23
>
patrkris07:04:13

Hello everybody. Does anybody here know of an easy and succinct way to use regular expressions with truss (https://github.com/ptaoussanis/truss)? I know I can create my own predicate for the purpose but would like to know if there is some idiom I can (ab)use

jonathanj10:04:44

@weavejester: Any chance of seeing a new release of ring-jetty-adapter in the near future? There are quite a few new features (`http?` being the one I’m most interested in) that are not in a release yet.

jimmy15:04:54

hi guys I would like to hear your opinion regarding serialize and un serialize between protocol, is it worth the effort ? For example : In the elasticsearch client project for clojure https://github.com/clojurewerkz/elastisch. I see that the author spends quite a lot of time to convert elasticsearch native protocol to clojure data structure and forth. If we use the rest api, it undoubtedly is faster in term of development and I think the performance of json serialize and deserialize is pretty fast as well. So my question is : is it worth the effort to convert elasticsearch native protocol to clojure in this case ?

mpenet15:04:30

In the case of ES the rest api should be slower. The native api has a true long lasting connection to the cluster + compact protocol, and the bottleneck with rest is more likely to be network roundtrips than serialisation. That said it might not matter in your case. Personnally I prefer to use the http api with ES, it makes upgrading less painful too (version mismatch between cluster/client can be a pita with native)

hiredman17:04:25

nxqd: I doubt it is worth it

hiredman17:04:35

my last job was a pretty heavy user of elasticsearch, we started out with the http es api, then thought the native protocol api would be a good idea, and then went back to the http api, because the native protocol api was a pain to work with

hiredman17:04:53

and then continued to use the http api while our elasticsearch team was one by one hired away by the new elastic company, and I suspect still use it to this day

jimmy18:04:41

@mpenet: thanks for your info.

jimmy19:04:31

@hiredman: thanks for your info especially as a heavy user as well it's good to know simple_smile

andreas-thoelke19:04:57

Hi! I'd like to get a nicely formatted string from clojure data. Basically pprint, but returning a string with line breaks.

tom19:04:39

@andreas-thoelke: do you have an example string and data?

andreas-thoelke20:04:43

As an example I'd like to format a nested clojure map or vector of maps

tom20:04:56

You can surround preformatted text with three back ticks, if you care to paint a picture.

tom20:04:33

{:a "A"
 :b  "B"}
How would you want that to look?

andreas-thoelke20:04:12

oh, I mean not in Slack. In my editor.

tom20:04:52

Yes, I meant to write examples in slack. It helps folks like me picture what you're looking for 😉

andreas-thoelke20:04:25

so I'm looking for a clojure function, perhaps in the pprint namespace..?

tom20:04:49

Sure so if you did

(require '[clojure.pprint])
(clojure.pprint/pprint {:a "A" :b "B"})
=> {:a "A"
    :b "B"}

andreas-thoelke20:04:56

yes, pprint prints to the console, but I need it to return me a string

tom20:04:16

(with-out-str (clojure.pprint/pprint {:a "A" :b "B"}))

andreas-thoelke20:04:16

Thanks! This definitely returns the formatted string!

andreas-thoelke20:04:39

Not ideal though, as it still prints to the console

tom20:04:25

guess it depends on how you're using the string, if written to a file I don't recall seeing it printed to the console. When using with-out-str I'm usually writing some big string to a file.

andreas-thoelke20:04:00

Wait! It actually doesn't print to the console! ("it evaluates in a context"?). So it seems to do exactly what I want, it just looks a bit odd..

richiardiandrea23:04:09

I am looking for a backend lein template with boot, postgres mount and config management (maybe environ). Are there alternatives to Luminous?