#clojure logs

2015-06-16

00:06Surgoall the destructuring docs I see for maps use keywords for the keys; is there a doc that shows destructuring where the map keys aren't keywords?
00:08oddcullySeeq: :strs and :syms in the special forms page
00:09oddcullyerm sorry
00:09oddcullySurgo: http://clojure.org/special_forms :strs and :syms
00:11Surgothanks!
00:19WickedShellI've found update-proxy on clojure docs, which looks to fit my need. But is this really considered the correct way to change a single function within a library? (IE the library has a very long proxy and I only need to modify one of the functions)
03:49lvhIf I just want to execute a list of side-effecting functions, (doseq [f fs] (f)) is the idiomatic pattern, right?
03:50lvhThat seems more idiomatic than the alternative (dorun (map apply fs))
03:51amalloydoes (apply f) even work? i didn't think so
03:51amalloy,(apply +)
03:51clojurebot#error {\n :cause "Wrong number of args (1) passed to: core/apply"\n :via\n [{:type clojure.lang.ArityException\n :message "Wrong number of args (1) passed to: core/apply"\n :at [clojure.lang.AFn throwArity "AFn.java" 429]}]\n :trace\n [[clojure.lang.AFn throwArity "AFn.java" 429]\n [clojure.lang.RestFn invoke "RestFn.java" 412]\n [sandbox$eval25 invoke "NO_SOURCE_FILE" 0]\n [clojure.lang.C...
03:51amalloyno, it doesn't
03:52lvhoh, I guess that makes the choice even easier then
03:52lvhthat seems like an obvious degenerate case for apply though
03:52lvheven though the verb doesn't make as much sense anymore since you're not applying it to anything
04:43TMA,(funcall +)
04:43clojurebot#error {\n :cause "Unable to resolve symbol: funcall in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: funcall in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6543]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: funcall i...
04:44TMAyea, no need for funcall in lisp-1
04:44TMA,(let [f +] (f))
04:44clojurebot0
04:49profil,(*)
04:49clojurebot1
04:49TMA,1+
04:49clojurebot#<NumberFormatException java.lang.NumberFormatException: Invalid number: 1+>
04:51TMAwell, that explains the choice of inc instead of 1+
04:51TMA,(= 'a 'a)
04:51clojurebottrue
04:51TMA,(= 'a 'A)
04:51clojurebotfalse
04:52profilTMA: clojure does not have currying, multi arity
04:53profil,(source +)
04:53clojurebotSource not found\n
04:55TMAprofil: Sorry, I do not understand what you are trying to say.
04:55profil,(partial + 1)
04:55Emppericurrying in clojure would be: ##(let [almost-curried (partial + 1)] (almost-curried 1))
04:55clojurebot#object[clojure.core$partial$fn__4525 0x64192b7e "clojure.core$partial$fn__4525@64192b7e"]
04:56profilEmpperi: yes :)
04:56Empperibah, I never remember the inline code example syntax for clojurebot
04:56Empperiit was something like that
04:57Empperianyway, that is *not* real currying
04:57Empperiit's something very similar but it's not currying
04:57TMAcommon-lisp:1+ is the function that adds one to its argument -- hence the equivalent of clojure.core/inc
04:57TMAwhat I was testing was whether 1+ is a valid symbol name
04:57Empperiwell, clojure has several other naming conventions which differ from common lisp
04:58Empperifirst, rest vs car, cdr and so forth
04:58TMAfirst and rest are there in CL too :
04:58Empperibut car cdr is not in clojure
04:59Empperithey've been slowly renamed by lisp community over the decades
04:59Empperithe original were pretty aptly named considering what they actually did
04:59Empperibut current implementations of eg. clojure have nothing to do with that
04:59Empperithey just happen to solve the same problem
05:01TMAyes, clojure being a lisp-1, its users might appreciate that they can use car as a variable name for holding vehicle data without shadowing the list destructuring primitive
05:02Empperihehe
05:03TMAwhich unfortunately does not extend to the ability to name the list parameter list in a generic list utility function
05:04profilEmpperi: no currying is like "(+1) :: Int -> Int", written i haskell. Which clojure does not have due to multi arity?
05:05Empperiprofil: I know what currying is
05:05Empperiand multi-arity does complicate things
05:05TMA,(let [+ *] (+))
05:06clojurebot1
05:06Empperibut this comes to the same discussion as with recur and TCO
05:06Empperiwhen it comes to recur I actually prefer the way it's in clojure
05:07Empperiwhen talking about currying I'm not sure
05:07profilprefer to what?
05:07Empperiprefer to automatic TCO
05:07Empperilike it's in haskell and in so many other languages
05:07Empperialthough in Haskell automatic TCO is less hazard since the whole language is lazy
05:08TMAwhat hazard it is?
05:08EmpperiI like the fact that clojure compiler tells me if something can be tail call optimized
05:08Empperiand that I can't by accident make a normal recursive call when I meant it to be TCOd
05:09Empperithe additional "recur" is minimal overhead and actually provides better readiblity too imho
05:09Empperithe whole discussion with currying and partial is similar
05:09TMAI do not concur.
05:09Empperibut there true currying would be more useful
05:10TMAThe recur is a stopgap measure.
05:10Empperiso like I said, I wouldn't mind true currying in Clojure but I'm fine with current implementation too
05:11j-pbcurrying breaks varargs
05:11Empperiyup, also mentioned above :)
05:11j-pbah yeah sorry
05:11TMAit shifts the burden of doing TCO from the machine to the programmer. And frankly it's the programmer's mind capacity that is the limiting factor these days.
05:12j-pbwell varargs are such a big part of clojure that I don't think curring would work
05:12EmpperiTMA: maybe but at the same time I've seen bugs in TCOd languages where the programmer had thought the compiler would take care of the optimization but he had by accident caused a regular recursion
05:13Empperiwith Clojure you can't do that bug
05:14TMAEmpperi: could you provide me with an example of such a situation?
05:14Empperiusually bugs like that occur when you modify existing code which had been TCOd and after your modifications it isn't
05:14EmpperiTMA: any recursion call which isn't in tail call position
05:15Empperieven more easy with mutual recursion
05:15TEttingerEmpperi, you totally can in clojure, by using recursion without using loop
05:15Empperito do that bug
05:15TEttingerthankfully we have loop :)
05:15TMAEmpperi: I seek the example, that would be avoided in clojure.
05:15EmpperiTEttinger: hmm? That's what I said? That if you use 'recur' compiler tells you if your making the call from non tail position?
05:16Empperisure you can blow the stack by normal recursion but then you're not using recur
05:16TEttingeryeah, I mean something like... that, yes
05:16TMAah
05:16TMAnow I see
05:16TEttingerif someone assumed clojure had TCO, that would be silly, but would soon blow the stack
05:16Empperiyup
05:16TEttingerI do think explicit recur makes sense
05:17Empperiindeed
05:17Empperiin the beginning I thought it was a dumb idea but these days I think it is better than automatic TCO
05:17TEttingerI think clojure's emphasis on preferring map, reduce, filter, etc. and combinations of them makes even more sense
05:17TMArecur contains an assertion "I am called in tail position" and the compiler checks that
05:17EmpperiTMA: yeah
05:17Empperisince then compiler can be sure you really wanted tail call optimization
05:18Empperiwhile with automatic TCO compiler can't make such assumptions
05:18TEttingeralso, recur I believe is very handy in translating to better bytecode instructions, though I'm not sure
05:18Empperianyway, partial isn't equal to recur but it is it's distant relative :)
05:19Empperithere too you tell explicitly to the reader that you are currying the function
05:19TEttinger(I believe a call to loop can compile down to approximately the same bytecode as java's for or foreach loop, though I don't know which)
05:19Empperiwhile with true currying you have to know the function being curried that how many arities it has
05:19Empperithat will it call the function or just create a new one
05:19TMAI can envision (declare (tail-call)) or some other marking that would permit the check that in other languages
05:20EmpperiTMA: yes, and such things do exist
05:20Empperieg. in scala
05:20TEttingerbut the JVM still lacks TCO even there
05:20Empperiyup
05:20Empperiit's done completely on the compiler
05:20Empperiif it's done at all
05:24TMAlack of support for TCO in JVM is one of my pet peeves. it prevents me to use my usual recursive programming style in Java. It makes me reconsider and rewrite in an inferior way (in a readability sense)
05:25Empperiwell, in Java we have this thing called for loop for TCO (troll)
05:25EmpperiI seriously think that IRC needs a trollface emoticon
05:30j-pbwh not have both? :D
05:30r4viso I might have to write some Java soon (holdme)
05:49dysfunEmpperi: no, in that sense defn would also be TCO. ITYM 'recur' :)
06:04kaiyin(defn- expired? [[id session]] (pos? (- (:ring.middleware.session-timeout/idle-timeout session) (current-time)))) Shouldn't it be neg? here?
06:04kaiyincurrent-time is always increasing.
06:09TMAEmpperi: yes, indeed. [response in re: IRC emoticon need]
06:11kaiyinAnyways this is a clj file generated by `lein new luminus`, should I file a bug report somewhere?
06:18kaffeeboehnchenAnyone who can help me with http-kit? I can start the server without an error but not connect :( https://paste.xinu.at/m-AByN/
06:18TEttingerkaiyin: I'd assume it's because it's a check for expiration, and (:ring.middleware.session-timeout/idle-timeout session) returns a larger number if it has timed out, but I'd verify the behavior is wrong first
06:19TEttingerkaiyin, sure seems weird, but it may have a reason
06:20kaiyinTEttinger: ok, I am not in a hurry, :-), just learning stuff.
06:22TEttingerkaiyin, there's a lot I'm not sure about there, is that copied from somewhere online and link-able?
06:23TEttingerin particular, I may have the wrong middleware I am looking at: https://github.com/ring-clojure/ring-session-timeout/blob/master/src/ring/middleware/session_timeout.clj
06:23kaiyinTEttinger: no, but if you run lein new luminus myapp, and check myapp/src/hipstr/session.clj , you should see the same.
06:24marbetscharHi @all! Are there any good Datomic ressources out there for start playing with it?
06:25kaiyinsorry, it's myapp/src/myapp/session.clj , but you probably got it.
06:27TEttingerohhhhh that's why it's so weird...
06:27TEttinger,(:ring.middleware.session-timeout/idle-timeout {:ring.middleware.session-timeout/idle-timeout 42})
06:27clojurebot42
06:28TEttingerit's getting that key from session, not actually calling a fn on session
06:28TEttingerthe ket being :ring.middleware.session-timeout/idle-timeout
06:28TEttingerwhy it is called that, no idea
06:30TEttingerso that key is probably being set to when the session expires, as a number in seconds since the date/time that 0 is (january 1st 1970 I think)
06:30TEttingermeaning it expires in the future, unless the current time has caught up
06:31TEttingernaming is weird though, I think it's being used to test that things haven't expired?
06:32kaiyinTEttinger: than I imagine it should be named not-expired?
06:32TEttingerit's private, so I guess it doesn't matter. it's only used in one place
06:32kaiyinalright.
06:33TEttingerah, yeah, it is weird but
06:33TEttinger (clojure.core/swap! mem #(->> % (filter expired?) (into {}))))
06:35TEttingerthat takes mem, which is an atom that will contain a map of ids to sessions, and replaces its value with all id/session pairs that expired? returns true for, then sticks those back in a map and makes that the new mem
06:36TEttingerexpired? returns true if the time the session expires is later than the current time
06:36TEttingerso it is taking out any sessions that have expired, because those returned false
06:36TEttingerit could definitely be clearer if they used neg? and remove or made it alive? instead of expired?
06:37kaiyinTEttinger: yeah.
06:38TEttingerand the keyword with a / is just bizarre...
06:39TEttingerit looks like that's all meant to be close to internal only, so I guess if it hasn't needed changing they haven't changed it
06:43kaiyinCould anyone help me understand this error? https://gist.github.com/kindlychung/c4571765ab3c07e3533e
06:45kaiyinIf I have modified some clj file after starting lein ring server, what should i do to make this modification take effect?
06:46mmeixrestart the server (I guess)
06:48mmeixCompojure has "wrap-reload"
06:51kaiyinthanks.
06:52mmeixsorry... Ring I meant
06:53mmeixhttps://ring-clojure.github.io/ring/ring.middleware.reload.html
06:56oddcullyisn't namespacing this map key there actually a nice thing to do?
06:57mmeixyou mean :dirs ?
06:57oddcullyi meant :clojure/TEttinger ;P
06:58mmeixah, ok
06:58mmeix(brain in economy drive here)
06:58TEttingeroddcully, i didn't know that namespaced it, since / doesn't namespace normally...
07:04BronsaTEttinger / in symbols and keywords is only allowed once and precisely to namespace it
07:04Bronsaand it's not uncommon at all
07:13mskoudIs there a way to call a function when using deconstruction. I'm using something like (defn route-erp-customer [{{id :id} :params :as req}] , but id i a string and i would like to convert it to an int...
07:20sdegutisIs Clojure suitable for parsing a pretty well structured HTML file?
07:24J_A_Worksdegutis: This should do nicely: https://github.com/davidsantiago/hickory
07:24sdegutisI LIKE!
07:25sdegutislemme try it on my doc
07:26J_A_WorkAlso this; fewer features, but might work fine if all you want is hiccup results. https://github.com/nathell/clj-tagsoup
07:26J_A_Work<3 hiccup
08:04pandeiroanyone know how I can get liberator to return an image resource (eg image/jpeg)? I've put "image/jpeg" in the :available-media-types but when I try to retrieve the resource, I get 'org/apache/commons/compress/archivers/StreamingNotSupportedException' as a response
08:07pandeiro(in :handle-ok I'm returning (ring-response {:status 200 :headers {"Content-Type" mime-type} :body (io/input-stream image-bytes)}) ... thinking liberator should support input streams)
08:12wombawombaWhat's the easiest way to make ring log all requests to stdout?
08:12pandeirowombawomba: easiest imo would be a middleware fn that does a println
08:12Empperiguess I'd make a middleware
08:12Empperiyeah
08:12wombawombaI figured I'd use https://github.com/pjlegato/ring.middleware.logger , but it seems to use https://github.com/pjlegato/onelog , and making that log to stdout seems complicated
08:12Empperi(defn logging-mw [handler] (fn [request] (println request) (handler request)))
08:13Empperithat's it, just add that to your ring handler
08:13tdammershow about timber
08:13tdammersdoesn't that do what you need?
08:13pandeirotimbre yeah has more advanced features, prints the ns, level etc
08:13tdammerstimbre*
08:15pandeiroseems my problem above is with pantomime.mime/mime-type-of, not liberator per se... huh
08:17jtmarmonhow do you structure a system of components so that the components know that they're in testing/dev/prod mode? in testing, for example, I'd want my "twilio" component to use twilio's magic numbers instead of trying to register real twilio numbers, but that isn't something that can just be tuned by the component inputs (since the inputs to the twilio component are just account credentials - number purchasing is automated)
08:17pandeirojtmarmon: environment variables?
08:18snowelljtmarmon: https://github.com/weavejester/environ
08:19jtmarmonhmmm..it seems to me that using env vars would sort of void the purpose of letting component manage dependency injection. now you have two sources of truth for configuration to worry about
08:20jtmarmonrather than just a test config map, prod config map, etc
08:20pandeirojtmarmon: i haven't used component a lot but couldn't the twilio component depend on the config component or something?
08:21pandeiroand then the config component sources its data acc. to env
08:22jtmarmonpandeiro: right that's my intention - having the config indicate to components what state they should take. it just seems messy to pass in an indicator like (->Twilio "accountsid" "authtoken" :test) to every component that has special state during test mode.. i guess there's not really a better way to do that
08:22jtmarmoncan you have variadic argument record constructors?
08:23oddcullymap->Twilio perhaps?
08:25jtmarmonoddcully: i'm not quite clear on what the map->* syntax actually does. can you clarify for me?
08:27pandeirojtmarmon: turns a map into a record i believe
08:27oddcullyit constructs you a record from a map (with keywords like your attributes in the record)
08:28jtmarmongot it, ty.
08:33pandeiroanyone experienced w/ pantomime/tika know why org.apache.tika.Tika.detect() would be throwing a org/apache/commons/compress/archivers/StreamingNotSupportedException on a [B input?
08:34TEttinger[B being bytes?
08:34TEttinger,bytes
08:34pandeiroTEttinger: yeah, right?
08:34clojurebot#object[clojure.core$bytes 0x59424635 "clojure.core$bytes@59424635"]
08:34pandeirois that not the same as a byte array? :)
08:35TEttinger[B is the actual type of a primitive byte array, yeah
08:35TEttingerbut you can also call it, conveniently, bytes, in type hints
08:35TEttinger,(type (bytes [1 2 3]))
08:35clojurebot#error {\n :cause "clojure.lang.PersistentVector cannot be cast to [B"\n :via\n [{:type java.lang.ClassCastException\n :message "clojure.lang.PersistentVector cannot be cast to [B"\n :at [clojure.lang.Numbers bytes "Numbers.java" 1371]}]\n :trace\n [[clojure.lang.Numbers bytes "Numbers.java" 1371]\n [sandbox$eval47 invoke "NO_SOURCE_FILE" 0]\n [clojure.lang.Compiler eval "Compiler.java" 6792...
08:35TEttingerhm
08:36pandeiroright I see that in pantomime's protocol implementation signatures
08:36TEttingerI think bytes is just the cast
08:36TEttingerso what class throws this?
08:36TEttingerit's possible you need to wrap the byte[] somehow so it can stream it
08:36pandeirojava.lang.NoClassDefFoundError: org/apache/commons/compress/archivers/StreamingNotSupportedException
08:37TEttingerwhat code throws the error
08:37pandeiroTEttinger: https://github.com/michaelklishin/pantomime/blob/master/src/clojure/pantomime/mime.clj#L50-L53
08:38pandeiro...as far as I can tell...
08:40TEttingerhttps://github.com/apache/tika/blob/trunk/tika-core/src/main/java/org/apache/tika/detect/Detector.java#L57
08:41TEttingerdetect takes an InputStream, and I don't think a byte array can be cast to that
08:41kwladykaI am looking in Clojure web framework something similar what Laraver has, for example: return redirect()->back()->withInput()->withErrors($errors); - it redirect to site from request was sended with field inputs and with error msg.
08:41kwladykaIt is very usefull with POST forms
08:42TEttingerhuh, never seen (extend byte-array-type
08:42pandeiroTEttinger: thanks... odd thing is it works fine in the tests where i generate base64 on the jvm side (then convert to [B, stick in postgres, retrieve at bytes and then extract mime type)...
08:42pandeiros/at/as
08:42TEttingerpandeiro, right, there aren't bytes on JS
08:43pandeiroyeah so the http handler expects base64 and then does the decoding
08:43pandeirothought maybe the browser's base64 encoding is funky but the file seems identical
08:44pandeiroweird thing too is even wrapping pantomime.mime/mime-type-of in a (try ...), the exception 'escapes'
08:45pandeirodidn't know that was even possible?
08:49TimMcThat sounds like something deeper is wrong, like you're looking at the wrong source.
08:49pandeiroTimMc: hmm... yeah...
08:50TimMcbecause that sounds impossible
08:50pandeiroTimMc: ok good to know, gotta dig through it... but it is the only place in the entire source tree where that namespace and function are used
08:51pandeiroand when I comment it out, no exception
08:53pandeiro(catch Exception e ...) should catch anything right?
08:57dnolenClojureScript can now compile ClojureScript, only trivial things working but still fun https://github.com/swannodette/cljs-bootstrap
08:57TimMcpandeiro: Oh, is this Clojure or CLJS?
08:57pandeiroTimMc: clojure
08:57TimMcTry Throwable? What is being thrown?
08:57pandeirojava.lang.NoClassDefFoundError: org/apache/commons/compress/archivers/StreamingNotSupportedException
08:58pandeirocould this be a crazy commons compatibility thing/
08:58TimMcOh yeah, Error is a sister class to Exception, so that's why you couldn't catch it.
08:59pandeiroTimMc: ah, so if I want to catch *everything*, I use Throwable?
08:59TimMcYeah, but it can be a bad idea. :-P
08:59pandeirowhy?
08:59clojurebotwhy is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone
09:01TimMcSome Throwables are things like ThreadDeath, and you really want those to propagate. It's fine for logging purposes (but then you should rethrow), or if a thread absolutely, positively must not die.
09:01TimMcI don't remember the details, and it's a bit folkloreish, unfortunately.
09:02pandeirohuh, even with (catch Throwable ...) the error/exception propagates
09:02TimMcThat's alarming.
09:02pandeiroI'm alarmed.
09:02TimMcIt must not be thrown in that scope, then.
09:03TimMcDo you have a stack trace that actually implicates that fn, or could it be a compile-time error?
09:03pandeirosure one sec
09:04pandeirohttp://sprunge.us/dBFF
09:05TimMcWell, that's pretty clear, I guess.
09:06TimMcI've never heard of (catch Throwable) not catching everything, though, so we're missing something.
09:06pandeirowhat would the realm of possibilities include?
09:07pandeiroi'd really like to leave the mime detection stuff in place and be able to (try ...) in order to just revert to another heuristic or something if/when tika explodes like this...
09:08TimMcWell, the class not found could be a dep mismatch; see if `lein deps :tree` turns up any Commons version mismatches.
09:08pandeirodunno if it matters but the code in question is here: http://sprunge.us/bDaL
09:11TimMcWhat is mime-type-of? Is it a macro? I don't see it in the stack trace, and I don't see the definition.
09:11pandeirohuh, don't see a direct conflict: http://sprunge.us/PIFG
09:11pandeiropantomime.mime/mime-type-of, sorry
09:11pandeiroi :refer it
09:12TimMcSo, is it a macro?
09:12pandeirono it's a protocol... 'method'?
09:12pandeirobeing given a byte-array
09:13pandeiroso should be this: https://github.com/michaelklishin/pantomime/blob/master/src/clojure/pantomime/mime.clj#L50-L53
09:14TimMcI see, that's why it's an anonymous fn in the stack trace.
09:14pandeiroyeah that's something i don't like about record/protocol-y stuff :/
09:15pandeiroha
09:15pandeiroremoving selenium from my deps at least gets me my (try ...) back :)
09:16TimMcYou're able to catch now?
09:16pandeiroyep
09:16TimMcyikes
09:16pandeiro:)
09:17pandeirotell me about it
09:17TimMcwhat the hell
09:17pandeiroit's odd that lein deps :tree didn't complain about any commons-* conflicts
09:18pandeirobut that stuff is in 20 different packages it seems so maybe that's why... maybe the dep graph is crazy between those things
09:18pandeiroTimMc: super grateful for the help, TEttinger: you too
09:19TEttingerI'm glad I could help, even if most of the time I was helping my kitten catch a june bug
09:20TimMcTEttinger: That's important.
09:20pandeiroyeah a bug's a bug
09:20TEttinger(inc kittens)
09:20pandeiroi need a cigarette
09:20TimMc(dec kittens)
09:20TimMcjust kidding
09:20TimMc(inc kittens)
09:21TimMcamalloy_: botdead
09:21TEttingerhttp://i.imgur.com/3ma6cRl.gifv
09:21TimMcamalloy_: It's important, I need to give karma to kittens.
09:35TimMcTEttinger: Adorable.
09:36TEttingerit's octocat!
10:23irctcI'm trying to come up with a way of parallelizing my reduce of a huge seq of maps. Order is not important. The vanilla reduce function is to assoc several calculations onto the map. This is pure CPU bound processing (calculating geometric average with BigDecimal). All the fold examples I'm seen are virtually identical, counting items in a map.
10:24irctcAnybody have experience with reducers r/fold r/monoid and combining maps back into a vector?
10:25benhudahello
10:26irctcbenhuda: ciao!
10:38phillordIs there a function in clojure that has the "nil-safe" capabilities of some-> but doesn't do the threading
10:39phillordso transforms (a (b (c 1))) into something that returns "nil" if any of the c, b or a calls return nil?
10:40pwzoiimaybe monad?
10:40pwzoiiphillord: would that design work?
10:41phillordpwzoli: in what sense? I mean, some-> has two functionalities -- should be possible to do them both?
10:41phillordor rather do them independently
10:42profilphillord: and?
10:43phillordI was wondering if there were a way -- I not a great fan of threading, but I need the nil short-circuiting
10:43stuartsierraphillord: There's nothing built-in that does this. It would have to be a code-restructuring macro like `some->`
10:44stuartsierraphillord: `fnil` can make a single function "nil-safe" with a default value.
10:44profilphillord: (and (fn1) (fn2) (fn3))
10:45phillordno I need it to short-circuit -- the late stuff fails
10:45profiland does short-circuit
10:45phillordprofil: nope, I need to pass values between fn1,fn2 and fn3
10:45profilwithout threading? why?
10:45phillordnever mind, was just curious -- will use threading instead
10:46phillordprofile: I may be in a minority, but personally, I find the threading a little confusing
10:46profil(-> 1 (c) (b) (a)) is equal to (a (b (c 1)))
10:47profilwhich means that the threading is done the "right" way
10:47pyrtsaphillord: I once did this silly little write-up where you can short-circuit by binding (reduced expr) to some "ret" binding: https://gist.github.com/pyrtsa/1af9fdd56267a3631b0c#file-ret-clj-L3-L22
10:48pyrtsaBecomes nicer if you use functions (or wrappers) that return (reduced x) in case of error.
10:49phillordpyrtsa: looks good -- something like a let binding would make sense!
10:49phillordthanks for suggestions!
10:50pyrtsaYep, the transformation from (let [x expr1, y expr2] body) into (ret [x expr1, y expr2] body) is pretty straightforward, I'd say. :)
10:50pyrtsaThen just make the exprs short-circuit when needed.
11:19irctc,(require '[clojure.core.reducers :as r])
11:19clojurebot#error {\n :cause "Could not locate clojure/core/reducers__init.class or clojure/core/reducers.clj on classpath."\n :via\n [{:type java.io.FileNotFoundException\n :message "Could not locate clojure/core/reducers__init.class or clojure/core/reducers.clj on classpath."\n :at [clojure.lang.RT load "RT.java" 449]}]\n :trace\n [[clojure.lang.RT load "RT.java" 449]\n [clojure.lang.RT load "RT.java"...
11:19irctc,(r/fold (r/monoid conj list) (r/map #(assoc % :b (inc (:a %))) [{:a 1} {:a 9}]))
11:19clojurebot#error {\n :cause "No such namespace: r"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: No such namespace: r, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6543]}\n {:type java.lang.RuntimeException\n :message "No such namespace: r"\n :at [clojure.lang.Util runtimeException "Util.java" 221]}]\n :trace...
11:33justin_smithirctc: I think it's because reducers use threads
11:35irctcjustin_smith: Yeah, threads, security, etc. No worries. Once I looked at the impl of r/monoid, I saw the pattern. Just thought I'd post back the essence.
11:56voidnoiddunno if this is OT, can anyone recommend some good books that are more theory based?
11:57voidnoidI'm aware of SICP for example, but looking for some other suggestions too if anyone has them
11:59justin_smithvoidnoid: joy of clojure has some good theory elements to it
12:00voidnoidjustin_smith: cool thanks
12:01hiredman~bookshelf
12:01clojurebotbookshelf is http://www.amazon.com/Clojure-Bookshelf/lm/R3LG3ZBZS4GCTH
12:02kwladykahello justin_smith :)
12:03mmeixSo palletop/leaven serves the same purpose as Component, right? Why would I chose one over the other?
12:03justin_smithkwladyka: hello
12:05mmeix* palletops/leaven
12:06justin_smithmmeix: I don't know leaven at all, but I do know that component has wider general adoption (and for me it works great)
12:08mmeixok, thanks
12:14justin_smithoh - leaven looks good, and it's cljs compatible which is cool
12:17justin_smithbut I like the way component has declarative deps vs. explicit dep order
12:17justin_smithI guess that's a style thing? that's the boot / leiningen difference too
12:17justin_smiththe/a ?
12:37devnhello all
12:37devnlogback + clojure.tools.logging -- is that a thing?
12:41mnngfltgdevn, I'm pretty sure you can use it, yes
12:42mnngfltgdoesn't logback simply implement the log4j api?
12:42TimMcWe use that in a projector two, yeah.
12:42TimMc*project or
12:42devnother question is -- timbre? decisions, decisions.
12:43devni have a situation or two where i'll need to refer to specific classes for things like Layout
12:43devnit's not totally clear to me if timbre supports that, but i havent finished digging into it
12:45devnthat's kind of how i feel about it
12:45devnbut timbre does have a few things that i'd like to have, utility-wise
12:45devnbut i suppose there's nothing that precludes me from just using those fns
12:46justin_smithlog4j can have per-package config, right? like applying a different log level on a package basis?
12:46justin_smithI sometimes think it would be nice to be able to modulate logging per namespace
12:46devnjustin_smith: yes you can do that
12:47devnspecifically thinking of stuff like logged-future, log-and-rethrow-errors, uncaught-jvm-exceptions! -- those are nice to have
12:47justin_smithcool, so I assume the per-package stuff using the namespace package might just work?
12:47devnmnngfltg: so are you using logback with a logback.xml?
12:51mnngfltgdevn, no I used regular log4j
12:52devnah ok
13:05m1dnight_seems like there is a meeting of the .be clojure community at my uni
13:05m1dnight_they just invited me to come and listen :>>>
13:37Guest53Hi @all! I'm currently playing a bit with xmpp-clj, but in the repl it seems the bot is not keeping online?
13:37Guest53(xmpp/start-bot :username "username" :password "password" :host "host" :domain "domain" :handler (fn [m] "Hi, I'm 'Bot'!")))
13:37Guest53returns in REPL with {:default #<XMPPConnection org.jivesoftware.smack.XMPPConnection@12368a85>}
13:38Guest53how to send/receive messages?
13:49jtmarmonhow does one write tests for an application using components? I need access to the datomic connection so I can add test data - is there a way I can directly get components from the system without being a component myself?
13:59tmtwd(ns my.library) is a namespace or a module?
14:04amalloytmtwd: there's not really any such thing as a module
14:04tmtwdoh ok
14:05amalloythat form creates a namespace named my.library, and doesn't put anything in it
14:05justin_smithjtmarmon: you can instantiate an individual component and call call start on it individually
14:06justin_smithno need to build a system if you only need one component for a test
14:06tmtwdhow do you get just a plain clj repl running in emacs or the terminal?
14:06tmtwd(or lein)
14:06justin_smithlikely you would pass in placeholders (somewhat like mocks) for any other components it expects to use
14:06justin_smithtmtwd: plain cljs, or lein?
14:06justin_smitherr, clj
14:07tmtwdeither
14:07justin_smithtmtwd: the easiest is java -jar clojure.jar
14:07amalloytmtwd: if you have lein already, the easiest is lein repl
14:07tmtwdah ok
14:07justin_smithwhere you likely have clojure-foo.jar in your ~/.m2/ somewhere already
14:07justin_smithamalloy: yeah, you are right, I meant "simplest" not easiest
14:09amalloyjustin_smith: an interesting proposal. yours is certainly simplest from clojure's POV, but i wonder if lein repl is simpler from the user's point of view since it doesn't entangle notions of what filesystem paths the relevant jars are on
14:12oddcullyyet nothing what an alias cant fix for repetitive use
14:12oddcullyand some nice rlwrap-ping
14:13TimMcand pretty soon you've built lein
14:40justin_smithamalloy: I perhaps misunderstood the thing required - "plain clj repl" to me implied just clojure with no project deps
14:40justin_smithamalloy: and reliably getting that from lein would likely require some weird hoops
14:41justin_smith(my brain is a bit scattered today)
14:41amalloyprobably it would, indeed. the requirements were not spelled out to an exacting level of detail, and we filled in the blanks differently
15:07pandeirowhy might tika bork on trying to detect bytes received via jetty/http, but not when simulating the requests/response with peridot?
15:09pandeiroit's [base64 -> bytes -> tika -> mime type string] both days
15:09pandeiroi've compared the base64, identical... how can i compare the bytes?
15:09justin_smithpandeiro: are you sure the http stream is base64? and not the bytes themselves?
15:10justin_smithidentical base64 will always be identical bytes
15:10pandeirojustin_smith: yeah for sure, i'm sending it base64 intentionally
15:10pandeiroright and because it's ascii encoding couldn't be it, right?
15:10pandeiro(like jetty doing something weird)
15:10justin_smithyeah, valid base64 only uses the ascii subset
15:11justin_smithunless one side is using utf16?
15:11justin_smithsomething that is not ascii compatible
15:11pandeirojavascript uses utf16 internally but i don't think that's it
15:11justin_smithjava also uses utf16 or something very close to it internally
15:11pandeiroi've compared the base64 i get from the browser and what my tests produce and it's identical
15:12justin_smithif you had a utf8/ascii string on one side, and utf16 on the other, and they were being processed the same, you could see some issue
15:12justin_smithOK
15:14pandeiroanother weird possibility: a lein development profile task running and a test profile task could have different versions of common deps potentially, i wonder?
15:15pandeiroi keep thinking my issue must be related to conflicting versions of apache commons stuff, but i don't see it in lein deps :tree
15:15pandeiroand there is only one version of tika anywhere
15:16justin_smithcompare the numeric output of (.getBytes s) for the base64 strings on each side
15:16justin_smith(into [] (.getBytes s)) might be more convenient to read
15:17justin_smith,(into [] (.getBytes "hello" "UTF-16"))
15:17clojurebot[-2 -1 0 104 0 ...]
15:17justin_smith,(into [] (.getBytes "hello" "UTF-9"))
15:17clojurebot#error {\n :cause "denied"\n :via\n [{:type java.lang.SecurityException\n :message "denied"\n :at [clojurebot.sandbox$enable_security_manager$fn__835 invoke "sandbox.clj" 69]}]\n :trace\n [[clojurebot.sandbox$enable_security_manager$fn__835 invoke "sandbox.clj" 69]\n [clojurebot.sandbox.proxy$java.lang.SecurityManager$Door$f500ea40 checkPropertyAccess nil -1]\n [java.lang.System getProperty ...
15:17justin_smith,(into [] (.getBytes "hello" "UTF-8"))
15:17clojurebot[104 101 108 108 111]
15:17pandeirojustin_smith: nice, let me try that
15:20pandeiroouch printing byte arrays into emacs shell buffer
15:27pandeirobyte arrays are identical...
15:45pbiggaranyone know a nice way to retry clojure.test tests if they fail? we have some flaky tests that I'd love to just retry 4-5 times (until they pass at least once)
15:46pbiggar(so I'm looking to do something like wrap them in a middleware where if the test fails its retried and if it succeeds it isn't marked as a failure)
15:58zerokarmaleftpbiggar: imho, at that point I think you have to ask yourself if those tests are providing any value
15:59pbiggarzerokarmaleft: Already did :) They provide a lot of value. But they're unreliable. Deleting them sucks. Keeping them being unreliable sucks. Retrying them doesn't suck
16:00zerokarmaleftis there any way to adjust the seam along which you're testing so that you can rewrite the tests to be deterministic?
16:00pbiggarthey test against an unreliable 3rdparty service
16:00pbiggarso no
16:00pbiggarmocking isn't an option for this test
16:01TimMcpbiggar: Write a lazy seq that runs the fn under test, filter it for the desired answer, and test that you get at least one valid.
16:01TimMcAlso say 3 Hail Marys.
16:02pbiggar@TimMc: interesting. OK, will try that. Very smart, thanks!
16:02TimMcMaybe also donate to a charity.
16:03pbiggarTimMc: what about the (is) calls in the fn. Won't they update the global count?
16:05TimMcOnly one (is) call. (is (not= (first (filter is-valid? (repeatedly 5 the-test))) nil)) or something.
16:06pbiggari was thiking about putting the (is) calls in the test, so that it doesn't really change how we write tests
16:06TimMcWell, that won't get you what you want.
16:06pbiggarso something like (deftest my-test-name (with-retries 5 ....)
16:06TimMcI don't know enough about clojure.test in order to write that. My suggestion will "work" without any extra research.
16:07pbiggarmaybe if I bind the assertion failure counts. starting to get messy
16:07pbiggarTimMc: yes, it will
16:07TimMcIt *should* look ugly. :-)
16:08pbiggarThat isa philosophy I don't subscribe to :)
16:08pbiggarlooks like I can bind do-report
16:13kaiyinI hate to have to deal with html and css stuff, what libraries should I learn if want to develop a website using just clojure and clojurescript?
16:15TimMcpbiggar: If it's too easy to use, people will use it.
16:15TimMcRemember to test that any failures are the expected kind of failure, otherwise you'll miss real failures of other sorts.
16:16TimMckaiyin: You'll still have to deal with HTML and CSS. :-)
16:16kaiyinok, :-(
16:16kaiyinthey are just ugly.
16:16TimMcI won't dispute that. :-)
16:18TimMcThere's a safe version of Hiccup you can use: https://github.com/ato/clojars-web/blob/master/src/clojars/web/safe_hiccup.clj (Don't use unmodified Hiccup, you'll get cross-site scripting vulnerabilities in your website.)
16:18eriktjacobsen /join #leiningen
16:18eriktjacobsenwhups
16:21eriktjacobsenDoes anyone have any good guides on running down compile issues? We had some conflicting versions, so I started normal route of “lein deps :tree” and start adding exclusions. The problem is now I’ve hit a brick wall in that I am getting notice a specific package is breaking, but that package has no shown dependency issues and all the correct versions should be loading for it. The compile error and output from deps is
16:21eriktjacobsenhere: https://gist.github.com/eriktjacobsen/9d02b57225db92dbe496
16:22eriktjacobsenAdding the exclusions got me through a douplicate signer error and two other missing class issues, but those seem to have resolved via exclusions unrelated to the cheshire package
16:27arohnereriktjacobsen: are you AOT'ing?
16:27arohnereriktjacobsen: or depending on any packages that have been AOT'd?
16:27eriktjacobsen :aot :all
16:28arohnerAOT also transitively compiles all dependencies
16:28arohnerand .class files are loaded with higher priority than source .clj files
16:29arohnerso for your deps to be respected, make sure your tree is clean, and make sure a dep isn't AOT'ing a lib version that you want to specify
16:30pandeiroarohner: if a dep *were* AOT'ing a lib, that version would be reflected by `lein classpath` right?
16:30pandeiro(i'm also in dep hell right now [i think])
16:31arohnerpandeiro: I don't think so
16:31eriktjacobsenwell, I do run lein clean before each compile, so no classes in target/. I’m guessing next step is to remove :aot during conflict resolution. How would I tell if a dep was AOT’ing a lib version I wanted to specify
16:31pandeirohuh
16:31arohnerpandeiro: lein dep tells you the lein/mvn .pom asks for, not what .class files are on disk
16:31arohnereriktjacobsen: inspect the jar for .class files :-/
16:31pandeiroarohner: ie, in `target/`?
16:31pandeiroor in .m2 as well?
16:31arohnerpandeiro: could also have .class files in a jar
16:32arohnerand that's the tricky one
16:32pandeiroso how does one get the definitive list of which versions of what are being loaded by a lein process?
16:33justin_smithpandeiro: lein cp will generate the actual classpath used, and I have been able to plug that into an explicit java call
16:33TimMcWorst case you could launch a repl and ask for the .class and .clj resources.
16:34pandeirothere's no existing tool to diff classpaths from clojure right?
16:34TimMcor iterate through the classpath, call unzip -l on each one, and grep for the class.
16:34TimMcpandeiro: It's not even the classpath that matters here, all you'll get is jars and target/ and such.
16:35pandeiroah ok
16:35TimMcWhere to look, not what's there.
16:35arohnerpandeiro: what I'm trying to get at is there's only a loose connection between a version, and what actually gets loaded. If you have a "malicious library maintainer", they could AOT their lib against [foo "1.0"], set the project.clj to [foo "2.0"], and then zip up
16:36arohnerpandeiro: your program downloads the lib, and [foo "2.0"], but because AOT, the foo 1 classfiles get loaded
16:36arohnernow, that's an extreme case, and unlikely
16:36arohnerbut I've seen similar things in the wild
16:36pandeiroyeah, i wish mine were that exciting but i'm sure it's more banal than that
16:37pandeiroi get a ClassNotDefError when i run code with profile dev, but not with test
16:37pandeirosame code
16:37pandeirolooking at lein classpath from both profiles shows the same version of the package with the class in question
16:38amalloypandeiro: i don't think there's any such thing as a ClassNotDefError. if you are going to tell people error messages, they should probably be the actual error messages, copy/pasted
16:38pandeiroamalloy: sure good point
16:38pandeiroNoClassDefFoundError
16:39TimMc,(defn foo [] )
16:39clojurebot#'sandbox/foo
16:40TimMc,(.getResource (class foo) "clojure/core__init.class")
16:40clojurebotnil
16:40TimMc,(.getResource (class foo) "clojure/core.clj")
16:40clojurebotnil
16:40TimMcInteresting. But run those locally, you'll see the clj and class files be found.
16:41TimMc(I'm using fn's class because it's a cheap and dirty way to get the right classloader.)
16:48TimMcAs a bonus, it will tell you where it found them. :-)
16:48pandeiroTimMc: yeah i tried it at the repl, that's cool
16:49pandeirounfortunately i don't see how to really apply that to my problem
16:49pandeiroi have to figure out the filepath of where the the not Def'd class ought to be, i guess?
16:50pandeiroi tried (println (.getResource org.apache.commons.compress.archivers.StreamingNotSupportedException "org/apache/commons/compress/archivers.class")), which is wrong apparently
16:53pandeirotried the file 'org/apache/commons/compress/archivers/StreamingNotSupportedException.java' (where it exists in the commons-compress src) too, grasping at straws here...
17:00matthaveneris (seq X) idiomatic for (not (empty? X)) ?
17:00pandeiromatthavener: there's (not-empty x) too
17:01matthavenerah cool, thank you
17:02amalloyugh do not use not-empty for that
17:02amalloythat is what seq is for
17:03AimHereWhat's not-empty for then?
17:04matthavenerfrom amalloy: http://stackoverflow.com/questions/3118962/what-is-the-correct-clojure-way-to-check-if-a-collection-is-non-empty#comment7947976_3120045
17:04amalloyit is for when you need to test for emptiness but not convert it into a seq if it's non-empty
17:04amalloyeg (when-let [xs (not-empty (build-some-map)] (...use xs as a map))
17:07TimMcpandeiro: Oh, I got two conversations confused. That was actually for eriktjacobsen, I think.
17:07eriktjacobsenTimMc: “Worst case you could launch a repl and ask for the .class and .clj resources.” How would I go about doing that? If I remove :aot then I can start the repl, and even (require ‘cheshire.core) and see the same error message
17:08eriktjacobsenAlso sanity check: in cheshire it complains about tag not being public…. in generate.clj there is a (defmacro tag), and in generate_seq.clj there is (:use [cheshire.generate :only [tag]]) in the namespace…. and the latter is whats failing
17:09csd_When I try to cider-jack-in, it tells me I'm connected to the nrepl but doens't actually open a window with the repl. When I look at the buffers, I see it creates 2 nrepl buffers, one for "server" and the other for "connection". As I recall from using cider before, there should only be one nrepl window and another window labeled cider .... What might be causing this?
17:09eriktjacobsenafaik defmacro should be public for the :use… so just in case there is some unrelated to compiling issue this might be source problem
17:09TimMceriktjacobsen: The method I described would only help you probe for AOT'd versions of a specific namespace, unfortunately.
17:09TimMcI don't know if an easy way to search for such things.
17:10eriktjacobsenTimMc: so if I take out AOT and merely try to require the offending library from the repl and get same error message… any idea how I’d start running down the issue? It doesnt seem to be a problem with this often used library so I’m 99% sure its my local environment
17:12pandeirocsd_: the nrepl-server buffer may have useful info
17:12csd_pandeiro: alas, it does not :-/
17:12pandeirosometimes it's just downloading 200 dependencies and taking a while
17:13pandeironothing at all?
17:13csd_it just says im connected, have a nice day
17:14eriktjacobsenTimMc: also I’m a bit of a loss as to what you were using the second argument of getResource… I can (require ‘cheshire.generate) without error but can’t call “ (.getResource (class cheshire.generate))”
17:16jcrossley3csd_: pandeiro: i'm seeing the same
17:17csd_jcrossley3: think its a bug?
17:17pandeirobrand new cider?
17:17csd_yeah
17:17jcrossley3yep, 0.9.0
17:19pandeiroworking for me with cider-20150615.1053
17:19pandeiro(0.9.0-SNAPSHOT)
17:19csd_pandeiro: would i need to use git to dl that?
17:20pandeirocsd_: no just emacs
17:20pandeirowith the melpa repo enabled
17:20pandeirothat will get the latest snapshots
17:20csd_ah looks like i installed from melpa-stable
17:21TimMceriktjacobsen: You need to get ahold of a Class that has the right classloader. The Class of a function defined in your program works for that.
17:22freeone3000I'm trying to get my first clojure application working, an anagram finder. My application so far looks like: https://gist.github.com/freeone3000/19d6224a8d2dd7142274 . my errors are included in the paste. Where am I attempting a cast?
17:23TimMcIf you take out AOT from your own llib, you still have to contend with the possibility of an AOT'd library conflicting with a dependency. Let's say you depend on Bar and Baz, and both depend on Foo.
17:23TimMcIf Baz is AOT'd then you'll have the Foo dependency on your classpath, but also Baz's compiled version of it.
17:23eriktjacobsenTimMc pretend I know nothing about java/ jvm (I’ve been progrmaming in clojure for years but rarely have to worry about the java backend). where would I find the class of a defined function?
17:24eriktjacobsenGotcha about AOT’d dependencies
17:24TimMcJust like I demonstrated -- (defn foo [] ) and use (class foo) as your Class. The explanation is kind of complicated, I can't provide it at the moment.
17:24eriktjacobsenOk. So class = function name?
17:24TimMcNo, each Clojure function is backed by a Class.
17:24TimMc,(class +)
17:24clojurebotclojure.core$_PLUS_
17:25amalloyfreeone3000: you want (defn frequency-table [words])
17:25TimMc,(Class/forName "clojure.core$_PLUS_")
17:25clojurebotclojure.core$_PLUS_
17:25csd_pandeiro: its giving me an error saying my nrepl version is 0.2.6 when im using the 0.9.0 release. any idea what that's about?
17:25jcrossley3csd_: this may help: https://github.com/clojure-emacs/cider/issues/1050
17:26freeone3000amalloy: Ah, I accidentally a reserved word. Thanks.
17:26amalloywell actually you aren't even using that words argument
17:26amalloyno, i don't think you did
17:26freeone3000amalloy: So why "words" and not "word"?
17:26amalloyfreeone3000: i guess i am confused. it doesn't seem like your source file, as written, should cause that error
17:26eriktjacobsenTimMc: I’m trying to require cheshire.generate-seq but it is failing, so I can’t use anything in there as a function… likewise my own project’s core.clj includes the cheshire so it also will fail in a (require).. what function should I be putting into class? Just a random function I create in the repl itself?
17:27freeone3000amalloy: But "words" instead of "word" fixes it.
17:27amalloyuh
17:27amalloyfreeone3000: the important change was removing the &, not the name change
17:27amalloybut i think if you change it back it should still work
17:27clojurebotIt's greek to me.
17:27amalloybecause you aren't even using the argument, and the name you give it doesn't matter at all
17:28freeone3000amalloy: Ah. Okay.
17:28eriktjacobsenTimMc: I’ve tried that, and upon entering (.getResource (class foo)) I get “No matching field found: getResource for class java.lang.Class"
17:28TimMceriktjacobsen: You ned to ask it for a resource. (It needs another argument.)
17:30freeone3000amalloy: Okay, it looks like there's some change between when I make a code change and when running the program gets different results. is there a clojure agent or something similar to the scala agent that could cause problems like this?
17:30eriktjacobsenGotcha, thanks. per my previous msg: “also I’m a bit of a loss as to what you were using the second argument of getResource”. So what is the other argument “cheshire.generate-seq” as this is the failing to compile file?
17:31justin_smith(inc eastwood)
17:31lazybot⇒ 9
17:31justin_smithfinds my bugs :)
17:31amalloyfreeone3000: no. possible causes might include AOT, but it doesn't look like you're doing any; or your IDE is doing some funny business; or you are expecting changes to be applied before you press Save or something
17:31TimMceriktjacobsen: You're asking the JVM to find the actuall .class and .clj files in the jars.
17:32TimMcIt's a quick way of searching the jars, subject to the limitation of your classloader.
17:33eriktjacobsenAlright, I believe I understand what you’ve said, however I’m not sure how that relates to the second argument. Is that the “actual clj files” in the jars? I’ve been throwing random strings at it, and I do get back something for “cheshire/core.clj” and the other files.
17:33eriktjacobsenOk so I’m getting back: user=> (.getResource (class foo) "cheshire/core.clj") #<URL jar:file:/Users/eriktjacobsen/.m2/repository/cheshire/cheshire/5.5.0/cheshire-5.5.0.jar!/cheshire/core.clj>
17:34devnhow do i prevent clojure.tools.logging from using commons-logging, and instead have it use log4j?
17:34eriktjacobsenAll 3 source files in question (core, generate, generate_seq) all show up as coming from cheshire version 5.5.0, however it still won’t include with (require) as it is giving this “Tag not public” error.
17:37TimMceriktjacobsen: What if you look for cheshire/core__init.class ?
17:37tcrawleydevn: I think (alter-var-root #'clojure.tools.logging/*logger-factory* (constantly (clojure.tools.logging.impl/log4j-factory))) should do the trick
17:38eriktjacobsenah
17:38timvisherwhat's this error mean? `No namespace: foo, compiling bar` ?
17:38eriktjacobsenTimMc: AHA file:/Users/eriktjacobsen/.m2/repository/collectiveds/scraper/0.9.2/scraper-0.9.2.jar!/cheshire/core__init.class>
17:38TimMcThere you go! The culprit.
17:38eriktjacobsenTimMc: How did you know to look at core__init.class, and where can I find a book or guide that would give me that same information in the future
17:39TimMcI happened to know that that's the format of classname that namespaces get compiled to. :-/
17:39TimMcI think I knew that because of poking around in AOT'd JAR files or something.
17:40eriktjacobsenSo why was looking at “cheshire/core.clj” giving me different than “cheshire/core__init.class”… because .class is higher precedence to .clj files? So I should always be inspecting with the “__init.class” appended to whatever I want to really look for?
17:40TimMcMaybe there's a book or guide that would tell you that but... unfortunately, I doubt there is.
17:41TimMcYeah, the classfile would be the first place to look. It's higher precedence in Clojure 1.6.0 and below. I think 1.7.0 switches it.
17:41puredangerno, it does not
17:42TimMcHuh. WHat does it change, then? There's something about this...
17:42puredangerthe primary change in 1.7 is that class loads will now inspect the dynamic class cache before going to disk
17:42puredangerbut .class will still be picked over .clj if both are on the classpath
17:43puredangerI have not read the back chat
17:43puredangerso apologies if I'm missing all the relevant context :)
17:43TimMcOooh, OK. I think I heard differently in the channel at some point.
17:44TimMcpuredanger: Context is dependencies and transitive AOT conflicts.
17:44puredangerwell, there's a lot of subtleties :)
17:46puredangeris this *while* compiling your own project perhaps?
17:46puredangeruberjar for example?
17:48puredangerI have to step away, but happy to discuss tomorrow if neede
17:48TimMcpuredanger: Not my project, no.
17:49TimMcFound the issue in eriktjacobsen's project, and am somewhat curious as to what I had misunderstood about .class vs. .clj precedence.
17:53jcrossley3csd_: you get it working?
17:54jcrossley3csd_: reinstalling clojure-mode got things working for me
17:57eriktjacobsenTimMc: better question…. is AOT the specific reason this doesn’t show up with “lein deps :tree” ?
18:05TimMceriktjacobsen: Yep.
18:06justin_smith~clean
18:06clojurebotexcusez-moi
18:17pandeiroanyone able to draw any leads from this: http://sprunge.us/SMhO
18:24justin_smithpandeiro: looks like you need to download the whole file before tika can tell you what it is?
18:24pandeirojustin_smith: yeah no it's downloaded, i'm testing with local files
18:24justin_smithhttp://commons.apache.org/proper/commons-compress/javadocs/api-1.8/org/apache/commons/compress/archivers/StreamingNotSupportedException.html
18:24justin_smithweird!
18:25justin_smithso ArchiveStreamFactory is being used erroneously?
18:25pandeirojustin_smith: no idea! none of this is thrown when i do the exact same thing in tests
18:26pandeiroi'm getting close to `rm -rf ~/.m2`
18:29justin_smithpandeiro: in my experience that doesn't really help much
18:29pandeiroit's not even clear to me which class is not being found
18:29pandeiroor which class definition
18:30pandeiroi am 80% it's related somehow to the classpath, not any actual app or library code
18:38voidnoidis there a good basics book available online? the primary docs http://clojure.org/reader seem to be geared more as a reference manual than an instructional book
18:38voidnoidrather, I'm guessing there is, wondering what people might suggest
18:42pandeirovoidnoid: http://www.braveclojure.com/ is pretty good imo
18:43voidnoidpandeiro: k thanks
18:47arohnerdoes ring-mock (or any other ring testing library) support passing cookies around, similar to clj-http cookie manager?
18:48pandeiroarohner: peridot manages cookies
18:49arohnerpandeiro: great!
19:09arohnerpandeiro: peridot appears to be sending the header "Set-Cookie" rather than "Cookie". Am I doing something wrong?
19:11pandeiroarohner: ah, you're setting the cookie for the request manually?
19:11arohnerpandeiro: no
19:11arohnerpandeiro: trying to login to an app that uses friend for auth
19:11pandeiroSet-Cookie: is the name of the header that the response includes
19:12arohnerpandeiro: right, but then the next request is *sending* Set-Cookie rather than Cookie
19:12pandeiroso with peridot i do something like (-> (session my-app) (do-login sample-user) (api-request :foo))
19:12pandeirowhere api-request is just a wrapper over my api
19:13pandeiroand would include a cookie for my session if login succeeded
19:13arohneryup
19:15arohnerhrm, actually it looks like it's losing cookies during a follow-redirect
19:23arohnerpandeiro: aha! peridot doesn't like it if you mess with the Host header, because it uses that to decide which cookies to send
19:36jacob_hey guys i’m having problems connecting to datomic inside a docker container when datomic is hosted on aws. I have no problem connecting to a database that is in my local network though. any ideas?
19:37eriktjacobsensecurity groups? have you verified the port is open to that machine?
19:37jacob_i can expose only 1 port
19:37jacob_i have tried many different ones, like 4334
19:38jacob_which i think is the one that database is on
19:38eriktjacobsenget on the box running datomic and do “sudo netstat -nutlp” and see
19:38eriktjacobsenit’ll tell you what ports are listening
19:38eriktjacobsenAlso: Yet another compilation question: My project has 2 libraries, lets say foo and bar, which each use the same underlying library, Bob, at different versions, 1 and 2. Foo requires 3 different sections of Bob version 1: A,B and C. (this shows in lein deps :tree as “com.Bob/A” vs “com.Bob/B”. Bar only requires A and B from version 2. If I put all 3 exclusions on bar, or all 3 on foo, or just the 2 overlapping on foo,
19:38eriktjacobsenI get different “ClassNotFoundException”.
19:39eriktjacobsenI’m bit of a loss as what to do. Never been a java / jvm guy. Coding clojure for 3 years and still rarely run into issues that aren’t solved with a quick exclusion
19:43pandeiroarohner: nice catch! good to know for future reference too
21:58iamjarvoare there any open source clojure webapps that show testing?
22:23justin_smithiamjarvo: I think circleci does
22:25iamjarvoi think it's just their frontend
22:25danielcomptonamalloy: you around?
22:26amalloycould be
22:26justin_smithiamjarvo: oh, so you aren't interested in cljs test
22:27danielcomptonamalloy: would it be possible to consolidate all of the flatland and ninjudd protocol buffer repos? It's really confusing having forks that both seem to be updated and maintained
22:27iamjarvoboth, but more on the clojure side of things
22:33wildnuxwhat is the idiomatic way of matching strings in a sequence and creating a map out of it ? for eg: ["//this is a comment line" "01-this is data line" "//TODO: todo line"]
22:34wildnuxto {:comment "//this is a comment line" :data "01-this is data line" :special "//TODO: todo line"}
22:34justin_smithwildnux: perhaps (group-by line-categorizer lines)
22:35justin_smithwhere line-categorizer takes a line of text and returns :comment or :data or :special
22:35justin_smith,(group-by first ["hello" "world" "hippo" "welsch" "hottentot" "alabama"])
22:35clojurebot{\h ["hello" "hippo" "hottentot"], \w ["world" "welsch"], \a ["alabama"]}
22:36wildnuxjustin_smith: thank you, let me try
22:36wildnuxjustin_smith: coming from java background, i can think of line-categorizer as something in the line of: (if (.startsWith "//) ... )
22:36amalloydanielcompton: i dunno. the idea was that we wanted them to be flatland repos, but those didn't show up in our personal github profiles so it looked like we never did anything interesting
22:37justin_smithwildnux: sure, though it needs to be a function of course
22:37wildnuxjustin_smith: is there functional way of avoiding if then else ?
22:37amalloyso we re-hosted the repos, and then forked them back to flatland so old links would still work and so on
22:37justin_smithwildnux: cond can be nicer than nested ifs at least
22:37justin_smith(doc cond)
22:37clojurebot"([& clauses]); Takes a set of test/expr pairs. It evaluates each test one at a time. If a test returns logical true, cond evaluates and returns the value of the corresponding expr and doesn't evaluate any of the other tests or exprs. (cond) returns nil."
22:38wildnuxjustin_smith: aah yes, thank you.. let me try it
22:38danielcomptonamalloy: I'm pretty sure that's no longer the case, they'll show up under "Repositories contributed to"
22:40justin_smith,(group-by #(cond (.startsWith % "//TODO: ") :special (.startsWith % "//") :comment :true :data) ["//this is a comment line" "01-this is a data line" "//TODO: todo line"])
22:40clojurebot{:comment ["//this is a comment line"], :data ["01-this is a data line"], :special ["//TODO: todo line"]}
22:40justin_smithof course the real art will be in making the categorizer better (eventually you might want a parser or at least regex?)
22:45danielcomptonamalloy: the current situation is really confusing. If you still wanted it to show up as your repo on GitHub, could you remove the flatland forks, but keep the groupID as flatland?
23:12wildnuxjustin_smith: yeah, for now this should work :)
23:26lvhWhen I open up a nrepl session, say, in CIDER, it automatically honors stuff from project.clj, like :init-ns, :init and other :repl-options. What's the part that actually makes that work for CIDER? How does it ask leiningen what it shoudl to do the REPL before giving it to the user? I'm asking because I'd like to contribute that behavior to figwheel.
23:27amalloylvh: leiningen does all that, not cider
23:27amalloycider just says "hey lein, gimme a repl"
23:29justin_smithand lein's all like "OK, current wait time for a repl is about 45 seconds" and then puts cider on hold
23:30lvhOh, okay.
23:31lvhamalloy: So, right now, figwheel sets up an nrepl server, but it ignores all the nrepl middleware and other :repl-opts stuff from project.clj, since, well, it's not lein
23:31lvhI'm not sure what the best way to fix that is
23:31lvhjust using stuff from project.clj seems fine, since it's already lein-figwheel
23:31lvhyou can't really use it without it AFAIK
23:32lvhjustin_smith: sad but true :(
23:32lvhI guess I'll look into leiningen to see if I find any nrepl-specific stuff? Although I guess it's not just nrepl, it's any repl
23:33lvhI'm kind of hoping there's something I can call that will worry about project.clj's contents for me, and specifically knows all about :repl-opts and just.. does it
23:33lvhI guess lein repl is always nrepl? IIRC
23:33justin_smithyes, but "lein run -m clojure.main" gives a vanilla repl
23:34lvhamalloy: Thanks! :)
23:34lvhAh :)