#clojure log - Feb 11 2012

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

0:00 seancorf: $google clojure irc log

0:00 lazybot: [#clojure log - Feb 10 2012] http://clojure-log.n01se.net/

0:00 seancorf: heh

0:02 muhoo: did you solve your math.numeric-tower problem?

0:03 i would have expected the dependency to look like [[org.clojure/math.numeric-tower "0.0.1"]]

0:06 Raynes: seancorf: http://lazybot.org/logs/#clojure/2012-02-10 :D

0:08 muhoo: seancorf: that worked, thanks!

0:13 seancorf: yay! :)

0:13 muhoo: here's what confused the hell out of me

0:13 the namespaces make no sense

0:13 (require 'clojure.math.numeric-tower)

0:13 but (add-dependencies '[[org.clojure/math.numeric-tower "0.0.1"]])

0:13 so, why org.clojure/math.numeric-tower in one, and clojure.math.numeric-tower in the other?

0:14 seancorf: it's just the pattern used for (new) contrib libraries

0:14 you have org.clojure/clojure but that contains clojure.set, clojure.java.io, etc

0:15 Raynes: muhoo: Also, namespaces are not what maven artifacts are named after.

0:16 seancorf: and you have congomongo as the artifact but you require somnium.congomongo so there's no direct correlation between artifact names and namespaces

0:16 muhoo: ah. different naming conventions.

0:17 makes sense.

0:18 * Raynes is taking refheap down for a moment to do some updates.

0:18 seancorf: clojure core and contrib is in the org.clojure group with a variety of artifacts, technically congomongo has congomongo/congomongo as its full name

0:18 but, yeah, the whole maven artifact thing is confusing if you're not used to it (as i wasn't before i started doing clojure)

0:19 muhoo: yep, it's one of those things. thanks for explaining it.

0:19 it's not too surprising after some thought. debian package names for language libraries often bear little resemblance to the actual namespace path inside the language itself.

0:21 Raynes: seancorf: What do you think of monger?

0:25 seancorf: Raynes: we use CongoMongo at World Singles so I haven't looked at monger... CongoMongo does exactly what we need: a thin wrapper around the MongoDB Java driver :)

0:25 Raynes: seancorf: I keep forgetting that pretty much everything you ever do is the result of something you needed at work.

0:25 :p

0:26 But yeah, monger looks neat. It looks 'prettier', but it also looks more macro-driven and heavy.

0:27 antares_: Raynes: only query DSL (which is not the only way to query, regular finders are also there) uses macros. Take a look at the implementation, it is very straightforward.

0:28 Raynes: antares_: In that case, excellent.

0:28 antares_: Are you the Monger guy?

0:28 antares_: Raynes: the goal wasn't really to make it pretty but to make it feature complete and integrated with joda time, clojure.data.json and so on. I don't think monger will have many more DSLish features except for a fixtures framework.

0:28 Raynes: I am

0:29 Raynes: and each part is opt-in. We don't force you to use joda time integration, we don't assume it is available in other namespaces, we don't load query DSL automagically, etc.

0:29 Raynes: antares_: I'd like to move RefHeap to monger, if only just to try it out (I'd be very unlikely to not use my changes though), but the snapshots kind of kill that for me. Could you perhaps release some alphas/betas/RCs or something? Just something solid that I can depend on? I don't care that it be totally API-stable and complete, just that I have something that isn't going to change right underneath me.

0:29 * Raynes is sorry if he made that sound bad.

0:29 Raynes: I should have disclaimed that I hadn't actually looked at the implementation of things.

0:29 antares_: monger.core, monger.collection and monger.gridfs probably give you roughly what congomongo has, w/o a single macro

0:30 Raynes: that sounded OK :)

0:30 no worries

0:31 Raynes: another person asked for a non-snapshot release today: https://github.com/michaelklishin/monger/issues/7 :)

0:31 Raynes: so, I think I will do a beta1 now

0:31 Raynes: That sounds great! I'll move RefHeap to it in the morning.

0:32 (God bless Saturday)

0:33 antares_: I've got this thing embedded in me from work: we never snapshot things at work ever. We always release alphas or betas. It's so deeply embedded that I almost always do it in my own projects now.

0:34 antares_: Raynes: ok. I am releasing validateur that monger depends on and is currently a snapshot only

0:34 Raynes: I can, of course, see the benefit of snapshots early in development though. No sense in releasing half-done or non-working crap, but sometimes you do want to put that out there.

0:34 antares_: or maybe I should just completely remove this dependency. It is a validations library that monger can work without.

0:35 Raynes: monger was started in early August

0:35 Raynes: so it is very close to 1.0, the doc site is not ready yet.

0:35 Raynes: Yeah, I saw it ages ago.

0:36 antares_: I'm going to have fun with this. :>

0:37 muhoo: whenever i read anything about mongo, i keep hearing a robotic voice in th eback of my head saying "why don't you write your data to /dev/null? it will be very fast"

0:37 damn xtranormal.

0:37 Raynes: antares_: You're the travis-ci guy too, aren't you?

0:38 Man, you don't ever half-ass things.

0:38 I want to be like you.

0:38 But I like releasing things really quickly.

0:38 RefHeap took two weeks.

0:38 antares_: Raynes: I am

0:38 Raynes: I also have maybe a dozen of Clojure libraries for Neo4j Server, RabbitMQ, Web crawling and so on

0:39 and happen to maintain 3 Ruby AMQP clients :)

0:39 Raynes: Have you seen Jiraph?

0:39 antares_: no

0:39 Raynes: https://github.com/flatland/jiraph

0:39 antares_: is it something for jira? :)

0:39 Raynes: God no.

0:39 We wouldn't dare.

0:39 antares_: oh

0:39 sounds interesting, let me see the license

0:39 Raynes: amalloy: Is that README up-to-date?

0:40 * Arafangion was going to say that Jira's in Java, then he remembered that wouldn't matter here.

0:40 antares_: Raynes: jiraph looks very interesting, thanks for bringing it up

0:40 Raynes: antares_: EPLv1

0:40 antares_: We use this at work, so you can pretty much count on it being supported. :P

0:41 antares_: Raynes: it is embeddable, correct?

0:41 or accessible over the network? or both?

0:41 Raynes: Yes. It has a tokyo cabinet layer for backend storage.

0:43 amalloy: I'm going to put going over this README on my todo list for Monday, since it hasn't been changed since the partial rewrite.

0:44 antares_: Raynes: do you think it's OK for monger to depend on a library that is useful with it but is not a hard dependency in any way?

0:44 all my projects tend to integrate with one another but I can see why people may not like pulling extra jars

0:44 Raynes: If it is a problem for somebody they can always exclude it.

0:45 antares_: ah, right

0:45 I keep forgetting that with Maven-based tools you can do it

0:45 cool

0:47 Raynes: I really need to get my stuff on travis-ci, but that means I have to write tests...

0:48 I'm still not sure how to test something like RefHeap.

0:48 That's going to take some thought.

0:48 I think Noir has some nice test tools though. I'm just not good with testing I/Oish things.

0:48 muhoo: i like the way debian does it: required, recommended, and suggested, IIRC

0:48 Raynes: muhoo: How has your RefHeaping been going lately, btw?

0:48 Anymore problems with server lag?

0:49 muhoo: Raynes: naw, works great! it's now my go-to paste tool

0:49 Raynes: I'm assuming you're using refheap.el

0:49 I noticed. You got the 700th paste. With an error message...

0:49 muhoo: i just bound a key in emacs to refheap-paste-region

0:49 Raynes: :p

0:49 muhoo: most of my pasting is asking for help with stuff i can't figure out how to get working :-)

0:49 Raynes: Hah, I actually don't have any keys for my refheap Vim stuff. I get a strange thrill out of typing :Refheap

0:50 antares_: Raynes: just checking, to do a beta release with lein I need to change version to 1.0.0-beta1, lein pom, jar and push things to clojars, right? I don't I've done a beta release with lein before :)

0:50 only GAs and snapshot releases

0:50 Raynes: antares_: Yeah. Nothing special.

0:52 antares_: Raynes: 1.0.0-beta1 is up on clojars

1:06 rads: ibdknox: how do I know how to structure my code within the state machines? what should go in a transition vs the in/out functions for a state?

1:07 re: waltz

1:11 Raynes: antares_: You rock.

1:11 antares_: Raynes: I updated Neocons README to mention jiraph for people who need an embedded graph db. Great work.

1:11 Raynes: antares_: I can't take any credit for Jiraph. I've done very little work on it. amalloy and ninjudd get all the credit.

1:11 * Raynes will work on it more in the future, he expects.

1:12 antares_: hm, yeah, I meant "great work everybody who worked on it" :)

1:14 ibdknox: rads: transitions should be used to set and unset states, shouldn't really do much else

1:14 rads: in/out should do whatever interfac-y things you need to do

1:15 Raynes: ibdknox: When I get around to testing RefHeap, would you up for helping me out?

1:15 rads: in some of the examples, you use crate within the transitions

1:15 er, store

1:15 (which is fetch)

1:15 so you're updating remote state during the transition too?

1:15 ibdknox: getting state

1:16 think of transitions as the interface for your thing, whatever it is

1:16 what can you do with it?

1:16 rads: I see

1:16 ibdknox: Raynes: how can I help?

1:17 Raynes: ibdknox: I suck at testing websites and I/O. I expect that you don't.

1:17 ibdknox: Mostly I just mean help me out by answering questions and listening to long explanations of how things work so that you can explain the best way to test certain things.

1:17 Also, not tonight. Not tomorrow either. Eventually.

1:18 ibdknox: sure :)

1:18 Raynes: Great. :>

1:18 Or you can just write the tests for me. That works to. As a matter of fact, go do that.

1:18 ;P

1:21 antares_: Raynes: by the way, monger now has a mailing list: https://groups.google.com/forum/#!forum/clojure-monger

1:22 rads: ibdknox: thanks for the help, btw

1:22 * Raynes reiterates that antares_ never halfasses things.

1:23 ibdknox: rads: np :)

1:25 Raynes: antares_: Joined.

2:39 muhoo: ping

2:55 muhoo: Raynes: yo

2:56 Raynes: muhoo: https://refheap.com/paste/708 Just wanted to show you the better highlighting I just added. Notice that ns is highlighted the same as 'defn' (and other top-level things).

2:57 muhoo: nice. now how do i get that in clojure-mode.el ? :-)

2:58 Raynes: The color theme?

2:58 muhoo: (ns is not highlighted at all in clojure-mode, pfui).

2:58 Raynes: Well, this was a change to the pygments lexer.

2:58 I couldn't tell you how to fix the clojure-mode lexer. :p

2:58 muhoo: i kno, i'm being silly

2:58 your highlighting is better than that of my editor

2:58 Raynes: I never had problems with clojure-mode. :O

2:59 muhoo: oh it's great. at some point i'm going to have to learn how to edit modes.

2:59 Raynes: Also, for future reference, the color theme is a version of tomorrow-night-bright that I wrote for pygments.

3:01 muhoo: heh, it was a simple matter of customize-face. nice.

3:10 Raynes: muhoo: The Clojure highlighting in Pygments is getting pretty good with my recent changes, even if it is all one big regexfest.

3:12 muhoo: you've inspired me to edit the crap out of my customize-face stuff

3:12 i love this. i've got all my java stuff a different color from the builtins, from the macros, it's very nice.

3:13 makes reading clj a lot easier. since, because there's so little syntax, it's kind of hard to tell what's what without it.

3:15 * muhoo reads enlive_html.clj and starts to almost understand it

3:17 Raynes: muhoo: I'm going to try to move refheap to enlive soon.

3:17 muhoo: I expect suicidal tendencies though, so I might have to back down.

3:17 muhoo: "i'm not crazy, you're the one that's crazy, you're driving me crazy"

3:18 http://www.youtube.com/watch?v=LoF_a0-7xVQ

3:19 all i wanted was a pepsi. just one pepsi

3:19 ok, well i like hiccup because it's simple and i can read that source and understand most of it

3:20 it's like the difference between generating html or doing jquery js stuff. matter of taste and/or application i suppose

3:28 fliebel: Can we do Enlive in ClojureScript yet?

3:35 Raynes: fliebel: https://github.com/ckirkendall/enfocus

3:37 fliebel: Raynes: yay

3:43 cemerick mentioned cljs is now a regular lein dep, but where is it?

3:46 ok, org.clojure.clojurescript

3:52 Is the Clojure reader the same thing as the ClojureScript reader?

4:59 originalserver: I am selling dedicated servers in different countries, only windows xp, 2003,2008, seven! write who need them.

5:30 Guest11659: Hey. I have a script file which I run through (load-file "myfile.clj") through the REPL. However the REPL does not print out my (print-str "hello world!") just the result of a following calculation. How come?

5:30 err nevermind

6:59 dEPy: how do I run my project with leiningen? I specified my main clj in project.clj

6:59 but when I do "lein run" I get: Exception in thread "main" java.lang.NullPointerException (NO_SOURCE_FILE:1)

7:02 vijaykiran: dEPy: do you have a -main method in the clj ?

7:04 dEPy: oh.. stupid me :)

7:07 works now yea.. thanks

7:07 totally forgot about it O_o

7:13 vijaykiran: dEPy: np

7:43 pyr: are dev-dependencies accessible during lein test ?

7:44 jcidaho: Hi. Our project at work has been using Clojure for 2-3 months now, and we're pleased with it and impressed at how quickly the team have picked it up. We're currently embedded Clojure in our monolithic Java app, but now we're looking at web framework options. I've been searching round various forums etc. Any definitive choice atm? Any really good blog entry that nails it head on for where we are right now? I.e. Noir vs composure, enlive vs hiccup, clojuresc

7:44 clojurescriptone. There's a lot of stuff out there and it all looks quite good tbh. Currently playing with Compojure and Hiccup, quite impressed by that combo...

7:44 pyr: jcidaho: it fits a lot of needs

7:44 jcidaho: really depends on what you want to do

7:45 jcidaho: clojurescript doesn't really have a "framework" yet

7:45 though pinot comes close

7:45 if you think you would have been fine with sinatra in the ruby world

7:45 vijaykiran: pyr: yes, dev-deps are test deps

7:45 jcidaho: it's not a public facing app, but houses a rule engine that we want to expose for our users to see what rules are in place, and in future to comment, track, rule breaks etc

7:45 pyr: then compojure will be fine

7:46 jcidaho: Noir would seem to wrap composure - any driver for moving to that?

7:46 compojure sorry

7:46 vijaykiran: jcidaho: as pyr said, depends on what you want to build

7:46 pyr: vijaykiran: 'k, thx

7:47 jcidaho: could you clarify that a bit… Compojure is good for build X type apps vs something-else that isn't..

7:47 pyr: jcidaho: compojure and noir share a lot indeed

7:48 vijaykiran: compojure is "micro" framework not a full stack framework

7:48 noir is more comparable to framework

7:48 pyr: jcidaho: think sinatra vs rails, in a way

7:48 jcidaho: ok

7:48 pyr: jcidaho: if you're building something that can be easily manipulated in js on the frontend

7:48 which would be advisable for a non web facing app

7:49 then compojure might just do, you send out json from api endpoints

7:49 and let the frontend do its thing

7:49 jcidaho: make sense

7:49 vijaykiran: I built an internal app SPA - with backbone frontend and clojure backend

7:50 Raynes: jcidaho: Noir is probably your best bet.

7:51 Compojure is really minimal. Excessively so.

7:52 jcidaho: check it out some more - thanks

7:54 Raynes: antares_: ping

8:46 fhd: Can I somehow undo a (require)?

8:47 raek: fhd: what effect of require do you want to undo?

8:47 Raynes: &(doc remove-ns)

8:47 lazybot: ⇒ "([sym]); Removes the namespace named by the symbol. Use with caution. Cannot be used to remove the clojure namespace."

8:48 Raynes: I'm not sure if that has the effect of removing the mapping that was created though.

8:48 fhd: raek: I'm executing tests from the REPL, updating with (require ... :reload)

8:48 raek: But when I remove a test, it's still executed by clojure.test

8:48 Raynes: You probably need to ns-unmap the tests you remove.

8:48 fhd: Raynes: Okay, thanks

8:49 Raynes: Reloading a require has the effect of just evaluating all that code again, so things you change and added are reflected. Unfortunately, it doesn't remove things that have been removed.

8:50 fhd: Raynes: Yeah, ns-unmap does the trick

10:41 blakesmith: Hrm, anyone ever had read-line fail in slime? https://gist.github.com/1801099

12:20 scottj: blakesmith: I think that's a "known issue; don't do it"

13:30 weavejester: Does anyone happen to know if deftype can work with loadClass?

13:30 i.e. create a class with deftype that can be loaded into a java library via loadClass.

13:32 TimMc: I don't see why not. What is loadClass used for?

13:34 weavejester: I think it might have to do with the classloader

13:34 I have a Java library with a static logging class loaded from a system property using loadClass

13:35 So I was trying to create a class with deftype and set the property to the full type name

13:37 So if I defined a type: (deftype T [])

13:37 Then: (.. (Thread/currentThread) (getContextClassLoader) (loadClass "user.T"))

13:37 Doesn't work...

13:37 I'm guessing that user.T isn't in the context class loader for the thread...

13:38 TimMc: Huh.

13:39 weavejester: (.getClassLoader (class (T.))) => #<DynamicClassLoader clojure.lang.DynamicClassLoader@1548414>

13:39 So I guess types all have their own class-loaders

13:40 jcidaho: hi - what do ppl use for http acceptance testing. I.e. writing test wrapping something like htmlunit so test a compojure style app? I see there's a couple of webdriver ports - any stand-out winner atm?

13:41 weavejester: web testing ala htmlunit isn't something I've kept an eye on, I'm afraid.

13:43 Hm, if I explicitly set the class loader of the thread it works...

13:43 jcidaho: k, surprised on the web finding that there doesn't seem to an option that leaps out

13:44 TimMc: weavejester: Wow, is that kosher?

13:45 weavejester: TimMc: Well, you can do it... but I don't know whether it'll mess up anything!

13:45 What I could do...

13:45 Is create a new Thread...

13:45 Swap in the Clojure class loader

13:45 Then load the static Java logging library

13:46 Then end the thread

13:46 TimMc: Heh.

13:46 muhoo: jcidaho: don't people use ci stuff, like hudson, or travis-ci ?

13:47 weavejester: I really hate it when Java programs use things like loadClass and the static {} block instead of just working OOP

13:47 jcidaho: how does CI help? Want a test tool for interrogating noir/compojure output

13:47 weavejester: muhoo: CI is something different. You run your tests in a CI system, but CI isn't a testing tool.

13:49 jcidaho: think I should investigate clj-webdriver. Never really used webdriver in java-land, more htmlunit and some selenium (pre webdriver)

13:49 so clk-webdriver is prob a good choice

13:50 arohner: weavejester: IIRC, every class (and every clojure fn) get their own classloader, because classes can't be GC'd, by themselves, but a classloader + all it's classes can, if the classloader has no references

13:51 weavejester: arohner: Ah, so if a Java library is using loadClass to load a logging class, I can't override that with a type without some fiddling

13:52 arohner: weavejester: yeah, that will probably require gen-class

13:53 weavejester: arohner: I think I can get around it by creating a new thread and changing the context class loader.

14:13 seancorfield: ibdknox: you about?

14:26 nm, figured it out (:externs in ClojureScript :compiler directive)

14:33 TimMc: Haha, if I hit up-arrow while lein is running some task (e.g. uberjar), I see repl commands I have typed in the past.

14:34 I guess it wraps everything in rlwrap.

14:40 rhall: hi all... anyone around?

14:41 seancorfield: rhall: yup

14:41 rhall: hi... hit something I can't explain... was hoping to get an opinion or two

14:41 seancorfield: TimMc: i assume that's in interactive mode?

14:42 rhall: (when-let [z (try (new ZipFile "junk") (catch ZipException _)) ] println z)

14:42 (when-let [z (try (new ZipFile zip-name) (catch ZipException _)) ] println z)

14:42 those two lines... assuming (def zip-name "junk") ... should be identical, right?

14:43 seancorfield: but...? :)

14:43 rhall: the one with the constant works as written

14:43 the one with the variable leaks the exception

14:43 I took out the try catch and the stack is different

14:44 seancorfield: yes because of CLJ-855 i suspect

14:44 (new ZipFile ^String zip-name)

14:44 see if that solves it

14:44 (i'm assuming you're on clojure 1.3)

14:44 rhall: yep, 1.3

14:45 seancorfield: add the type hint and see if it catches the exception as expected

14:45 rhall: yep, that did it

14:45 hmm...

14:45 so I saw the invocation sequence was diff between the two cases

14:45 using the constant was a newinstance

14:45 using the var was a reflection call

14:46 seancorfield: without the type hint, clojure does reflection to set up the call - and exceptions thrown from reflected code are wrapped in RuntimeException so your catch won't catch it

14:46 rhall: ok, makes sense

14:46 seancorfield: clojure/dev are still hotly discussing the right solution for exception wrapping / unwrapping

14:47 CLJ-855 is the ticket in JIRA that relates to this issue

14:47 having to (catch RuntimeException _) and unwrap it to find the real exception is a PITA

14:47 rhall: yeah... not ideal

14:48 but sticking type hints everywhere is not cool either

14:48 seancorfield: but having checked exceptions in the clojure compiler is also undesirable (which was how things were in 1.2)

14:48 rhall: ok, thought this was new behavior but didn't go back to 1.2 yet to test

14:48 seancorfield: rhall: agreed, hence the "hotly discussing" comment :)

14:49 rhall: appreciate the fix tho... I can deal with it that way for the moment

14:49 guess I should start following clojure dev

14:52 TimMc: seancorfield: Nope, not in interactive mode, just `lein uberjar`. Pretty funny.

14:52 seancorfield: It would be nice if slingshot could peer down through the layers of RTEs to see the underlying ones.

15:04 &(proxy [Object] [])

15:04 lazybot: java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to clojure.lang.DynamicClassLoader

15:09 citizenparker: Hey blakesmith! =)

15:13 ibdknox: seancorfield: what's up?

15:14 seancorfield: hey ibdknox i was having problems with jayq and advanced compilation mode... i was trying to recreate my success of the other night, from scratch

15:14 i missed the :externs line... then i put it in the wrong place... got it working now (and blogged!)

15:15 also the update to lein-cljsbuild 0.0.12 solved the externs on the class path issue - thanx for that heads up!

15:15 if evan was around, i'd thank him too :)

15:15 ibdknox: sweet! so you can just put "externs/jquery.js"

15:15 ?

15:15 seancorfield: yup

15:16 the whole gory episode is here http://corfield.org/blog/post.cfm/getting-started-with-clojurescript-and-jquery-and-fw-1

15:17 ibdknox: awesome

15:17 we now have a real library story

15:18 seancorfield: yup

15:19 now i need to figure out whether i can reasonably start using cljs + jayq at world singles for production code :)

15:20 we use a few jquery plugins so i guess i'd need externs for those too... but mostly we just use plain ol' jquery and a helping of raw JS in our UI...

15:46 dbushenko: hi all!

15:46 a make an uberjar with leiningen

15:46 but when it runs it throws lots of warnings

15:46 how to eliminate them?

15:52 empity: dbushenko: well you have first to read and understand the warnings I'm afraid

15:52 they normally mean something not perfectly correct is going on

15:52 dbushenko: empity: they are not mine. They are from the included library Lobos

15:53 is there a way just to disable all the warnings?

15:54 ibdknox: seancorfield: you can bind events with jayq too, then you wouldn't need to export that function and all the code would be contained :)

15:54 AeroNotix: any eu people want to trade Practical Clojure for Clojure in Action?

16:17 weavejester: Leiningen 1.7 doesn't have profiles yet, does it?

16:26 skelternet: I think I am running into a problem caused by calling a macro in a function, and as that macro renders code, it checks the type of a parameter I'd like to pass it, and throws an exception

16:27 specifically, I'm trying to call noir's pre-route.

16:27 augustl: The web framework I want: ring, clout, and a basic defpage macro `(defpage :get "/foo" {constraints...} [req] (... handler ...))`. Purely functional. Any suggestions? :)

16:28 skelternet: augustl, not happy with noir?

16:28 augustl: skelternet: I don't like the way it uses side effects for cookies and other things

16:29 I would prefer to just return a ring handler where I set the Set-Cookie header

16:29 skelternet: augustl, so routes and all of the chains would build up a map and pass to subsequent functions?

16:29 augustl: I guess I can do that with noir though, heh :)

16:30 skelternet: not sure what you mean

16:31 skelternet: I think the problem I'm running into is that the pre-route macro checks the parameter I"m handing it at runtime, and because it's not a string literal, it throws a compile time exception. I've even tried ~

16:32 augustl: there is so much that we lean on state for when handling a request…you want a purely functional mechanism…al

16:32 all the things traditional frameworks hold as state somewhere end up having to be passed along some how.

16:35 augustl: skelternet: I'm used to writing web apps with Rails

16:35 there, you typically don't have cross-request state other than the database

16:35 you only store the logged in users ID in the cookie for example, fetching the user from the db on every request

16:37 MenTaLguY: so, what's the best way to add a generated .jar to the classpath (and get it packaged as part of the uberjar) in leiningen?

16:38 from a leiningen plugin

16:39 skelternet: augustl: I would think compojure, ring, could be used similarly, but I am still learning. very much the noob.

16:40 Mentalguy: I think you could write a rudimentary pom for it and install it to your local repository. How familiar are you with mvn?

16:41 MenTaLguY: skelternet: I don't think that's viable

16:41 it's a .jar with generated code

16:41 not something I can stick in an MVN repository somewhere

16:41 local or otherwise

16:42 skelternet: What do you mean by generated?

16:42 augustl: won't a .jar in lib/ automatically be on the classpath?

16:43 perhaps `lein clean` removes it though

16:43 skelternet: I am not sure about that. I am concerned that that's just where leiningen just stashes its downloaded deps.

16:43 * augustl said, as if he knew what he was talking about

16:43 MenTaLguY: a .jar in lib/ will not automatically be on the classpath

16:43 skelternet: no…I just did a clean, and it's still there

16:44 does the .jar contain generated SOURCE code? or .classes ?

16:44 MenTaLguY: Ruby gems :)

16:44 skelternet: huh.

16:45 'quizzical dog look

16:45 seriously?

16:46 MenTaLguY: yes

16:46 I originally looked at extending mvn to use gems as a repository

16:46 but there's a lot of impedence mismatch between mvn and gems as far as the way that dependencies are resolved

16:47 so at this point I'm writing a leiningen plugin that uses the normal Ruby gems/bundler infrastructure to pull down the gems, and then packages them as a .jar to be included in the uberjar/classpath

16:47 the missing piece is getting that .jar actually on the classpath

16:48 trptcolin: cool. would the plugin hook into the normal `lein deps` flow?

16:48 MenTaLguY: (I think if it's on the classpath, uberjar should pick it up too)

16:48 yeah, that's the idea

16:48 trptcolin: maybe toss it in :resources-path ?

16:48 MenTaLguY: I'd rather not users of the plugin had to that manually

16:48 er, have to do that manually

16:48 trptcolin: right. i mean have the plugin do that.

16:49 MenTaLguY: is there a way to override/supplement options like that globally?

16:49 trptcolin: unfortunately i haven't done any nested jar stuff w/ lein, so i'm kind of guessing

16:49 MenTaLguY: I know how to robert.hooke get-classpath, I'm wondering if there's a better way though

16:51 trptcolin: getting ahold of the values should just be a lookup from your plugin task, like (:resources-path project) or (:extra-classpath-dirs project). modifying them, i'm not sure.

16:52 MenTaLguY: yes exactly

16:53 well, I'll bbl

16:56 trptcolin: there's a default value for :resources-path : "resources", but i'm guessing you knew that..

16:58 MenTaLguY: actually, I had forgotten that

16:58 the question is whether that will add .jars in that directory themselves to the classpath though

16:58 I mean, I would need whatever/resources/vendor-gems.jar to be on the classpath, not whatever/resources itself

16:58 although

16:59 maybe I'm thinking about this the wrong way

16:59 if I just install the gems directly to the resources/ directory....

16:59 hmm.

16:59 that might be simpler

16:59 trptcolin: oh, skip the jarring? could work. they'll be zipped anyway in the uberjar situation

17:01 MenTaLguY: exactly

17:01 simple makes me happy

17:03 hmm

17:03 you know, asking people to add vendor/gems to :resources-path isn't so terrible

17:04 trptcolin: well, except if they're using :resources-path for something else

17:10 MenTaLguY: you can set multiple directories for the resource path

17:10 it's a sequence, not a single string

17:14 trptcolin: cool. there was one of these knobs that's newly-a-sequence in lein2, didn't remember whether this was one

17:15 MenTaLguY: bbl

17:23 muhoo: gems? in clojure?

17:23 * muhoo does a doubletake

17:29 Raynes: muhoo: Where?

18:30 ibdknox: ping

18:31 ibdknox: Raynes: sup?

18:31 Raynes: ibdknox: Have you used enlive?

18:31 ibdknox: barely

18:31 * Raynes is at a "I know how to do this in hiccup, but I'm not sure how to express it with enlive" moment.

18:32 ibdknox: I'm likely not much help I'm afraid :(

18:33 * Frozenlock rages against the clojure's java part, where .setsize ISN'T the same thing as .setSize, making sure we have to spend time pressing the shift key.

18:35 trptcolin: ditto for the clojure part, i'm afraid :)

18:35 Frozenlock: Perhaps, but I don't see as much lowercase-uppercase mixes

18:36 amalloy: unluckily 9 isn't the same as ( either

18:36 Raynes: ibdknox: Do you happen to know of any open source projects using enlive?

18:36 I've seen none. Enlive is supposed to be so super popular, yet nobody seems to actually use it. :|

18:37 ibdknox: Raynes: they do, but it's for the stuff that isn't just side-projects (it's better than hiccup when you work with non-devs)

18:37 dnolen has a nice tutorial as does marick I believe

18:37 Raynes: https://github.com/marick/enlive-tutorial

18:38 Raynes: dnolen's tutorial is pretty meh. I read through Brian's last night. I know how to use Enlive -- I don't know how to restructure my project in an expressive way using it. I was hoping to see some real examples.

18:38 ibdknox: ah

18:38 don't know of any

18:38 I find enlive overly complex

18:39 Raynes: So do I, for the most part.

18:39 muhoo: i ffear enlive

18:40 but if i had to screenscrape, i'd probably go there first.

18:40 or, if a designer handed me some html/css to use as a template and said "here, it's done, have fun".

18:43 ibdknox: Raynes: why're you making the switch?

18:43 Raynes: ibdknox: Because it seems like it might be a cleaner solution.

18:43 I mean, I haven't had problems other than mental block so far.

18:43 ibdknox: mm

19:03 alex_baranosky: how can I do integer division?

19:04 seancorfield: ,(long (/ 23 4))

19:04 clojurebot: 5

19:04 alex_baranosky: thanks!

19:05 seancorfield: (/ 23 4)

19:05 clojurebot: *suffusion of yellow*

19:05 seancorfield: ,(/ 23 4)

19:05 clojurebot: 23/4

19:05 seancorfield: the first time i did division and got a fraction i was like wtf?

19:05 ,(double (/ 23 4))

19:05 clojurebot: 5.75

19:06 rhall: ok... #clojure newb here... why is clojurebot saying "suffusion of yellow" ??

19:06 lazybot: rhall: Uh, no. Why would you even ask?

19:06 rhall: cool and lazybot is joining in

19:06 ibdknox: well done lazy bot

19:06 hiredman: google it

19:06 seancorfield: i'd guess because i typed a clojure form without , at the beginning?

19:06 (try again)

19:07 ibdknox: such a great book

19:07 seancorfield: so it's more subtle than just any form...

19:07 (/ 1 2)

19:07 clojurebot: 1/2

19:07 seancorfield: hmph

19:07 (/ 23 4)

19:07 clojurebot: *suffusion of yellow*

19:07 seancorfield: (/ 23 3)

19:07 clojurebot: *suffusion of yellow*

19:07 seancorfield: (/ 23 x)

19:07 ibdknox: greater than 4

19:08 seancorfield: oh

19:08 (/ 5 2)

19:08 clojurebot: 5/2

19:08 seancorfield: (/ 5 1)

19:08 clojurebot: *suffusion of yellow*

19:08 seancorfield: ah, i see

19:08 ibdknox: http://www.thateden.co.uk/dirk/

19:08 seancorfield: $google suffusion of yellow

19:08 lazybot: [Dirk Gently's Holistic I-Ching Calculator] http://www.thateden.co.uk/dirk/

19:09 seancorfield: geeks... gotta love 'em...

19:15 jodaro: is there a way to do the tailable cursor thing in congomongo?

19:35 * tmciver wonders if Dirk Gently's Holistic I-Ching Calculator is an insight beyond his ability to fathom.

19:41 seancorfield: jodaro: not sure what you're asking for?

19:54 jodaro: seancorfield: http://www.mongodb.org/display/DOCS/Tailable+Cursors

19:54 not even sure if the java driver supports it

20:21 Frozenlock: Is there a newer way (integrated with slime?) to get java doc from clojure than this http://bc.tech.coop/blog/081120.html ?

20:34 amalloy: well, there's C-c shift-i

20:59 emezeske: ibdknox: Hey, so I was just thinking about fleshing out the various *-helpers from hiccup in crate

21:00 ibdknox: Any reason to keep them all in crate.tags? I was thinking about making it crate.form-helpers, crate.page-helpers, etc, like hiccup

21:01 tmciver: amalloy: Cool, I didn't know about that emacs command. Thanks. It seems to only work on Classes (not methods), true?

21:02 amalloy: well, it inspects objects

21:03 tmciver: I tried it on Class in an expression like (. Class forName ...) and it worked beautifully.

21:03 amalloy: sure. classes are objects

21:03 methods ain't

21:05 gfredericks: amalloy: you're talking about java?

21:05 tmciver: amalloy: in what sense do you mean classes are objects?

21:06 amalloy: &(instance? Object (class "x"))

21:06 lazybot: ⇒ true

21:07 amalloy: that returns true for anything at all, of course, but my point is you can have a reference to a Class object. you can refer to Method objects too, but that's really part of the reflection facility and Methods are just a part of a Class anyway

21:08 gfredericks: amalloy: is there an underlying jvm distinction here, or is it just semantics about the package name differences between java.lang.Class and java.lang.reflect.Method?

21:09 amalloy: eh

21:09 classes are a lot more first-class than methods are

21:09 * gfredericks doesn't really know what he meant by the word "semantics"

21:09 amalloy: but it's just a difference of degree

21:09 i think you mean "are you just being a dick"

21:09 gfredericks: amalloy: but that could backfire because if you're just being a dick then that's probably also what I'm doing

21:10 though maybe it's not important because if you're not being a dick I'm probably still being a dick

21:11 skelternet: LoL…I'm listening to y'all via text-to-speech from the other room. The tone of the conversation is equally ambiguous if I read it or hear it read to me.

21:13 tmciver: skelternet: text-to-speech? Cool! How do you do it?

21:13 skelternet: Adium has it built in

21:15 tmciver: Doh! OSX :(

21:15 * gfredericks did that too

21:16 skelternet: not available on other platforms? Surely other IRC clients have the feature.

21:16 rhall: skelternet: does adium read all the drop messages too :)

21:16 I'm running erc in emacs

21:17 I think I can hack festival to read the erc stream

21:17 skelternet: rhall: people leaving and entering? no. at least not the way I've configured it.

21:17 though it does annoy my wife when the clojure conversation picks up when I'm not in the house and I've forgotten to shut it down.

21:18 emezeske: Can anyone point me in the right direction to figure out what the ClojureScript equivalent of (instance? clojure.lang.Named x) would be?

21:18 rhall: skelternet: I'm sure :)

21:20 gfredericks: emezeske: since no one else has answered yet, I will speculate it has something to do with protocols?

21:21 emezeske: gfredericks: That makes sense. Starting point! Thanks.

21:21 skelternet: emez: I'm curious what the answer will be. I thought javascript is a nearly typeless prototype-based language.

21:22 gfredericks: skelternet: my assumption is if there is such an equivalent it'll be entirely at the clojurescript semantic level, not JS; e.g. protocols

21:22 emezeske: skelternet: If I'm lazy enough, the answer might be (or (symbol? x) (keyword? x)) ^_^

21:22 gfredericks: ,(instance? clojure.lang.Named "foo")

21:22 clojurebot: false

21:22 gfredericks: ,(name "foo")

21:22 clojurebot: "foo"

21:22 gfredericks: I hate everything

21:23 amalloy: &(doc satisfies?)

21:23 lazybot: ⇒ "([protocol x]); Returns true if x satisfies the protocol"

21:23 amalloy: (satisfies? INamed x) is surely the JS thing

21:25 gfredericks: oh of course strings couldn't be clojure.lang.Named, since you can't muck with the string class. I am ashamed.

21:26 skelternet: ibdknox: if you have a minute, I have a pre-route question for you.

21:41 Frozenlock: Could someone help in translating the following example in working clojure code?

21:41 I'm ok with this: java: test.initialize(); clojure: (.initialize test)

21:41 But this..... java: (test.sendBroadcast(2222, new WhoIsRequest(null, null)); clojure: ???

21:41 lazybot: Frozenlock: How could that be wrong?

21:42 alandipert: (.sendBroadcast test 2222, (WhoIsRequest. nil nil))

21:43 Frozenlock: alandipert: thanks!

21:44 alandipert: Frozenlock: no problemo

21:50 emezeske: amalloy: You are awesome, thanks

22:07 Null-A: How can I perform lookup in hash-map by using pointer of object as key

22:08 burlappsack: does clojure have support for pointers?

22:08 Null-A: it has support for identity

22:08 Tcepsa: burlappsack: Not that I know of... but there is a lot that I don't know ^_^;

22:10 burlappsack: I don't think it does

22:10 clojure is written in Java

22:18 muhoo: tis funny. the first time i call any function in my repl, it takes like 30 seconds. the next time, it takes less than a second.

22:18 slow computers and java don't get along so well.

22:20 Arafangion: muhoo: Yet my Atom-based system is fast enough for everything else.

22:26 muhoo: yep. atom here too.

22:26 netbooks ftw

22:27 ok, i'm confused. if i have something like (for ... (loop [] .... (recur)), what gets recurred?

22:27 the loop, or the for?

22:28 i'm trying to figure out this: https://refheap.com/paste/714

22:33 amro: muhoo: for isn't a recur target

22:35 burlappsack: has anyone hear used a profiler for clojure code?

22:35 like visualvm or something similar?

22:42 alandipert: burlappsack: i've had success with yourkit

22:43 burlappsack: okay, i'll have to check it out

22:44 thanks

22:45 have you found using the profiler helped you choose the correct clojure commands/structure to use?

22:50 alandipert: burlappsack: oh, no - i used it for performance work

22:51 (characterizing the behavior of a web service that needed to meet certain perf criteria)

22:51 burlappsack: the tool you are looking for is practice :-)

22:52 burlappsack: lol

22:52 i'm speaking about performance

22:52 alandipert: burlappsack: oh, sorry i misunderstood. yourkit definitely handy

23:19 jweiss: i have trace logs that are stored as data like: [(+ 1 (- 5 2) nil] [(- 5 2) nil] [3 true] [4 true] (where the boolean is whether it's the function call or the return value) I want to nest everything back up for printing as html. is there a simple functional way to do that, maybe using reduce? [(+ 1 (- 5 2) [(- 5 2) 3] 4]

23:38 muhoo: jweiss: zipper?

23:41 jweiss: muhoo: yeah that might do it

23:42 alandipert: jweiss: i'd probly use walk

23:42 esp. if these things are arbitrarily deep

Logging service provided by n01se.net