Fork me on GitHub
#clojure
<
2017-07-09
>
hiredman00:07:29

have you looked at htmlunit? it might be slightly easier to stomach than going full selenium

hiredman00:07:37

I don't know, but clj-http unit has an option to automatically follow redirects or not, and I wonder if turning it off and handling redirects manually might unbreak the cookie stuff

lvh01:07:23

I haven’t, but that’s a good suggestion. clj-http with disabled redirects doesn’t fix the problem, unfortunately.

lvh02:07:21

I wonder what even happens when you have repeat header values — the response headers look like they’re just str/str maps

hiredman02:07:12

the header map in clj-http is actually a special map type for dealing with header name case insensitivity

justaboutnormal04:07:42

I'm trying to write a csv file, but the data is truncated when I look at the output file. If I print out the vector that I pass into write-csv I see all of the results, but only part of them make it to the file.

justaboutnormal04:07:16

I've also tried doubling the data (into data data) and that prints the rest of the result as well as some additional lines when it starts gets to the beginning of the original dataset again.

justaboutnormal04:07:38

Ha! I should write in here more often, it gave me an idea to use `(with-open [writer (io/writer output-file-name)] (csv/write-csv writer data))` and it worked!

ajs10:07:14

i'm specifying an enviornment var in my project.clj in the :profiles :dev :env map. but when I try to run lein with-profile dev repl, that env variable is not there when using environ.core to load it. is there a piece to this process I'm missing?

lvh13:07:33

@hiredman Sorry; yeah — I meant “I’m not sure how this would deal with a header value set twice”, which explains why I only see parts of the set cookies 🙂

cjhowe15:07:10

i've seen many recommendations to use clojure.spec.alpha, but doesn't that require clojure 1.9? is the alpha stable enough for production or something?

dominicm16:07:31

I'm trying to create a java object & getting no matching ctor. Is it possible to show the available ctors somehow?

bronsa16:07:33

use clojure.reflect

dominicm16:07:42

@bronsa I'm trying, but not really sure what I'm looking for in there?

bronsa16:07:59

e.g. (sorry for the awkard code, wrote it on the repl)

user=> (-> (cr/type-reflect String) :members (->> (filter (comp #{'java.lang.String} :name)) (filter (comp #(contains? % :public) :flags)) (map :parameter-types)))
([byte<>] [java.lang.StringBuilder] [int<> int int] [byte<> int int java.nio.charset.Charset] [byte<> java.lang.String] [] [byte<> int] [java.lang.StringBuffer] [byte<> int int java.lang.String] [char<> int int] [char<>] [byte<> int int int] [java.lang.String] [byte<> java.nio.charset.Charset] [byte<> int int])

bronsa16:07:04

to get the public ctors

bronsa16:07:05

unless I'm not understanding what you're asking

dominicm16:07:11

Hmm, it's non-public. That's... odd right?

bfabry16:07:56

@dominicm in java land that's usually a sign that you're supposed to use a factory method, builder class, or some other way of getting instances of the object

bfabry16:07:18

// You can also get the commit for an (abbreviated) SHA
                walk.reset();
                ObjectId id = repository.resolve("38d51408bd");

bfabry16:07:22

^ that doesn't help?

dominicm17:07:15

That made me reconsider, I can get the sha from objectid, but it was in a higher class... sigh. I hate java.

dominicm17:07:43

Oh, nvm, repository.resolve doesn't return a RevCommit, ^^

dominicm17:07:00

It's okay, the walker is simpler than expected

bfabry17:07:32

yeah... this is a pretty good example of "god dammit there's a whole magical DSL around traversing the commits in a repo" rather than the repository just being represented by regular data structures

bfabry17:07:12

iirc a git repo is DAG of immutable nodes, so would be perfectly representable as a persistent data structure

cjhowe19:07:37

is there a way to have multiple handlers in bidi? i want to use ->ResourcesMaybe with a fallback route... something like [["/" (->ResourcesMaybe ...)] ["/" index-handler]]

hiredman22:07:44

the comment on https://github.com/juxt/bidi/blob/master/src/bidi/ring.cljc#L110 seems to indicate it would work that way

hiredman22:07:34

it may depend on you using bidi in a particular way to work

hiredman23:07:25

the problem is ResourcesMaybe is a handler, not a route, you could make a custom implementation of whatever bidi calls its routing protocol (I forget, maybe Pattern), that succeeds or fails based on the existence of a resource

cjhowe23:07:12

yeah, i tried making something that wraps handlers, detects if it's a vector, and if so, tries each of the handlers with some

cjhowe23:07:32

i don't see anything in the code to support multiple handlers with fallbacks though