This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-11-26
Channels
- # adventofcode (2)
- # announcements (9)
- # bangalore-clj (1)
- # beginners (158)
- # calva (32)
- # cider (2)
- # clara (4)
- # cljdoc (40)
- # cljs-dev (3)
- # cljsrn (6)
- # clojure (45)
- # clojure-brasil (2)
- # clojure-dev (35)
- # clojure-europe (9)
- # clojure-italy (7)
- # clojure-nl (2)
- # clojure-uk (29)
- # clojurescript (144)
- # code-reviews (3)
- # core-logic (9)
- # cursive (11)
- # datascript (8)
- # datomic (9)
- # duct (1)
- # figwheel (6)
- # fulcro (11)
- # hyperfiddle (27)
- # kaocha (23)
- # luminus (1)
- # off-topic (7)
- # onyx (2)
- # pathom (3)
- # re-frame (61)
- # reagent (12)
- # remote-jobs (10)
- # shadow-cljs (40)
- # spacemacs (4)
- # sql (27)
- # tools-deps (6)
- # unrepl (3)
- # vim (47)
I’m trying to convert some strings to a number with different number of precisions I have to convert a string to a number with 2 decimals, so I did this:
(/ (double (read-string "199504")) 100)
1995.04
Does either (/ (Double/parseDouble "00000869") 1000)
or (/ (Long/parseLong "00000869") 1000.0)
work?
How can I convert a tring like "00000869"
to a number with three decimals? The result must be 0.869
Hi, I am really struggling with logging and I am not sure if this is the right place to ask for help. I am still new to Clojure and am trying to put the pieces together.
I'm trying to write to Graylog using gelf in taoensso.timbre.appenders.3rd-party.gelf
for taoensso.timbre
and org.graylog2.log.GelfAppender
for clojure.tools.logging
(`[org.graylog2/gelfclient "1.4.1"]`).
timbre sends to Graylog but the messages are not readable. https://stackoverflow.com/questions/53481404/why-are-my-graylog-messages-using-the-taoensso-timbre-appenders-3rd-party-gelf-a
The GelfAppender just doesn't send anything. I can verify this using sudo tshark | grep 1514
<appender name="graylog2" class="org.graylog2.log.GelfAppender">
<param name="graylogHost" value=""/>
<param name="graylogPort" value="1514"/>
<param name="graylogProtocol" value="udp"/>
<param name="extractStacktrace" value="true"/>
<param name="addExtendedInformation" value="true"/>
<param name="facility" value="app"/>
<param name="Threshold" value="INFO"/>
<param name="Layout" value="org.apache.log4j.PatternLayout"/>
</appender>
...
<root level="INFO">
<appender-ref ref="STDOUT" />
<appender-ref ref="FILE" />
<appender-ref ref="graylog2" />
</root>
Any ideas what I could be missing?@UCM1FJA4E With UDP transport, the messages are by default gzipped. I think it should just work with Graylog, but maybe there's something wrong. I'd try disabling the compression. Timbre's included appender does not allow you to disable the compression, but you could just copy-paste the code to a new namespace and edit it. In make-gelf-transport
, you'd need to call (.compression Compression/NONE)
on the GelfConfiguration.
In a previous project I had so much trouble with the GELF appender that I ended up making my own, but I never published it. 😐
http://docs.graylog.org/en/2.4/pages/gelf.html "Graylog nodes detect the compression type in the GELF magic byte header automatically." That does not seem to happen then 😐
@U1NDXLDUG Thanks so much. I'll give that a go tomorrow and let you know. Do you have a sample of your gelf appender by any chance? Sounds like something worth publishing ;)
@U9E8C7QRJ oh boy :(
Thanks for the help. I needed a GELF UDP input on Graylog on port 12201. That did the trick.
Now I need to get org.graylog2.log.GelfAppender
to send UDP data. For some reason it just doesn't want to send anything 😞
Is there any support for doing "The Little Typer" / Friedman + christiansen ... in Clojure ?
There is this Type therory project in Clojure LaTTe https://github.com/latte-central/LaTTe by @fredokun
Clojure is really wonderful. I needed to make a change to one Clojure app - to support different data sources. I thought this is a great place to study Clojure protocols. I created a protocol for my domain functions, then created a record per each environment and implemented that protocol for each environment and created a service factory to get the right service entity (based on profile the system is running). The changes were minimal to web layer (calling protocol functions with the service entity returned by the service factory). And using IntelliJ IDEA + Cursive REPL development is really fast.
I guess there is no way to from a tools.deps project use a git dependency that uses Leiningen (with it’s own deps), or am I wrong?
if you control the lein dep you can have lein generate a pom file and then tools.deps can target it (i think)
Ok, I’ll dig some more. I guess it’s time to learn more about all this Maven & pom stuff.
Maybe add a git hook to run lein pom
whenever project.clj
is updated...
Cool, after some LEIN_SNAPSHOTS_IN_RELEASE trickery and printing colouring drawings for my kids it worked like a charm. Thanks - much appreciated
I was trying to run latest aleph from master. Created pom.xml and ran a repl to make sure project worked. Then referenced it with local/root. But when I try to use the library I get Exception in thread “main” java.lang.ExceptionInInitializerError Caused by: java.io.FileNotFoundException: Could not locate aleph/http__init.class, aleph/http.clj or aleph/http.cljc on classpath.
I’ll just install it in my local m2. But once seen, it’s difficult to ignore the git & sha story
I just stumbled on a new way to do multiline comments without semicolons or (comment...)
#_"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus maximus
sem vitae libero dictum, vel posuere lectus imperdiet. Quisque vitae nisl nibh.
Donec iaculis tempor blandit. Suspendisse potenti. Sed at ipsum fermentum
justo maximus porta. Nullam posuere fermentum efficitur. In ut neque sed nisl."
I kinda like that--clean.
@viebel: I just bought "The Little Typer", so I'm really looking for a library to go along precisely with that book. 🙂
Hello, is there a way to pass java system property to the clj
CLI tool? -Doption=value
does not work... Thank you!
@manutter51 Yep, that is great when the string or other immediately following object is syntactically correct Clojure code/data, but otherwise will cause an error, similar to (comment ...)
. Most editors intended for programming have the capability in a few key/mouse strokes to select a region of lines and comment or uncomment them using ';;' or whatever that programming language uses for comments.
@holyjak -J-Doption=value
thanks a lot!!! I did read the help but obviously not well enough
also see clj -h
for help
Yeah, I’ve been using the keyboard shortcut, and it works great, but I think the string comment is visually appealing for multiline comments intended as documentation.