#clojure log - Aug 03 2012

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

0:00 nDuff: Hmm -- latest korma is very slightly behind on c.j.jdbc (0.2.2 vs 0.2.3)

0:01 ...same behavior on latest release of both. Trying it raw.

0:11 Issue reproduces with c.j.jdbc

0:14 ... :fetch-size appears to have no effect (with the MySQL connector; haven't tested with others).

0:27 khu: hi, i'm interested in parallel graph computations -- is clojure well suited for this sort of distributed computation?

0:27 something similar to the C++ parallel boost graph library

0:35 g

0:38 akhudek: nDuff: could it be a bug in the connector? The relevant clojure jdbc looks like it should work correctly.

0:38 nDuff: akhudek: I've filled in some details in a comment to https://github.com/ibdknox/Korma/pull/66

0:41 akhudek: khu: without knowing much about parallel graph libraries it's hard to comment, but clojure is general purpose and has good concurency features so I don't see why not

0:49 m0smith: cljs question; do it support promise/deliver?

0:50 nDuff: m0smith: No.

0:51 m0smith: nDuff: thanks. Is there a way to do the same thing?

0:54 nDuff: m0smith: Depends on exactly what you mean by "the same thing". Haven't run into anything I couldn't do with the facilities available, but I don't have time (or remaining brain facilities -- it's extremely late here) for a discussion now.

0:55 m0smith: good night

0:58 nsxt: any benefit to using java.io over slurp/spit when writing/reading files?

0:58 tomoj: m0smith: if you deref and the value has not been delivered, what do you want to happen?

0:58 muhoo: for some reason, in nrepl.el, C-c C-l is bound to clojure-load-file not to nrepl-load-file

1:00 Raynes: nsxt: slurp pulls an entire file into memory as a string.

1:00 I'll leave what happens when you ready a 200GB file with slurp to your imagination.

1:00 read*

1:02 nsxt: Raynes: thanks

1:03 Raynes: any arguments discouraging the use of spit, or is it the shortcut that clojuredocs makes it out to be?

1:06 emezeske: nsxt: slurp and spit are both great for quickly getting stuff out of or into files

1:07 nsxt: Neither one should be discouraged, just keep in mind that their simplicity means you don't get much control

1:07 nsxt: If you need more control, then java.io is waiting :)

1:07 nsxt: emezeske: thank you

1:08 Raynes: emezeske: I wasn't discouraging it.

1:08 I thought I was clear.

1:08 You wouldn't want to use slurp to read in and process large files.

1:08 emezeske: Raynes: I know! nsxt used the word discourage.

1:08 Raynes: I was responding to that :)

1:08 Raynes: Your names are colored similarly in my IRC client, so I assume you're the same person.

1:09 I'll continue assuming that despite any objections.

1:09 emezeske: I don't object

1:09 Raynes: Then I do object. Why would you think you were the same person?

1:09 emezeske: I thought who was the same person as what, on when

1:10 Raynes: I know!

1:29 cheezey: ?

1:50 duck1123: does doall make sure that all the sequences are realized, or just the top one?

2:22 alex_baranosky: what is the best-maintained clojure csv library out there?

2:24 ro_st: https://github.com/clojure/data.csv/ was last updated a couple months ago

2:32 muhoo: wow, reading cljs/core.cljs is a lot more fun way to explore the inner guts of clojure, than reading the java variant, because it's all in clojure itself.

2:36 ro_st: i believe it's interesting because it has to do stuff in ways not possible in idiomatic clojure

3:58 augustl: are there any clojure-isms for shelling out/making sub processes?

4:31 muhoo: augustl: there's the java shell, or conch in clojure

4:32 augustl: muhoo: looking it up, thanks

4:39 bpr: there's also stevedore, but i'm not sure if that's what you were asking for

4:47 magopian: hello there

4:48 is somebody from the 4clojure.com team around?

4:49 augustl: bpr: looking that up too, thanks :)

5:15 eml: I'm having some trouble reading the body of a JSON POST request, anyone have a recent guide/forum post/whatever regarding it that I can steal some code from?

5:16 ro_st: are you using middleware to do the json parsing?

5:17 eml: I would be glad to do that. :)

5:20 ro_st: eml: https://www.refheap.com/paste/4022

5:21 and [cheshire "4.0.1"] in project.clj for the middleware to use

5:21 this will parse json request bodies and :kewordise the keys, and it'll convert clojure data structures to json when emitting response

5:22 my handlers return {:body <data>} for the response middleware to pick up

5:22 good luck :-)

5:22 eml: I've seen some code similar to that, the one thing that confuses me is the (def app-routes ...) and (def app). Not sure what that is :)

5:24 ro_st: (compojure/defroutes app-routes …)

5:24 assuming you use compojure for routing

5:24 eml: Nope I use (defpage) from Noir :)

5:25 Which I failed to mention.. d'oh

5:25 ro_st: yer on yer own, buddy :-)

5:25 but the middleware i provided works directly with the req/response maps

5:25 so if you can find out how to wrap noir with middleware (i've never had to), you should be ok

5:26 i went for compojure because there's less magic between me and http. wanted to understand what's going on

5:33 eml: dang :)

6:42 Raynes: ro_st, eml: noir.server/add-middleware!

6:43 ro_st: boom :-)

6:44 Raynes: ro_st: In wrap-json-params, why did you use the name 'req*' in the let?

6:45 ro_st: it's a copy-paste job from the wrap-json-params in the middleware lib i used

6:45 i did this to add x-url-form-encoded to the check

6:45 Raynes: What middleware lib is that?

6:45 ro_st: https://github.com/ngrunwald/ring-middleware-format

6:46 oh, wait, perhaps it's not a copy-paste of that one

6:46 -shrug- havnae a clue :-)

6:47 i'm guessing your point is that the inner let will bind over the outer, making the * unnecessary?

6:47 Raynes: I should probably add middleware for this to lib-noir.

6:47 Yeah, and bstr is unnecessary and can be inlined.

6:47 I was going to give you those two tips, but if you didn't write the code… *shrug*

6:47 :p

6:48 ro_st: yep. when this code went in, i was … unconcerned with how this code worked, as long as it did

6:49 here's an expansive question. what is clojure not a good fit for?

6:56 ro_st1: disconnected. didn't see any responses to my massive question :-)

7:03 naeg_: is there actually a reason why other lisps don't make use of [] for e.g. vectors or something else?

7:03 Bronsa: common lisp uses #() for vectors

7:03 cacodaemon: &(apply (partial merge-with concat) [{:A [1 2]} {:A [3 4]} {:B "abc"} {:B [:a :b :c]}])

7:03 lazybot: ⇒ {:B (\a \b \c :a :b :c), :A (1 2 3 4)}

7:04 cacodaemon: &(apply (partial map concat) [[[1 2] [3 4]] [[5 6] [7 8]] ["abc" [:a :b :c]]])

7:04 lazybot: ⇒ ((1 2 5 6 \a \b \c) (3 4 7 8 :a :b :c))

7:25 lancero: is there any guide online for setting up CDT on windows?

7:28 ro_st: step1: install ubuntu OR buy a mac -duck, run-

7:29 i need to check CDT out. it looks great. i've been getting by with swank's break

7:30 Raynes: do you know if nrepl.el has a breakpointer like swank does?

8:44 XPherior: Has anyone ever used Noir with multiple view namespaces?

8:44 kral: namaste

8:44 XPherior: Hm?

8:48 ohpauleez: XPherior: it's a way to show gratitude, respect, thanks, etc

8:48 a word*

8:52 XPherior: ohpauleez: Thanks for the info.

9:09 TimMc: Also a greeting, yeah?

9:16 ohpauleez: TimMc: for sure

9:22 ludston: Hey, I have a question that someone here might be able to help me with,

9:23 What's the answer to managing state in a Java library, such as Swing, functionally?

9:24 duck11231: Those kind of libraries are annoying, but there's nothing stopping you from using them, they just feel odd

9:25 usually when there's a lib like that, there's a clojure lib wrapping it up

9:25 ludston: I'm using a library called seesaw that wraps it, but all it does is provide a better API

9:27 It doesn't solve the real problem, which is that when state changes in some component, it's really expensive to do the right thing, which would be to completely destroy the UI element and replace it with a new one with new changes

9:28 duck11231: but short of re-writing all of the internals to be clojurey, what can you do?

9:30 ludston: I could theoretically write a wrapper that has some sort of cloned version of the entire api in a clojure that contains all of the actually important info, like the contents of text boxes etc

9:30 But I was hoping that when I asked, someone could point to where this was already done.

9:31 Or at some magic state wrapping library that does a much better job than I could

9:32 duck11231: you would have to have a type of text box that supports the structural sharing in order to make those type of ops efficient.

9:34 ludston: I need 40 million dollars to hire a team of programmers to make the Lisp that I want.

9:34 duck11231: it would be cool to see a completely clojure windowing library, but so many wheels to re-invent

9:34 ludston: Who's up for it?

9:36 bryanl: shouldn't "lein deps" show a listing of my deps?

9:37 duck11231: ok then, in this hypothetical clojure gui library I have a form with a text box. I want to set the value of the text box by assoc-ing on the vew value and getting back a cheap copy. How does the form know to use the new text box

9:37 bryanl: try lein deps :tree

9:37 bryanl: duck11231: thanks

9:39 ludston: The text doesn't get replaced

9:39 joegallo_: duck11231: the old gui should stay there unmodified, with a whole new gui rendered in a new window. but, you know, with structural sharing so it's efficient. ;)

9:40 ludston: The GUI creates a monad that presents all of the content contained in it

9:40 duck11231: "Oh god! why did I map over my window?"

9:41 ludston: Each function invoked on the gui causes the entire state of the program to get passed into the clojurey part of the program, which modifies it how it will

9:41 And then passes it back, replacing the contents of the old gui

9:42 duck11231: interesting idea

9:43 ludston: All of the interaction with the gui comes through a single function, called "process-input" or something

9:43 And it has datastructures passed to it that explain the change that has occured on the gui

9:44 None of this 1billion listeners stuff. It uses multimethods to figure out the output it returns

9:45 Construct the gui in some made up lispy markup language, and then have it throw exceptions if ever a button/combination of input is sent from it that the multimethod underneath can't handle

9:45 Amen.

9:46 duck1123: so where's your github repo already? :)

9:46 ludston: Lol I haven't got the time or the skills to make something like that.

9:48 I've only been playing with clojure for about a month, and I still haven't touched the object system

9:49 duck1123: I wonder if a system like that would make it easier to work around the limitations of updating the gui from other threads.

9:51 ludston: If it was passing the state of the whole UI, it'd have to only be able to interact with one thread,

9:51 But I guess you could build up the new UI with more than one

9:53 Maybe you *could* split up the UI so each component could individually be sent, or as smaller groups

9:54 But UI components that affect each other would have to be in the same group

9:56 Unless you split it up so each component would get updated individually by a single change, taking whatever state they needed before coming back...

9:58 Stateful UI's can allready do that with listeners...

9:58 The real boon would be the whole groups that return, or replacing the whole UI in one goe

10:09 The problem with the Java UI, is that because it's horrible, I can't access its state unless I pass it into the listeners I add to it upon their creation, and that means the state is only accesible via a clojure

10:10 Which is horrible code design

10:14 And it's creating a problem for me with text-listeners, because changes to text objects are handled in two ways, first the change can be caught by a "document filter" which lets me change it into whatever form I want, and then, an

10:14 "event listener" will be fired that will look at that change

10:14 And there are things that only the event listener can do, such as create menus

10:16 Because both of those listeners need to share the same function output

10:18 I'm caught between having state, or writing a hacky wrapper around the "Event Listener" part that will immediately undo changes made to the text field, which will trigger another "Event Listener" again, which doesn't really solve the problem, because then that event listener needs state to figure out that it's getting trapped into a recursive loop.

10:18 Blarg.

10:18 Which I guess is why I asked, what is the solution to state, in the first place.

10:18 :(

10:58 gtrak: TGIF

10:59 joly: amen

11:00 ohpauleez: holler

11:01 * sduckett hollers

11:15 grc: given that defn provides :pre and :post condition checking, why is it so rarely used?

11:17 devn: grc: Take it too far and use it everywhere, and then you'll know why. :)

11:18 grc: devn: I was hoping to avoid the pain!

11:19 But seriously, Eiffel trades on this, JML tries to implement it for Java but it appears to have been added to the language as A Good Thing but never used

11:19 ohpauleez: grc: I think there are two reasons

11:19 1.) People move code around like clay - they don't quite think as far ahead or careful as someone like Rich might

11:20 it's hard to come up with the constraints of a system that you yourself aren't even sure about

11:20 2.) Creating contraints on domain input and output takes practice, just like writing good tests

11:20 BUT

11:20 you end up capturing these domains in your tests anyway, you might as well enforce them and program defensively

11:21 Programming to an interface instead of an implementation helps to avoid pointless dependencies between calling pieces of code

11:22 grc: 1) sounds eminently plausible, particularly given the flexible nature of REPL based programming

11:22 ohpauleez: If you need more flexibility in your contraints, take a look at trammel

11:22 * grc googles

11:22 ohpauleez: grc: The REPL isn't an excuse for thinking, it's part of the process

11:23 play in the REPL, build up the solution, pull out the abstracts and widdle them down, then enforce the domain of operation that you're expecting

11:23 usually when you're in the REPL, you're already reasoning about input and output domains

11:25 abstractions*

11:25 acheng: (in general do people prefer to be notified when they use the wrong word?)

11:25 S11001001: acheng: I don't know, but I do

11:26 ohpauleez: I do

11:26 acheng: s/widdle/whittle

11:26 ohpauleez: ahh yes, thank you

11:26 acheng: I think irc allows private channels but i do not possess that fu

11:27 grc: ohpauleez: widdle is what my 5 year old son does in the bathroom. But I knew what you meant

11:27 S11001001: acheng: it lets you put a password on

11:27 ohpauleez: If someone publicly makes a mistake, you should publicly point it out :)

11:27 grc: :)

11:28 S11001001: acheng: you don't need a chan to send someone a private message, though, just /msg S11001001 I will hear this

11:28 acheng: ah thanks

11:28 ohpauleez: That said, easy access to contracts + generative testing has had a serious impact on my general development and my confidence in my solutions

11:29 acheng: ohpauleez: does that mean you lean towards or away from :pre :post ? i'm not awake yet

11:30 ohpauleez: acheng: I'm all for :pre/:post or trammel. A contract + solid comment with example usage + generative testing is a big win

11:30 acheng: does that mean you think as far ahead as Rich? :)

11:31 cgag: ohpauleez: is test.generative what you're using? I looked into it a while ago but never tried it. The readme said it was very early days and changing, but it didn't look like it'd been touched in a quite a while.

11:31 ohpauleez: matched with pair-wise integration tests, unit tests only when cyclomatic complexity demands it, system tests (top-level functional tests, ideally in a behavior-oriented fashion) make up the rest of the story for me and my teams (usually)

11:32 acheng: I think far ahead, but I don't think I'm in the same league as RH

11:32 I'm like a AAA far thinker to RH's Hall of Fame league

11:33 grc: ohpauleez: I'm currently struggling through an implementation of high order function contract checking but was hiiting the wall of doubt

11:33 If folk don't do first order checking then ,,,

11:33 (M.Sc. dissertation subject)

11:34 ohpauleez: for sure

11:36 you can use contracts though to "control" the boundaries of your system the dependencies it has

11:36 which is usually as good as you can do in that case - if you really want to enforce at those points

11:36 I find as I go higher up in the solution space, the contracts get fewer and fewer

11:37 (for better or worse)

11:38 cgag: I think test.generative is fine to use

11:56 rplevy: weird that this is acceptable (keyword "fooo()a")

11:57 gtrak: rplevy: stop breaking the reader...

11:57 rplevy: of course the reader will not interpret it that way as a literal

11:57 scriptor: ,(keyword "fooo()a")

11:57 clojurebot: :fooo()a

11:57 rplevy: gtrak: haha

11:58 but oddly a keyword can contain these characters as demonstrated

12:00 I wonder if there are other things that choke on the keyword once produced

12:01 ,(symbol "fooo()a")

12:01 clojurebot: fooo()a

12:01 rplevy: odd

12:01 muhoo: ludston: ztellman did a great talk at clojurewest on how to wrap stateful libraries like swing. it was at clojurewest, probably up on blip.tv by now

12:04 rplevy: even stranger: (symbol "(+ 1 2 3)") I guess I just never thought to try these, so I didn't realize symbol and keyword allow these reader-incompatible symbols and keywords

12:05 naeg: some men just want to watch the world burn...

12:05 rplevy: that said, I don't see what good it does, obviously the reader is too slow to run a check each time

12:05 that's probably the reason

12:06 bryanl: Why does this happen: https://gist.github.com/3248995 if (:date-of-birth person) returns a Long?

12:06 rplevy: but you don't need the whole reader, just a check of what characters are allowed

12:06 which should be a fast regexp

12:07 dunno

12:07 gtrak: it would only make sense to limit symbols and keywords if you're for-sure going to to read them, yea?

12:07 rplevy: yeah, true

12:07 that's probably the reasoning, and makes sense

12:08 the argument about failing faster/earlier might make sense if these could cause problems

12:09 S11001001: it would make more sense to have escape syntax for printing symbols and keywords

12:09 rplevy: S11001001: yeah I agree

12:11 bryanl: nm.. on my early question. i just set the test up wrong

12:23 rplevy: ,(do (defmacro pointless [s] (type s)) [(type (symbol "(+ 1 2 3)")) , (pointless (symbol "(+ 1 2 3)"))])

12:23 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

12:23 rplevy: clojail...

12:23 result is: [clojure.lang.Symbol clojure.lang.PersistentList]

12:25 so I guess if you're reading some weird stuff into keywords, it might be a different type than you expect at macro expansion time

12:25 or symbols

12:25 ludston: muhoo: Do you know what the talk was called?

12:26 llasram: rplevy: I believe what's happening there is that `pointless` is being passed '(symbol "(+ 1 2 3)")

12:26 ludston: In the mean time: http://danielkeogh.com/blog/view/clojure-architecture-time-functional-gui-library Fleshed out ideas a little on my wishlist. I'd love feedback.

12:26 llasram: (that is, the quoted list of those literal values)

12:26 rplevy: maybe lemme check

12:27 S11001001: rplevy: stick `'~ in pointless def

12:28 rplevy: llasram: yeah oops

12:32 muhoo: ludston: "distilling java libraries", IIRC

12:35 ludston: sorry, infoq, not blip.tv

12:36 ludston: slides here https://github.com/strangeloop/clojurewest2012-slides/blob/master/README.md

12:38 ludston: muhoo: Thanks. You're a champion.

12:40 muhoo: naw, the champion in this case is ztellman.

12:41 cgag: ludston: "however it does not do any more than make the Swing."

12:42 is that sentence missing a few words or am i miss reading it?

12:43 augustl: for debugging purposes, how do I add a specific free floating jar to my project?

12:43 using lein2

12:44 ludston: cgag: Nope, I'm just retarded.

12:46 There we go. All fixed.

12:46 Sleep now.

12:48 ckirkendall: Does anyone know how to route clojure.tools.logging to the slime repl

12:52 joegallo_: (alter-var-root #'clojure.tools.logging/log* (constantly println))

12:52 a sloppy, but workable solution.

12:53 i'm sure you could refine that into something better

12:53 hiredman: depending on which concrete logging impl you are using it is pretty easy to create an appender that does whatever you want

12:53 llasram: Huh. I had not considered that one.

12:55 Yeah, with log4j it's something like (.addAppender (Logger/getRootLogger) (WriterAppender. (SimpleLayout.) *out*))

12:55 Mmm.... Java APIs...

12:57 augustl: anyone on adding a free floating jar to a lein2 project for testing purposes? Want to test my own build of a dependency I use.

12:58 technomancy: augustl: you can use lein-localrepo

12:58 augustl: technomancy: looking it up, thanks

13:00 ckirkendall: llasram: thanks

13:02 joegallo_: that said, though, using the ConsoleAppender from log4j (for me), resulted in filling up the *swank* buffer, not writing to my slime repl.

13:02 technomancy: just uuuuuuuse priiiiiiintln

13:02 joegallo_: in all likelihood, though, that was my fault in some way.

13:02 technomancy: well, yeah, that's why i suggested it

13:03 or do you mean println debugging?

13:03 technomancy: no, I mean for logging

13:03 java logging is clown shoes

13:03 joegallo_: heh

13:03 llasram: technomancy: But, log levels!

13:03 technomancy: llasram: (defn debug [& msgs] (when *debug* (apply println msgs))) ; done

13:04 java log levels can't even be changed on a per-thread basis or even changed at all at runtime reliably; screw that

13:05 llasram: Hmm. I have never even considered that as an option, although I can see how it could be useful to e.g. attach a REPL and raise the log level

13:06 Maybe clojure.tools.logging needs a "just use println" backend

13:06 technomancy: inc

13:06 you can change the log level at runtime with log4j, but it's super annoying

13:06 and it doesn't work on the other backends

13:06 so it's not exposed in c.t.logging

13:06 ckirkendall: technomancy: I would use println but the need to connect to log4j in prod is out of my control

13:07 technomancy: I would use println but the need to connect to log4j in prod is out of my control

13:07 technomancy: ckirkendall: yeah, there are some cases where it's appropriate

13:08 it just shouldn't be your first choice

13:10 ckirkendall: agree

13:20 acheng: hm. The page at www.infoq.com says: null [OK]

13:21 (while viewing the page that has all of Zach Tellman's content)

13:42 stuartsierra: Can someone verify my latest work on CLJS-276?

13:42 http://dev.clojure.org/jira/browse/CLJS-276?focusedCommentId=29084&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-29084

13:50 TimMc: clojurebot: java logging is clown shoes

13:50 clojurebot: c'est bon!

13:50 nDuff: stuartsierra: Hmm. There's a bunch of stylistic / convention-breaking things we'd jump on for someone proposing that script in #bash, but I don't see anything obvious that would impact functionality.

13:50 stuartsierra: nDuff: I don't care about the style of the Bash code, I only care about the results.

13:51 Not to be dismissive of coding style for Bash, it's just not important to me in this case.

13:52 nDuff: (capitalization of non-exported variables, use of dirname rather than parameter expansion, use of [ ] vs [[ ]], etc)... but yah, it smells fine on readthrough for functionality.

14:01 stuartsierra: nDuff: Can you point me to a quick explanation of "use of dirname rather than parameter expansion"?

14:04 ibdknox: technomancy: is there a way for me to tell leiningen-core what directory it's in?

14:04 nDuff: stuartsierra: "${path##*/}" is much faster than "$(basename "$path")" (no fork+exec+read cycle)

14:05 stuartsierra: nDuff: cool, thanks

14:08 technomancy: ibdknox: it should use :root from the project map, but there may be a few places where it still falls back to the JVM process's PWD

14:08 (if so that's a bug)

14:15 ibdknox: technomancy: ah, I see. thanks :)

14:20 nDuff: ibdknox: Know if anyone has attempted to get streaming resultsets working against MySQL with korma? I'm having rather a rough time of it.

14:20 ibdknox: no idea

14:20 nDuff: have you seen it work with c.j.jdbc?

14:20 if it can work there, it can work with korma

14:28 pbostrom__: I'm trying to convince myself that the following code will accomplish what I want: https://gist.github.com/3250162 I guess what I'm trying to figure out, are the two actions sent to the agent "atomically" at the end of the transaction, or could another thread step in and send its actions

14:32 stuartsierra: pbostrom: I wouldn't rely on both agent sends being atomic. Why not send a single function that does both things?

14:33 ibdknox: nDuff: I misread your question - the way exec works right now, if there's some magical way of doing a streaming result set, it won't work. Korma intentionally realizes the results, since you'd otherwise have to do a bunch of inversion stuff to get everything into a result-preserving scope

14:34 nDuff: i.e. you couldn't pass the seq around, because by the time you do, the results will have closed themselves. You can add a new exec mode that would allow you to tell it what to do

14:35 pbostrom__: stuartsierra: I guess the question still stands in that case, would a single send be atomic after the transaction is successful, or could the transaction that finishes 2nd still step in and send its println first

14:36 stuartsierra: I don't know, but even if I did I wouldn't rely on it.

14:37 pbostrom__: ok, thanks, I should probably think about this some more

14:38 ohpauleez: I wonder what just happened to freenode (or the internet)

14:40 stuartsierra: I think IRC is distributed. That's the result of a network failure between nodes.

14:41 gtrak: haven't these guys heard of spanning tree?

14:42 rlb: http://en.wikipedia.org/wiki/Netsplit?

14:42 clojurebot: dakrone maintains clj-http

14:42 gtrak: clojurebot: http links happen a lot

14:42 clojurebot: profiles in clj-http is https://gist.github.com/1846759 an example of the profiles feature in Leiningen 2

14:45 weavejester: Has anyone run across any problems using "lein cljsbuild auto" before?

14:57 piranha: (clojurescript) so if I did a (defrecord Some [] (func1 [this] ...) (func2 [this] (func1 this)), compiler spits warnings. What am I doing wrong here? Methods of record can't use other methods or what?

15:00 emezeske: weavejester: Care to be more specific about your "lein cljsbuild auto" question?

15:00 muhoo: technomancy: thanks for pointing me to nrepl.el. it is fully integrated into my world now. also, nix.

15:00 llasram: pbostrom_: For exactly what you've got, I believe the "do not want" case can never happen, but you could get e.g. "x 1, x 2, y 2 y 2"

15:01 technomancy: yay!

15:01 weavejester: emezeske: It compiles once, but not any other times. Hm… actually it looks like it can't find Clojurescript.

15:01 emezeske: weavejester: That sounds weird

15:02 weavejester: emezeske: Hm, it's a problem with domina's dependencies

15:02 Domina beta4 looks like it has a bad clojurescript dependency

15:02 emezeske: weavejester: I see "goog-jar" in domina's deps. That's a sure-fire path to disaster

15:03 weavejester: Also what you said!

15:03 weavejester: What does everyone else use for dom manipulation and events in Clojurescript?

15:03 ibdknox: weavejester: jayq ;)

15:03 pbostrom_: I use jQuery

15:03 emezeske: I use jayq.

15:03 llasram: pbostrom_: (that is, the agent dispatches done w/in the transaction will always be ordered wrt each other, but not necessarily wrt to dispatches from other transactions. But since x and y are only incremented and dispatch execution on the agent is serialized, you'll never "travel back in time" and get an old value from the ref deref)

15:04 nkkarthik: how does clojurescript compare to parenscript... or are they apples and oranges?

15:04 weavejester: jayq it is, then :) - I already have jquery included anyway

15:04 muhoo: what are you using for gui libraries in clojurescript? jui stuff, or the google closure widgets?

15:04 weavejester: nkkarthik: Apples and oranges, really...

15:05 emezeske: I would *love* to use a pure cljs DOM manipulation library, but practicality wins out for me, at least with the current state of things

15:06 nkkarthik: weavejester: hmm... no escaping the jvm overhead, huh :) thanks

15:06 weavejester: nkkarthik: As far as I know, anyway. My knowledge of parenscript is sketchy, but as far as I know it doesn't do the same transformations as Clojurescript. Clojurescript is a language that compiles into JS; parenscript is a way of representing JS with S-expressions.

15:06 nkkarthik: That's my understanding, but it might be wrong. I haven't looked at parenscript in huge detail.

15:08 nkkarthik: weavejester: ah ok... guess I will just give a quick shot at it (and not more) then

15:08 ibdknox: emezeske: I'm not sure it'll ever be practical to have a pure cljs dom manip library

15:09 emezeske: just like in JVM clojure it doesn't make sense for us to write a webserver from scratch

15:09 emezeske: ibdknox: I guess I didn't mean pure as in "only cljs", just pure as in "designed for cljs"

15:09 ibdknox: I don't care if there's JS under the covers

15:09 ThatOneGuy: better to lean on tried and tested Java bytecode

15:09 ibdknox: emezeske: ah, I fully agree with you then :)

15:09 emezeske: ibdknox: "pure" was probably not the right word

15:10 ThatOneGuy: I think he means like a more idiomatic clojure wrapper on top of a JS Dom manip lib

15:10 ibdknox: it'll come, CLJS is still hard for people

15:10 emezeske: ThatOneGuy: I don't mean that exactly; I want something that is *not* a wrapper

15:10 ibdknox: lots of things need to happen for it to get wider adoption

15:10 emezeske: ThatOneGuy: If there's JS code involved, it's just performance optimizations for an otherwise all-cljs library

15:10 ibdknox: Sooo many things

15:11 ibdknox: emezeske: I'm trying to work on one of em ;)

15:11 emezeske: ibdknox: :)

15:11 ThatOneGuy: why not wrap an existing library?

15:11 emezeske: ibdknox: I think source maps are huge, but unfortunately (fortunately?) I have gotten so used to debugging the compiled JS that I don't need them anymore

15:11 ibdknox: I think that might be why they don't get built

15:12 ibdknox: emezeske: someone will

15:12 emezeske: ibdknox: I know there are a couple people on it

15:12 ibdknox: emezeske: we need them, even if you are used to it at this point

15:12 it'd still be faster

15:12 emezeske: ibdknox: Yeah, I really really want them

15:12 ibdknox: oh damn

15:12 emezeske: ibdknox: But not quiiiiite badly enough to do it myself

15:12 ibdknox: I forgot to bring up analyzer and column stuff on the dev list

15:13 emezeske: haha inertia's a bitch ;)

15:13 emezeske: ibdknox: aye.

15:14 ThatOneGuy: Well, I don't care if this theoretical library uses some goog.dom tools under the covers or something

15:14 ThatOneGuy: I just think that cljs could lend itself to a new way of dealing with the DOM that hasn't been explored in other languages

15:14 ThatOneGuy: So just writing a thin wrapper for an existing JS lib will not take advantage of things unique to cljs

15:14 ThatOneGuy: I see

15:15 uvtc: Hi #clojure. I was just looking at https://github.com/yogthos/yuggoth/blob/master/src/yuggoth/models/db.clj#L29 . How does this work? It seems to me that

15:15 ThatOneGuy: yeah I guess so. Well you could use really low level tools to manipulate the dom and build up the abstraction in cljs.

15:15 uvtc: `res` would be undefined.

15:16 emezeske: ThatOneGuy: I guess I really don't care how it's implemented, I just object to more "wrappers"

15:17 hiredman: uvtc: with-query-results is a macro

15:17 emezeske: ThatOneGuy: jayq is a wrapper, and it's super practical, but when you use it you are basically just using JS

15:17 hiredman: uvtc: it binds the results of the query to res

15:17 (ind the body)

15:17 uvtc: hiredman: Ah. Thank you. Will go look at the docs for with-query-results.

15:18 ThatOneGuy: well a good wrapper leverages the underlying system into a process that is more idiomatic to the host language

15:19 emezeske: I guess it's just a nit of terminology; to me a wrapper only "idiomizes" things in a very very basic way, if at all

15:19 E.g. a wrapper is close to a 1:1 mapping

15:19 But I suppose the definition of "wrapper" is open

15:20 ThatOneGuy: Yeah I think it is a very broad term in CS. cause you could think of korma as a wrapper because it wrapper SQL scripts into idiomatic clojure

15:21 wraps*

15:21 * emezeske repeats the term "wrapper" out loud until it turns into a meaningless sequence of meat-flapping sounds.

15:22 acheng: (love the meat-flapping sci fi short story)

15:23 emezeske: acheng: They're made of MEAT!

15:24 hiredman: we just need a big route! macro that wiresup events and dom "I want events from X to go to Y" and "I want dom element A to be a child of dom element B"

15:24 ThatOneGuy: rapper can be applied in the same way ;P

15:25 stuartsierra: Hey everyone, let's play "name that function"!

15:26 I need a name for a function that will 1) scan source code directories for files that have changed, 2) unload all the namespaces which have changed, and 3) reload those namespaces.

15:27 uvtc: hiredman: Ah, I see; it's a "with-something-something", which usually means that it's going to set up something for you, then and then close it up once you leave the scope of the "with-".

15:27 ThatOneGuy: I would break that up into three functions

15:28 uvtc: hiredman: Got distracted a little there, looking up acheng 's "made of meat" sci fi clip. :)

15:28 * amalloy has a shirt that says "I'm made of meat!"

15:29 piranha: can somebody please tell me why this logs false on (satisfies? Map (google/make)): https://github.com/piranha/cj-locations/blob/master/src/google.cljs#L9

15:29 eggsby: what's the easiest way to spit out a list of similar clojure maps as a csv?

15:30 nDuff: amalloy: Where's that from? (My significant other thinks cannibalism is hilarious)

15:30 emezeske: amalloy: Your shirt lies! I know you're at least half machine.

15:30 stuartsierra: ThatOneGuy: it already is 3 functions. I want a short, easy-to-type name for the whole process.

15:31 amalloy: http://www.topatoco.com/merchant.mvc?Screen=PROD&Store_Code=TO&Product_Code=QW-MEAT&Category_Code=QW-SHIRTS

15:31 piranha: stuartsierra: (reload-changes)? :)

15:31 arohner: reload-modified-files

15:32 ThatOneGuy: I would cycle the scanning of directories as a daemon that would signal a reload of the namespace

15:32 brb lunch

15:33 llasram: OOC, how does one reload just changed namespaces? Don't other namespaces still have references to the old namespace?

15:33 stuartsierra: I'm aiming for a single word. Thinking of "ready" as in "ready your troops."

15:33 llasram: One builds a DAG of namespace dependencies!

15:33 llasram: Ah! Of course :-)

15:33 stuartsierra: I've already done that.

15:33 emezeske: stuartsierra: Just one word? (watch)

15:34 stuartsierra: emezeske: I'd use 'watch' if it were an on-going process, but it's just a single step for now.

15:34 emezeske: stuartsierra: Oh!

15:35 In that case, I nominate (freshen)

15:36 stuartsierra: emezeske: not bad

15:36 jcrossley3: stuartsierra: sweep?

15:36 llasram: (rerequire)

15:37 S11001001: llasram: worried about macro expansions?

15:38 hiredman: "bad-idea-that-is-going-to-break-someone's-protocol-and-defrecord-code"

15:41 jcrossley3: refresh

15:43 stuartsierra: hiredman: I'm dealing with that. You still have to be careful.

15:43 jcrossley3: 'refresh' is good

15:45 hiredman: stuartsierra: how? by scaning code for "defprotocol" and "defrecord" ?

15:45 stuartsierra: No, but with the dependency graph I can be sure that 'defprotocols' are reloaded before any 'defrecords' that implement them. You still have to be careful not to hang on to old instances.

15:46 hiredman: I suppose you can call that dealing with it if you like

15:47 stuartsierra: The problem with reloading protocols gets into how the JVM loads dynamically-generated classes. That's beyond the reach of a library like this.

15:48 hiredman: *shrug*

15:49 Frozenlock: Is there a function to transform a map to a vector?

15:49 hiredman: we already get people wandering in here wondering why their code breaks based on the various reloading middle ware for ring

15:49 llasram: Frozenlock: have you tried `vec`? :-)

15:50 stuartsierra: hiredman: That's one reason I'm working on this. I want to document and encourage development patterns which are reload-friendly.

15:50 Frozenlock: llasram: Oh.. no... I was under the impression that vec and [] where the same thing.

15:51 amalloy: Frozenlock: vector is []

15:52 stuartsierra: The naive approach (just reload files on each request) doesn't work.

15:53 By the way, I'm going to go with' refresh'. Thanks, jcrossley3.

16:00 jcrossley3: stuartsierra: welcome :)

16:00 wilfredh: I'm looking for a way of reading the properties set in project.clj. Specifically, I'd like to pull out the version passed into defproject. Any pointers?

16:01 muhoo: what purpose would the construct @(promise) serve, at the end of a quoted form?

16:01 S11001001: wilfredh: there is a java system prop that lein sets for version

16:03 amalloy: muhoo: that sounds like "block forever"

16:03 xeqi: wilfredh: there was a recent discussion about that on the mailing list - https://groups.google.com/forum/?fromgroups#!topic/leiningen/7G24ifiYvOA

16:03 Raynes: S11001001: That's if you run the code with lein.

16:04 S11001001: good luck to anyone trying to pick up project.clj contents without project.clj present

16:04 clojurebot: Just 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:04 S11001001: anyone anyone anyone

16:04 Raynes: wilfredh, xeqi: What I do is have a hook in project.clj that spits the version out into a file whenever I run… something.

16:04 pbostrom: llasram:, stuartsierra:, I think you both have sufficiently answered my question, but here is what I really intended: https://gist.github.com/3250162 So I don't think I can guarantee against the "do not want" case. I'm wondering what would be a good way to tackle this problem. I think I want some sort of agent-like queue ref of side effect functions that gets updated inside the dosync, but I'm not sure

16:05 Raynes: I did that because I needed to get the version in a war file, so I spit it into resources.

16:06 wilfredh: S11001001, xeqi, Raynes: thanks :)

16:09 S11001001: you can also play little games with the aot

16:21 duck11231: Raynes: do you have that code somewhere? I have a need for that as well

16:21 Raynes: duck11231: https://github.com/geni/geni-gedcom project.clj

16:21 duck11231: nice, thanks

16:23 melipone: hello

16:24 acheng: melipone!

16:25 melipone: I am trying to read an object serialized by a java program but I get a classcastexception error. Any idea?

16:25 acheng: both ends use the same compiled version?

16:26 melipone: acheng: oh, how can I check that?

16:27 acheng: sorry. i only have questions.

16:29 duck11231: melipone: try cleaning

16:30 melipone: I am using clojure 1.3 on a 64-bit machine. Is there a problem calling a java program compiled for 64-bit within clojure?

16:32 duck11231: cleaning?

16:32 acheng: melipone: lein clean ?

16:32 melipone: acheng: thanks! TGIF

16:32 duck11231: lein clean. It might not do anything, but can't really hurt

16:33 amalloy: i think it hurts technomancy's feelings anytime you run lein clean

16:34 duck11231: It's nice how well it works without needing to clean, but I still run into issues every now and then where it helps

16:34 acheng: melipone: maybe also clean and compile the java program and regenerate the serialized thing? (start with a clean slate)

16:34 duck11231: usually only whaen I'm moving code around

16:36 llasram: pbostrom: Totally an abuse of agents, but: https://gist.github.com/3251293

16:42 acheng: melipone: if the clojure side depends on the java program, i'd clean/compile the java side first

16:42 pbostrom: llasram: thanks, that looks like what I want

16:45 melipone: acheng: my java program is actually in a jar that I load from my local mvn repository.

16:46 acheng: the serialized object is from another program which might be a 32-bit program

16:47 acheng: I am able to read this serialized object fine though outside of clojure by this other 64-bit program

16:48 acheng: it's just when I call the 64-bit java program within clojure that it has problem reading the object

16:49 hiredman: melipone: serialized in what sense?

16:49 jvm serialized?

16:49 melipone: hiredman: yes

16:49 hiredman: and what error are you seeing?

16:50 melipone: hiredman: parse.classify=> (new EvaluateModel learner ds) ClassCastException cannot assign instance of java.util.ArrayList to field weka.core.Attribute.m_Values of type weka.core.FastVector in instance of weka.core.Attribute java.io.ObjectStreamClass$FieldReflector.setObjFieldValues (ObjectStreamClass.java:2063)

16:50 hiredman: melipone: there is no such thing as compiling a jvm program for 64bit, java bytecode is java bytecode, and the jvm is the jvm

16:51 melipone: that is a type error

16:51 melipone: hiredman: here learner is a filename and EvaluateModel should read this object from the filename

16:51 hiredman: why is javac different then?

16:52 hiredman: melipone: most likely you serialized a type, then changed the type, and are trying to deserialize it

16:52 you have different versions of the type

16:52 so in one version a field is one type, and in another, another type

16:52 melipone: hiredman: hmmmm... okay

16:53 llasram: Using different version of weka on the generating and consuming ends?

16:53 hiredman: yeah

16:53 melipone: bingo!

16:54 okay, thanks, and have a nice weekend!

16:56 SegFault1X|work2: Is Ring compatible with websockets?

16:56 hiredman: ring is for http, websockets are not http, so...

16:57 SegFault1X|work2: Oh, well that answers that.

16:57 duck11231: aleph supports websockets, but that's not quite the same

16:59 dgrnbrg: hi clojurians

17:01 muhoo: has anyone found/made a hack to download infoq clojure presentations so they can be watched offline?

17:01 the slides i got, it's the video i'd like to have

17:01 llasram: off... line. What is that?

17:02 dgrnbrg: I am using lein at work w/ custom plugins that are deployed from an internal maven repo. I have been putting that repo & the plugins into everyone's profile.clj, but that causes the scary message that the build isn't repeatable due to the repository being in the profiles.clj. Is there a best practice for deploying plugins in an organization? Or a way to suppress lein's warnings?

17:03 emezeske: dgrnbrg: Plugins that are just for developer productivity make sense in user profiles. If the plugins affect the build, though, they should be in the project.clj.

17:04 dgrnbrg: emezeske: The plugins are for developer productivity -- a bunch of lein templates to prepopulate common modules we make, and to do various integration tasks outside of the project

17:04 the lein templates are the biggest part, though

17:06 emezeske: I see, so I guess the problem is just the warning about maven repos in user configs

17:06 dgrnbrg: emezeske: exactly--is there a solution to that?

17:07 or a way to add a repository that's only used for searching plugins?

17:07 muhoo: *cough* lein local-repo? *cough*

17:07 emezeske: I don't know.

17:08 dgrnbrg: muhoo: that doesn't really fit my needs

17:09 llasram: Hmm, I think the lein warning is overly-broad

17:09 It gives that warning if any user profile contains a repository, even a profile which is never applied to the build

17:09 dgrnbrg: maybe i'll write a feature for lein to stop that warning by giving it a special plugins-only repo

17:09 like :plugin-repositories ...

17:10 llasram: Well, that still makes it unrepeatable if the build depends on the plugin :-)

17:11 dgrnbrg: yeah, but deal ;)

17:11 how else can i distribute templates?

17:11 llasram: No, no. What I'm saying is that I think you're doing it right right now

17:12 dgrnbrg: ah

17:12 Well I'll stick with it then

17:12 is there a way to make the plugins use the latest version?

17:12 in the profiles.clj, so that the users don't need to keep changing their profiles.clj?

17:14 llasram: I think that lein should only complain when you [something] with a user profile with a repository. The [something] part is hard though...

17:15 technomancy: plugin-repositories seems reasonable

17:15 llasram: dgrnbrg: You can use a version range http://docs.codehaus.org/display/MAVEN/Dependency+Mediation+and+Conflict+Resolution#DependencyMediationandConflictResolution-DependencyVersionRanges

17:16 dgrnbrg: I understand they're generally bad news for maven dependency resolution, but I think it'd be okay for plugins, isolated in their own profile

17:17 dgrnbrg: i'm not isolating the plugins, but i have to work with a lot of non-devs using clojure

17:17 so they'll probably be in :user

17:18 so I can put the coordinates as [my-plugin "[1.0.0,)"]?

17:18 i never knew that the convention of using "1.0.0" was a soft dependency

17:19 llasram: I believe that will work. And yeah, where else is saying what looks like "use exactly this version" considered a "soft" dependency? :-)

17:20 dgrnbrg: llasram: in that link you pointed out

17:20 it says "[1.0.0]" is a hard dependency, but "1.0.0" is just a recomendation

17:20 technomancy: dgrnbrg: feel free to open an issue for :plugin-repositories if you like

17:20 llasram: dgrnbrg: Right. I was just saying it's very unexpected vs. the way everything else I've seen works

17:21 dgrnbrg: llasram: yeah

17:21 technomancy: will do :)

17:21 pbostrom: SegFault1X|work2: with aleph you can define a server with both ring HTTP handlers and websocket handlers, so your websocket handler can access the same cookies and sessions as the HTTP handlers

17:23 hiredman: technomancy: I want to be able to open urls at point from clojure-mode

17:24 ThatOneGuy: clj-http

17:25 duck1123: hiredman: aside from something like M-x browse-url-at-point ?

17:26 hiredman: oh wait, no wonder that doesn't work

17:26 this emacs isn't even on this machine

17:26 technomancy: haha

17:26 duck1123: lol

17:26 hiredman: the dream dies

17:27 technomancy: emacsclient over reverse SSH tunnel

17:27 hiredman: have to write an sqs client in emacs, and have it send links over sqs to my laptop

17:27 duck1123: use mozrepl and browse-url-gnome-moz

17:27 technomancy: also: asciiart QRcodes

17:27 then hold a mirror in front of your screen

17:27 hiredman: duck1123: why would I have gnome, or anythign like X?

17:27 technomancy: haha

17:28 technomancy: or wear mirrorshades and have the webcam read the qrcode in the reflection

17:28 llasram: hiredman: 100% text-only console?

17:28 hiredman: I could do mirrorshades

17:29 llasram: on the headless machine running my vm(s) that I ssh in to? of course

17:29 llasram: oic

17:29 hiredman: headless machine/foot rest

17:32 llasram: Actually, now that I think about it, Conkeror works that way, and I have no idea how

17:33 stankley: Hey guys, I've got a question about how to best accumulate a value

17:33 gfredericks: with reduce!

17:33 stankley: I'm reading from a serial port, and with every character a function gets called

17:33 I can only set the function to be called on a call

17:33 llasram: I do have Conkeror installed on both machines involved, but when I'm ssh+emacsclient'd into the session on one machine, browse-url-at-point causes my local browser to open the URL. Huh

17:34 stankley: Should I just use a mutable data structure?

17:34 I want to read until a newline, then call a function on the accumulated value

17:34 Completely new to Clojure, but want to solve the problem the Clojure Way

17:36 I tried using a transient, and calling a function with accumulated value upon newline

17:36 But no idea if that's the right direction or not

17:36 hiredman: definitely do not use a transient

17:36 stankley: That's what I figured

17:36 Because you can only realize value once per variable name

17:37 amalloy: (f (take-while (complement #{\newline}) (repeatedly read-from-serial-port)))?

17:37 hiredman: amalloy: it soulds like he doesn't have a "read-from-serial-port", he can just say "when there is input, run x"

17:38 but the latter combined with a queue could be turned in to the former

17:38 amalloy: oh, you're right

17:38 stankley: exactly, all I get is a function called on each character read

17:38 so I just pass an anonymous function to be called on each character

17:39 Thanks for the help by the way, amalloy

17:39 amalloy: yeah, sounds like a LinkedBlockingQueue or something. put characters on from your callback, and create a sequence reading them

17:39 llasram: LinkedBlockingQueue? callback pushes characters in, lazy-seq polling them out?

17:39 heh,

17:40 hiredman: you could possibly even make it a transferqueue http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/TransferQueue.html

17:41 amalloy: hm. what for?

17:42 hiredman: dunno, but they are newish and someone should kick the tires

17:42 http://tech.puredanger.com/2009/02/28/java-7-transferqueue/

17:42 stankley: hiredman: lol

17:45 llasram: Cool, sounds like that's the strategy I'm going to go with, thanks.

18:02 antares_: cemerick: JFYI, I'd be happy to review the draft ;)

18:03 akhudek: are there plans to build out the clojure.browser namespaces?

18:04 gerunddev: cemerick: Am I missing search support in clutch?

18:04 cemerick: Would it be a bad idea to use get-view* directly and provide my own path segement with _search instead of _view?

18:08 CouchDB search might be Cloudant specific, but perhaps someone else has run into this with clutch... I'm trying to hit _design/mydesign/_search/mysearch?q=text

18:09 polypus: ~ping

18:09 clojurebot: PONG!

18:09 gerunddev: Clutch's get-view function builds it as _design/mydesign/_view/myview, but has a private function called get-view* which takes a path segment param I could build myself

18:10 So I'm currently using #'com.ashafa.clutch/get-view*

18:12 The Java voice in my head is saying "They made it private for a reason!" and the Python voice is saying "What's private?" :)

18:13 treehug: why is add-classpath deprecated and what should I use instead to load jar files at "runtime"?

18:13 muhoo: what's the workflow to test a lein plugin? do i really have to build the plugin jar, install it, then run lein? or is there another way?

18:15 akhudek: whoa

18:15 the goog.editor.SeamlessField produces some unexpected html

18:16 hitting enter in a line of text seems to produce divs, not br tags

18:17 hyperboreean: hi guys, I have a lein project in which carmine is specified as a dependency - I fail to import the taoensso/carmine into the repl, can anyone help? (require '[taoensso/carmine :As r])

18:17 muhoo: hyperboreean: try :as instead of :As ?

18:18 hyperboreean: muhoo: that was a typo, sorry, I did try with :as

18:18 muhoo: hyperboreean: make sure the dependency is in your project.clj ?

18:19 hyperboreean: muhoo: [com.taoensso/carmine "0.9.3"] this is what I have in my dependencies entries

18:19 I also ran lein deps

18:19 muhoo: try taonesso.carmine in your require, no /'s

18:19 technomancy: treehug: pomegranate is the kosher way to do it, but in general it's Fraught with Peril

18:20 amalloy: someone squat that library name on clojars

18:21 hyperboreean: muhoo: CompilerException java.lang.RuntimeException: No such namespace: taoensso, compiling:(NO_SOURCE_PATH:1) :(

18:22 treehug: technomancy: that project looks perfect for the job at hand, what things can go wrong though?

18:22 Raynes: muhoo: Might help if somebody actually knew the namespace of the library, I think.

18:22 Oh, that is the actual namespace.

18:23 technomancy: treehug: depends on the context. if it's just going to be run via Leiningen or an uberjar you'll be fine. you can run into issues if it's embedded in another context like tomcat or an IDE IIUC

18:23 Raynes: (require '[taoensso.carmine :as r])

18:23 hyperboreean: Raynes: that got me thinking, it's actually . instead of /

18:23 thanks!

18:23 Raynes: Or in ns (:require [taoensso.carmine :as r])

18:23 treehug: ah ok. thanks

18:23 hyperboreean: muhoo: thank you too

18:35 muhoo: oh cool, i got it .lein-classpath

19:12 ToxicFrog: This is completely bizarre

19:13 xml/parse takes several minutes to process even small files, but never goes above 5% CPU usage or so

19:19 gtrak: hrm... where do I put a web.xml for lein-ring to pick up, that I can also programmically pick up with code to start a jetty from -main?

19:21 weavejester: gtrak: In your resources, perhaps? What were you planning on doing with your web.xml?

19:21 gtrak: it's a hybrid of jax-rs servlets and ring handlers

19:22 I was also considering a way to create a ring handler that can delegate to servlets, but that looks hard

19:25 weavejester: gtrak: Ah, I see

19:26 ToxicFrog: This is painful :( I'm going to try 1.3 and see if it works there.

19:30 Nope, still broken in 1.3

19:30 What the hell is going on here

19:31 gtrak: ToxicFrog: tried profiling?

19:31 ToxicFrog: gtrak: not yet; what's the recommended tool?

19:32 All I can think is that it must be spending a huge amount of time in iowait, but the file it's loading is tiny

19:32 gtrak: I use jvisualvm

19:32 it comes with your jdk

19:36 amalloy: are you using clojure.xml? i wouldn't recommend it

19:37 ToxicFrog: amalloy: I am

19:37 Or trying to

19:37 francis: I'

19:38 amalloy: clojure.data.xml has got to be a better option, at the very least

19:38 ToxicFrog: It's kind of hard when it takes several minutes (at effectively no CPU usage, so what the hell is it doing?) to parse even a trivial test file

19:38 ivan: downloading trojaned DTDs

19:39 ToxicFrog: gtrak: it may come with some JVMs but it apparently doesn't come with this one :/

19:39 amalloy: clojure.xml is just so old and crusty. most of the file is from 2008

19:39 a few lines have been updated to 2009 or 2010

19:39 gtrak: ToxicFrog: ah, hrm, maybe just oracle JDK, but you can download the program anyway

19:40 francis: I'm working on a 4clojure problem, however I'm rather confused as to a question. Specifically http://www.4clojure.com/problem/137 test case 5

19:40 ToxicFrog: gtrak: yeah, I only have openjdk installed here

19:41 francis: The test case says that the answer for converting to base 42 is a sequence of integers. However, my understanding it that base 42 uses chars to represent #s

19:41 gtrak: ToxicFrog: looks like the site is being DoS'd :-)

19:42 ToxicFrog: francis: it might expect a sequence of numbers in the 0..41 range rather than trying to come up with 32 chars to supplement the digits

19:43 amalloy: you're conflating number bases with textual representation

19:44 francis: amalloy & ToxicFrog: thanks, I belive I know what to do now

19:45 ToxicFrog: amalloy: is data.xml part of core now, or is it a 3PL?

19:45 amalloy: no; no

19:46 it's part of contrib

19:46 ToxicFrog: Aah

19:46 ...where?

19:47 Also, is it this? http://clojure.github.com/data.xml/

19:50 * ToxicFrog goes to install jvisualvm, because he wants to know what clojure.xml could possibly be doing

19:52 gtrak: weavejester: I think I figured it out, jetty has a setResourceBase thing that can deal with classpath resources apparently

19:53 and setDescriptor points to the web.xml file

19:53 ToxicFrog: real 2m29.983s user 0m7.452s sys 0m0.472s

19:53 what

19:54 gtrak: ToxicFrog: try the profiler or sampler tab, sampler's faster

19:59 amalloy: i don't know what you're doing, ToxicFrog, but for me a simple xml/parse on a tiny file is instantaneous

20:00 you probably have something unrelated in your benchmark causing problems

20:00 hiredman: amalloy: mostly likely calling it on string

20:00 amalloy: yes, he says he is

20:00 hiredman: he should read the docstring for parse then

20:01 amalloy: okay...

20:02 hiredman: xml/parse doesn't take a string of xml, it takes a string uri or inputstream

20:02 amalloy: indeed, if you've been following along he's passing it a uri

20:02 and he's complaining that it's very slow

20:02 hiredman: amalloy: I haven't been following along

20:05 gtrak: hrm, why does lein's resources-path not apply in dev?

20:06 i think src/main/resources works from tests in maven

20:07 technomancy: :resource-paths

20:07 gtrak: ah jeez

20:07 wait, but dev-resources-path seems to work

20:07 ToxicFrog: Well that was fun

20:08 And by "fun" I mean "the profiler at all of my memory and crippled my laptop"

20:08 gtrak: ToxicFrog: :-)

20:08 sampler is faster

20:08 technomancy: gtrak: on lein1?

20:08 gtrak: yea

20:08 ToxicFrog: gtrak: I didn't even get to the point of getting to choose between those

20:08 gtrak: oh wow

20:09 amalloy: ToxicFrog: it sounds like every program you run is very slow. you should get your computer looked at, not clojure.xml

20:10 ToxicFrog: amalloy: ...how the hell do you arrive at that conclusion?

20:14 gtrak: technomancy: i'm looking at my classpath system property and it looks like it should work, so i guess not a lein problem

20:15 oh damn, it sees it now...

20:17 ToxicFrog: well it should start up at least, maybe you were thrashing swap to begin with

20:18 ToxicFrog: gtrak: yeah, I mean, it started, it did the calibration, and then in the process of finding running JVM apps it ran into swap and everything went to shit

20:18 emezeske: ToxicFrog: How much RAM do you have, out of curiousity?

20:19 ToxicFrog: between lein, IDEA, chrome, and a bunch of other stuff I must have been pushing swap to begin with

20:19 emezeske: 3GB.

20:19 gtrak: ! not enough these days

20:19 emezeske: That is a bit on the low side for a dev machine

20:19 ToxicFrog: Yeah

20:19 gtrak: 8GB is like $20

20:19 casion: 3gb is on the 'decade ago' scale for a dev machine

20:20 ToxicFrog: gtrak: this laptop tops out at 4GB

20:20 gtrak: ah

20:20 ToxicFrog: So the cost to upgrade is not "the cost of two 4GB SODIMMs" but "the cost of a new laptop", which is out of my budget right now

20:20 technomancy: 33% boost wouldn't hurt though

20:21 gtrak: if it's 3GB, it's probably also windows 32-bit

20:21 ToxicFrog: 64bit linux, actually.

20:21 gtrak: oh ok

20:21 * technomancy still works comfortably in 4GB

20:21 technomancy: I don't use an IDE though

20:22 gtrak: eclipse is relatively a hog on my 4GB c2d laptop

20:22 * Bronsa_ rarely even uses more than 2GB

20:22 ToxicFrog: technomancy: yeah, I just have to weigh the cost (and pain in the ass, since the second SODIMM slot requires disassembling most of the laptop to access) of that against the fact that once I graduate and am employed I will probably be getting a new laptop anyways

20:22 * gtrak is using 7.5GB at the moment.. .hmm

20:22 emezeske: If you are using a modern operating system, you are using all of your RAM all the time

20:22 gtrak: how is it even possible

20:23 ToxicFrog: Ok, so the jvisualvm profiler is unhelpful; it reports the program as taking ~3.5s to execute

20:23 emezeske: Even if only part of it is being used by programs you're running, the kernel is caching the filesystem there

20:23 ToxicFrog: emezeske: yes, I'm pretty sure everyone here is well aware of the block cache and means "used by applications" for "used".

20:23 gtrak: Mem: 8102524k total, 7459824k used, 642700k free, 203932k buffers; Swap: 8242284k total, 172328k used, 8069956k free, 3075332k cached

20:23 effing silly

20:23 technomancy: http://www.linuxatemyram.com/

20:23 emezeske: ToxicFrog: I'm just saying, for people that are only using a small amount of ram, they are still getting a benefit from having lots of it

20:24 ToxicFrog: "using"

20:24 hiredman: of the top 10 processes ordered by memory, 8 are java processes and 1 is firefox

20:24 ToxicFrog: gtrak: ok, so of that 7.5GB "in use", 3GB is the block cache and 200MB is buffers

20:24 So you're at a bit over 4GB

20:24 hiredman: (the last is kernel_task)

20:24 ToxicFrog: I wonder if strace will be any more helpful here

20:24 gtrak: ahh ok

20:24 ToxicFrog: like maybe it's doing a separate read() for each byte in the file or something else completely insane

20:25 gtrak: if it's low CPU it sounds like an IO blocking, yea

20:25 I think context-switches still show up as cpu usage

20:25 ToxicFrog: Yeah, I just have no idea what it could possibly be

20:25 emezeske: ToxicFrog: How big is this xml file?

20:25 ToxicFrog: It's a single-threaded program, the only IO it does explicitly is reading a single 30k XML file

20:26 emezeske: Hmmph.. At 30k, it doesn't even seem like something ridiculous like a read() per byte would cause that bad of a slowdown

20:26 Crazy.

20:28 * gtrak closes eclipse

20:28 ThatOneGuy: smart move

20:29 gtrak: it was chrome, really, closing eclipse got me down to 6.9, with chrome got me down to 4439184k used

20:38 casion: anyone know of an example of loading a wav file using clojure?

20:39 gtrak: casion: depending on what you're doing, you might want to check out overtone

20:39 casion: gtrak: I use supercollider directly daily

20:39 gtrak: awesome

20:39 casion: I'm more curious about it as an exercise in clojure

20:40 since I'm still learning

20:40 riley526: Would anyone recommend Friend (https://github.com/cemerick/friend) as a good authentication library for a Clojure noob? Other suggestions?

20:40 gtrak: casion: I've played briefly with the java sound APIs, I find them quite painful

20:40 but check out this: http://www.jsresources.org/examples/

20:40 casion: I've managed to open the file and parse the header, but reading sample data correctly eludes me

20:41 hiredman: riley526: I hear friend is good, but if you actually try and use it, the examples given in the readme, etc, don't work

20:41 so I dunno

20:41 gtrak: casion: that's all I got for you, unfortunately

20:41 have a good weekend guys

20:41 emezeske: riley526: I have used friend successfully, for what it's worth

20:42 hiredman: like, if you want to use friend, you have to crack open the source and figure out "oh this option here isn't being given a default value correctly" and work that all out

20:42 cemerick: riley526: Yeah, my bad on the error in the current docs. If you give it a roll and hit a snag, you can fall back to looking at the example. https://github.com/cemerick/friend/blob/master/test/test_friend/mock_app.clj#L100

20:42 casion: gtrak: thanks :)

20:43 riley526: cemerick: Oh, perfect. I'll try it out and see what happens. Thanks.

20:49 ToxicFrog: Found the problem!

20:49 gtrak, emezeske: that long delay is it downloading the DTD.

20:49 gtrak: ah.....

20:49 silly validation

20:49 you can probably turn that off

20:50 emezeske: ToxicFrog: awesome . O_o

20:51 ToxicFrog: emezeske: I'm on slow internet here and the W3C's servers are pretty awful to begin with

20:53 gtrak: AFAICT, yes, but only by ignoring clojure.xml entirely and using the Java XML API directly (and setting half a dozen poorly documented parser behaviour flags just right)

20:55 death to xml

20:57 emezeske: death to xml!

21:00 ToxicFrog: real 0m3.905s

21:00 That's a lot more acceptable

Logging service provided by n01se.net