#clojure log - Jul 19 2015

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

0:23 crocket: It's fucking weird.

0:24 The maintainer of https://github.com/ptaoussanis/timbre blocked me from creating new issues because he thinks ANSI colors should be enabled by default in log files.

0:24 I knew he was rude, but I didn't know he was very rude.

0:28 It seems timbre is basically a one-man show.

0:40 Does anyone know a good logging library other than timbre?

0:40 Timbre is a brainfuck.

0:42 anti-freeze: crocket: Why so?

0:43 crocket: I think there's a logger called tools.logging, but I prefer timbre. (https://github.com/clojure/tools.logging)

0:44 crocket: anti-freeze, Have you ever tried logging exceptions in a log file with timbre?

0:44 anti-freeze: crocket: Yes, it was pretty straight forward

0:44 crocket: Now, there are ANSI colors in exceptions in log files.

0:45 anti-freeze: crocket: Give me a second to find an example

0:45 crocket: anti-freeze, The maintainer of timbre blocked me from his timbre github repository because I wanted timbre to disable ANSI colors in log files.

0:45 Do not use timbre.

0:46 If you use timbre, replace it with something else as soon as possible.

0:46 Do not rely on anything written by the maintainer of timbre.

0:47 anti-freeze: crocket: Hold on, I'm using a straight up (set-log-file (get-in config/env [:log :file])) and I have no issues

0:47 Unless you're doing ASCII colours manually

0:47 In which case its not his responsibility to account for that

0:47 crocket: anti-freeze, Use the latest version of timbre, and log an exception to a file.

0:48 (log/info (Exception. "hi"))

0:48 You can make a test project to test it.

0:48 anti-freeze: crocket: I see. Alright, how about you define a custom appender that uses filter to remove the colours?

0:49 crocket: And then maybe submit a pull request to timbre

0:49 crocket: anti-freeze, As I said above, the maintainer of timbre blocked me from his repository.

0:49 This means I can't submit a pull request or an issue.

0:49 I submitted a pull request that disables ANSI colors in rotor appender, which is a file appender.

0:49 He turned it down.

0:49 anti-freeze: crocket: Well as a temporary solution, it works. We can't help when maintainers are assholes

0:50 crocket: Did he give you a reason?

0:50 crocket: anti-freeze, Replace it with something else as soon as possible.

0:50 anti-freeze, He said some people wanted ANSI colors by default.

0:50 I think some people include only 'him'.

0:51 anti-freeze: crocket: Well, atleast he gave his reasoning. I don't see the issue with just using your custom version if you really want that functionality. Otherwise, there's tools.logging, which I didn't particularly enjoy

0:51 iceCupa: OLA

0:51 Hello fellas

0:52 crocket: anti-freeze, Why did you not enjoy tools.logging?

0:52 It seems tools.logging is another project maintained by a rude hermit.

0:53 anti-freeze: crocket: I don't remember. Last time I used it, it was lacking quite a bit. You know, you could write another logging library, they're not difficult to make. Call it YAL (Yet another logger) and state that you're not an asshole

0:54 lacking as in it didn't quite match up with my requirements

0:54 Not to say that it doens't get the job done for others

0:54 crocket: anti-freeze, I wouldn't write another library if possible.

0:56 anti-freeze: crocket: Well you seem unsatisfied with the current state of logger libraries and if you're saying to yourself a "Someone outta do that", its probably a good idea to get started

0:56 crocket: As long as tools.logging doesn't require me to write any configuration file without sacrificing configurability, I'm good.

0:57 oahner: crocket: why not simply disable ANSI colors in timbre?

0:57 crocket: oahner, I wasted a few hours on figuring out how to disable ANSI colors in timbre.

0:58 Eventually, the maintainer of timbre told me how to do it and blocked me from his repo.

0:58 The maintainer didn't document how to disable ANSI colors in timbre.

0:58 Obviously, the maintainer of timbre wants to push ANSI colors to everyone.

1:00 oahner: crocket: so you have your solution?

1:00 crocket: oahner, I'm going to try tools.logging and decide what to do later.

1:02 Oh, I could fork timbre and rename it.

1:06 Oh god, tools.logging brings back the nightmare of logback.

1:07 anti-freeze: crocket: Yep. Just make your own fork man.

1:16 crocket: anti-freeze, Were you burnt by the maintainer before?

1:17 anti-freeze: crocket: Not really. When maintainers piss me off I either fork and maintain my own version or if I can justify it I begin a rewrite

1:23 crocket: Ain't nobody got time to deal with arsy maintainers

1:25 crocket: ha

1:26 anti-freeze: crocket: Life is too short, fork it.

1:26 crocket: That should be a T-Shirt

1:28 crocket: I'll fork it when I find time.

1:30 However, I can't still believe that clojure only has two logging libraries.

1:30 timbre and tools.logging

1:31 I thought clojure had more momentum than that.

1:32 Hmm....

1:32 No

1:32 I'm going to write a very simple one.

1:32 This is a mess.

1:34 diyfupeco: crocket, I used log4j, which worked fine. Maybe the problem is, that there are already good libraries out there which are written in Java?

1:36 crocket: diyfupeco, log4j doesn't easily permit programmatic configuration.

1:36 diyfupeco: crocket, I know. Just wanted to say that are already tools (which a user may even know from earlier work).

1:37 crocket, I'd like to see what you come up with though. Sign me up to your mailing list. :)

1:41 crocket: Should I have a global log configuration in a log library?

1:41 This means impurity.

1:45 anti-freeze: crocket: Generally, people prefer using the lein config. I set up my own custom config loading, but that's application specific. I don't think you should enforce a specific configuration format

1:46 crocket: ???

1:46 lazybot: crocket: How could that be wrong?

1:47 crocket: timbre has *config*

1:51 logback also doesn't easily permit programmatic configuration

2:03 anti-freeze: crocket: Its up to you really. I personally prefer a minimal config that can easily be integrated in to my application config

2:34 crocket: Does anyone know an alternative to tools.logging and timbre?

3:14 wasamasa: lol, it's possible to *block* people on github from creating issues and pull requests?

3:17 apparently it is: https://help.github.com/articles/blocking-a-user/

3:18 * wasamasa still can't understand why there's no messaging system built in

3:20 oahner: wasamasa: I would assume because there's already email, irc, slack and everything on the internet for that

3:20 not to mention, handling spam sucks

3:20 wasamasa: oahner: well, you'd first need to figure out their contact details

3:21 oahner: and that's a bit tricky if they haven't got anything useful listed in their profile, so I had to resort to looking up the DNS details of their website a bunch of times to mail them

3:22 oahner: that's true, but if you're on someone's github page, odds are you wish you want to discuss something related to a project, so the project's issue tracker probably should be tried first :P

3:23 wasamasa: most of the time, yes

4:53 Pupeno: What should I do if I want to push a modified version of a library to clojars to use it in one of my projects before my changes are accepted upstream and released?

4:55 TEttinger: Pupeno: use a different... what's the word... the part of the name that isn't the artifact ID. like if there's some org.clojure/dance-music , you would make com.pupeno/dance-music

4:55 Pupeno: I see.

4:55 TEttinger: it automatically gets marked as unofficial pretty much

4:55 there's a curated thing on clojars, kinda?

4:56 but there's also a free-for-all thing

4:56 different repos

4:56 Pupeno: What should I do the with the version? the current version is 0.4.2... should I set it to or something like that?

4:59 dysfun: TEttinger: 'group identifier'

5:01 Pupeno: it's a different package. you need not change it at all, but depending on what you're going to change, you may want to consider restarting the version numbering

7:37 crocket: Did anyone use unilog?

8:07 grgr: Hi! This is a question about using Clojure with JVM. I installed Java 8 on my Mac, with the .dmg from java.com. If I were to run graphical Java programs, they would (I guess) start with Java 8. But when I run `java -version`, it tells me I'm on 1.7. When I run Cider (in Emacs), it also is using 1.7. How can I make lein & cider and all other clojure tools use Java 1.8 instead?

8:20 The solution to my problem, if anyone in the same situation, is to install Java via homebrew instead of shitty Oracle installer. You want to install Homebrew Cask (https://github.com/caskroom/homebrew-cask), and then `brew cask install java`.

8:21 oddcully: grgr: your problem was most likely around wrong set environment vars

9:05 crocket: Why is org.clojure/tools.logging 0.3.1 missing in clojars.org?

9:06 blkcat: good morning

9:07 liuchang: good night

9:20 andyf: crocket: Clojure, tools.logging, and all Clojure contrib libraries are released on maven.org, not Clojars. Search at search.maven.org

9:33 crocket: ok

9:35 arkh: crocket: is the something you don't like about timbre?

9:36 rhg135: did you find a solution?

9:44 crocket: arkh, timbre maintainer blocked me from creating pull requests and issues on his github repo because I wanted ANSI colors to be disabled by default in file appenders.

9:44 arkh: oh ok

9:44 crocket: arkh, I'm in the process of replacing timbre with clojure.tools.logging and unilog.

9:44 arkh, Do you know what I mean by ANSI colors in log files?

9:45 It is a brainfuck.

9:45 arkh: escape sequences embedded with what you're trying to output, right?

9:45 crocket: yes

9:46 It makes it impossible to read stack traces in log files.

9:46 arkh: hmm

9:46 crocket: Somehow, he was very rude from the beginning.

9:47 arkh, unilog configures logback with a map.

9:47 tools.logging uses logback in the background.

9:48 wasamasa: just read the logs with `less` :P

9:54 crocket: Logging anything other than plain text in a log file is a brain damage.

9:54 wasamasa: that aside, I don't believe you were blocked for that issue specifically

9:55 crocket: I'm pretty sure I was blocked for wanting to push a change that disables ANSI colors in log files.

9:55 Even now, I can't believe I was blocked.

9:56 The vast majority of people at least consider my github issues for days.

9:56 A small subset of people have 'no' empathy at all, and they don't hesitate blocking others.

9:57 That's why it's so hard to believe that psychopathic behaviors happened.

9:57 arkh: you could fork it

9:58 crocket: arkh, No, I'm replacing it with tools.loggin and unilog.

9:58 It is saner.

9:58 arkh: unilog looks good, too

9:58 crocket: tools.logging + unilog is actually simpler than timbre.

9:58 as long as you use what is provided.

9:59 wasamasa: FWIW, I don't see anything unusual in any of your issues/PRs

9:59 the questions you've posed were answered in all closed ones

9:59 crocket: He blocked me right after he closed my last issue.

9:59 wasamasa: and as for the reason why the author didn't implement any of your suggestions, it's third-party code

9:59 crocket: And, he was very quick to close my issues.

10:00 wasamasa: the kind of code you get from someone else and don't know at all to make any changes to it

10:00 crocket: He didn't even say sorry for closing my issues without a word.

10:00 wasamasa: you wrote there that you solved it yourself...

10:00 crocket: It was a workaround, but not a solution.

10:01 To really close the issue, there needs to be more documentation or a permanent solution.

10:01 timbre author didn't really document a way to turn off ANSI colors.

10:01 Anyway, he is an ass.

10:02 Don't rely on his libraries if your career or sanity is at stake.

10:02 * wasamasa rolls eyes

10:03 crocket: He clearly lacked any civil etiquette from the beginning.

10:04 wasamasa: you know, the usual reaction to a ban is reconsidering your own behaviour and reflecting what might have been possibly wrong about it

10:05 crocket: Since his actions were so absent of etiquette, I didn't have to contemplate about my behaviors.

10:05 arkh: crocket: this is the wrong channel for attacking someone's character. We're all free to use whatever libraries we wish - unilog looks. Be well.

10:05 wasamasa: right, there's a #clojure-offtopic channel IIRC

10:07 crocket: ok

10:08 Sorry for being angry here.

10:44 Does anyone know how to launch a stepping clojure debugger in emacs?

10:44 C-u C-M-x doesn't launch a debugging session.

11:39 bensu: mfikes, cljs-1349 filed for the lein test failures we discussed yesterday

11:41 mfikes: bensu: Cool. I won't dup that one ;)

11:43 bensu: mfikes, haha :) I only new about IKVReduce because I was about to take it when somebody commented "I'll do it!"

11:44 s/new/knew -> s/knew/remember

12:07 crocket: Does anyone debug clojure in emacs?

12:56 dnolen: mfikes: ping

12:56 mfikes: dnolen: pong

13:28 crocket: Does *out* pull from System/out now?

13:28 nREPL fails to capture System/out in *out*.

13:44 justin_smith: crocket: *out* doesn't pull from anything. It's a binding for an output channel. cider intentionally does not use System/out for output to its repl

13:44 crocket: if you use cider-jack-in it uses a separate buffer for things printed to *out*

13:44 err, for things printed to System/out that is

13:44 crocket: The problem is logback.

13:45 logback prints to System/out

13:45 cider repl fails to capture logback output.

13:45 justin_smith: yeah, logback stuff will not show up in your repl with cider, I have conversed with bbatsov, this is considered a feature

13:45 crocket: What

13:45 justin_smith: crocket: it does output it, it goes to a separate buffer

13:45 crocket: How do I capture it?

13:45 justin_smith: crocket: he doesn't want the log output in the repl, because he does not consider it part of the repl interaction

13:46 crocket: I checked github issues, and it is not a feature.

13:46 justin_smith: you open the other buffer, something like *nrepl output* iir

13:46 *iirc

13:46 crocket: They closed the issue because it is an nREPL issue.

13:47 justin_smith: crocket: I told him how to fix it. If they used the process buffer as the repl interaction buffer (like pretty much all other language repl modes do) the output would go to the expected place

13:47 but he does not want that behavior

13:48 crocket: Meh

13:48 Ignoring market signals(including yours) is hardly good.

13:49 justin_smith: it could be, that technically the nrepl interaction model makes it so he can't do that...

13:50 crocket: open source maintainers don't owe me shit. They aren't getting paid to do what I want. I make suggestions, and maybe they like the idea, maybe they don't. I decided not to use cider, but I am sure bbatsov doesn't care, it doesn't hurt him at all that I made that choice.

13:50 crocket: justin_smith, I was referring to C4.1 process adopted by ZeroMQ community.

13:51 ZeroMQ community tends to accept whatever doesn't break existing users.

13:51 justin_smith: cider isn't a community, it's one dude's project that some other people use

13:52 it would be cool if it were a community, but it really isn't

13:52 crocket: If he was a free-market capitalist guy, he would have made a community with cider.

13:52 justin_smith: similar with clojure, there's a community of people using it, but it's run top down by rhickey, that's just how it is

13:55 crocket: Really?

13:56 Even, linus eventually hired sergeants.

13:56 justin_smith: crocket: clojure isn't run by consensus or user input. Rich Hickey listens to community feedback, but there is no community driven process, it's totally run top-down.

13:57 crocket: sure he has people like puredanger, but it's still a top-down project.

13:57 crocket: justin_smith, Was cider's maintainer rude when he rejected?

13:57 justin_smith: crocket: not at all

13:57 crocket: Then, it should be ok

13:57 justin_smith: he explained why he didn't want it to be that way, and that was that

13:57 he probably would have been rude if I had started arguing I guess

13:59 wasamasa: fun fact: zmq got into trouble later on with their mindless api expansions :P

13:59 justin_smith: wasamasa: I can see how arbitrarily accepting new features would do that...

14:00 wasamasa: justin_smith: according to the developers it just got very hard to guarantee nothing to ever break

14:00 justin_smith: later one of them did a rewrite in C

14:16 nenorbot: Anyone know how to change the Clojure version when launching lein repl outside a project? Changing my ~/.lein/profiles.clj didn't help

14:16 justin_smith: nenorbot: you could fork leiningen

14:18 or wait for a new leiningen that uses 1.7 I guess

14:19 nenorbot: justin_smith: i'll just run a repl inside a project :)

14:39 tmtwd: How can I iterate through a map like this and get all the keys and values in just rows? {:content "lolcode", :author "TIMOTHY", :title "Good morning", :id 0}{:content "CONTENT", :author "jeff", :title "titletsr", :id 1}{:content "lolcode", :author "TIMOTHY", :title "Good morning", :id 2}{:content "hehne", :author "no prob", :title "yeah", :id 3}

14:40 and without the ids

14:43 ro_st: (let [maps [{:content "lolcode", :author "TIMOTHY", :title "Good morning", :id 0}

14:43 {:content "CONTENT", :author "jeff", :title "titletsr", :id 1}

14:43 {:content "lolcode", :author "TIMOTHY", :title "Good morning", :id 2}

14:43 {:content "hehne", :author "no prob", :title "yeah", :id 3}]

14:43 ks (keys (dissoc (first maps) :id))]

14:43 (map (apply juxt ks) maps))

14:46 justin_smith: ro_st: don't do that

14:46 dpathakj: that assumes the first thing in your list has all the keys you want

14:47 ro_st: apologies, justin_smith - do you mean the paste? or did i write bad code?

14:47 justin_smith: multi-line paste

14:47 ro_st: dpathakj: yes. tmtwd is welcome to write code to gather all the keys and handle missing keys on his own :-)

14:47 i do apologise

14:48 justin_smith: ro_st: your answer won't get the keys, only the values

14:48 tmtwd: wait that just returns a list of vectors?

14:48 justin_smith: tmtwd: what does "in just rows" mean?

14:48 ro_st: also true. tmtwd perhaps if you show what you mean by a 'row'

14:48 dpathakj: its output is ([“lolcode" "Good morning" "TIMOTHY"]

14:48 ["CONTENT" "titletsr" "jeff"]

14:48 ["lolcode" "Good morning" "TIMOTHY"]

14:49 ["hehne" "yeah" "no prob"])

14:49 ugh, sorry, that was a multiline paste

14:49 tmtwd: i meant like pargraphs or divs in html

14:50 in hiccup - kind of irrelevant I suppose

14:50 justin_smith: tmtwd: can you give an example of one row?

14:50 dpathakj: what’s the problem you are trying to solve? are you actually trying to generate html, or is it something else?

14:51 tmtwd: Title: Good Morning , Author: Timothy, lolcode

14:51 yes Im generating html

14:51 using hiccup

15:00 I tried that function http://pastebin.com/jKpsSWkt but I get a class cast exception

15:02 justin_smith: was the exception because get-messages is not a hash-map? by the name I would guess it is a function that gets a hash-map

15:05 tmtwd: also "a class cast exception" is really generic, it's more helpful if you can add the full message and stack trace to the paste

15:05 tmtwd: yes you are right

15:06 get-messages returns a hash-map

15:06 justin_smith: so I would think you'd want [(get-messages)]

15:06 not a sequential of hash-maps? if it was that, (get-messages) would suffice

15:08 tmtwd: it is a sequential of hash-maps I belive

15:08 clojure.lang.LazySeq cannot be cast to clojure.lang.IPersistentMap

15:09 so I need to establish that it is a list of hash-maps?

15:14 justin_smith: right, so use (get-messages) rather than [(get-messages)]

15:15 tmtwd: oh, right I think I know what to do :)

15:39 monsta: Hello, can anyone tel me how to remove and get a specific char from a string

15:40 joegallo: monsta: what are you really trying to do? java strings are too amenable to that sort of thing. i mean, it can be done (after a fashion), but that's not really how folks typically attack the problem.

15:40 justin_smith: monsta: remove and get?

15:40 joegallo: s/are too/aren't too/

15:41 justin_smith: monsta: since strings are immutable, the best you can do is return a new string with that character taken out.

15:41 monsta: like: remove "b" from "abcd" = "acd"

15:41 justin_smith: oh, so you don't need to "get" anytyhing at all

15:41 joegallo: is this just an academic exercise, though, or is it a part of some bigger thing?

15:42 monsta: the get part that I was refering to is like: get "b" from "abcd" = "b"

15:42 justin_smith: monsta: you'd have to return a collection for that

15:43 monsta: so filter?

15:43 Lollypop: Do you have the char you want or the do have the index of the char?

15:43 monsta: I have the index

15:43 Lollypop: you can get the char with .charAt

15:44 ,(.charAt "abcd" 1)

15:44 clojurebot: \b

15:44 monsta: uhh, I forgot all about Java

15:45 then how do I return "abcd" without \b

15:46 Lollypop: you concat two substrings, one before and one after

15:46 justin_smith: ,(#(str (subs % 0 (dec %2)) (subs % %2)) "abcd" 1)

15:46 clojurebot: "bcd"

15:46 justin_smith: err

15:47 ,(#(str (subs % 0 %2) (subs % (inc %2))) "abcd" 1)

15:47 clojurebot: "acd"

15:47 monsta: Ok, I will try. Thanks

15:55 tmtwd: how do you do a foreach for a list?

15:55 justin_smith: ,(defn stringectomy [st idx] [(.charAt st idx) (str (subs st 0 idx) (subs st (inc idx)))])

15:55 clojurebot: #'sandbox/stringectomy

15:56 justin_smith: ,(stringectomy "abcd" 1)

15:56 clojurebot: [\b "acd"]

15:56 justin_smith: tmtwd: tmtwd doseq if you don't need a return value, for if you do

15:57 tmtwd: justin_smith, is for just for vectors?

15:58 justin_smith: ,(for [c "hello"] (char (inc (int c))))

15:58 clojurebot: (\i \f \m \m \p)

15:58 justin_smith: ,(apply str (for [c "hello"] (char (inc (int c)))))

15:58 clojurebot: "ifmmp"

15:59 tmtwd: thanks

15:59 justin_smith: tmtwd: for works on anything seqable. Lots of things are seqable.

16:32 noncom|2: what would be the best analogy for core.async, but *synchronous* ?

16:33 in other words, is there any synchronous message delivery library for clojure ?

16:44 monsta: justin_smith: (defn stringectonomy [s i]

16:44 ((juxt #(.charAt % i) #(str (subs % 0 i) (subs % (inc i)))) s))

16:44 tmtwd: [ :h3 (first message) " (by: " (nth (message) 2)]]))) I get the error Wrong number of args (0) passed to: PersistentArrayMap for this line of hiccup

16:44 justin_smith: monsta: I started with that, but it's needlessly verbose

16:45 tmtwd: (message) is weird

16:45 unless message is a function of no args...

16:45 monsta: yup, but still :1

16:45 tmtwd: it says nth not supported on this type?

16:46 justin_smith: tmtwd: what is the type of "message" - if it isn't a function of 0 args, if it isn't a sequential you shouldn't be doing (nth message x)

16:47 tmtwd: based on prior context, I assume message is a hash map, neither of those operations make sense if it is a hash map

16:47 tmtwd: thanks, my bad

16:47 justin_smith: I mean even "first" is iffy in that case, though clojure lets you do it

16:48 ,(first {:a 0 :b 1 :c 2 :d 3 :e 4 :f 5 :g 6 :h 7 :i 8 :j 9 :k 10})

16:48 clojurebot: [:e 4]

16:49 tmtwd: ah yes

16:49 rhg135: arkh: yes, (-> path io/resource io/file .gePath load-file)

16:49 tmtwd: my problem is that clojure let me use first

16:49 rhg135: getPath*

16:59 clojurenoob: I'm dealing with this situation in Korma: when I have (where (= :key val)) I get a valid query, whereas using (where temp) with temp being (= :key val), temp is not being translated.. I guess this has to do with macros being processed before run-time? is there anything I can do about this?

17:01 tmtwd: what do I use to access elements of a vector by index?

17:01 nvm

17:02 justin_smith: tmtwd: nth, get, or just calling it

17:02 tmtwd: Im okay, I was trying to call get on a map......

17:02 hehe

17:02 justin_smith: get on a map works too, just make sure to use the keys

17:08 ed-g: clojurenoob, For what its worth I found Korma confusing, and ended up moving to YESQL.

17:08 clojurenoob: hm, maybe I should look into that one then. I must say it's also confusing me

17:09 ed-g: I moved the fancy joins into the database as views to keep the sql code more concise in the application.

17:10 Also I found my life got easier when I realized I can mix and match clojure database libraries so if one library is more convenient for a purpose I can use it for that, and still use direct jdbc calls when that's more straightforward.

17:12 clojurenoob: unfortunately YESQL seems to be better suited for static queries

17:12 I'm dealing with something that has to be quite dynamic :(

17:12 ed-g: clojurenoob, can you share the code?

17:15 noncom|2: ,(keyword "how are we supposed to deal with this?")

17:15 clojurebot: :how are we supposed to deal with this?

17:15 noncom|2: ,(symbol "'or even with this?")

17:15 clojurebot: 'or even with this?

17:16 noncom|2: ,(symbol "'this symbol has 'quote and spaces\space:)':)")

17:16 clojurebot: #<RuntimeException java.lang.RuntimeException: Unsupported escape character: \s>

17:16 noncom|2: ,(symbol "'this symbol has 'quote and spaces:)':)")

17:16 clojurebot: 'this symbol has 'quote and spaces:)':)

17:16 noncom|2: ,(symbol "'this symbol has 'quote and spaces \space :)':)")

17:16 clojurebot: #<RuntimeException java.lang.RuntimeException: Unsupported escape character: \s>

17:16 noncom|2: huh..

17:17 ed-g: noncom|2, run the string through a regular expression first, to convert non keyword-able characters?

17:17 noncom|2: yeah, that'd probably work... but it is funny to be able to do this thing

17:17 ed-g: s/ /-/g; s/[^_-A-Za-z]//g

17:18 bcham: Stupid question inbound. I just cannot figure out how to deal with PersistentArrayMaps. my functions/db calls consistently return a map in the form ({:k v}) and I want to do things like merge it with another map {} but then I get errors. Can someone point me to an explanation about how to deal with these?

17:19 ed-g: bcham, I use http://jafingerhut.github.io/cheatsheet/grimoire/cheatsheet-tiptip-cdocs-summary.html all the time for short usage examples.

17:20 ,(merge-with assoc {:a 1} {:b 2})

17:20 clojurebot: {:a 1, :b 2}

17:20 bcham: ,(merge {:k v} ({:k1 v1})

17:20 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

17:20 bcham: ,(merge {:k v} ({:k1 v1}))

17:20 clojurebot: #error {\n :cause "Unable to resolve symbol: v in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: v in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6543]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: v in this context"\n ...

17:21 bcham: ,(merge {:k "v"} ({:k1 "v1"}))

17:21 clojurebot: #error {\n :cause "Wrong number of args (0) passed to: PersistentArrayMap"\n :via\n [{:type clojure.lang.ArityException\n :message "Wrong number of args (0) passed to: PersistentArrayMap"\n :at [clojure.lang.AFn throwArity "AFn.java" 429]}]\n :trace\n [[clojure.lang.AFn throwArity "AFn.java" 429]\n [clojure.lang.AFn invoke "AFn.java" 28]\n [sandbox$eval210 invoke "NO_SOURCE_FILE" 0]\n [cloj...

17:21 ed-g: you're trying to call (:{k1 "v1"}) as a function.

17:21 ,(merge {:k "v"} {:k1 "v1"})

17:21 clojurebot: {:k "v", :k1 "v1"}

17:22 ed-g: ,(merge {:k "v"} (first '({:k1 "v1"}))

17:22 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

17:22 bcham: Yeah that's the issue, I know what my problem is. It's calling it like a function, but that is what is being returned from my db-calls in the library I am using. and I don't know how to work around that. I get how to do it, as you just wrote, but I don't know how to work with the paren wrapped version.

17:22 clojurenoob: ed-g: give me a second

17:22 bcham: I figured out the whole "first" work around but that just feels like the wrong solution

17:23 Does that make sense ed-g? I understand my problem, that it's wrapped like a function call, but the thing is, it shouldn't be. I can call (first ()) but that just feels ugly... So I figured there'd be a more clojured way of doing that.

17:23 ed-g: bcham, also you can use destructuring bind. (let [[m] [{:k1 "v1"}]] {merge {:k 'v} m))

17:23 justin_smith: bcham: what do you want to do with the return value? if it returned multiple results, what would you want to do with each of them?

17:24 ed-g: justin_smith, yeah that's the better question ;-)

17:24 clojurenoob: ed-g: http://pastebin.com/gBXz7RwA

17:24 bcham: justin_smith, the logic being that if a db-query returned multiple results, I should be able to handle that? Well it shouldn't return multiple results as I'm calling a specific `id` key.

17:25 justin_smith: bcham: if it's guaranteed to return only one result, use first, or if you'd like to feel clever use destructuring instead

17:25 clojurenoob: ed-g: my goal is to get the query at the bottom to work with cl instead of (= :CBORD "KM1")

17:25 bcham: not clever enough to want to feel clever :). Thanks justin_smith and ed-g

17:25 justin_smith: bcham: it always returns a sequence, because the database calls themselves are always allowed to return multiple results (regardless of what you know about the query / schema)

17:26 bcham: Gotcha, that makes sense now.

17:26 thanks so much

17:26 super helpful

17:27 justin_smith: bcham: imagine how much harder it would be to write code to deal with a function that sometimes returns a sequence, and sometimes a hash-map

17:27 bcham: yeah, when I think about it that way it makes a ton more sense. So much more logical that way.

17:27 justin_smith: bcham: if you weren't careful the conditionals to handle each of these cases could leak all through the codebase...

17:28 bcham: That's why I come to the IRC channel, so much learning to be had here.

17:29 ed-g: clojurenoob, I'm looking at the database code, my question is what task does this code accomplish?

17:30 it looks like there is some kind of program stored in the database and you're interpreting it using clojure?

17:32 for one thing you'll want cl to be a function instead of a value. It's being evaluated at compile time.

17:34 Also its better form to use a let form that to redefine toplevel var's at run time.

17:35 *than* to redefine var's

17:37 I don't know whether you have the authority to change the database schema, but it could make things simpler to move each "OP" to its own table which you can join to webqryr rather than as a tag within webqryr.wsopr

17:37 My $0.02 anyhow.

17:38 If your application really requires building dynamic SQL, I would also consider going full monty and writing a database function to build and then EXECUTE the SQL within DB.

17:39 squeedee: Hey folks. Im using Midje to test some code, and I want to make sure that my function, in a specific case, returns '+' (as in the function).

17:39 ed-g: But hard to say without knowing more about what the application is.

17:39 squeedee, can you compare (= '+ (yourfn ...))

17:40 rather, lose the '+ and use +

17:40 clojurenoob: unfortunately I can't change the schema, this is what I have to work with :)

17:40 ed-g: clojurenoob, what does the application do?

17:40 squeedee: yeah withor without the quote its failing for me

17:40 clojurenoob: ed-g, I'm basically trying to rebuild an SQL query which components are stored in my database

17:40 squeedee: I think it's an artifact of Midje's macros. I might try it with .test first

17:41 tmtwd: http://pastebin.com/BED5yKim when I do this in compojure the routes don't work

17:41 justin_smith: ed-g: '+ is not the function +

17:41 ed-g: clojurenoob, I understand. I think that's an inherently messy process regardless of which library you use.

17:42 justin_smith: ed-g: squeedee: compare + itself, or @(resolve '+)

17:42 tmtwd: for example (GET "/" [] "hey") works, but (GET "/messages/new" [] "hi there") doesn't work

17:42 justin_smith: ,(= @(resolve '+) +)

17:42 clojurebot: true

17:42 justin_smith: ,(= '+ +)

17:42 clojurebot: false

17:42 ed-g: justin_smith, yeah I was stuck halfway to common lisp ;-)

17:42 justin_smith: heh

17:43 ~lisp-2

17:43 clojurebot: Excuse me?

17:43 justin_smith: oh, I was hoping we had a witty factoid

17:43 scriptor: ~lisp2

17:43 clojurebot: I don't understand.

17:44 squeedee: Yeah it's definitely something in mije

17:44 tmtwd: nvm my code works

17:44 ed-g: tmtwd, glad we could help! ;-)

17:45 squeedee, can you post the function you're testing, and the failing test?

17:46 squeedee: (test (= + +)) is fine.. (fact "plus is plus" + => +) fails with:

17:46 https://www.irccloud.com/pastebin/SJOIuwwJ/

17:46 ed-g yeah was just making a reduction for you :D

17:47 justin_smith: squeedee: I don't know midge, but "checking function" makes me think that there is something else going on there

17:47 squeedee: i think midge see's the function as a 'matcher'

17:47 I'll look into it some more.

17:47 Was hoping someone just knew :D

17:47 ed-g: what happens if you test (= (fact "plus is plus" + => +) core/+) ?

17:47 justin_smith: ~midge

17:47 clojurebot: Gabh mo leithscéal?

17:47 justin_smith: err

17:47 ~midje

17:47 clojurebot: midje is :(

17:48 ed-g: namespacing the symbol?

17:48 justin_smith: also, who the hell aliases clojure.core as core? that's weird

17:49 squeedee: There are things i like about Marick's thinking around tests

17:49 so I want to explore Midje.

17:50 He's inspired me on a number of occasions on a bunch of different topics, i'll suspend disbelief

17:51 this i think is what is hapenning https://github.com/marick/Midje/wiki/Checkers

17:52 justin_smith: squeedee: maybe you want (fact (identity +) => +) - just cargo culting those docs

17:52 oh wait!

17:52 squeedee: other side maybe

17:52 justin_smith: (fact + => #(= + %))

17:52 squeedee: gah

17:52 looking through the issues :D

17:53 if it starts looking like that I'll just leave :D

17:53 justin_smith: I don't know how the macros are working there, it could just be (fact + => (= +))

17:54 (dec macros)

17:54 lazybot: ⇒ -1

17:54 ed-g: squeedee, is the issue that Midje will try to execute a function argument? perhaps if you compared the name of the function rather than function itself?

17:54 squeedee: ed-g: that might solve it too. I just don't like it.

17:56 ed-g: squeedee, good luck. See y'all later.

17:56 squeedee: ciao

17:57 justin, inserting the 'equal' checker works

17:57 It's just ugly

18:02 justin_smith: I found the answer in the docs, in case anyone else asks the same esoteric thing.. It's `(+ => (exactly +))`

18:05 justin_smith: cool

18:17 tmtwd: How do we generate forms in hiccup? http://pastebin.com/t389s1U2 I tried this

18:31 justin_smith: tmtwd: I think you want :label and not label, and options (foo=bar style) after that should be in a hash-map

18:38 reutermj: Hey, does anyone know how to get gradle working with clojure?

18:56 tmtwd: anyone know any resources to make forms in hiccup?

20:41 mistaBIZ_: hello, what is supposed to be in .lein/profiles.clj?

20:45 upon trying to create a new project or run repl im getting an error pointing to that, and it is somehow blank

20:55 justin_smith: mistaBIZ_: ~/.lein/profiles.clj should contain a map of keywords indicating run profiles

20:56 mistaBIZ_: perhaps try setting aside your whole ~/.lein/ first?

20:56 (eg. moving it somewhere other than your home directory, temporarily)

21:02 bcham: Hey in emacs, I'll commonly give myself some extra spaces between closing parens, like when adding parts to a function or something like that. is there anyway to mass delete all the space between two closing parens? ie ) ) to ))?

21:09 amalloy: bcham: are you using paredit? if so, you can just press ]. if not, you should try it

21:10 bcham: I am, and that's what I was looking for amalloy.

21:10 That works perfectly man I knew someone had solved this problem :)

21:21 mistaBIZ_: what is the default in .lein/profiles.clj?

21:23 justin_smith: mistaBIZ_: it can just be an empty file.

21:24 mistaBIZ_: and remember it is ~/.lein/profiles.clj - the one in your home directory is the important one

21:31 mistaBIZ_: a

21:33 trying to open repl or project / app any.. is saying "Error reading from profiles.clj

21:51 mistaBIZ: yeah, i can run 0 lein commands

21:51 justin_smith: then delete the file

21:51 or fix it

21:52 scriptor: is there more to the error? Pastebin it if you need to

21:54 mistaBIZ: http://pastebin.com/V5KisFuj

21:54 justin_smith: mistaBIZ: just delete the file, you don't need it

21:54 and the error will go away

21:54 or, you could paste the contents, and someone could tell you how to fix it

21:54 mistaBIZ: k will give it a go justin

21:57 jstin removing file worked, that makes no sense, whats pointing to it?

21:57 justin_smith: mistaBIZ: lein reads the file when it starts up

21:57 mistaBIZ: so if the file is broken, lein just fails

21:59 Wild_Cat: ...and since it's your user-wide profiles.clj, it's read for *every* project you attempt to open

21:59 (which means that if it's broken they all fail)

21:59 mistaBIZ: yeah but does that inhibit me from making global deps in future?

22:00 or is it ther lack of specificity to current deps (empty profiles.clj)

22:00 i would have hoped it would be smarter =n

22:00 justin_smith: mistaBIZ: the error you were getting was caused by invalid contents of the file. If you fixed the file it would work.

22:01 mistaBIZ: it's plenty smart, but it thinks it is more helpful to fail and let you know it was misconfigured, rather than continue without your customization

22:02 mistaBIZ: ok, thanks all

23:43 crocket: Stepping into java libraries in a clojure debug session seems impossible.

23:54 I can't figure out why logback fails to roll log files.

Logging service provided by n01se.net