#clojure logs

2015-10-12

00:00neoncontrailsYeah cannot reproduce. Lesson learned, don't count on templates to remain static
00:00justin_smithI've always thought there should be a version option for templates, it would help tutorials stay useful (though maybe not relevant)
00:02neoncontrailsI alsot authors should post a final version of the file being modified, if not a full git repo
00:04neoncontrailsThere's always some ambiguity when following these tuts. (Bracket the :require statement? Bracket it how?!)
05:08sm0kehow do you APPEND to classpath in boot or lein?
05:08sm0kesome arbitrary paths
05:09oahner:source-paths is added to the classpath (in lein)
05:09oahnerprobably a few other keys too
05:10sm0kebut they are not appended
05:11sm0keso the classes may resolve from :source-paths before deps
05:11oahnerohh
05:11oahnerthat's... correct
05:13oahnerI don't think it's possible with lein
05:13sm0kei cannot believe how difficult we have made java -cp "a:b:c" with build tooling
05:14sm0kei was looking into boot for this, but cannot find anything obvious
05:14muhukworst case it should be possible with a lein plugin
05:16oahneractually
05:17sm0kei am all ears oahner
05:17oahnerlein adds the :dependencies in order
05:17sm0kebut adding a simple path with dozen of jars would be a pain
05:18sm0kei am looking to a path glob "a/b/*"
05:18oahneradd those jars to a maven repo and put them in your :dependencies
05:18sm0keto add*
05:18oahnerI believe that would be the lein way of doing things
05:19sm0keunacceptable for my situation
05:19sm0keI have two three paths with 100's of jars
05:19oahnerI have to ask; what are those jars?
05:19sm0kejust provided dependencies for libraries
05:20sm0kei dont want to include them as dependency in the project
05:20oahnerlibraries that have never been added to a maven repository?
05:21sm0kethey are in mvn but they are many and makes the project profile complex
05:21sm0kespecially with different versions
05:21sm0keso if i add the folder to :resource-paths for e.g. it is PREPENDED to classpath
05:22sm0keif classpath has httpclient-4.1.3 clj-http doesnt like it
05:22sm0keyou get the thing? common java nonsense
05:22oahnerseems like you have a higher level problem than trying to add a classpath to your clojure project... but at this point you could simply look into clojure.core/add-classpath
05:23sm0kehurmm i forgot https://github.com/cemerick/pomegranate
05:24oahnerthat would work too
05:24sm0kelet me try
05:25sm0keis there a lein post hook for repl?
05:26oahner:repl-options :init
05:27oahnerhttps://github.com/technomancy/leiningen/blob/stable/sample.project.clj#L345
05:28sm0keawesome
05:29oahneryou'll have to manually massage your java -cp when you decide to lein jar your project tho
05:30sm0keno as i said the deps are provided
05:30sm0keso when i run i have full freedom of java -cp
05:30sm0keyeah sorry thats what you said
05:30sm0ke:P
05:31oahner^^
05:31sm0kewell add-classpath from core fails for "a:b/c/*" with invalid path error
05:32sm0kepomegranade add-classpath seems to run quietly
05:32sm0kebut i cannot access classes added
05:34oahnermaybe pomegranate simply did the wrong thing
05:34oahnertry adding a single one of those directories, see if it works for one jar
05:35oahnerif it does, you may simply have to iterate over all subdirectories and add-classpath all of them
05:37sm0ke"/ab/c" is malformed for core/add-classpath i added "file://ab/c" it runs
05:37sm0kebut still classpath is not modified
05:38oahnersorry, I still don't grok that whole classloader story
05:41Leonidasyogthos: the example page dies with an ungaught exception: https://yogthos.github.io/reagent-forms-example.html
05:41Leonidas*uncaught, even.
05:48oddcullyLeonidas: due to cloudflare not sending react? error i had at first reload was "React not defined" and 404 for reacht.min.js. frantic reloading fixed it
05:51Leonidasoddcully: no, I am getting "uncaught exception: Invalid match arg: /\./"
06:10instilledhi. how can I check a record implements a protocol? I've tried with instance? and satisfies? but both fail. Anyone?
06:14dstocktoninhortte: satisfies? should do it
06:14dstocktoninstilled:
06:14dstocktonsorry inhortte
06:21instilleddstockton: Thanks. The issue was when I reloaded the namespace with the protocol definition but not the namespace with the implementation. I should have thought of that. Thanks anyway.
07:01ashwink005does clojure.tools.logging library breakdown large error logs into smaller parts?
07:08sm0keashwink005: what do you mean? the log file?
07:08oddcullyashwink005: do you mean a rollover when the file grows?
07:09sm0keyou can configure log files with log4j.properties
07:09sm0keor what every logger you are using
07:10ashwink005sm0ke, I have configured the log4j.properties but the logs are broken
07:10ashwink005when I open var/log/syslog
07:11ashwink005large log messages (those having stacktraces) are logged in parts
07:11sm0kehurmm var/log/syslog are linux system logs
07:11ashwink005yes my log4j is configured to log onto Syslog
07:11sm0keyou must have configured it to some other location
07:11sm0keah
07:11sm0kewont you need sudo permission for it?
07:12ashwink005I don't think so.. I can see the logs in it.
07:13ashwink005sm0ke, here's my log4j http://txt.do/aymbd
07:15oddcullyashwink005: is your message longer than 1k?
07:16ashwink005oddcully, no no not at all
07:16ashwink005oddcully, here's the log http://txt.do/aymb4
07:18sm0kehurmm seems to use log4j.appender.SYSLOG.layout.ConversionPattern=venus %d{ISO8601} %p %t %c{1}.%M - %m%n
07:18sm0keis the log not in the format you have put?
07:19oddcullyis this mentioning of "localhost" actually using syslog via upd?
07:19sm0kenot sure if you should even put that as org.apache.log4j.net.SyslogAppender should have sane default for it already?
07:19oddcullyi have never used that "feature"
07:19sm0keme too
07:19sm0kenever used syslogs
07:20oddcullybut if it is, there are limits to syslog, there are limits to udp
07:20oddcullysyslog rfc says, min-len is 480 byte. your message there comes close to this barrier
07:21ashwink005oddcully, thats minimum length right?
07:22oddcullythats the minimum length an implementation must support
07:23ashwink005I have not much idea about rsyslog. Though I did read the conf file.
07:23ashwink005smaller messages are going sweet
07:24ashwink005should removing syslogAppender help?
07:26oddcullyi'd have a look in the depth of the web, if syslog is a safe, sane and performant option for your amounts of logs
07:27ashwink005oddcully, they aren't that large. Just stacktrace of errors
07:27ashwink005I want my clojure errors to be sent to loggly. And rsyslog is one of the few options
07:34oddcullywell, to me the output looks it got split in parts, that fit the limit. your two entries there, the second looks like the continuation of the first
07:36neoncontrailsSay you just made a version-breaking change to your stack, your app is back up and running as before, but keyboard inputs don't work. What would you inspect?
07:39oddcullystack is what? swing, javafx, react, ...?
07:40neoncontrailsChestnut. I incorporated Chestnut to simplify the Figwheel HTTP serving
07:41neoncontrailsAnd there's my error: yes, a missing keydown handler could have something to do with it.
07:58sm0keoahner: i ended up using https://github.com/nickgieschen/lein-extend-cp in case you are interested
07:58sm0kesimply appends to the classpath
07:59oddcullyneoncontrails: then i assume your keyboard no longer works in some input field in your html in the browser?
07:59oahnerI like the Usage section of the readme
08:00oddcullyneoncontrails: and in case this is react (by om, reagent, rum, ...) my very first check would be, if you put a constant value in that input, which would prevent any changes by keyboard
08:00oddcullyneoncontrails: otherwise i'd track down what your existing handler there does
08:01neoncontrailsoddcully: I figured it out already, thanks. Sadly just a missing event handler... I should go to bed, heh
09:19noncomwhat's the most idiomatic way to find all indexes of a string in a string?
09:19noncoma reduce + .indexOf ?
09:50yottabytehi guys, are clojure classes .java? can I use them with regular java classes?
09:50yottabytei.e. can a clojure class call a java class' methods?
09:50xemdetiayottabyte, did you read this page? http://clojure.org/java_interop
09:50mavbozo,(java.util.UUID/randomUUID)
09:51clojurebot#uuid "851cd002-7902-4514-b199-f88a378e4930"
09:51noncomclojure does not have classes as such..
09:52noncomthere are various conditions when it is possible to talk about clojure classes, like when during aot compilation, but not for clojure itself
09:57yottabyteI can't really see how I would call a java method from clojure
09:57yottabyteoh like (. foo bar 7 4) ; call the method bar of the instance/class foo with arguments 7 and 4?
10:02dzhuswhat is the difference between nth and get for vectors?
10:02snowellyottabyte: The function name comes first. So for an instance you would do (.bar foo 7 4)
10:02snowellyottabyte: If the function is static, you'd do (foo/bar 7 4)
10:04yottabyteah, k
10:05sobelnoncom: clojure can generate java classes aot
10:06noncomsobel: yep, that's what i said in the second sentence
10:06noncombut as a language construct, they are non-existant
10:06sobelnoncom: but i thought it did not have classes, rather uses java classes under the hood, but offers protocols and records instead
10:06sobelah ok
10:07noncomsobel: yes, many things in clojure are actually JVM classes.. each (fn) even
10:07sobelimpl details
10:08noncomoh, correct, that's the word
10:16mmitchellI'm starting to play with clojurescript for the first time really, and have a question about whether or not something is possible. For the final result/build, I'd like to have a bunch of JS functions, based off of a JSON schema on the file system. I don't want the final build to have any knowledge of the JSON schema, just JS functions. Do I need to use Clojure to read the schema file, and generate ClojureScript? Is there an
10:16mmitchellobvious way to do this that I'm not aware of (probably)?
10:23luxbockmmitchell: you can use a macro (in Clojure) that generates code in CLJS
10:34luxbockI keep having problems with using a protocol as a part of my schema definition, and then reloading code in the REPL making my schemas invalid
10:35luxbockI know the protocol and REPL reloading is a known issue, and the reloaded REPL work flow is one solution to the problem, but it feels so awfully heavy handed
10:53mmitchellluxbock: yeah +1. Makes sense, thanks!
11:15justin_smithluxbock: it's either that or not use protocols
11:16justin_smithor not reload your protocol definition, of course
11:16justin_smithluxbock: one thing that I find helps a lot is to have a file that has only the protocol definition, that rarely needs reloading (since protocols shouldn't change often...)
11:48luxbockjustin_smith: yeah that's how I have them right now but it's still not quite perfect
11:56KanteWhen starting up emacs I get two buffers. For example when opening a file in Nautilus I see that file 2x. It happens when I do `(require-package 'cider)`.
11:59justin_smithKante: do you mean that the view is split and both parts show the contents of the same file?
12:01justin_smithbecause emacs starts up with at least two buffers (*scratch* and *messages*) even if you don't open any files.
13:44noncomi am trying to fetch this dep, but the jar that leiningen gets does not contain the library http://search.maven.org/#artifactdetails%7Cde.schlichtherle.truezip%7Ctruezip-archetype-path%7C7.7.9%7Cmaven-archetype
13:44noncomwhat is that?
13:44noncomhow do i get this library?
13:44noncomit only has this: http://joxi.ru/J2be6W4sPenxm6
13:45noncomand not much more :/
13:47oddcullyaren't maven arche types used to bootstrap maven projects. like lein templates?
13:49noncomprobably...
13:49noncombut..
13:49noncomis there no way to get that library ?
13:49oddcullyyou could look into that pom.xml and see for the real dep then
13:49noncomah
13:51noncomoh, it worked!
13:51noncomi did as you said
14:00janus_Hello! How do I convert lazy data structure to a normal one, so I can print it normally? My current code prints like that
14:00janus_"The City and the City, written by clojure.lang.LazySeq@1"
14:00justin_smithjanus_: (apply str lazy)
14:00janus_justin_smith: it gives me an empty string then
14:00justin_smith,(apply str (range 10))
14:00clojurebot"0123456789"
14:00justin_smithjanus_: then it is empty
14:01justin_smithalso, there's string/join
14:01justin_smith,(clojure.string/join \space (range 10))
14:01clojurebot"0 1 2 3 4 5 6 7 8 9"
14:03janus_apply str gives me "The City and the City, written by ", the other function gives me an error
14:03janus_justin_smith: Can I paste the code to sth like lpaste?
14:03justin_smithsure
14:04janus_justin_smith: It's kinda tangled, so I'll add the comments, wait a minute
14:04justin_smith,(str (map inc nil))
14:04clojurebot"clojure.lang.LazySeq@1"
14:04justin_smithnotice that is @1
14:04justin_smithI think @1 is always the empty lazy seq
14:05justin_smithjanus_: check the result of (empty? your-lazy)
14:05justin_smithI bet it returns true
14:05janus_I'll do that
14:06janus_justin_smith: aand you're right
14:06janus_justin_smith: don't know why tho
14:06justin_smithjanus_: well, you're one step closer at least
14:11janus_justin_smith: what is this nightmare? that helper function worked correctly 5 mins ago
14:11janus_justin_smith: thanks anyway, will talk to you when I figure out what's wrong
14:19yottabytehow do you pronounce clojure? like closure?
14:20aneyes
14:20yottabytety
14:21justin_smithyottabyte: I pronounce it like rich hickey does in his videos, which is almost identical to closure, but not exactly, but I don't know enough linguistics to describe the difference
14:37free_beardhi guys, how do i get all the keys/values from a map?
14:37free_beardsorry if select-keys select-values is not obvious enough for me to use
14:38justin_smithfree_beard: what format do you want?
14:38free_beardsay a vector of them
14:38free_beardany sequence is fine
14:38justin_smith,(vec {:a 0 :b 1 :c 2})
14:38clojurebot[[:a 0] [:b 1] [:c 2]]
14:38free_beardyeah, but i don't know the keys
14:38justin_smith?
14:38justin_smiththe keys are the first value in each pair
14:39free_beardi don't know that they are :a :b :c
14:39free_beardi don't know what they are beforehand
14:39justin_smithfree_beard: that part doesn't matter
14:39snowell,(keys {:a 1 :b 2 :c 3})
14:39justin_smith(vec m)
14:39clojurebot(:a :b :c)
14:39justin_smithfree_beard: once again, what is the result you actually want to get?
14:40free_beardsomething like the python dict's keys()
14:40free_beardand values()
14:40justin_smithfree_beard: keys, vals
14:40justin_smith,(keys {:a 0 :b 1 :c 2})
14:40clojurebot(:a :b :c)
14:40free_beardjustin_smith: ah, perfect
14:40free_beardjustin_smith: thank you! I didn't understand your example for some reason
14:40justin_smithfree_beard: I didn't think you wanted keys, because you were literally naming it in your question, hah
14:41justin_smith,(vals {:a 0 :b 1 :c 2})
14:41clojurebot(0 1 2)
14:43tdammersso I have a macro in foo.clj; that macro takes an argument that is a function which it runs at compile time. Now I need to call that macro from clojurescript, but I can't for the life of me figure out how to write a suitable function to pass int
14:43tdammersin*
14:44tdammersI understand that I need to write the function in clojure, not clojurescript, but how can I refer to a clojure function from within clojurescript?
14:44sveriäfd)P?
14:45justin_smithtdammers: isn't this what :require-macros is for?
14:45tdammersso I thought, but what I'm pulling isn't a macro, it's a function
14:46justin_smithtdammers: can't you just have the function in the same ns you pull in with require-macros? or does the macro need to be parameterized when called?
14:47tdammersthe macro is defined in a library
14:47justin_smithbut at worst, you could have another macro, that calls the original with the apropriate function arg...
14:47justin_smithand then use require-macros to pull that into cljs in the normal way
14:48tdammershmm
14:58tdammersso wrapping the macro somehow doesn't work either
14:58tdammers"Can't eval locals" - what does that mean?
15:11tdammersoh, hmm, next question - everything compiled without errors, but when I run things in the browser, I get "Type error: foo.bar is undefined"
15:11tdammershow is this even possible?
15:17pbxtdammers, runtime bug?
15:18tdammershow can an undefined macro be a runtime bug?
15:20pbxtdammers, sorry, i thought it was a js error
15:20tdammersit is
15:20tdammersthat's the weird thing
15:21tdammersit's a JS error that occurs as a result of a macro not being in scope
15:21pbxtdammers, i shouldn't pretend to know anything about clojurescript, but share source and full error output?
15:21dnolentdammers: it sounds like your macro needs var resolution to work no?
15:22tdammersnah, I have it solved now
15:22tdammerscan't share actual code because copyright shenanigans
15:22tdammersbut anyway, what happens was I simply didn't pull the wrapper in with require-macros
15:22tdammersbut everything compiled fine anyway
15:22tdammersinstead crashing at runtime
15:23tdammersI'd expect something like this to raise a compiler error
15:23dnolenif there was something unresolved you should have been given a compiler warning
15:23dnolenif you didn't that's a bug and you should determine a minimal reproducer
15:25tdammersI'll see what I can do
18:07bjaddellacosta: any chance you'll be able to get to https://github.com/jkk/honeysql/pull/95 in the next couple days?
18:07bjajust wondering if I need to make a temporary release for myself
18:10ddellacostabja you should assume I won't get to it and do what you need to do
18:10ddellacosta...as with all open source projects
18:52mungojellyjustin_smith: fyi the difference is that closure is pronounced with a "voiced alveolar fricative" aka /z/ https://en.wikipedia.org/wiki/Voiced_alveolar_fricative#Voiced_alveolar_sibilant while clojure is pronounced with a "voiced palato-alveolar fricative" aka /Z/ or more prettily ʒ https://en.wikipedia.org/wiki/Voiced_palato-alveolar_sibilant
18:53justin_smith(inc mungojelly) ; if only
18:53justin_smiththanks!
18:59TEttingermungojelly: I pronounce closure with the ezh ("ʒ" as in treasure, another *sure word), and clojure with the d-ezh digraph (normally, "j")
19:01TEttingerI've never heard closure, as in "seeking closure" or "a closure that contains the current state" pronounced without a zh sound a la ezh or treasure
19:14mungojellyTEttinger: yeah i guess you're right, "closure" is often pronounced with /ʒ/, i don't recall hearing clojure with /dʒ/ though that's interesting.
19:15TEttingeryeah that might just be my literal pronounciation of the "Java" in the root of the name that I think was "CLR, Java, functional programming play on words"
19:15mungojellyit'd be nice if there were some way to distinguish them. and trie from tree. :/
19:16TEttingerI just say trie as try, but that has its own problems!
19:16mungojellyi was thinking for a second that a pun for a name is odd for something so serious, but then i remembered that even "C" is sorta a pun or play of some sort on "B"
19:18justin_smiththere's nothing serious in the world of programming
19:21mungojellyi thought of a distinctive way to pronounce "trie" /triaɪ/ tree-eye but that doesn't do any good because no one knows my pronunciation hm
19:21justin_smithmungojelly: I got a copy of the Codex Seraphinianus recently, it has some tree-eyes in it
19:25TEttingermungojelly: the choices for trie are what, "tree eye", "tree A" (like spanish pronounciation), or "try E" (overheard at raves)
19:26TEttingeror, Try Uh, which sounds like you haven't finished your sentence
19:32mungojellyi think we should say it every time all elongated like we're emphasizing what a ridiculous word it is like: http://vocaroo.com/i/s0ztmjDBei3W
19:44TEttingerhash-array mapped tryyyyyyyyyyyyyy
21:41neoncontrailsI know that there is a cute way to do this using map + juxt:
21:41neoncontrailsYou have a collection of keywords and strings like so, ["283" "89" :div]
21:42neoncontrailsAnd you'd like to reduce over the collection to return false if any of the values are "null" in their respective types.
21:50SeyleriusIs there an easy clojure interface to calling up print dialogs?
21:52neoncontrailsI kludged my problem to death and ended up with this, but I'd be curious to see this written correctly
21:53neoncontrails,(not-any? true? (into [] (map empty? (map str (map show ['x 'y 'op])))))
21:53clojurebot#error {\n :cause "Unable to resolve symbol: show in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: show in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6704]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: show in this co...
21:54neoncontrails,(def show {'x 1 'y 2 'op :div})
21:54clojurebot#'sandbox/show
21:54neoncontrails,(not-any? true? (into [] (map empty? (map str (map show ['x 'y 'op])))))
21:54clojurebottrue
22:00xzilendHi there, is there a simple way to monitor how many items are in a core.async buffer? I'd like to monitor a channel to make sure that the consumer(s) are keeping up with the producer(s).
22:01Seyleriusxzilend: Try count?
22:03justin_smithit's intentionally prevented, if it was allowed it could lead to race conditions, believe it or not
22:03SeyleriusInteresting!
22:04Seyleriusjustin_smith: D'you know if there's a straightforward way to call print dialogs from Clojure?
22:06xzilendhmm interesting, thanks! I'll have to come up with some other solution
22:06justin_smithSeylerius: from the jvm?
22:07Seyleriusjustin_smith: Essentially, yeah. I'm trying to see if something like seesaw already has the capability.
22:07justin_smithhttps://docs.oracle.com/javase/7/docs/api/java/awt/print/PrinterJob.html
22:07justin_smithI don't have high hopes there are clojure bindings already, but interop is easy usually
22:09SeyleriusHmm... Maybe I'll fiddle around with that and submit a PR for seesaw
22:10justin_smithSince it's generic and mostly controlled by the host, it should be easy to use on its own