#clojure logs

2015-12-12

00:00justin_smith,(let [in [1 2 3 [4 5]]] (into (pop in) (peek in)))
00:00clojurebot[1 2 3 4 5]
00:01justin_smiththat of course relies on knowing that the last item is the thing to merge with the rest
00:01amalloyjustin_smith: (partial apply list*)
00:02justin_smithaha!
00:03justin_smith,(apply list* [1 2 3 [4 5]])
00:03clojurebot(1 2 3 4 5)
00:03justin_smithnice
00:14TEttingerjustin_smith: wow cmd is terrible
00:14TEttingercmd /S /C " java -jar %HOME%/.m2/repository/org/clojure/clojure/1.7.0/clojure-1.7.0.jar -e "(println \"hell
00:14TEttingero world\")" "
00:14TEttingerthat's what it took
00:14justin_smithaha
00:14TEttinger(yeah it took me over 20 minutes to figure out what odd tweaks it needed...)
00:15TEttingerit is pretty fast though
00:15justin_smithbut hey, bright side is you have the basis for running clojure from a script :)
00:15justin_smithTEttinger: another cool option: make an uberjar containing all the deps you would use in a shellscript
00:16TEttingeralso fun: $help time -> Displays or sets the system time.
00:16justin_smiththen write a clojure ns as a shebang - remember #! on the beginning of a line is a comment
00:16justin_smithhaha
00:16justin_smithso wait, was /S or /C the thing that showed the time elapsed?
00:20TEttingeryou overestimate my abilities with cmd
00:20TEttingerthe /C tells it to execute another command, the /S tells it don't mess with quotes in it
00:20justin_smithoh - so you didn't get it to time
00:20TEttingeryep
00:21TEttingerI have a timer utility somewhere
00:21justin_smithyou could implement it with clojure using clojure.java.shell/sh :)
00:29TEttingerwow this was just wonderful
00:29TEttingerapparently the timer itself may do some redirection
00:29TEttingerC:\dev\TIMETHIS java -jar %HOME%/.m2/repository/org/clojure/clojure/1.7.0/clojure-1.7.0.jar -e \"(println \\\"hello world\\\")\"
00:29TEttingeronly the triple backslashes seemed to escape quotes properly in code
00:30justin_smithwow
00:31justin_smithTEttinger: nethack 3.6 came out, btw
00:31TEttingerI saw!
00:31TEttingerhave not played yet
00:31justin_smithamong other things it has the new amusing message "it won't come off its hinges" - bet you can figure out how to make that one happen
00:31TEttingerI heard someone died to "a gnome lord wielding 5 daggers"
00:32TEttingernot sure how that happens
00:34justin_smithTEttinger: looks kind of like wolverine, but 3 foot high, wearing a pointy red cap
00:35TEttingerI was thinking he was very good at juggling
00:35justin_smithoh yes, gnomes are good jugglers
00:36justin_smithand a gnome lord with 5 daggers, well he can juggle them right up to your jugular!
00:36TEttingerI wonder where Raynes is
00:36TEttingerI had a question/possible complaint about a refheap behavior
00:37TEttinger(pasting large amounts of text, even with plain text syntax highlighting, freezes the browser)
00:37justin_smithTEttinger: is line length a factor there?
00:38TEttingerit was something like https://gist.githubusercontent.com/tommyettinger/9079f8f882db658f301f/raw/eb452cd90915c558cd9ece03ee30af829dda059e/layer-dungeon.txt
00:38TEttinger240 char wide lines
00:39TEttinger,(* 121 16) ;; lines
00:39clojurebot1936
00:39TEttinger,(* 121 16 241)
00:39clojurebot466576
00:39TEttingerso half a megabyte
00:43TEttingeroh haha utf-8
00:43TEttingerright so much more than half a MB
00:45justin_smithTEttinger: utf8 is fairly compact - 590k
00:45justin_smithTEttinger: I just downloaded and measured
00:47TEttingernice
00:47TEttinger...hm
00:48justin_smithutf8 is the best
00:48TEttingerthinking about the ol' hilbert curve
00:50TEttingerI wonder what ways there are to compress text
00:50TEttingerall the compression work I've done is very specialized and meant for spatial data
00:54justin_smithTEttinger: what about trying to make a path that optimized the run length of a given token when walking the 2d space of that file
00:54justin_smithdifferent curves should end up with different average run lengths (and thus different compression ratios in run length encoding)
00:58TEttingerI think one size opt that could be done on most UTF-8 text is to use a "custom unicode codepage" of 256 chars that are only the most frequently used in the document
00:59justin_smithTEttinger: for sure, - and for docs like yours, you could even reduce it to like 3 bits per char, because that's enough to encode every char you use uniquely
01:00justin_smitherr, make it 4 bits, oosp
01:01TEttingernot sure 16 items would do it
01:02TEttingeryeah, I think I'm like 3 over
01:02justin_smithTEttinger: oh? 6 for the solid walls, one for empty space, one for dug out, one for lit space?
01:02justin_smithoh
01:03TEttingersolid walls are 11 chars
01:03justin_smithI forgot the ts
01:03TEttinger
01:03TEttinger,"
01:03clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading string>
01:03TEttingercome on IRC!
01:34justin_smithTEttinger: woah, I spammed myself out of my client - I hope I didn't accidentally paste any dungeon before the client went down
01:35TEttingerha, nope
01:35justin_smithTEttinger: sometimes paste is a terrible mistake
01:35justin_smithhalf a meg of dungeon ascii, heh
01:35TEttingerunicode!
01:46justin_smithTEttinger: ever see this? it's a curated list of "nasty" strings for fuzz testing https://github.com/minimaxir/big-list-of-naughty-strings/blob/master/naughtystrings/internal/resource.go#L530
01:46justin_smithcould be the basis of a simple unit test helper lib
01:56TEttingerneat
03:37BRODUSwhats the most succinct way to tell if a number is between a range?
03:37opqdonut,(< 1 2 3)
03:37clojurebottrue
03:37opqdonut,(< 1 4 3)
03:37clojurebotfalse
03:45BRODUSopqdonut: thanks
03:55conprehendantHow do I destructure an array of this: http://pastebin.com/1TgZL1PV ?
05:19oraclehi
05:19oraclehji
05:19BRODUSyo
05:19oracle(transduce (comp (take-while true?)
05:19oracle (map (fn[x] (println x) true))
05:19oracle )
05:19oracle conj
05:19oracle []
05:19oracle (map inc (range 4)))
05:19oraclewhy that code doesn't print anything?
05:20oraclesince the map always return true, so take-while consume all the data
05:20oracleso I expected it to print 1,2,3. But it doesn't print anything, and the result is emtpy of []
05:24allenj12Hey has anyone here tried clojure in the atom editor? Im doing alot of stuff in windows lately and i dislike emacs in windows
05:25MJB47i use ST3, is that close enough?
05:25oracleanyone know transduce in clojure 1.7?
05:26allenj12MJB47: not really an nrepl for sublime like there is in emacs is there?
05:26MJB47there is sublimeREPL
05:26MJB47but
05:26MJB47its pretty shit
05:27allenj12MJB47: gotcha, maybe i should try emacs in windows, or just suck it up and reboot everytime i need to switch back and forth
05:27MJB47you could also try cursive
05:29allenj12MJB47: I thought about that and will probably try it but i wanted something more general cause i work in multible languages
05:29MJB47yeah i hesitate for the same reason :(
05:51allenj12MJB47: welp the atom repl looks shitty to
05:51MJB47:(
05:56oracle(transduce (comp (take-while true?)
05:56oracle (map (fn[x] (println x) true))
05:56oracle )
05:56oracle conj
05:56oracle []
05:56oracle (map inc (range 4)))
05:57oraclesorry, pasted wrong
05:59keep_learningHello everyone
05:59keep_learningPardon me if I sound stupid.
05:59keep_learningI am planning to do some work with stanford nlp
06:01keep_learningand planning to use [me.arnaudsj/corenlp "3.5.2"]
06:01keep_learningMy job is very much similar to extracting the dependencies http://stackoverflow.com/questions/5449098/stanford-parser-how-to-extract-dependencies
06:02keep_learningfrom a syntax
06:02keep_learningso I am wondering if I can do this with current version of corenlp "3.5.2"
06:08oraclefor tranducer, why the following code doesn't print anything?
06:09oraclehttp://paste.lisp.org/display/166410
06:09oracleI also asked in in stackoverflow: http://stackoverflow.com/questions/34238843/transduce-why-this-transduce-doesnt-print-anything
06:28justin_s1ith,(transduce (comp (map (fn [x] (println x) true)) (take-while true?)) conj [] (map inc (range 4))) ; oracle
06:28clojurebot1\n2\n3\n4\n[true true true true]
06:30justin_s1ithoracle: when you call comp on the transducer arg, it isn't composing the functions, it's composing the transduction - which effectively means it is reversing the args to comp
06:30justin_s1ithoracle: because a transducer takes a function as an arg, and returns a new function
06:30justin_s1iththe function that gets returned is what finally sees the collection
06:35sunset-shimmerhello, guys!
06:42sunset-shimmerI have a complex structure (vector of maps) and I need to "remove" the given item from it. I can accomplish this with (->> [{:a 1} {:b 2}]) (remove PRED)) form. Lets say I need to remove item where :a is 1, is there a concise way to write a predicate?
06:43sunset-shimmerIt seems like I can use deconstruction here.
06:44sunset-shimmeror just #( (= (:a %) 1) ) is the best way?
06:44justin_smith,(remove (comp #{1} :a) [{:a 1} {:b 2}])
06:44clojurebot({:b 2})
06:45justin_smiththat version is probably only better if you have more than one relevant value - eg. if it was #{1, 3, 4}
06:50sunset-shimmerjustin_smith: great! It looks better and I didn't aware of this function. I'll check its description. Thank you.
06:51BRODUSwould anyone be willing to code review my solution to this 4clojure problem: https://www.4clojure.com/problem/94 ?
06:54BRODUSlink to solution: http://pastebin.com/wYAHRSQm
06:54justin_smithsunset-shimmer: #{} is the literal syntax for sets
07:08sunset-shimmerokay, I see! and then you check if the given set contains element that we extract from map by property. Now I can articulate more complex predicates for finding exact items in a vector of maps like (#{{:color lavender :type unicorn}} {:color lavender :type unicorn}) or just find what I want by id, if I'll decide to use identifiers. It was very helpful!
07:41BRODUS,((fn [& args] (count args)) nil nil nil)
07:41clojurebot3
07:49justin_smith,((comp count list) nil nil nil)
07:49clojurebot3
08:54jonathanjhow does one usually handle errors with something like core.async?
08:54jonathanjhave a separate channel for putting errors on?
09:13sunset-shimmerIs it fine to generate unique ids with (keyword (gensym)) construct? :)
09:17zamateriansunset-shimmer, only if the are not persistet, they are probably not unique across jvm invocations. better use uuids
09:49C4K3Is it not possible to use anonymous functions in the -> macro? For example (-> 2 (fn [x] (+ x 1))) throws an error, but if I make a named function that does the same thing, then it works fine
09:52MJB47,(-> 2 ((fn [x] (+ x 1))))
09:52clojurebot3
09:52C4K3I see, thanks
09:55uptowni am trying to build a local jar which does not have a main and install it in my maven repo for reuse. what do i put in my jar manifest? (i use boot if that changes things)
11:47Trioxinif I have a random number generator and I'm calculating times that the numbers are seemingly more non-random, would the non-randomness be considered lower entropy?
11:55C4K3How do I pass a list to recur, without doing (recur (first mylist) (second mylist)) and so on? If I try (apply recur mylist) then it says Unable to resolve symbol: recur in this context.
11:56MJB47you could just past the list as normal, and then within the body of whats being looped, desctructure it with let
11:57MJB47you could also just have 2 arguments and do head-tail recursion, (recur (first mylist) (next mylist))
11:57MJB47unless i am misunderstanding the problem
12:06C4K3I don't understand the second solution, what's head-tail recursion?
12:12C4K3Sorry I lost connection, if you responded I didn't see it
12:39MJB47C4K3: (loop [i 0 r (range 3)] (println i) (if i (recur (first r) (next r)) "done"))
12:39MJB47like this
12:44justin_smithuptown: what info does boot want for the jar manifest? (I'm used to lein where it's auto-generated, and it doesn't really matter whether I have a main)
13:05justin_smithC4K3: also, a loop/recur that always visits every item in a collection in order can be replaced with reduce (using a collection if you need more than one accumulator value)
14:00Go3afahbSo say I want to write cljs client(browser)-server(nodejs) app, does it mean that I have to run 3 (cider, figwheel client, figwheel server) java instances in order to get decent dev env?
14:03justin_smithGo3afahb: cider is usually 2 java instances as well
14:04Go3afahbOh, so it's 4 javas for a project that actually doesn't use java at all, right?
14:04justin_smithright
14:05domgetterI'm writing a mandelbrot viewer in Clojure, and I'm wondering if it's a "bad idea" to store a (make-array Integer/TYPE 185000) in an atom so that I can update it mutably. Is that a proper use of atoms?
14:05MJB47there is the clojurescript compiler in clojurescript project
14:05MJB47but idk how mature it is
14:05justin_smithdomgetter: arrays are already mutable
14:05justin_smithdomgetter: mutable objects inside atoms are terrible - because of retries
14:06domgetterooh, okay, I'll go revisit my implementation then
14:06domgetterso I should just store in a plain old variable?
14:06justin_smithdomgetter: with immutable objects, retries on swap are no problem - you just keep the last one
14:06domgetter(def my-array (make-array ...)) ?
14:06justin_smithdomgetter: with arrays - your update could run any number of times
14:06Go3afahbjustin_smith: all right, I guess I just should buy more RAM and stop grumbling.
14:07justin_smithdomgetter: sure, if it needs to exist at the top level
14:07MJB47Go3afahb: how much ram do you have?
14:07Go3afahbMJB47: it's 2 (two)
14:07justin_smithGo3afahb: you can use lein trampoline to reduce the number of vms used, but clojure is not a lightweight language ram wise, no matter what
14:08MJB47this might be my first-world-problem side talking but i dont understand how you can survive on 2gb o.0
14:08domgetterjustin_smith: Got it. Yea, I'm writing to the array and then letting Swing use the integers to blit to the screen, so I want access to the array to be as fast as possible
14:08justin_smithGo3afahb: really though - with one figwheel you can switch targets (switch-to-build client) / (switch-to-build server), and you don't actually need cider
14:09justin_smithso you could pull it off with one instance of "lein trampoline figwheel"
14:11Go3afahbjustin_smith: well actually it's pretty lightweight - never had any problems with it memory-wise, and I humbly hoped that it will be even much more lightweight in its cljs incarnation, but, um, yeah.
14:11Go3afahbjustin_smith: I guess it possible, but not that convenient, yes.
14:11justin_smithGo3afahb: the cljs compiler code is not lightweight, and immutable data means your heap usage goes up fast as your app scales up
14:12Go3afahbdon't want to start a flame war, but it doesn't necessarily mean that, does it?
14:12justin_smithin my experience, at least
14:13justin_smithGo3afahb: the amount of heap used to store N items in a vector is a lot more than the amount used to store the same number in an array
14:13justin_smiththe only 1-1 comparison would be LinkedList on the java side and lazy-seq on the clojure side
14:14justin_smithGo3afahb: unlike arrays and hash-maps in the java versions, clojure vectors and immutable-hash-maps have a tree structure - trades performance on immutable updates for increased heap usage
14:15justin_smithit's an intentional choice of the implementation - to get more speed, plus immutability, by consuming more memory space
14:15justin_smithand by "more speed" we mean "a bit closer to as fast as mutable data"
14:16justin_smithI love programming with immutable data, and I love using clojure, but we have to be realistic that this design decision exists and has consequences
14:16Go3afahbYes, but it's still incorrect to say that immutable data means higher memory usage.
14:16justin_smithGo3afahb: the implementation is guaranteed to use more heap space to store the same amount of data
14:16justin_smitheven leaving update out of the picture
14:17Go3afahbIs it because they are immutable though? And what about sharing?
14:17justin_smithGo3afahb: no, it is not because they are immutable - it is because of the internal structure that optimizes the immutable updates
14:17justin_smitheg making conj fast even though you cannot modify the original
14:17Go3afahbThat is correct.
14:18justin_smithsharing can help, but in practice doesn't do a lot
14:18justin_smithin my experience at least
14:19justin_smithmy clojure code uses an order or magnitude or more heap to do the same work a java program would use. I see this as a cost I'm willing to pay given clojure's benefits (and occasionally implement something in java or at least using java data structures if that cost becomes too much)
14:20Go3afahbAn order of magnitude? Really?
14:20justin_smithI've seen servers exceed 10 gigs usage (crunching graph data on graphs with 1000 - 2000 nodes, maybe 5 graphs being crunched at a time)
14:22justin_smithperhaps this is because of other problems in our code, but if we switch part of the code to do things java style we see the usage drop much lower for that
14:23justin_smithGo3afahb: this isn't just because of immutable data structures, I suspect it also has to do with fp style abstractions in the codebase that are not space friendly as well, but I'm not going to win the "don't be so functional" argument with clojure writing coworkers
14:23Go3afahbI thought the difference would not be that much. I've never cared to test it myself, but I recall seeing some benchmarks showing something like 10 or maybe 20 percents of the difference. Of course, such benchmarks are always synthetic and are far away from real world, but yeah, it had to be some other factors played the role
14:24justin_smithGo3afahb: sure, 10 percent if it's just directly using the structure, but what if you have 7 or 8 levels of functional programming abstraction, each one taking on that kind of overhead as it operates - it adds up
14:25justin_smithI'd be delighted to hear our immense heap usage was unusual and caused by a simple mistake we were making that we could fix - we'd save on server bills for sure. But nobody has been able to show me that simple fix.
14:25justin_smithI've extensively profiled, etc.
14:26MJB47giff access to server repo
14:26MJB47:P
14:26justin_smith:)
14:27Go3afahbWell yeah, I can only agree with you here, it's kinda more of a style issue than of some particular implementation detail.
14:27Go3afahbIt's worth it though, right?
14:27MJB47your in a clojure channel
14:27MJB47we are gonna be pretty bias :P
14:28justin_smithoh yeah! we just pay for more ram, and we get good code with a low frequency of bugs
14:28MJB47you're*
14:28justin_smithimmutability helps with that for sure
14:28MJB47also depending on your project, memory might not be your bottleneck
14:28justin_smithGo3afahb: but if you stick with clojure, I'd expect to use more than 2 gigs of ram on my dev machine
14:29Go3afahbjustin_smith: ...unless you have to run 5 lein instances on a 5-year old laptop or whatever. Thank god there is still those crazy folks who use C for developing desktop apps!
14:29Go3afahbjustin_smith: well, it was just enough in the times of 1.2, I swear.
14:30justin_smithYeah, that's where it's a problem. They have different limitations and tradeoffs, of course I am glad that most everything on my machine is coded in C so I have ram left over for my stuff :)
14:31justin_smithGo3afahb: I'm definitely not going to say clojure couldn't use lest RAM. But realistically it does use a lot, and clojure is typically used for products and services where using more ram is just a button you click on the hosting console and a few bucks extra on the bill at the end of the month.
14:34Go3afahbIt's not a problem, I agree. It's just kinda funny that clojurescript hasn't actually made it any more lightweight but has done exactly the opposite. Still not sure it's a problem, but it definitely gives different overall feeling.
14:35justin_smithmaybe the new self-hosting ability will eventually change things?
14:38Go3afahbIt was actually quite some time since it was announced, isn't it? David is probably more busy with Om and stuff than with fighting lein dependency (I was tempted to call it illness: lein illnes. Sounds kinda cool to me, eh?).
14:41justin_smithsince lein is mostly about managing deps and node / js have their own ways of doing this, what's to stop you from skipping lein and using clojurescript.jar directly - just the tooling like figwheel that depends on lein?
14:41justin_smithor wait, now I am not even certain figwheel depends on lein
14:43rhg135Not really, you can use it without
14:44Go3afahbHmm, indeed.
14:45Go3afahbI should have called it "java illness".
14:45rhg135justin_smith: minor problem with that is if you do depend on stuff on the classpath. Then you can use trampoline or save the classpath.
14:45justin_smithrhg135: right, I usually use trampoline, and I usually use a single figwheel and use switch-to-build as I work on different js builds
14:46justin_smithor even the occasional build-once
14:46justin_smithit's a nice balance of the convenience of figwheel without having to have 3 of them running all the time
14:47rhg135I usually forego figwheel as it's not so useful in my case
14:48rhg135I just need a noderepl
14:49Go3afahbBy the way, I can probably run node server in the node-webkit process...
15:03Trioxincan't find any clojure or java webrtc clients
15:06Trioxinjust android stuff
15:09justin_smithTrioxin: how about Kurento https://www.kurento.org/docs/5.1.1/tutorials/java/tutorial-2-magicmirror.html
15:26Trioxinjustin_smith, that's just a java server. I already have a signaling server setup.
15:27domgetterIs it normal for the JVM to eat up 1.5 gigs of ram even if I'm not holding onto data?
15:32Trioxini see there are some ways to convert javascript to java automatically such as https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Rhino/JavaScript_Compiler . Was hoping that someone would have made a non-android webrtc client by now though
15:32justin_smithdomgetter: the jvm will use up to the max you allow - even if it's not all actively used by the jvm at a given moment
15:33justin_smithdomgetter: this function will show the specifics if you run it https://github.com/littlebird/conduit/blob/master/src/conduit/status_transmitter.clj#L26
15:34justin_smiththe :unused key is the amount of memory the vm is holding on to but not currently using
15:39domgetterjustin_smith: awesome, thank you
15:40tolstoydomgetter, justin_smith: That's HEAP related stuff, but there's additional process memory not tracked by those stats, right?
15:40justin_smithtolstoy: there's permgen, and yeah, that code is not meant to address permgen
15:40justin_smithbut permgen doesn't exist any more starting with 1.8 anyway
15:40domgetterWell I got the mandelbrot calc down enough for real time zooming :)
15:41justin_smithalso, total permgen size (for vms that still have it) will typically be a small fraction of total heap usage
15:41tolstoyNo permgen, but loaded classes takes up space. Is that tracked by getRuntime stats?
15:41justin_smithdomgetter: cool
15:41justin_smithtolstoy: now that permgen doesn't exist, it should be reflected in heap memory
15:41justin_smithiirc
15:43tolstoyI've got a process that reports 205m used, with heap max at 512m, but top reports RES as 425m.
15:44justin_smithtolstoy: yes, my code above addresses the difference between what java calls used vs. what the OS thinks is used
15:44justin_smithtolstoy: "unallocated"
15:45tolstoyYes, that's how I'm calculating it, too. 'cept I call it "free".
15:46justin_smithwait no - "allocated" is the total memory the jvm has gotten from the os, unused (.freeMemory) is the amount of that it doesn't consider used
15:46justin_smithso it's saying .totalMemory is 205, but OS shows it with 425?
15:47tolstoyYeah.
15:47justin_smithwow, that's way too much for permgen, or whatever replaces permgen
15:48justin_smithI wonder what that's about
15:48tolstoyRight. I'm on openjdk8. But the JVM is just a C program. It allocates memory for its own uses, one block of which is the heap, right?
15:49domgetterjustin_smith: Here's the code if you want to take a glance: https://gist.github.com/domgetter/450182edf3e88da7512f
15:49justin_smithI guess - but where could usage that big be coming in? massive usage of large static libraries? the vm itself?
15:50tolstoyNo idea.
15:51tolstoyMaybe thread stack.
15:51tolstoy81 threads.
15:52tolstoySome ideas: http://stackoverflow.com/a/20093537
15:52justin_smithdomgetter: if you used an array of two doubles instead of complex, that might make a difference - but rather than speculating, I'd try profiling. You can use hprof, or visualvm which is free. Yourkit is awesome for this, if you want to try a trial.
15:53domgetterjustin_smith: I came down to the deftype after a lot of trial and error, but only from using (time ...) I'll check those out to see if I can't squeeze out any performance
15:53justin_smithtolstoy: oh cool, that's close to what I was thinking, but clearly better thought out and actually researched :)
15:54justin_smithdomgetter: yeah - I thought the question had been about memory usage, which is why I said that
15:54justin_smithdomgetter: but the profilers will help both with memory usage and performance, of course
15:54domgetterah okay
15:55domgetterI was more concerned with speed in this app since it's such a cpu-intensive calculation
15:55justin_smithdomgetter: have you tried turning on boxed math warnings?
15:56tolstoyHm. On linux, default stack size for a pthread is 2MB, which accounts for 162Mb (if similar on FreeBSD).
15:57LauJensenGents, for the life of me I cant import/instantiate this static class, any hints would be appreciated: https://developers.google.com/api-client-library/java/google-http-java-client/reference/1.20.0/com/google/api/client/json/gson/GsonFactory
15:57domgetterjustin_smith: you mean warn-on-reflection? or something different?
15:57tolstoyjustin_smith Maybe track the number of threads on your thing? (.size (Thread/getAllStackTraces))
15:57justin_smithtolstoy: if you look at nearby code, I actually dump all stack traces
15:57justin_smithbut yeah- that's actually a good consideration too
15:58justin_smithdomgetter: warn-on-boxed http://insideclojure.org/2014/12/15/warn-on-boxed/
15:58tolstoyIf there's a way to find the default stack size, that can provide an additional "memory" stat (even if actual stack traces are useful elsewhere).
15:59justin_smithtolstoy: that's true - my usage here is a lib that dumps full status of a worker in a compute cluster, so I always get both the heap-memory usage and the stacks
15:59tolstoyYeah, post processing is perhaps a better strategy.
15:59justin_smiththe idea being that if things go wrong we can look at the dumps and figure out what subtask or combination thereof led to the failure
16:00domgetterjustin_smith: ah okay. I think I can benefit from going back and hinting outputs.
16:00domgetterI think I got most of the inputs
16:00justin_smithdomgetter: well, if you try using warn-on-boxed it will let you know what you missed
16:00domgetteroh, awesome
16:00justin_smiththe article shows how to do it (there's a shorthand to do it in lein too if you search for :warn-on-boxed in the example project.clj on github)
16:01domgetterhaha, I got like 20 warnings
16:01justin_smithdomgetter: well they show warn-on reflection but unchecked-math warn-on-boxed works the same way https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L253
16:02justin_smithdomgetter: wow, that's good - because you know how to fix them and they each will lead to sped up code :)
16:03justin_smithLauJensen: when you run (com.google.api.client.json.gson.GsonFactory.) to construct a new one, what happens?
16:04LauJensenjava.lang.ClassNotFoundException: com.google.api.client.json.gson.GsonFactory
16:04LauJensen@justin_smith
16:04justin_smithLauJensen: how are you adding gson to your classpath?
16:07LauJensenjustin: Its part of the google_analytics_v3.jar
16:07justin_smithand how are you adding this to your classpath
16:08LauJensenVia :dependencies in project.clj
16:08LauJensenAnd every other class from there imports, just not the inner statics
16:08justin_smithodd - have you tried opening the jar and seeing if the class file is actually present?
16:09LauJensenI'll have a look
16:09justin_smithsince it's public, you should have no trouble accessing it if its actually there...
16:10justin_smithLauJensen: oh wait, what syntax are you using for inner classes?
16:11LauJensenOuter$inner
16:11justin_smithOK, that's the right thing (though of course Inner would be capitalized)
16:11justin_smithalso, the import would look like (:import (foo.bar Baz$Quux))
16:12justin_smithit's Baz$Quux is not imported when you import Baz
16:13LauJensen(import '(com.google.api.client.json.gson$GsonFactory)) - Would that be the correct syntax?
16:13justin_smithno
16:13justin_smithbecause GsonFactory is not an inner class of gson there
16:13justin_smithit's a regular class
16:14justin_smithgson is just part of its package qualifier
16:15LauJensenoh, right you are
16:15justin_smithso you just want (import '(com.google.api.client.json.gson.GsonFactory)) but (import com.google.api.client.json.gson.GsonFactory) is equivalent, and if you were importing more then one thing you could use (import (com.google.api.client.json.gson GsonFactory Foo)) but there are no other classes to import in that package I don't think
16:16justin_smithclass names don't need quoting because they are resolved
16:16justin_smith,java.util.Date
16:16clojurebotjava.util.Date
16:16justin_smith,(import (java.util Date))
16:16clojurebotjava.util.Date
16:16justin_smithsame thing
16:17LauJensenRE (import '(com.google.api.client.json.gson.GsonFactory)) -- Clojure doesn't do any actual work, if there is no space in an import statement IIRC
16:17justin_smithLauJensen: nonsense
16:17justin_smithit imports either way
16:17justin_smithbut import isn't much - it just changes class lookup rules
16:17LauJensenI still get the (GsonFactory.) => Class not found exception
16:17justin_smithits accessing the class name that loads it
16:18justin_smithLauJensen: did you check if GsonFactory was in the jar that lein downloaded to your m2 cache?
16:19LauJensenThe jar is downloaded, but I actually cant fint the GSonfactory class
16:19LauJensenStill looking though
16:20justin_smiththat was my suspicion - if the jar is in your deps, and you can't find the class, that makes me think the class might not be in the jar
16:20justin_smithother possibility being that the project file is malformed?
16:20LauJensenI'll continue searching, but thanks for your help so far
16:21justin_smithnp, I'm sure there's a simple fix
16:21justin_smithLauJensen: what does the dependency vector you are using look like (eg. version string etc.)
16:26justin_smithLauJensen: my suspicion is that the class you want actually comes from google-client-api which is required by google_analytics_v3, and in turn google-client-api only requires google-http-client-gson in the "test" scope. So you should require google-http-client-gson explicitly if you want it http://central.maven.org/maven2/com/google/api-client/google-api-client/1.21.0/google-api-client-1.21.0.pom
16:26justin_smiththe coordinates to get that version are in that pom file in the dependencies section
16:27justin_smithsorry, to be pedantic about my own language above I should have said "depends on" rather than "requires" throughout, I appologize for any confusion that might have caused
16:29LauJensen[com.google.apis/google-api-services-analytics "v3-rev121-1.21.0"]
16:30justin_smithLauJensen: cool - try adding a dep to google-http-client-gson - I think that's your issue
16:31LauJensenI'll give it a shot
16:48justin_smithwhich is why I said you should add the dep on google-http-client-gson
16:54roninhackerI’ve just found this code in compojure:
16:54roninhacker(let [mw (:route-middleware request identity)]
16:55roninhackerdoesn’t matter what it does w/the bindings
16:55roninhackerthe important part is
16:55roninhacker(:route-middleware request identity)
16:55roninhacker(request is a map)
16:55roninhackerwhat does clojure do when a keyword is used as a function, and has two arguments?
16:56roninhacker(let [m {:k :v}] (:k m identity))
16:56ridcully_,(:b {:a 1} 666)
16:56clojurebot666
16:56roninhacker,(let [m {:k :v}] (:k m identity))
16:56clojurebot:v
16:57tolstoyThe second parameter is what you return if there's no value in the map.
16:57roninhacker,(let [m {:k 4}] (:k m inc))
16:57clojurebot4
16:57roninhackerah
16:57roninhackerok
16:57roninhackerty
16:57justin_smith,(:foo nil :default)
16:57clojurebot:default
16:58tolstoyOooo, my turn!
16:58tolstoy,(:foo {:bar "x"} "y")
16:58clojurebot"y"
16:58justin_smith,(:foo :foo :foo)
16:58clojurebot:foo
16:58tolstoy,(:foo {:bar "x"} identity)
16:58clojurebot#object[clojure.core$identity 0x74e2a4dc "clojure.core$identity@74e2a4dc"]
16:59justin_smith,(def id (partial get get get))
16:59clojurebot#'sandbox/id
16:59justin_smith,(id 42)
16:59clojurebot42
16:59tolstoyI guess that form is expecting to extract a function out of the request map.
16:59roninhackeryeah
17:00roninhackeri’m not sure but it hink compojure middleware works by constructing a mega-fn (using comp) in the req map, incrementally adding to the mega-fn
17:01justin_smithroninhacker: there's various ways to do it, you can call comp, or use -> to build a nested form
17:01justin_smithas long as you get nested functions returning a handler, you're good
17:01justin_smithvery similar to how transducers work actually
17:01roninhackeron that topic actually
17:02roninhackerdoes anyone know of a good resource where i can learn about composing async channels together in cljs for building ui’s?
17:02roninhackersort of like a flapjax approach, where “everything is a stream”, etc.?
17:03justin_smithroninhacker: I don't have an example publicly available, but I use sente to abstract websocket communication as core.async channel ops
17:03justin_smitheach incoming message becomes a message consumed in a go loop, etc.
17:03roninhackeroh, i will probably grab that
17:03roninhackeri’m doing it manually now w/cljs-ajax
17:04justin_smithaha - ajax is slightly more portable, but websockets are great
17:04justin_smithalso, sente can do ajax too if you set it up right
17:05tolstoyThe basic idea is that you have a single channel. You consume messages from it to update UI state, and every other thing (event handlers, ajax results, incoming socket data) gets dumped on that channel. Simple! ;)
17:06tolstoyI suppose you can use multiple channels and alts! on your state-processing consumer. But, basically, ... ;)
17:06justin_smithtolstoy: oh yeah, you could wrap your reagent atom for example, so the only way to update it is via a channel
17:07tolstoyThe thing that consumes channels messages can delegate to a multimethod, or you could have "defrecord" messages that all implement an "update state" protocol (take a state, return a new state), etc.
17:10tolstoyIt's been raining like crazy in Portland this past week. Hard to take my dog for a walk.
17:10justin_smithit has been rainy
17:11justin_smithtolstoy: you ever come to the clojure meetups here?
17:12tolstoyNo. Well, just twice. Once it was just me and a guy from Simple. The other time, a guy gave a talk: the Kevin cljx guy.
17:12tolstoyIs it fun?
17:12justin_smithdepends on your definition of fun, I often learn a lot
17:12tolstoyKevin Lynnagh? Something like that.
17:12justin_smithand get job offers I don't need, heh
17:13justin_smiththe next one is on om-next
17:13tolstoyI can't hear "job offer" without hearing "Work on tickets to lie about at daily stand ups, micro manage, micro manage." Hopeless.
17:14tolstoyThat might be interesting. I read the tutorial about Om-next. The stuff about "state" being normalized and so on was ... confusing.
17:16tolstoyI'm the type that can understand what I read, but then I have to sit down and actually do it. The "doing it" understanding is different than the "reading about it" understanding.
17:22tolstoyAccording to DarkSky, rain non-stop until noon tomorrow.
18:32LauJensenGents, how do I call the Builder constructor from Clojure? https://developers.google.com/api-client-library/java/google-api-java-client/reference/1.19.1/com/google/api/client/googleapis/auth/oauth2/GoogleCredential.Builder
18:32LauJensen@justin-smith perhaps you know?
18:41tolstoyLauJensen: Try "doto"?
18:42LauJensenDoto would only work after instantiation as it just inserts the instance as the 2nd argument to the following forms
18:42tolstoyI'm guessing that every method called on the builder just returns the builder, so using doto, which maintains a reference to the original builder would work.
18:42tolstoy(doto (GoogleCrededential/Builder) ... )?
18:43tolstoy(Well, correct spellering, of course.)
18:43LauJensenNoSuchFieldExpcetion
18:46tolstoyTry "$".
18:46tolstoyGoogleCredential$Builder?
18:46tolstoy(new GoogleCredential$Builder) ... ?
18:46LauJensenTried, no luck
18:47LauJensenI get an Unable to resolve Classname GoogleCredential$Builder
18:47tolstoyYou might have to import it.
18:47LauJensenAnd its not a classname, so it makes sense
18:47LauJensenAh right
18:50LauJensenNo dice
18:52tolstoyIs there some version of that in the JDK? I'd give it a try locally.
18:53LauJensenI mistook which one was the inner class, I got it now [oauth2 GoogleCredential$Builder) then(GoogleCredential$Builder.)
18:53LauJensenThanks for sparring
18:53tolstoyAh, good!
19:32RaynesHey guys. Just a heads up to those using Refheap that I'm going to be more or less shutting it down soon. I've received complaints from Citibank because folks have posted stolen credit card/security info. As is the nature of pastebins this is unlikely to be an isolated occurrence and as one dude who can't really even maintain the thing in the first place, I don't have the resources to mitigate these sorts of things.
19:33RaynesMy plan is to shut off the ability to make new pastes, for starters. I'll leave it running with old pastes for as long as I can so people can retrieve and link to their current pastes for the time being, and regardless I'll be sure to make public data available when the site gets shut down completely.
19:34RaynesBut hey, it took like 3 whole years for assholes to abuse the site beyond rando-spam.
19:34RaynesPretty solid run I'd say.
19:48justin_smithRaynes: RIP
19:48justin_smithI'll miss refheap :(
20:27alive876hi, newbie here, im having a problem at the beginning of this book "Clojure Web Development Essentials", do this "lein new luminus hipstr" cd into hipstr and run "lein ring server" but it comes back "ring not a task"
20:28alive876any help much apprciated, seems this has happen multiple times in various tutorials, do i have to set my path maybe?
21:01justin_smithalcazoid: can you share a paste of the project.clj somewhere? also what version of lein?
21:31justin_smithoh, wait, that question was from alive876 who apperently left
21:31justin_smithanyway, I can replicate the issue, but it looks like it works with "lein run", and tutorials should be able to specify a specific version of a template because this happens way too often