#clojure logs

2012-02-11

00:00seancorf$google clojure irc log
00:00lazybot[#clojure log - Feb 10 2012] http://clojure-log.n01se.net/
00:00seancorfheh
00:02seancorfmuhoo: did you solve your math.numeric-tower problem?
00:03seancorfi would have expected the dependency to look like [[org.clojure/math.numeric-tower "0.0.1"]]
00:06Raynesseancorf: http://lazybot.org/logs/#clojure/2012-02-10 :D
00:08muhooseancorf: that worked, thanks!
00:13seancorfyay! :)
00:13muhoohere's what confused the hell out of me
00:13muhoothe namespaces make no sense
00:13muhoo(require 'clojure.math.numeric-tower)
00:13muhoobut (add-dependencies '[[org.clojure/math.numeric-tower "0.0.1"]])
00:13muhooso, why org.clojure/math.numeric-tower in one, and clojure.math.numeric-tower in the other?
00:14seancorfit's just the pattern used for (new) contrib libraries
00:14seancorfyou have org.clojure/clojure but that contains clojure.set, clojure.java.io, etc
00:15Raynesmuhoo: Also, namespaces are not what maven artifacts are named after.
00:16seancorfand you have congomongo as the artifact but you require somnium.congomongo so there's no direct correlation between artifact names and namespaces
00:16muhooah. different naming conventions.
00:17muhoomakes sense.
00:18seancorfclojure core and contrib is in the org.clojure group with a variety of artifacts, technically congomongo has congomongo/congomongo as its full name
00:18seancorfbut, yeah, the whole maven artifact thing is confusing if you're not used to it (as i wasn't before i started doing clojure)
00:19muhooyep, it's one of those things. thanks for explaining it.
00:19muhooit'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.
00:21Raynesseancorf: What do you think of monger?
00:25seancorfRaynes: 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 :)
00:25Raynesseancorf: I keep forgetting that pretty much everything you ever do is the result of something you needed at work.
00:25Raynes:p
00:26RaynesBut yeah, monger looks neat. It looks 'prettier', but it also looks more macro-driven and heavy.
00:27antares_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.
00:28Raynesantares_: In that case, excellent.
00:28Raynesantares_: Are you the Monger guy?
00:28antares_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.
00:28antares_Raynes: I am
00:29antares_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.
00:29Raynesantares_: 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.
00:29RaynesI should have disclaimed that I hadn't actually looked at the implementation of things.
00:29antares_monger.core, monger.collection and monger.gridfs probably give you roughly what congomongo has, w/o a single macro
00:30antares_Raynes: that sounded OK :)
00:30antares_no worries
00:31antares_Raynes: another person asked for a non-snapshot release today: https://github.com/michaelklishin/monger/issues/7 :)
00:31antares_Raynes: so, I think I will do a beta1 now
00:31RaynesThat sounds great! I'll move RefHeap to it in the morning.
00:32Raynes(God bless Saturday)
00:33Raynesantares_: 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.
00:34antares_Raynes: ok. I am releasing validateur that monger depends on and is currently a snapshot only
00:34RaynesI 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.
00:34antares_or maybe I should just completely remove this dependency. It is a validations library that monger can work without.
00:35antares_Raynes: monger was started in early August
00:35antares_Raynes: so it is very close to 1.0, the doc site is not ready yet.
00:35RaynesYeah, I saw it ages ago.
00:36Raynesantares_: I'm going to have fun with this. :>
00:37muhoowhenever 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"
00:37muhoodamn xtranormal.
00:37Raynesantares_: You're the travis-ci guy too, aren't you?
00:38RaynesMan, you don't ever half-ass things.
00:38RaynesI want to be like you.
00:38RaynesBut I like releasing things really quickly.
00:38RaynesRefHeap took two weeks.
00:38antares_Raynes: I am
00:38antares_Raynes: I also have maybe a dozen of Clojure libraries for Neo4j Server, RabbitMQ, Web crawling and so on
00:39antares_and happen to maintain 3 Ruby AMQP clients :)
00:39RaynesHave you seen Jiraph?
00:39antares_no
00:39Rayneshttps://github.com/flatland/jiraph
00:39antares_is it something for jira? :)
00:39RaynesGod no.
00:39RaynesWe wouldn't dare.
00:39antares_oh
00:39antares_sounds interesting, let me see the license
00:39Raynesamalloy: Is that README up-to-date?
00:40antares_Raynes: jiraph looks very interesting, thanks for bringing it up
00:40Raynesantares_: EPLv1
00:40Raynesantares_: We use this at work, so you can pretty much count on it being supported. :P
00:41antares_Raynes: it is embeddable, correct?
00:41antares_or accessible over the network? or both?
00:41RaynesYes. It has a tokyo cabinet layer for backend storage.
00:43Raynesamalloy: 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.
00:44antares_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?
00:44antares_all my projects tend to integrate with one another but I can see why people may not like pulling extra jars
00:44RaynesIf it is a problem for somebody they can always exclude it.
00:45antares_ah, right
00:45antares_I keep forgetting that with Maven-based tools you can do it
00:45antares_cool
00:47RaynesI really need to get my stuff on travis-ci, but that means I have to write tests...
00:48RaynesI'm still not sure how to test something like RefHeap.
00:48RaynesThat's going to take some thought.
00:48RaynesI think Noir has some nice test tools though. I'm just not good with testing I/Oish things.
00:48muhooi like the way debian does it: required, recommended, and suggested, IIRC
00:48Raynesmuhoo: How has your RefHeaping been going lately, btw?
00:48RaynesAnymore problems with server lag?
00:49muhooRaynes: naw, works great! it's now my go-to paste tool
00:49RaynesI'm assuming you're using refheap.el
00:49RaynesI noticed. You got the 700th paste. With an error message...
00:49muhooi just bound a key in emacs to refheap-paste-region
00:49Raynes:p
00:49muhoomost of my pasting is asking for help with stuff i can't figure out how to get working :-)
00:49RaynesHah, I actually don't have any keys for my refheap Vim stuff. I get a strange thrill out of typing :Refheap
00:50antares_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 :)
00:50antares_only GAs and snapshot releases
00:50Raynesantares_: Yeah. Nothing special.
00:52antares_Raynes: 1.0.0-beta1 is up on clojars
01:06radsibdknox: 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?
01:07radsre: waltz
01:11Raynesantares_: You rock.
01:11antares_Raynes: I updated Neocons README to mention jiraph for people who need an embedded graph db. Great work.
01:11Raynesantares_: I can't take any credit for Jiraph. I've done very little work on it. amalloy and ninjudd get all the credit.
01:12antares_hm, yeah, I meant "great work everybody who worked on it" :)
01:14ibdknoxrads: transitions should be used to set and unset states, shouldn't really do much else
01:14ibdknoxrads: in/out should do whatever interfac-y things you need to do
01:15Raynesibdknox: When I get around to testing RefHeap, would you up for helping me out?
01:15radsin some of the examples, you use crate within the transitions
01:15radser, store
01:15rads(which is fetch)
01:15radsso you're updating remote state during the transition too?
01:15ibdknoxgetting state
01:16ibdknoxthink of transitions as the interface for your thing, whatever it is
01:16ibdknoxwhat can you do with it?
01:16radsI see
01:16ibdknoxRaynes: how can I help?
01:17Raynesibdknox: I suck at testing websites and I/O. I expect that you don't.
01:17Raynesibdknox: 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.
01:17RaynesAlso, not tonight. Not tomorrow either. Eventually.
01:18ibdknoxsure :)
01:18RaynesGreat. :>
01:18RaynesOr you can just write the tests for me. That works to. As a matter of fact, go do that.
01:18Raynes;P
01:21antares_Raynes: by the way, monger now has a mailing list: https://groups.google.com/forum/#!forum/clojure-monger
01:22radsibdknox: thanks for the help, btw
01:23ibdknoxrads: np :)
01:25Raynesantares_: Joined.
02:39Raynesmuhoo: ping
02:55muhooRaynes: yo
02:56Raynesmuhoo: 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).
02:57muhoonice. now how do i get that in clojure-mode.el ? :-)
02:58RaynesThe color theme?
02:58muhoo(ns is not highlighted at all in clojure-mode, pfui).
02:58RaynesWell, this was a change to the pygments lexer.
02:58RaynesI couldn't tell you how to fix the clojure-mode lexer. :p
02:58muhooi kno, i'm being silly
02:58muhooyour highlighting is better than that of my editor
02:58RaynesI never had problems with clojure-mode. :O
02:59muhoooh it's great. at some point i'm going to have to learn how to edit modes.
02:59RaynesAlso, for future reference, the color theme is a version of tomorrow-night-bright that I wrote for pygments.
03:01muhooheh, it was a simple matter of customize-face. nice.
03:10Raynesmuhoo: The Clojure highlighting in Pygments is getting pretty good with my recent changes, even if it is all one big regexfest.
03:12muhooyou've inspired me to edit the crap out of my customize-face stuff
03:12muhooi love this. i've got all my java stuff a different color from the builtins, from the macros, it's very nice.
03:13muhoomakes reading clj a lot easier. since, because there's so little syntax, it's kind of hard to tell what's what without it.
03:17Raynesmuhoo: I'm going to try to move refheap to enlive soon.
03:17Raynesmuhoo: I expect suicidal tendencies though, so I might have to back down.
03:17muhoo"i'm not crazy, you're the one that's crazy, you're driving me crazy"
03:18muhoohttp://www.youtube.com/watch?v=LoF_a0-7xVQ
03:19muhooall i wanted was a pepsi. just one pepsi
03:19muhoook, well i like hiccup because it's simple and i can read that source and understand most of it
03:20muhooit's like the difference between generating html or doing jquery js stuff. matter of taste and/or application i suppose
03:28fliebelCan we do Enlive in ClojureScript yet?
03:35Raynesfliebel: https://github.com/ckirkendall/enfocus
03:37fliebelRaynes: yay
03:43fliebelcemerick mentioned cljs is now a regular lein dep, but where is it?
03:46fliebelok, org.clojure.clojurescript
03:52fliebelIs the Clojure reader the same thing as the ClojureScript reader?
04:59originalserverI am selling dedicated servers in different countries, only windows xp, 2003,2008, seven! write who need them.
05:30Guest11659Hey. 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?
05:30Guest11659err nevermind
06:59dEPyhow do I run my project with leiningen? I specified my main clj in project.clj
06:59dEPybut when I do "lein run" I get: Exception in thread "main" java.lang.NullPointerException (NO_SOURCE_FILE:1)
07:02vijaykirandEPy: do you have a -main method in the clj ?
07:04dEPyoh.. stupid me :)
07:07dEPyworks now yea.. thanks
07:07dEPytotally forgot about it O_o
07:13vijaykirandEPy: np
07:43pyrare dev-dependencies accessible during lein test ?
07:44jcidahoHi. 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
07:44jcidahoclojurescriptone. 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...
07:44pyrjcidaho: it fits a lot of needs
07:44pyrjcidaho: really depends on what you want to do
07:45pyrjcidaho: clojurescript doesn't really have a "framework" yet
07:45pyrthough pinot comes close
07:45pyrif you think you would have been fine with sinatra in the ruby world
07:45vijaykiranpyr: yes, dev-deps are test deps
07:45jcidahoit'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
07:45pyrthen compojure will be fine
07:46jcidahoNoir would seem to wrap composure - any driver for moving to that?
07:46jcidahocompojure sorry
07:46vijaykiranjcidaho: as pyr said, depends on what you want to build
07:46pyrvijaykiran: 'k, thx
07:47jcidahocould you clarify that a bit… Compojure is good for build X type apps vs something-else that isn't..
07:47pyrjcidaho: compojure and noir share a lot indeed
07:48vijaykirancompojure is "micro" framework not a full stack framework
07:48vijaykirannoir is more comparable to framework
07:48pyrjcidaho: think sinatra vs rails, in a way
07:48jcidahook
07:48pyrjcidaho: if you're building something that can be easily manipulated in js on the frontend
07:48pyrwhich would be advisable for a non web facing app
07:49pyrthen compojure might just do, you send out json from api endpoints
07:49pyrand let the frontend do its thing
07:49jcidahomake sense
07:49vijaykiranI built an internal app SPA - with backbone frontend and clojure backend
07:50Raynesjcidaho: Noir is probably your best bet.
07:51RaynesCompojure is really minimal. Excessively so.
07:52jcidahocheck it out some more - thanks
07:54Raynesantares_: ping
08:46fhdCan I somehow undo a (require)?
08:47raekfhd: what effect of require do you want to undo?
08:47Raynes&(doc remove-ns)
08:47lazybot⇒ "([sym]); Removes the namespace named by the symbol. Use with caution. Cannot be used to remove the clojure namespace."
08:48RaynesI'm not sure if that has the effect of removing the mapping that was created though.
08:48fhdraek: I'm executing tests from the REPL, updating with (require ... :reload)
08:48fhdraek: But when I remove a test, it's still executed by clojure.test
08:48RaynesYou probably need to ns-unmap the tests you remove.
08:48fhdRaynes: Okay, thanks
08:49RaynesReloading 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.
08:50fhdRaynes: Yeah, ns-unmap does the trick
10:41blakesmithHrm, anyone ever had read-line fail in slime? https://gist.github.com/1801099
12:20scottjblakesmith: I think that's a "known issue; don't do it"
13:30weavejesterDoes anyone happen to know if deftype can work with loadClass?
13:30weavejesteri.e. create a class with deftype that can be loaded into a java library via loadClass.
13:32TimMcI don't see why not. What is loadClass used for?
13:34weavejesterI think it might have to do with the classloader
13:34weavejesterI have a Java library with a static logging class loaded from a system property using loadClass
13:35weavejesterSo I was trying to create a class with deftype and set the property to the full type name
13:37weavejesterSo if I defined a type: (deftype T [])
13:37weavejesterThen: (.. (Thread/currentThread) (getContextClassLoader) (loadClass "user.T"))
13:37weavejesterDoesn't work...
13:37weavejesterI'm guessing that user.T isn't in the context class loader for the thread...
13:38TimMcHuh.
13:39weavejester(.getClassLoader (class (T.))) => #<DynamicClassLoader clojure.lang.DynamicClassLoader@1548414>
13:39weavejesterSo I guess types all have their own class-loaders
13:40jcidahohi - 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:41weavejesterweb testing ala htmlunit isn't something I've kept an eye on, I'm afraid.
13:43weavejesterHm, if I explicitly set the class loader of the thread it works...
13:43jcidahok, surprised on the web finding that there doesn't seem to an option that leaps out
13:44TimMcweavejester: Wow, is that kosher?
13:45weavejesterTimMc: Well, you can do it... but I don't know whether it'll mess up anything!
13:45weavejesterWhat I could do...
13:45weavejesterIs create a new Thread...
13:45weavejesterSwap in the Clojure class loader
13:45weavejesterThen load the static Java logging library
13:46weavejesterThen end the thread
13:46TimMcHeh.
13:46muhoojcidaho: don't people use ci stuff, like hudson, or travis-ci ?
13:47weavejesterI really hate it when Java programs use things like loadClass and the static {} block instead of just working OOP
13:47jcidahohow does CI help? Want a test tool for interrogating noir/compojure output
13:47weavejestermuhoo: CI is something different. You run your tests in a CI system, but CI isn't a testing tool.
13:49jcidahothink I should investigate clj-webdriver. Never really used webdriver in java-land, more htmlunit and some selenium (pre webdriver)
13:49jcidahoso clk-webdriver is prob a good choice
13:50arohnerweavejester: 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:51weavejesterarohner: 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:52arohnerweavejester: yeah, that will probably require gen-class
13:53weavejesterarohner: I think I can get around it by creating a new thread and changing the context class loader.
14:13seancorfieldibdknox: you about?
14:26seancorfieldnm, figured it out (:externs in ClojureScript :compiler directive)
14:33TimMcHaha, 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:34TimMcI guess it wraps everything in rlwrap.
14:40rhallhi all... anyone around?
14:41seancorfieldrhall: yup
14:41rhallhi... hit something I can't explain... was hoping to get an opinion or two
14:41seancorfieldTimMc: i assume that's in interactive mode?
14:42rhall(when-let [z (try (new ZipFile "junk") (catch ZipException _)) ] println z)
14:42rhall(when-let [z (try (new ZipFile zip-name) (catch ZipException _)) ] println z)
14:42rhallthose two lines... assuming (def zip-name "junk") ... should be identical, right?
14:43seancorfieldbut...? :)
14:43rhallthe one with the constant works as written
14:43rhallthe one with the variable leaks the exception
14:43rhallI took out the try catch and the stack is different
14:44seancorfieldyes because of CLJ-855 i suspect
14:44seancorfield(new ZipFile ^String zip-name)
14:44seancorfieldsee if that solves it
14:44seancorfield(i'm assuming you're on clojure 1.3)
14:44rhallyep, 1.3
14:45seancorfieldadd the type hint and see if it catches the exception as expected
14:45rhallyep, that did it
14:45rhallhmm...
14:45rhallso I saw the invocation sequence was diff between the two cases
14:45rhallusing the constant was a newinstance
14:45rhallusing the var was a reflection call
14:46seancorfieldwithout 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:46rhallok, makes sense
14:46seancorfieldclojure/dev are still hotly discussing the right solution for exception wrapping / unwrapping
14:47seancorfieldCLJ-855 is the ticket in JIRA that relates to this issue
14:47seancorfieldhaving to (catch RuntimeException _) and unwrap it to find the real exception is a PITA
14:47rhallyeah... not ideal
14:48rhallbut sticking type hints everywhere is not cool either
14:48seancorfieldbut having checked exceptions in the clojure compiler is also undesirable (which was how things were in 1.2)
14:48rhallok, thought this was new behavior but didn't go back to 1.2 yet to test
14:48seancorfieldrhall: agreed, hence the "hotly discussing" comment :)
14:49rhallappreciate the fix tho... I can deal with it that way for the moment
14:49rhallguess I should start following clojure dev
14:52TimMcseancorfield: Nope, not in interactive mode, just `lein uberjar`. Pretty funny.
14:52TimMcseancorfield: It would be nice if slingshot could peer down through the layers of RTEs to see the underlying ones.
15:04TimMc&(proxy [Object] [])
15:04lazybotjava.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to clojure.lang.DynamicClassLoader
15:09citizenparkerHey blakesmith! =)
15:13ibdknoxseancorfield: what's up?
15:14seancorfieldhey 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:14seancorfieldi missed the :externs line... then i put it in the wrong place... got it working now (and blogged!)
15:15seancorfieldalso the update to lein-cljsbuild 0.0.12 solved the externs on the class path issue - thanx for that heads up!
15:15seancorfieldif evan was around, i'd thank him too :)
15:15ibdknoxsweet! so you can just put "externs/jquery.js"
15:15ibdknox?
15:15seancorfieldyup
15:16seancorfieldthe whole gory episode is here http://corfield.org/blog/post.cfm/getting-started-with-clojurescript-and-jquery-and-fw-1
15:17ibdknoxawesome
15:17ibdknoxwe now have a real library story
15:18seancorfieldyup
15:19seancorfieldnow i need to figure out whether i can reasonably start using cljs + jayq at world singles for production code :)
15:20seancorfieldwe 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:46dbushenkohi all!
15:46dbushenkoa make an uberjar with leiningen
15:46dbushenkobut when it runs it throws lots of warnings
15:46dbushenkohow to eliminate them?
15:52empitydbushenko: well you have first to read and understand the warnings I'm afraid
15:52empitythey normally mean something not perfectly correct is going on
15:52dbushenkoempity: they are not mine. They are from the included library Lobos
15:53dbushenkois there a way just to disable all the warnings?
15:54ibdknoxseancorfield: you can bind events with jayq too, then you wouldn't need to export that function and all the code would be contained :)
15:54AeroNotixany eu people want to trade Practical Clojure for Clojure in Action?
16:17weavejesterLeiningen 1.7 doesn't have profiles yet, does it?
16:26skelternetI 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:27skelternetspecifically, I'm trying to call noir's pre-route.
16:27augustlThe web framework I want: ring, clout, and a basic defpage macro `(defpage :get "/foo" {constraints...} [req] (... handler ...))`. Purely functional. Any suggestions? :)
16:28skelternetaugustl, not happy with noir?
16:28augustlskelternet: I don't like the way it uses side effects for cookies and other things
16:29augustlI would prefer to just return a ring handler where I set the Set-Cookie header
16:29skelternetaugustl, so routes and all of the chains would build up a map and pass to subsequent functions?
16:29augustlI guess I can do that with noir though, heh :)
16:30augustlskelternet: not sure what you mean
16:31skelternetI 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:32skelternetaugustl: there is so much that we lean on state for when handling a request…you want a purely functional mechanism…al
16:32skelternetall the things traditional frameworks hold as state somewhere end up having to be passed along some how.
16:35augustlskelternet: I'm used to writing web apps with Rails
16:35augustlthere, you typically don't have cross-request state other than the database
16:35augustlyou only store the logged in users ID in the cookie for example, fetching the user from the db on every request
16:37MenTaLguYso, 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:38MenTaLguYfrom a leiningen plugin
16:39skelternetaugustl: I would think compojure, ring, could be used similarly, but I am still learning. very much the noob.
16:40skelternetMentalguy: I think you could write a rudimentary pom for it and install it to your local repository. How familiar are you with mvn?
16:41MenTaLguYskelternet: I don't think that's viable
16:41MenTaLguYit's a .jar with generated code
16:41MenTaLguYnot something I can stick in an MVN repository somewhere
16:41MenTaLguYlocal or otherwise
16:42skelternetWhat do you mean by generated?
16:42augustlwon't a .jar in lib/ automatically be on the classpath?
16:43augustlperhaps `lein clean` removes it though
16:43skelternetI am not sure about that. I am concerned that that's just where leiningen just stashes its downloaded deps.
16:43MenTaLguYa .jar in lib/ will not automatically be on the classpath
16:43skelternetno…I just did a clean, and it's still there
16:44skelternetdoes the .jar contain generated SOURCE code? or .classes ?
16:44MenTaLguYRuby gems :)
16:44skelternethuh.
16:45skelternet'quizzical dog look
16:45skelternetseriously?
16:46MenTaLguYyes
16:46MenTaLguYI originally looked at extending mvn to use gems as a repository
16:46MenTaLguYbut there's a lot of impedence mismatch between mvn and gems as far as the way that dependencies are resolved
16:47MenTaLguYso 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:47MenTaLguYthe missing piece is getting that .jar actually on the classpath
16:48trptcolincool. would the plugin hook into the normal `lein deps` flow?
16:48MenTaLguY(I think if it's on the classpath, uberjar should pick it up too)
16:48MenTaLguYyeah, that's the idea
16:48trptcolinmaybe toss it in :resources-path ?
16:48MenTaLguYI'd rather not users of the plugin had to that manually
16:48MenTaLguYer, have to do that manually
16:48trptcolinright. i mean have the plugin do that.
16:49MenTaLguYis there a way to override/supplement options like that globally?
16:49trptcolinunfortunately i haven't done any nested jar stuff w/ lein, so i'm kind of guessing
16:49MenTaLguYI know how to robert.hooke get-classpath, I'm wondering if there's a better way though
16:51trptcolingetting 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:52MenTaLguYyes exactly
16:53MenTaLguYwell, I'll bbl
16:56trptcolinthere's a default value for :resources-path : "resources", but i'm guessing you knew that..
16:58MenTaLguYactually, I had forgotten that
16:58MenTaLguYthe question is whether that will add .jars in that directory themselves to the classpath though
16:58MenTaLguYI mean, I would need whatever/resources/vendor-gems.jar to be on the classpath, not whatever/resources itself
16:58MenTaLguYalthough
16:59MenTaLguYmaybe I'm thinking about this the wrong way
16:59MenTaLguYif I just install the gems directly to the resources/ directory....
16:59MenTaLguYhmm.
16:59MenTaLguYthat might be simpler
16:59trptcolinoh, skip the jarring? could work. they'll be zipped anyway in the uberjar situation
17:01MenTaLguYexactly
17:01MenTaLguYsimple makes me happy
17:03MenTaLguYhmm
17:03MenTaLguYyou know, asking people to add vendor/gems to :resources-path isn't so terrible
17:04trptcolinwell, except if they're using :resources-path for something else
17:10MenTaLguYyou can set multiple directories for the resource path
17:10MenTaLguYit's a sequence, not a single string
17:14trptcolincool. there was one of these knobs that's newly-a-sequence in lein2, didn't remember whether this was one
17:15MenTaLguYbbl
17:23muhoogems? in clojure?
17:29Raynesmuhoo: Where?
18:30Raynesibdknox: ping
18:31ibdknoxRaynes: sup?
18:31Raynesibdknox: Have you used enlive?
18:31ibdknoxbarely
18:32ibdknoxI'm likely not much help I'm afraid :(
18:35trptcolinditto for the clojure part, i'm afraid :)
18:35FrozenlockPerhaps, but I don't see as much lowercase-uppercase mixes
18:36amalloyunluckily 9 isn't the same as ( either
18:36Raynesibdknox: Do you happen to know of any open source projects using enlive?
18:36RaynesI've seen none. Enlive is supposed to be so super popular, yet nobody seems to actually use it. :|
18:37ibdknoxRaynes: 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:37ibdknoxdnolen has a nice tutorial as does marick I believe
18:37ibdknoxRaynes: https://github.com/marick/enlive-tutorial
18:38Raynesdnolen'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:38ibdknoxah
18:38ibdknoxdon't know of any
18:38ibdknoxI find enlive overly complex
18:39RaynesSo do I, for the most part.
18:39muhooi ffear enlive
18:40muhoobut if i had to screenscrape, i'd probably go there first.
18:40muhooor, if a designer handed me some html/css to use as a template and said "here, it's done, have fun".
18:43ibdknoxRaynes: why're you making the switch?
18:43Raynesibdknox: Because it seems like it might be a cleaner solution.
18:43RaynesI mean, I haven't had problems other than mental block so far.
18:43ibdknoxmm
19:03alex_baranoskyhow can I do integer division?
19:04seancorfield,(long (/ 23 4))
19:04clojurebot5
19:04alex_baranoskythanks!
19:05seancorfield(/ 23 4)
19:05clojurebot*suffusion of yellow*
19:05seancorfield,(/ 23 4)
19:05clojurebot23/4
19:05seancorfieldthe first time i did division and got a fraction i was like wtf?
19:05seancorfield,(double (/ 23 4))
19:05clojurebot5.75
19:06rhallok... #clojure newb here... why is clojurebot saying "suffusion of yellow" ??
19:06lazybotrhall: Uh, no. Why would you even ask?
19:06rhallcool and lazybot is joining in
19:06ibdknoxwell done lazy bot
19:06hiredmangoogle it
19:06seancorfieldi'd guess because i typed a clojure form without , at the beginning?
19:06seancorfield(try again)
19:07ibdknoxsuch a great book
19:07seancorfieldso it's more subtle than just any form...
19:07seancorfield(/ 1 2)
19:07clojurebot1/2
19:07seancorfieldhmph
19:07seancorfield(/ 23 4)
19:07clojurebot*suffusion of yellow*
19:07seancorfield(/ 23 3)
19:07clojurebot*suffusion of yellow*
19:07seancorfield(/ 23 x)
19:07ibdknoxgreater than 4
19:08seancorfieldoh
19:08seancorfield(/ 5 2)
19:08clojurebot5/2
19:08seancorfield(/ 5 1)
19:08clojurebot*suffusion of yellow*
19:08seancorfieldah, i see
19:08ibdknoxhttp://www.thateden.co.uk/dirk/
19:08seancorfield$google suffusion of yellow
19:08lazybot[Dirk Gently's Holistic I-Ching Calculator] http://www.thateden.co.uk/dirk/
19:09seancorfieldgeeks... gotta love 'em...
19:15jodarois there a way to do the tailable cursor thing in congomongo?
19:41seancorfieldjodaro: not sure what you're asking for?
19:54jodaroseancorfield: http://www.mongodb.org/display/DOCS/Tailable+Cursors
19:54jodaronot even sure if the java driver supports it
20:21FrozenlockIs there a newer way (integrated with slime?) to get java doc from clojure than this http://bc.tech.coop/blog/081120.html ?
20:34amalloywell, there's C-c shift-i
20:59emezeskeibdknox: Hey, so I was just thinking about fleshing out the various *-helpers from hiccup in crate
21:00emezeskeibdknox: 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:01tmciveramalloy: Cool, I didn't know about that emacs command. Thanks. It seems to only work on Classes (not methods), true?
21:02amalloywell, it inspects objects
21:03tmciverI tried it on Class in an expression like (. Class forName ...) and it worked beautifully.
21:03amalloysure. classes are objects
21:03amalloymethods ain't
21:05gfredericksamalloy: you're talking about java?
21:05tmciveramalloy: in what sense do you mean classes are objects?
21:06amalloy&(instance? Object (class "x"))
21:06lazybot⇒ true
21:07amalloythat 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:08gfredericksamalloy: 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:09amalloyeh
21:09amalloyclasses are a lot more first-class than methods are
21:09amalloybut it's just a difference of degree
21:09amalloyi think you mean "are you just being a dick"
21:09gfredericksamalloy: but that could backfire because if you're just being a dick then that's probably also what I'm doing
21:10gfredericksthough maybe it's not important because if you're not being a dick I'm probably still being a dick
21:11skelternetLoL…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:13tmciverskelternet: text-to-speech? Cool! How do you do it?
21:13skelternetAdium has it built in
21:15tmciverDoh! OSX :(
21:16skelternetnot available on other platforms? Surely other IRC clients have the feature.
21:16rhallskelternet: does adium read all the drop messages too :)
21:16rhallI'm running erc in emacs
21:17rhallI think I can hack festival to read the erc stream
21:17skelternetrhall: people leaving and entering? no. at least not the way I've configured it.
21:17skelternetthough 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:18emezeskeCan anyone point me in the right direction to figure out what the ClojureScript equivalent of (instance? clojure.lang.Named x) would be?
21:18rhallskelternet: I'm sure :)
21:20gfredericksemezeske: since no one else has answered yet, I will speculate it has something to do with protocols?
21:21emezeskegfredericks: That makes sense. Starting point! Thanks.
21:21skelternetemez: I'm curious what the answer will be. I thought javascript is a nearly typeless prototype-based language.
21:22gfredericksskelternet: my assumption is if there is such an equivalent it'll be entirely at the clojurescript semantic level, not JS; e.g. protocols
21:22emezeskeskelternet: If I'm lazy enough, the answer might be (or (symbol? x) (keyword? x)) ^_^
21:22gfredericks,(instance? clojure.lang.Named "foo")
21:22clojurebotfalse
21:22gfredericks,(name "foo")
21:22clojurebot"foo"
21:22gfredericksI hate everything
21:23amalloy&(doc satisfies?)
21:23lazybot⇒ "([protocol x]); Returns true if x satisfies the protocol"
21:23amalloy(satisfies? INamed x) is surely the JS thing
21:25gfredericksoh of course strings couldn't be clojure.lang.Named, since you can't muck with the string class. I am ashamed.
21:26skelternetibdknox: if you have a minute, I have a pre-route question for you.
21:41FrozenlockCould someone help in translating the following example in working clojure code?
21:41FrozenlockI'm ok with this: java: test.initialize(); clojure: (.initialize test)
21:41FrozenlockBut this..... java: (test.sendBroadcast(2222, new WhoIsRequest(null, null)); clojure: ???
21:41lazybotFrozenlock: How could that be wrong?
21:42alandipert(.sendBroadcast test 2222, (WhoIsRequest. nil nil))
21:43Frozenlockalandipert: thanks!
21:44alandipertFrozenlock: no problemo
21:50emezeskeamalloy: You are awesome, thanks
22:07Null-AHow can I perform lookup in hash-map by using pointer of object as key
22:08burlappsackdoes clojure have support for pointers?
22:08Null-Ait has support for identity
22:08Tcepsaburlappsack: Not that I know of... but there is a lot that I don't know ^_^;
22:10burlappsackI don't think it does
22:10burlappsackclojure is written in Java
22:18muhootis 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:18muhooslow computers and java don't get along so well.
22:20Arafangionmuhoo: Yet my Atom-based system is fast enough for everything else.
22:26muhooyep. atom here too.
22:26muhoonetbooks ftw
22:27muhoook, i'm confused. if i have something like (for ... (loop [] .... (recur)), what gets recurred?
22:27muhoothe loop, or the for?
22:28muhooi'm trying to figure out this: https://refheap.com/paste/714
22:33amromuhoo: for isn't a recur target
22:35burlappsackhas anyone hear used a profiler for clojure code?
22:35burlappsacklike visualvm or something similar?
22:42alandipertburlappsack: i've had success with yourkit
22:43burlappsackokay, i'll have to check it out
22:44burlappsackthanks
22:45burlappsackhave you found using the profiler helped you choose the correct clojure commands/structure to use?
22:50alandipertburlappsack: oh, no - i used it for performance work
22:51alandipert(characterizing the behavior of a web service that needed to meet certain perf criteria)
22:51alandipertburlappsack: the tool you are looking for is practice :-)
22:52burlappsacklol
22:52burlappsacki'm speaking about performance
22:52alandipertburlappsack: oh, sorry i misunderstood. yourkit definitely handy
23:19jweissi 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:38muhoojweiss: zipper?
23:41jweissmuhoo: yeah that might do it
23:42alandipertjweiss: i'd probly use walk
23:42alandipertesp. if these things are arbitrarily deep