#clojure logs

2016-01-14

02:17lokien_Hello noncom|2
02:20noncom|2lokien_: hi:D
02:21noncom|2just woke up, dressing up to go to job
02:21noncom|2and you?
02:22lokien_me has no job :^) so just shower
02:23lokien_and I'll read about all these hexagons and cljs and reagent and stuff
02:24noncom|2oh right!
02:24lokien_I wonder, why not brutha?
02:25noncom|2what is brutha?
02:26lokien_"A simple and functional ClojureScript interface to React."
02:26noncom|2oh
02:26lokien_"Unlike Om and Reagent, Brutha is unopinionated on how you handle your application state. It doesn't include cursors or specialized atoms, instead relying on you to call a mount function with new state data. This is useful when you want to manage your application state yourself"
02:26lokien_it's interesting
02:28noncom|2well, actually what you choose, depends on how you want it to be... i was working with reagent.. afaik it does not care about the state too.. this description could fit it too. not sure what's different
02:28lokien_hmm, so I'll try reagent, cause it's more popular here
02:28noncom|2but i am not well-experienced on all the cljs-react interfaces
02:28lokien_brb, have fun at your job!
02:29noncom|2yeah, ok, thank! :)
02:29noncom|2also, there's #clojurescript
02:29noncom|2but sometimes there's just not many people and talking here can be more productive.
02:30noncom|2but #clojurescript is nice, there are good cljs-specific discussions
02:33noncom|2ah, just re-read the description you posted - yes, reagent uses special atoms which replace usual atoms
02:33noncom|2changing them triggers the redraw
02:33noncom|2be careful not to get in a dead loop then
02:35noncom|2i use reagent and mostly like the experience. but also i will try the other things some time
02:41lokien_noncom|2: this family is fine for me :^)
02:42lokien_noncom|2: eww, dead loops. I knew there was a hook
04:10noncomlokien_: but if you follow the React guideline that state should not be modified from the rendering code, you won't get into that trouble. the trouble is that my code was heavily relying on lazy initialization of some render-specific structures. so i had to separate things more preceisely, ok. but originally i got into some loops. they're easy to debug though
04:23django_#lesswrong
05:26lokien_noncom: are cljs' errors better than clj's? I heard they are
05:27jonathanji was reading <http://stuartsierra.com/2016/01/09/how-to-name-clojure-functions&gt; and the author mentions "Don't repeat the name of the namespace"
05:28jonathanjwhich is something i currently have a problem with, i have a namespace ns.pdf.crush and i have some functions related to crushing (compressing) the document, notably `crush-document` which means if addressing it by an ns alias it's `crush/crush-document`
05:29MJB47he also mentions something about verb-functions iirc
05:29MJB47so i wouldnt worry about it :)
05:29jonathanjunfortunately `document` is a bad name, so the only other option i can think of is moving it to ns.pdf
05:29MJB47not to mention those are just guidelines
05:30MJB47they arent hard rules
05:30jonathanjsure, but it was something that was bugging me before i read the article
05:30jonathanjwhat's the stance on putting an implementation in src/x/pdf/crush.clj but using the ns x.pdf?
05:30jonathanjis that confusing or bad etiquette?
05:31MJB47the compiler might moan at you
05:31MJB47iirc proj.something.yeah
05:31MJB47actually expects a file to be at /proj/something/yeah
05:33jonathanjmmm, parts of clojure.core are actually structured this same way
05:33jonathanjhttps://github.com/clojure/clojure/blob/master/src/clj/clojure/core_deftype.clj
05:33MJB47i might be wrong
05:34MJB47i just recall having an issue with doing that when i first started using clojure
05:34MJB47oh
05:34MJB47that file doesnt have its own namespace
05:34jonathanjbut it's kind of weird, you have to call (load) from the "parent" file and stuff
05:34MJB47it just adds itself to clojure.core (using in-ns)
05:34jonathanjhttp://stackoverflow.com/questions/4690758/splitting-a-clojure-namespace-over-multiple-files
05:46jonathanjseems a bit weird
05:50kungiHow can I build a checkbox set with reagent forms? Im trying to use multi-select with checkboxes but keep failing at it.
05:53poweredkungi, can you build it with html?
05:53poweredreagent just uses hiccup style dsl to generate html
05:54kungipowered: yes I could but then I have to build the data binding myself. I really would like to use reagent-forms for this
05:55poweredthat's my point, just use reagent to build similar html
06:02noncomlokien_: i don't think so. all in all i find clj errors pretty awesome, since they are java errors to me, and i come from java. and java has one of the best (if not the best) error-reporting mechanism that i have known
06:03noncomlokien_: cljs errors OTOH are often riddled with JS errors, which are sometimes very hard to make sense of or even locate. on top of there there are cljs-specific errors, like a keyword cannot start with a digit, which is kinda present in clojure spec, but not popular, and clojure supports them anyway and many things silently rely on them..
06:04noncomlokien_: or there are some issues with shadowing, since variable concept of JS is totally different from java.. it's possible to shadoe or even maybe redefine an imported namespace locally in a function
06:05noncomkungi: the more you rely on frameworks the more frmeworks rely on you
06:08noncomlokien_: so with keywords like :42de98f987a7ccc77b i was getting totally uninformative messages and spent like 2 days analyzing the dump of my database to find what made the cljs edn reader choke
06:09noncomand this type of keywords is a hex id from a mongo db, which is perfectly working fine within clojure itself
06:54gfdhjfbad uncle is inserting his penis into 10 year old girl's vagina causing her to moan in agony because they both are niggers
07:01gfdhjfburn all jews in oven
07:08lokien_noncom: oh my god
07:09jsabeaudryWhen given the choice between apply and reduce, which is better? (i.e. (apply max coll) vs (reduce max coll) )
07:10poweredapply
07:11gfdhjfinnocent children deserve to be beaten to death
07:11TMA,(apply max (range 1 1000000))
07:11clojurebot999999
07:12noncomjsabeaudry: i wonder for the criterion on "better" though
07:13gfdhjfsieg heil
07:13powered(time (apply str (repeat 10000 "aaaaaa")))
07:13noncomi can only think of speed, so probably you can (time ...) your test and see what timings you get on 10th run or so (when the JVM warms up)
07:13poweredtry the same with reduce str and it will go orders of magnitude slower
07:13TMAjsabeaudry: other languages have a limit on maximum number of arguments to a function which apply hits but reduce doesn't
07:14gfdhjfchild rape is fun
07:14noncomlokien_: yeah, basically most of the bad that comes out of cljs in the underlying bad of js itself
07:14noncomi don't really like js for that sake. it can be a hell to debug
07:14noncomcljs makes it a LOT better
07:15noncombut be prepared for the js-specific fun
07:15noncomand css fun
07:16jsabeaudryinteresting, so in general apply is preferrable but there might be cases where only reduce would be possible
07:17the_nonameguyhey, how would I go about defining a prismatic schema that says that a map should optionally contain keywords or strings, mapped to strings?
07:17the_nonameguyas I see there is no or function
07:17the_nonameguy(s/defschema X {(s/optional-key s/Str) s/Str (s/optional-key s/Keyword) s/Str})
07:18noncomjsabeaudry: yeah, things like "or" and "and" cannot be applied, them are maceos
07:18the_nonameguythis didn't work either
07:18noncom*macros
07:20noncomthe_nonameguy: maybe you can make 2 schemes, catch their exceptions and OR on them... a bit hacky but should work
07:21noncomwonder if there's a way to do this in terms of the DSL
07:21the_nonameguyat that point it's cleaner to do a predicate fn
07:21noncomthe_nonameguy: if you wont find an answer, maybe you could post an issue on github with the question
07:23gfdhjfburn all jews in oven
07:23gfdhjfburn all jews in oven burn all jews in oven burn all jews in oven burn all jews in oven burn all jews in oven burn all jews in oven burn all jews in oven burn all jews in oven burn all jews in oven burn all jews in oven burn all jews in oven burn all jews in oven burn all jews in oven burn all jews in oven burn all jews in oven burn all jews in oven burn all jews in oven burn
07:23gfdhjfall jews in oven burn all jews in oven burn all jews in oven burn all jews in oven
07:27the_nonameguynoncom: solution: (s/defschema Headers {(s/cond-pre s/Str s/Keyword) s/Str})
07:27noncomthe_nonameguy: wow, elegant!
07:28the_nonameguythx
07:28noncomi want to employ schema in my projects too. currently i have very limited experience with it..
07:30the_nonameguyit's not bad, but take care not to overuse it
07:30the_nonameguyit's best at the edges of your system
07:39kunginoncom: yes you are right
07:48yunfanhi, which function just return the argument it accept?
07:48poweredidentity
07:49yunfanpowered: thanks
07:52lokien_noncom: "fun" D:
07:53yunfanare there any functions which could control how many depths we want while flatting collections?
07:53yunfanfor eg, i only want it to flat only 1 depth
07:53noncomyunfan: maybe in some libs, not in the core
07:54noncomyunfan: you can though do (apply concat []) to imitate this
07:54noncomfor 1 level
07:55yunfannoncom: i think i need a common ways
07:57noncomyunfan: well, https://www.google.ru/search?q=clojure+flatten+level&amp;oq=clojure+flatten+level&amp;aqs=chrome..69i57.287j0j9&amp;sourceid=chrome&amp;es_sm=122&amp;ie=UTF-8
08:00yunfannoncom: those ways would failed for this: (apply concat '((1 2) 3 (4 5 (6 7))))
08:00yunfanwhile flatten not
08:01noncomyunfan: yeah, well, you cold replace concat with a more sophisticated dunction that ensures that there's a seq
08:01noncom,sequence?
08:01clojurebot#error {\n :cause "Unable to resolve symbol: sequence? in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: sequence? in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6688]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: seque...
08:01noncom,seq?
08:01clojurebot#object[clojure.core$seq_QMARK___4355 0x531e966b "clojure.core$seq_QMARK___4355@531e966b"]
08:01noncom,(seq? [1])
08:01clojurebotfalse
08:01noncomhmmm
08:02noncom,(sequential? [1])
08:02clojurebottrue
08:02noncom,(sequential? 1)
08:02clojurebotfalse
08:02noncomyunfan: here ^
08:04yunfannoncom: ok
08:05noncomso you can do (fn [e] (if (sequential? e) e [e]))
08:06noncomprior to concat
08:56engblomWhat has been happening to clojure.org?
08:57engblomI wanted the cheatsheet, but the whole site seems to be down.
08:58MJB47http://jafingerhut.github.io/cheatsheet/clojuredocs/cheatsheet-tiptip-no-cdocs-summary.html
09:09juanjo_hi
09:09juanjo_how can i run an specific test from clojure sources?
09:10noncomjuanjo: ummm by loading the project and executing the specific function?
09:10juanjo_i was expected some command
09:10juanjo_but ok
09:10juanjo_thanks
09:12noncomjuanjo_: but command to waht? the tests are just code, and you can deal with it just like usual...? there's no specific testing framework build-in in clojure core
09:15noncomengblom: yep, o see it's down...
09:16noncomengblom: ummm actually the check says it's up..
09:17noncomhmmmm but can't accesss it through a proxy though :/
09:49juanjo_noncom: the answer was here http://dev.clojure.org/display/community/Developing+Patches under Run an individual test
09:51sohailwhat's the right way to set a "production url" vs a test url in a lein project?
09:51sohailI need to generate links with this url and in testing, I want it to go to my local server but in production I want it to point somewhere else
09:52jonathanjthere are probably many ways
09:52jonathanjone possible way is to use environ, or read the value out of a config file
09:53jonathanjreading configuration data out of project.clj is, imho, hard enough that you should probably consider it a mistake
09:53sohailI was thinking of environ, actually
09:54sohailso (env :theThingInMyProject.clj)?
09:55noncomsohail: yeah, environ is probably the best option, however, you code example seems a bit strange
09:56noncomjuanjo_: so it's just the same as i said - you load the project and run a particular test from the repl
09:56noncomjuanjo_: i would be surprised if it was different for a lisp
09:56sohailnoncom why is it strange?
09:58noncomsohail: it's camel keyword with a file extension... so you code a clojure source file name into a keyword? not that it's impossible, but um.. strange.. not sure if environ works that way also..
09:58noncombut it might
09:58sohailoh it was just an example
09:58noncomyeah :)
09:58sohailthe real thing would be something like (env :base-url) I guess
09:58noncomyeah
10:01sohailit's so easy to deploy onto heroku. Not sure how much pain I am in for in the future.
10:02noncomsohail: afaik heroky is pain just for its money
10:02noncomall else is rather fine there
10:02noncomone of the most expensive hostings i've seen so far
10:03sohailhm
10:03noncombut they like, very popular and are always on the edge and stuff
10:03noncomafaik
10:03sohailpricing doesn't seem TOO bad
10:04MJB47heroku is incredibly easy to set up and use
10:04MJB47i have to commend them for that
10:04MJB47but it is incredibly expensive :(
10:05noncomjsonmurphy: well, $7 per 512MB ram and you pay additional costs here and there if you overflow the limits
10:05MJB47ive always sort of used them to start something
10:05MJB47and then moved to AWS or a dedi or something if things get bigger
10:05noncommaybe $30 a month is not much for someone, but it definitely sensible for me and some other folks
10:06MJB47im more talking about when you have a cluster of 10 4gb machines the price begins to get noticable compared to competitors :P
10:06noncomdang, why i do i always forget to put in the "to be" verbs lately?
10:06MJB47we used to have our production stack on heroku, but we had to move
10:06noncomoh, so you're on more than a hobby plan
10:07MJB47for that yes
10:07MJB47i have lots of other things on heroku free tier/hobby stuff
10:07MJB47mostly for the simplicity of it
10:07MJB47takes literally 3 minutes to go from nothing to server online
10:07MJB47and thats awesome
10:08noncomyes, i totally agree for that
10:08codefingerMJB47: i would agree that the simplicity is a part of what you're paying for on Heroku. Its more than just an IaaS like AWS.
10:08noncomsomeone is paying for it to be so :D
10:08codefinger(i work at Heroku)
10:08MJB47definitely codefinger
10:09codefingermost shops that run on Heroku do so because they don't want to pay an ops team to handle routing, back-ups, failover, etc. so heroku does it
10:10noncomyeah, that's a good feature actually
10:12MJB47and entirely accurate
10:12noncomi love the design!
10:12MJB47heroku is an awesome service imo
10:12codefingerMJB47: <3
10:12MJB47(can i has free credit now?)
10:12MJB47:P
10:13codefingeri'm not in charge of that part unfortunately :)
10:13MJB47dammit
10:13MJB47so close
10:13jonathanjcodefinger: do you hang around in #clojure because you're a hobby Clojurist or because you use it at Heroku?
10:13codefingeri basically just break stuff in the clojure buildpack :P
10:13jonathanjah
10:13codefingerjonathanj: both
10:13codefingerso if you've ever deployed to Heroku and it didn't work -- it's probably my fault
10:13jonathanjdoes Heroku use Clojure internally?
10:14codefingerjonathanj: yes
10:14jonathanji've never deployed anything to Heroku, i once watched someone deploy some Haskell there though
10:14codefingerbut still predominately a ruby shop
10:14jonathanjcodefinger: interesting, what do you guys use Clojure for?
10:15codefingerhmm, not sure i can say :/ i has to do with how we deploy, manage and release buildpacks for production
10:16codefingerjonathanj: if you ever feel like trying, here's the fastest way https://twitter.com/codefinger/status/634771452760301568
10:16sohailis there a way to deploy from bitbucket? it' skind of annoying manually pushing to heroku
10:16jonathanjcool :)
10:17sohail#clojure/#heroku-support lol
10:18codefingersohail: we have some very good Github integrations https://devcenter.heroku.com/articles/github-integration but for bitbucket you would probably want to supplement it with something like codeship or a CI to deploy from
10:19codefingerthere may be a post-deploy hook thing too?
10:20sohailI figured, thanks codefinger
10:54TimMccodefinger: Oh, don't feel too bad -- the last time things broke, it's because fetching buildpacks pinned to commit IDs was broken.
10:56codefingerTimMc: oh i remember that. it was fixed though right?
11:11franksnlinuxbbq
11:13sdegutisHow do you generally prefer to have a main template that you return from most of your routes? Do you make it a function that you call which returns a Ring map?
11:14SevereOverfl0wsdegutis: I wrote a little thing I called "cloak" for wrapping up handlers in a template.
11:15SevereOverfl0wI may have not understood the question.
11:15TimMccodefinger: Dunno, I switched to a tag and it's working. It was a bit of rude surprise to resume work on a project and find that my build had broken in the meantime. :-P
11:15TimMcEh, I shouldn't harp on this too much, deployment is hard. :-)
11:15SevereOverfl0wBut you could write a protocol, which turns strings into a ring map. But again, I don't think I understand.
11:15SevereOverfl0wCompojure has a great protocol for it: https://github.com/weavejester/compojure/blob/master/src/compojure/response.clj
11:16sdegutisSevereOverfl0w: but that protocol kind of requires you return a new type
11:16codefingerTimMc: :( feel free to ping me if you have anymore issues
11:16sdegutisSevereOverfl0w: since for all the basic types you could use, it already has implementations
11:17SevereOverfl0wNow I'm confused as to what you're asking sdegutis
11:18sdegutisWelp.
11:19SevereOverfl0wsdegutis: Could you try again please? :D
11:20sdegutisNah.
11:29WorldsEndless I'm looking for a deep sort function for nested maps, so each level is sorted by a particular key
11:29WorldsEndless(presumably returning a sorted map)
11:39WorldsEndlessI guess some recursive form of sorted-map-by is the answer, but I haven't quite figured out how to put the pieces together
11:45justin_smithWorldsEndless: something like (clojure.walk/postwalk (fn [e] (if (map? e) (sorted-map-by some-key e) e)) m)
11:48justin_smithoh, that would be (into (sorted-map-by some-key) e)
11:49domgetterHow do you stop the execution of a form in lein repl without exiting the repl?
11:49justin_smithnever mind, sorted-map-by takes a comparator, and only compares keys, not values, which is likely not what you wanted
11:49domgetterI'm on Windows on Leiningen 2.5.4
11:49justin_smithdomgetter: with lein repl, Control-C will do that
11:49WorldsEndlessjustin_smith: Well, I've already inserted an :index key to each thing, so I can sort by key
11:49domgetterControl-C doesn't do anything
11:50justin_smithWorldsEndless: into the key of each thing? it doesn't sort by the maps, just by the keys
11:51WorldsEndlessjustin_smith: So I have {:index "1" :submap1 {:index "1A"} }
11:51domgetterjustin_smith: You think it might be a Windows issue?
11:51WorldsEndlessErr, add to that :submap2 {:index "1B"} etc
11:51justin_smithWorldsEndless: it would sort :index and :submap, and ignore the values
11:51WorldsEndlessI see
11:52justin_smithdomgetter: I'm really not sure how things work with windows - if there is a usual "interrupt" keystroke for the windows terminal you could try that
11:52sohailso is it possible to connect via cider to a repl running over http?
11:52domgetterjustin_smith: what keystroke is that?
11:52domgetterControl-D ?
11:52justin_smithdomgetter: sorry, I don't know windows
11:53domgetterah okay, fair enough. Thanks
11:53justin_smithon *nix Control-D is EOF, not interrupt
11:53WorldsEndlessI think Windows is Alt-. as per http://wiki.squeak.org/squeak/899
11:53justin_smithdomgetter: google found this, but I have no windows machine to test any of this on http://stackoverflow.com/questions/800521/linuxlike-ctrl-c-keyboardinterrupt-for-the-windows-cmd-line
11:53WorldsEndless(interupt key)
11:54justin_smithdomgetter: it suggests control-break also
11:55justin_smithdomgetter: also, very few leiningen devs use windows, so windows is a little less polished as a lein platform, I am sure they would accept fixes or bug reports though
12:00domgetterjustin_smith: control break does a thread dump
12:01domgetterunless it's doing control-pause and I don't know how to tell it to use the break part of my pause/break key
12:04justin_smithpeople who use ssh (probably all of us here): cho 'UseRoaming no' >> /etc/ssh_config
12:05justin_smiththey are not going to reveal the issue until they have a fix, but that closes the vuln.
12:05justin_smiths/cho/echo of course
12:06justin_smithit might be /etc/ssh/ssh_config on your box
12:35TimMcjustin_smith: A malicious/compromised remote server or a MITM can use roaming support to reveal chunks of client memory, possibly including key material.
12:36TimMcIsn't it exciting when security-sensitive applications are written in a non-memory-safe language?
12:37MJB47yes
12:37MJB47lets rewrite the security ecosystem in clojure :)
12:37MJB47wut could go wrong?
12:38winksshd would take longer to start than the server
12:38TimMcEven better, use swearjure. Not only is it memory-safe, you avoid all floating-point bugs! (Because it doesn't support floats...)
12:38TimMcMJB47: I was thinking maybe ocaml. :-)
12:41TimMc(Correction: No MITM exploits for this bug, only compromised servers.)
12:42MJB47you arent allowed to think about ocaml
12:42MJB47this is clojure chat
12:46TimMcActually, I still need to give that a shot.
15:29justin_smithany pl.danieljanus.tagsoup users? or anyone who might be able to explain why every time I get a lazy-parse-xml result from tagsoup it's creating a thread that never exits?
15:33justin_smithI found the issue - this line creates a future that won't exit if you stop reading results https://github.com/nathell/clj-tagsoup/blob/master/src/pl/danieljanus/tagsoup.clj#L219
16:18rhg135is there a way to atomically set a per thread binding?
16:22justin_smithrhg135: isn't binding sufficiently atomic, given it can't affect or be affected by other threads?
16:23rhg135ah, that's true, I forgot about that
16:23rhg135thx
16:26blake__Is there a doc on how to add clojurescript to your clojure app? I thought there was but now can't find anything.
16:34arrdemblake__: figwheel is likely going to be your starting point.
16:35blake__arrdem: Yeah, I just created a new figwheel app and was looking at what I needed to add. Unless there's a lein modify-template-to-include command. =P
16:35justin_smithalso there is a clojurescript quick-start, where first you can just compile cljs from your regular repl, then migrate that to a lein task, and finally that can be migrated to figwheel
16:35blake__justin_smith: Not a fan. Was trying to avoid that.
16:35justin_smithit was very enlightening to see how simple cljs was with zero tooling.
16:35justin_smithblake__: its' simpler than you think.
16:36blake__justin_smith: Perhaps it's changed since the last time I looked at it. It was pretty ugly...a year ago?
16:36justin_smithblake__: (cljs.build.api/build "src" {:output-to "out/main.js"})
16:36justin_smiththat's literally it
16:37justin_smiththat's all the tools are doing for you (except the config map gets bigger and uglier to put inline of course)
16:37justin_smithhttps://github.com/clojure/clojurescript/wiki/Quick-Start
16:38justin_smithany hints on how to make a future exit? for whatever reason future-cancel is not doing the trick, and this thread leak is terrible
16:41arrdemjustin_smith: thread/exit?
16:41arrdemjustin_smith: or do you need to kill it remotely?
16:42arrdemGonna be spending the afternoon on Grimoire and the Cheatsheet if there are particular pain points in those directions.
16:42justin_smitharrdem: an xml processor creates the future to process its input so it can deliver the result as a lazy-seq. I tried modifying it so it returned the future so I could cancel it, but this is not doing the trick. code outside scope has to be able to decide when enough data is read.
16:43justin_smithif I keep reading until input runs out, the thread exits as expected
16:44justin_smithbut if I just read until I find an item I want, it leaves a thread hanging until the vm dies, seemingly impervious to future-cancel calls
16:44amalloyfuture-cancel just calls .interrupt probably, which can only stop a threat that's blocking on a method that can throw InterruptedException
16:44amalloyfuture-cancel has never been reliable
16:45justin_smithamalloy: so maybe I don't want this lazy-seq abstraction, and I should just do the event processing in thread
16:45amalloyyes
16:45justin_smithbut it was someone else's code and doing it in terms of lazy-seqs seemed so nice
16:45justin_smithOK
16:46amalloyor just fully read the stream, if you know it won't be so big that's a problem
16:46justin_smithamalloy: stream is random junk from the intarwebs
16:46amalloystart up another future to consume that other future. hot future-on-future action
16:46justin_smithso I feel much better just closing it up and being done
16:46justin_smithhahaa
16:46amalloywell, you're already reading arbitrarily far into a stream that's random junk from the internet
16:47amalloystopping early is an improvement, but not really a guarantee of anything in particular
16:47justin_smiththat's true
16:48justin_smithsomeone is going to start tweeting links to /dev/random connected to an http port, just to fuck with me
16:48arrdemdibs
16:48amalloyarguably you would be getting what you deserve
16:48amalloy(also, someone is probably already doing this)
16:49amalloyjustin_smith: what about just truncating the input stream before you feed it to the xml parser?
16:50amalloy(process (take 1000000 input)) or whatever
16:50amalloyand then you can fully read without wory
16:51justin_smithamalloy: that would work except our cutoff is content based - we are searching for a specific tag (we don't care where or how it is nested so streaming works nicely, but we are looking for a specific tag)
16:51amalloyright, but you don't want to get stuck on /dev/random
16:51justin_smiththough I guess I could combine the truncation with the tag search
16:51amalloyright
16:56TimMcerr
16:57TimMc(concat "<" (repeat \a))
16:57TimMcYou'll never stop parsing the first tag!
16:57arrdemehehehe
16:57arrdemevil input is evil
16:57justin_smithyup, yup
16:58justin_smithTimMc: I wonder if this SAX impl is smart enough to be like "OK no tag is bigger than 40k" and just throw it away
16:58justin_smithI guess I could test it
16:58arrdemI mean... really it should be a bound on the tag name, and then a seperate bound on the k/v pairs etc.
16:59arrdembut that's hard and I've never met a parser that does that
16:59justin_smithTimMc: in the tests that led to using tagsoup, I found out that you can crash hiccup's html generation just by nesting elements deeply enough
16:59justin_smithand "deeply enough" is well less than 100
16:59justin_smithI thought it would be elegant to auto-generate the deeply nested html, to ensure I could consume things that deep
17:00justin_smithinstead I used emacs macros to generate the input
17:11lokien_noncom: apparently, I'll have to do this project by myself
17:13TimMcjustin_smith: 128k should be enough for anyone
17:13justin_smithTimMc: for tag names? yeah one would hope
17:13justin_smith"but I want each tag to be an animated gif"
17:15TimMcsounds reasonable
17:24neoncontrailsDoes uberjar do static analysis? Is there a performance advantage to compiling your query patterns in advance vs. populating the database dynamically in the REPL?
17:28justin_smithneoncontrails: clojure really doesn't do any optimizations automatically, it relies of hotspot mostly
17:29neoncontrailsjustin_smith: I see. So is uberjar strictly a convenience?
17:30justin_smithuberjar is for putting all your deps in one jar. There is a related action (that uberjar typically does) of aot compiling
17:31justin_smithyou give it a namespace to compile, and it aot-compiles that namespace and all its deps recursively
17:31clojurebotGabh mo leithscéal?
17:35neoncontrailsThat sounds advantageous. The reason I ask is uberjar finds my class file too large. To run postgresql, I had to remove the methods for populating the database – which isn't a huge deal because I could just do it in the REPL
17:38neoncontrailsBut it would seem to me like if you're inserting a bunch of large, static tables into a database, that's precisely the kind of operation static analysis would be helpful for
17:39justin_smithneoncontrails: the best way to deal with class files being too large is to move more things into smaller functions
17:39amalloyno, it's to not embed large static files into your program as source code
17:39amalloyread them from disk as data files
17:39justin_smithwell that would help too, sure!
17:41domgetterno, no, no, if they're too big, make them bigger until you have integer overflow. problem solved
17:44neoncontrailsSorry, this is my first database app and I'm trying to get a feel for best practices. amalloy When you say "read them from disk," you mean dump the tables to a CSV or similar and just read from that?
17:51justin_smithor just edn formatted file
17:52justin_smithand you can load them from inside your own jar with io/resource also
17:56neoncontrailsI didn't know about edn. This is great
17:59blake__So, I've done the QuickStart and gotten cljs code to compile. All the examples specifically point to the local cljs.jar you download first thing.
18:00blake__Yet none of the pre-built stuff (like figwheel) does. I don't even have a cljs.jar on my system, except for the one I Just downloaded.
18:03neoncontrailsblake__: that's the magic of Leiningen. No need to download the cljs.jar, your project.clj will grab it for you in the background
18:04blake__neoncontrails: And does what with it? I'd think it'd be on my hard-drive somewhere. Different name, maybe?
18:06justin_smithblake__: all lein deps are under ~/.m2/
18:06neoncontrailsblake__: it is. Not the jar, but the files themselves
18:07justin_smithneoncontrails: cljs.jar will be in there somewhere, maybe with a different name
18:08blake__clojurescript-build-0.1.9
18:08neoncontrailsinteresting. oh right, Leiningen transfers jar files only
18:10neoncontrailsblake__: depending on what IDE you use, you should be able to quickly reference those files should you ever need to. Cursive loads them alongside my project under 'external dependencies'
18:11blake__neoncontrails: I'm using Cursive (registered, cfleming!).
18:13blake__I haven't been using it for builds, though. Been doing that on the command-line.
18:13neoncontrailsIn your project view on the left hand side, you'll see an icon at the bottom minimized by default. You'll find cljs there once you successfully import it
18:14blake__Oh, "External Libraries"?
18:14neoncontrailsThat's the one
18:15blake__Yeah, it's not a matter of including it--Cursive really is great with that stuff--but the building thereof.
18:15blake__I've now got a workflow where I expect to go from the backend compojure app and the frontend clojurescript.
18:18justin_smithblake__: the same sort of config that works in the quickstart can be used in the lein cljsbuild or figwheel cljsbuild settings
18:18justin_smithand then lein cljsbuild / lein figwheel can do the building for you at that point
18:34blake__justin_smith: There doesn't seem to be much on the actual config. (Though this is way better than it was.)
18:34justin_smitheven better
18:35justin_smithor do you mean the config is undocumented?
18:37blake__justin_smith: Yeah, unless I missed something.
18:38justin_smith:cljsbuild {:builds [{:id "default" :foreign-libs ... :source-paths ... :compiler {...}}]}
18:38justin_smithand under builds is a vector of each defined build
18:40blake__Ah, right, that stuff is in its own project.
18:41justin_smithand under :compiler is the same options you would provide to cljs.jar
18:41blake__I think what confuses me is how compojure and my server-side code plays with (say) figwheel and my client-side code.
18:42justin_smithcompojure and figwheel have no interaction at all
18:42justin_smithyour cljs has one websocket connection to figwheel, and then whatever connection you set up (ajax, front-loading, websocket) to your compojure app
18:43justin_smithfigwheel is only there to push code updates and evaluate cljs in a repl, no app logic should depend on it and it should be absent on production
18:45blake__justin_smith: Right. That makes sense. Just loading up the compiled Javascript should do what's needed in production.
18:45justin_smithexactly, and that's why figwheel and compojure shouldn't rely on each other or even interact really
19:04devnhello all
19:06amalloyhow do i generate something like a compojure GET at runtime? like i have a list of urls, and i want to create a GET for each of them
19:07amalloybut GET is a macro, and expects the path to be a literal string
19:07justin_smithamalloy: so you want to make a router at runtime
19:07amalloyyes, after reading in a config file that says what routes to serve
19:08justin_smithamalloy: I think bidi would do this nicely. My own projects stopped using compojure once we needed to derive routes from data outside the code itself.
19:08justin_smithand of course there is the alternative of using eval in an init function
19:09justin_smithbut bidi is actually meant for that kind of flexibility (or polaris, which I helped make)
19:09amalloyactually i think compojure's GET just already does this. it looks like the macro is willing to accept a non-literal. i'll try that
19:09justin_smithoh, interesting
19:40domgetterHow do I use Hiccup with Luminus? http://www.luminusweb.net/docs/html_templating.md
19:40domgetterIt doesn't say how to add Hiccup into the namespace you're in
19:42arrdemdomgetter: (require '[hiccup.core :refer :all])
19:42arrdemsee https://github.com/weavejester/hiccup
19:42arrdemalso http://weavejester.github.io/hiccup/
19:42domgetterokay awesome
19:42domgetterthanks, arrdem
19:42arrdemsure
19:48rhg135is placing a channel in a persistent collection a good idea
19:48rhg135specifically one in an atom
19:49arrdemWhy wouldn't that be a good idea.
19:51amalloywell, in general mutable things in collections are fine, as long as you realize that means that the collection itself will act a bit like a mutable thing
21:10rhg135Retries, arrdem
21:11arrdem??
21:12rhg135That's why it could be bad
21:13rhg135I ended up just using a persistent queue of pending puts to do outside the swap
21:23noncom|2i have a {} where each value takes long to compute, i want to make it compute in another thread, what is the best approach?
21:23noncom|2maybe {:key @(future (compute-value)) ... } ?
21:23noncom|2or not?
21:24arrdemnoncom|2: so {:key @(future ...)} will force the value at map creation time. Not what you want.
21:24rhg135I would just use the future with no @ and update the client code. Less magic
21:24arrdemnoncom|2: someone... gfredericks or hyPiRion has a "lazy maps" library that does this.
21:24arrdemvalues are delayed and deref'd on get
21:24rhg135That too
21:25noncom|2well, i want them to compute on parallel because them are requests to a db and just the moment all of them are computed, they will be sent over network
21:25noncom|2this is a bit specific scenario
21:26noncom|2long requests. i feel doing them in parallel can be faster
21:26noncom|2since they're only reads
22:47irctcIf you use ack, and would like see better support for clojure filetypes please drop a note in this thread: https://groups.google.com/forum/#!topic/ack-users/gMFdNsmjY6I
22:48irctcI've submitted a PR, but the maintainer would like to confirm with the clojure community that .edn .cljs and .cljc are common clojure filetypes
22:48irctcas he's unfamiliar with the language