#clojure logs

2015-06-29

02:10visof_hi guys
02:11visof_is there anybody using enlive for parsing html?
02:11visof_how can i extract text after some html attributes?
02:14visof_https://www.refheap.com/104548 that's the html page
02:15visof_how can i extract "only there is nothing here." text from this page using enlive?
02:15visof_can anybody help in this?
03:02mmeixjust learning, when NOT to use reduce (4clojure #132) ...
06:12H4nsis there a way to determine the current namespace in a function call or macroexpansion? i would like to infer a resource path from the namespace of a test.
06:16kwladykaH4ns, http://clojuredocs.org/clojure.core/*ns* ?
06:17H4nskwladyka: thanks!
06:21ayiaHi... Somehow google did not help me... How can I extract position-based group from regex? (actually I need it for clojurescript, but the answer i guess should be the same)
06:29ayiaups... understood that "groups" comes in the result of re-find (and others) after the actual match.... somehow it was not clear to me, unless I played with it:) Thanks!
08:03J_A_Workhttps://twitter.com/J_Arcane/status/615489455340826624
08:35liuchonghehe
09:04H4nswhen will *ns* be bound at all? it seems that it is bound at read time, but not so much at macroexpansion, compile or run time.
09:05H4nswhich kind of makes sense, but it also makes it less useful for the purpose that i wanted to use it for (test resource directory determination)
09:05gfredericksH4ns: it is at macroexpansion time
09:05gfredericksH4ns: this is a dev tool?
09:06H4nsgfredericks: it is just tests
09:06gfrederickslike it's some utility function called by your tests?
09:06H4nsgfredericks: some of my tests require external resources, and i would like to avoid spelling out full resource paths. rather, i want a directory hierachy in dev-resources that mirrors my tests.
09:06H4nsgfredericks: yes, a macro, and it does not work. hence my question.
09:07gfredericksoh with the macro you have to be careful to use *ns* at expansion time
09:07gfredericksnot just emit code that uses it
09:07H4nsfair point!
09:07H4nsthanks :)
09:07gfredericksjust unquoting it usually works
09:07gfredericks,(defmacro my-ns-as-str [] `(str ~*ns*))
09:07clojurebot#'sandbox/my-ns-as-str
09:07gfredericks,(my-ns-as-str)
09:07clojurebot#error {\n :cause "EvalReader not allowed when *read-eval* is false."\n :via\n [{:type java.lang.ExceptionInInitializerError\n :message nil\n :at [sun.reflect.NativeConstructorAccessorImpl newInstance0 "NativeConstructorAccessorImpl.java" -2]}\n {:type java.lang.RuntimeException\n :message "EvalReader not allowed when *read-eval* is false."\n :at [clojure.lang.Util runtimeException "Util....
09:08gfredericksdon't pay that no mind it should still work :)
09:08H4nsgfredericks: now that you said it, it is quite obvious what went wrong. thank you so much :)
09:08gfredericksnp
10:08sharmsIn 'lein repl' I am doing a (:require '[datomic.api :as d]) but I cant actually use d/ anything
10:09dstocktonsharms: call require as a function
10:09dstocktonnot a keyword :require
10:09dstockton(require '[datomic.api :as d])
10:09sharmsdstockton - haha ok it works now
10:09sharmsthank you for entertaining my simple mind
10:10dstocktonno problem, glad to help
10:12yhwhat's the difference between a transducer and any other function? given that functions are composable
10:14ambrosebsyh: composing transducers eliminates intermediate data structures
10:16ambrosebsyh: (comp #(map inc %) #(map dec %)) builds up 2 data structures, (comp (map dec) (map inc)) just builds one.
10:23yhthanks ambrosebs
10:40irctcphilosophical question i guess... why is the interface for map different from doseq? Both apply a function to a collection yet doseq gives you all these other options (when/let features) also, doseq iterates over the entire collection join (is that how you say that?) while map does one from each at a time
10:41Chousuke_map is just a function. doseq is meant for side-effects
10:41chouser'doseq' is more like 'for' than 'map'
10:45Chousuke_map is also pretty much the same across functional languages. People might riot if you had a map function that didn't work at all like it usually does.
10:53ambrosebsany experience reports on repackaging dependencies by embedding them in your project, via something like mranderson or dolly?
10:53ambrosebsit's getting kind of ridiculous with the amount of tooling that depends on clojure contrib that it seems necessary
11:30irctchm, i guess i see the historical angle of it. makes snese.
11:33csd_Does anyone know how to work around this cider error: error in process filter: End of buffer ?
11:34csd_Received when running tests
11:35schmirI'd try a different version unless cider's bug tracker gives you some hints
11:39csd_yeah thats what i figured
11:40ShayanjmIf anyone is interested in browser security, I just wrote about how chrome stores its remembered user credentials as plaintext
11:41Shayanjmwould love any upvotes I can get if you like the content :) https://news.ycombinator.com/newest -> "We can do better - Please fix plaintext credential storage in Chrome"
11:44hellofunkShayanjm: "When you sign in to Chrome and enable sync, Chrome uses your Google Account to encrypt your synced passwords."
11:44Shayanjmhellofunk: It's encrypted on Google's servers
11:44Shayanjmbut stored in plaintext locally
11:48hellofunkShayanjm: and i take it Safari encrypts them?
11:48Shayanjmhellofunk: I believe safari uses keychain by default
11:48Shayanjmwhich is a far more secure implementation
11:49hellofunkwell +1 apple then
11:49ShayanjmYeah no kidding
11:49hellofunkthe 1Password app is good too
11:49hellofunkbut then no one ever accused google of being good on security. i've read for years you should never use chrome to store sensitive data.
11:50csd_how might i set a default protocol? is that even possible?
11:50csd_i just want to move type checking into either the protocol or a multimethod etc
11:51justin_smithcsd_: you can extend the protocol for Object ?
11:51csd_so if you are java Thingie, execute normal function, else, execute function that throws an error
11:51csd_justin_smith: i can, but im more interested in how to control things that arent Object
11:52justin_smithcsd_: everything inherits from Object, so it's a default. You can explicitly extend the other classes you care about of course.
11:52csd_oh i follow you. i thought you were speaking in the broader sense of the word
11:53csd_is this actually good practice though? what would be the best way to make sure my function only operates on Thingie?
11:54justin_smithif you only want to operate on one specific class, why make a protocol?
11:55csd_it doesn't have to be. it just seemed like one option that might work well
11:56csd_worst case i can just stick in an instance? check but it just seems like there is probably a better way
11:56justin_smiththe odd thing to me here is that the point of a protocol is to allow multiple classes to implement a standard set of methods. If you only want one class, what does a protocol gain you?
11:57csd_hypothetically the ability to redirect ever other class
12:02csd_i guess i can just make it an precondition assert
12:27irctc_Hello, I am trying to do a node.js / clojure interrop scenario. I am feeling like I'm getting lost, although I was able to make a few helper functions. Where should I start ?
12:30oddcullyirctc_: just to have it mentioned: there is also #clojurescript
12:31irctc_thanks, but it's not the idea here (I don't decide that, but the end idea is to make the heavy lifting in Clojure)
12:36irctc_I already have put sessions in Redis from node, and I have functions that can read those and validate them (these are signed cookies)
12:40irctc_but the basic friend example I found doesn't show how to control how cookies are made
12:41irctc_If I implement the ring middleware SessionStore protocol, should I do the validation there also ?
12:52digiorgihi, i want in seesaw to put in a frame of 500x500 some widget that doesn't get resized to take the whole frame size
12:53digiorgihow can i do that?
13:34kryftHmm, I can't seem to get a library under checkouts/ included in my uberjar
13:34kryft(Or anything else for that matter)
13:34TimMckryft: Is it in your :dependencies vector?
13:35kryftTimMc: Yes; I've been using the library (clj-pdf) for a while, and now I'm trying to add a feature, so I forked and cloned the repository and added a symlink to it under checkouts in the root folder of my project
13:35TimMcSo much for the most common mistake. :-)
13:36kryftThe version of the dependency in my project.clj matches the version number in my local clj-pdf's project.clj
13:36kryftTimMc: Certainly worth checking :)
13:39justin_smithkryft: checkouts require lein install (with the proper version number) before they work, right? Maybe they also require lein install before uberjar?
13:40kryftjustin_smith: What do you mean by 'with the proper version number'? And do I need to lein install both in my project's folder and the clj-pdf folder (symlink) under checkouts?
13:40justin_smithkryft: lein install in the lib's folder
13:41justin_smithkryft: the version number used by your project.clj must have been installed via lein install (or exist externally) before checkouts work
13:43kryftjustin_smith: So if I have [clj-pdf "2.0.4"] in my project's :dependencies, and "2.0.4" at the top of the project.clj in the folder under checkouts, it should be ok?
13:44justin_smithkryft: yes, but you probably need to run lein-install inside the folder inside checkouts
13:44justin_smithunless uberjar and checkouts are fully integrated, I'm not certain they are
13:45kryftjustin_smith: Right. Well, I did run lein install in the lib folder, but it still doesn't seem to work. :/
13:45justin_smithkryft: what error do you get on uberjar?
13:46kryftjustin_smith: No error at all; I think it's still using the dependency that it's downloaded previously (I was using clj-pdf installed by lein before I tried to include it via checkouts)
13:46kryftAs far as I can tell, it's ignoring the checkouts folder completely
13:48justin_smithkryft: if you ran lein install in the checked out lib, it doesn't need the checkout lib, and the installed version would be overwriting the version you previously downloaded
13:48justin_smithso either you have a version number mismatch or you didn't actually use lein install in the checked out lib
13:50justin_smithkryft: but the saner thing, to me, would be to update the version string in a way that made the checked out in-development version unique (such that you would get an error if it were not made available, instead of silently using the old version)
13:50Emppericfleming: sorry, haven't found time for that minimal reproduction project quite yet
13:52kryftjustin_smith: Yay, that worked. :) They were both "2.0.4" previously (the latest clj-pdf master), and now I changed both of them to "2.0.4-FOO", and that did the trick
13:52justin_smithkryft: cool
13:54justin_smithkryft: to be honest I avoid using checkout deps because they add some complexity with their convenience in my experience (but then again, my coworkers basically consider me a caveman because I am so suspicious of convenient tooling)
13:54justin_smith"auto reload? auto namespace loading? doc string popups? I distrust this sorcery, for it must be a sign of evil"
13:54kryft:)
13:55kryftI've never used it before either, but it seemed like the best choice here
14:03digiorgihi, anyway to align a widget vertically and horizontally in seesaw?
14:27gfredericks,(def ⒡ identity)
14:27clojurebot#'sandbox/⒡
14:27gfredericks,(⒡ 42)
14:27clojurebot42
14:27gfredericks^ #protip
14:30justin_smithgfredericks: I seem to have misplaced my elisp code that outputs every pair of unicode chars that are defined as opening and closing delimiters
14:32gfredericksoh that'd be interesting
14:46justin_smithgfredericks: some magic with (char-table) that I am now forgetting - that's where all symbols are categorized
14:47justin_smiths/symbols/codepoints
15:16gfredericksI briefly knew how unicode worked while building that regex->string-gen thing
16:44jdotleonardhi, can anyone in here help with a typed clojure question?
16:44gfredericks~anyone
16:44clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
16:44ordnungswidrigjdotleonard: simply ask and you will se
16:45jdotleonardit’s a bit long so I have posted the question here: https://groups.google.com/forum/#!topic/clojure-core-typed/NSTmqKLGtiY
16:46jdotleonardessentially the ‘.’ invocation of a java method entails reflection and typed clojure gets confused about what could be meant (although in my case there is only one possibility)
16:47jdotleonardand there’s no way i can find to annotate the method/member in a way that typed clojure is satisfied with. any attempt at runtime assertion of the type of the member is itself a violation
16:50ordnungswidrigjdotleonard: at least post a gist so we can reproduce :)
16:52jdotleonardhere ya go: https://gist.github.com/johanatan/4be9045bad40abd17f83
16:52jdotleonard[2 files]. Let me know if you’d like to see the project.clj (or anything else)
16:54ordnungswidrigjdotleonard: the actual error message would be nice.
16:56jdotleonardit’s in the group posting. did you look at it?
16:56jdotleonardType Error (adapters/cassandra.clj:32:7) Unresolved host interop: conn
16:56jdotleonard Add type hints to resolve the host call.
16:56jdotleonard Suggested fields:
16:56jdotleonard adapters.cassandra.CassandraEventConsumer
16:56jdotleonard \
16:56jdotleonard public final java.lang.Object conn
16:58oddcullyjdotleonard: please watch out when pasting many code lines. irc's flood protection will kick in and you out. better use a refheap/pastebin/gist/younameit/...
16:58jdotleonardahh, ok. thx
17:16seangroveIf I set the version of clojurescript to 3308, but the warnings during compilation tell me it's using 2411, what am I likely overlooking? I don't see any references to it in lein deps :tree, and if I delete that specific jar, it's immediately re-downloaded
17:17justin_smithseangrove: plugin or profile issues?
17:17seangrovejustin_smith: I'll check both...
17:22seangroveUgh, I don't see any references to it anywhere..
17:22ordnungswidrigjdotleonard: not sure, did you try to use regular type annotations? (^CassandraEventconsumer this)
17:22seangroveThe only plugin I have is lein-cljsbuild 1.0.6
17:23ordnungswidrigseangrove: maybe that depends on this clojurescript version? try to exclude the dependencies from lein-cljsbuild
17:24seangroveI have [lein-cljsbuild "1.0.6" :exclusions [org.clojure/clojurescript]]
17:25jdotleonard@ordnungswidrig: mmm, nope didn’t try that but I verified that typed.clojure already knows that ‘this’ is of that type from the vim plugin (also the error message hint that it gives indicates that it already knows what ‘this’ is)
17:26jdotleonard@ordnungswidrig: oooh! that worked!
17:27jdotleonard@ordnungswidrig: thx!
17:27ordnungswidrigjdotleonard: no problem, just guessing. I seldomly used core.types :-P
17:27ordnungswidrigcore.typed
17:27jdotleonardya, i didn’t even know about that notation. not sure where it is covered in the docs (didn’t see it anywhere)
17:28jdotleonardthere’s a lot of little gaps i’ve had to piece together along the way like that
17:29btobolaskiIts not part of core.typed, its a type hint. Type hints are used to avoid reflection http://clojure.org/java_interop#Java%20Interop-Type%20Hints
17:30oddcully(inc ordnungswidrig)
17:30oddcullylazy bots...
17:39seangroveIs there any way to search for all dependencies on clojurescript-0.0-2411 so I can get some way of tracking down where in the world this is coming from?
17:42cflemingEmpperi: No problem, I have plenty to do
17:44csd_Is there something similar to tools.ns that will load all project files into the REPL in correct order? Tools.ns seems more pertaining to reloading.
17:44seangroveThis is my entire project.clj file https://www.refheap.com/104569
17:44seangroveprofiles.clj is just `{}`
17:45seangroveIt only retrieves clojurescript-0.0-2411 when running cljsbuild, so that might be a clue...
17:46seangroveHrm, it does show up in the example/support projects https://github.com/emezeske/lein-cljsbuild/search?utf8=%E2%9C%93&q=2411
17:46justin_smithcsd_: simply requiring your primary ns should suffice for that
17:47csd_justin_smith: i normally use cider-load-buffer.. maybe that's why i have to load each ns manually
17:48justin_smithcsd_: on first load, require is all you need. After that you are looking at reload, which is what c.t.ns is for
17:49jdotleonard@btobolaski: ahh, i see. that makes sense. thx!
17:49jdotleonard@btobolaski: why would java method access involve reflection to begin with?
17:50jdotleonard@btobolaski: nevermind. i suppose it is because clojure being dynamically typed wouldn’t know what ‘this’ was at that point in the logic without the hint?
21:01xeqiseangrove: I'm fairly certain that is being added by the cljsbuild attempt to have a recent cljs https://github.com/emezeske/lein-cljsbuild/blob/master/plugin/src/leiningen/cljsbuild/subproject.clj
21:01xeqithe plugin modifies the deps and adds it
21:02seangroveI have a .cljc file that actually works without problem when compiling from the commandline, and I can eval in the buffer/file just fine, but on save the figwheel process complains: "java.io.FileNotFoundException : Could not locate mana/schemata__init.class or mana/schemata.clj on classpath."
21:03xeqimaven's dep model says that :classifier :aot is not the same as w/o classifier
21:03seangrovexeqi: Yeah, was going to point to https://twitter.com/swannodette/status/615651691237646336
21:03xeqiso it ignores that you have one declared
21:03seangroveAh, ok
21:03seangroveThat kind of makes sense
21:04seangroveBut it doesn't warn about it at all, which it usually does if the declaration is missing altogether
21:07seangrove$seen bhauman