#clojure logs

2009-08-01

00:31iBong(for [x (range 4) y (range 4)] (print (+ x y)))
08:08dysingermonin
08:08rhickeyhey
08:09lbjHey guys - Ive imported ServletFileUpload into my namespace and I'm having a problem calling a method. Is there a way to list all methods imported from that namespace, ie ServletFileUpload/* and possibly see which args they take?
08:15dysingercan you pastie the error / code ?
08:16lbjYou dont need it to tell me how to avoid hitting the javadocs everytime I have a question about a method :)
08:17dysingerThat's what javadocs are for :)
08:17dysingerYou said you were "having a problem calling a method"
08:23dysingerlbj: are you using emacs / slime ?
08:30dysingerlbj my guess is that you are used to an IDE w/ refletion code completion pop ups
08:31dysingersome of the newer ide plugins for clojure have that
08:31dysingerI just hit C-c C-d C-d in emacs / slime to jump to the javadocs if I need it.
08:32dysingerThe intellij guy who is writing the clojure plugin showed it to us at the june meetup
08:32dysingerlooks pretty slick but i don't think I could ever leave emacs for lisp development
08:33dysingerThe editor still kicks arse all over the IDEs
08:36lbjSorry, I was afk :)
08:37lbjYes I think I'll be hard to drag away from Emacs as well. I think kotarak succeeded in doing Java reflections for his VimClojure
08:37lbj...and if Vim can do it ...
08:37lbj@ dysinger
09:48dysingerIs there any code in contrib to reflect java object methods ("like poor-mans java version of find doc") ?
09:48dysingerI didn't see any
09:48dysingerwas going to write one
09:49Chouserrepl-utils/show ?
09:49dysingerdogh guess I didn't look hard
09:51dysingerthere we go :)
09:51dysingerthanks Chouser
09:51dysingerlbj: there you go ^
09:52rhickeyanyone try new new yet? the latest infers the types
10:17Chouserrhickey: I'm getting NoSuchMethodError: clojure.lang.RestFn.<init>(I)V
10:17Chouserstill trying to find the specific cause
10:18lbjdysinger, Chouser: Thanks
10:18rhickeyChouser: getting it with the very latest?
10:19rhickeychouser: did you ant clean contrib? I had that problem before I did
10:20rhickeythe latest new code builds and tests cleanly the latest contrib
10:20Chouserthat's probably it -- just a sec
10:21rhickeyMark Tarver throws in the towel on Qi - "There is no such thing as free software. That’s the fallacy. There is only software that is paid for by somebody else."
10:21Chouser:-(
10:21rhickeyhttp://groups.google.com/group/Qilang/browse_frm/thread/592773c562017d87
10:23Chouserant clean in contrib fixed it.
10:24Chouserso now if I hint any args on a new's method, all the unhinted are assumed to be Object or something?
10:24rhickeyChouser: right, no hint is Object, no hints at all tries to find a single method in your supers to override
10:25rhickeymethods overloaded w/same arity in supers require full matching type spec
10:26rhickeyin the no hints, override found, you'll get the exact signature from the super
10:27rhickeyhttp://www.lambdassociates.org/blog/prolegomena(1).htm
10:29drewrrhickey: thank you for paying for clojure
10:29Chouserwell this is beautiful. the proxy form in lazy-xml has become a new that is smallar and undoubtedly more efficient
10:30rhickeyI swapped out future-call and promise with new new
10:30rhickeystill to go: efficient self-calls and volatile
10:34rhickeydrewr: the bill is in the mail :)
10:35Mark_Addlemani see a weird interaction between a (println) statement and a very large sequence...
10:36Mark_Addleman(deftest test-lots-of-times
10:36Mark_Addleman (let [s (repeatedly #(java.util.Date. (long 0)))]
10:36Mark_Addleman (dorun
10:36Mark_Addleman (take 10000000 s))
10:36Mark_Addleman #_(println "done")))
10:36Mark_Addlemanthis code runs fine
10:36Mark_Addlemanbut when i remove the comment, i get an out of memory error (my JVM has 32m of heap)
10:37Mark_Addlemanwhy would the presence of println cause clojure to retain memory?
10:41opqdonuti'd guess because s doesn't leave scope as quickly then
10:42lbjI'm looking forward to the answer rhickey, looks like unexpected behaviour :)
10:42opqdonuthmm, but isn't take lazy?
10:42lbjHence the dorun
10:42opqdonutah, dorun
10:42opqdonutyes
10:42Mark_Addlemanjust ran another test:
10:42Mark_Addleman(deftest test-lots-of-times
10:42Mark_Addleman (let [s (repeatedly #(java.util.Date. (long 0)))]
10:42Mark_Addleman (dorun
10:42Mark_Addleman (count (take 10000000 s)))
10:42Mark_Addleman #_(println "done")))
10:43drewrlisppaste8: url
10:43lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
10:43ChouserMark_Addleman: please don't paste multiple lines here
10:43Mark_Addlemanthis also explodes with OOM. i'd expect count to be a simple accumulator and not hold onto the head
10:43drewrMark_Addleman: ^^
10:43Mark_Addlemanah, sorry
10:43lbjChouser: Is it really a problem when were speaking 5 - 6 lines?
10:43lbjI think thats an easier read than hunting links, personally
10:44lisppaste8Mark_Addleman pasted "unexpected out of memory" at http://paste.lisp.org/display/84564
10:45lisppaste8Mark_Addleman pasted "untitled" at http://paste.lisp.org/display/84567
10:46lisppaste8Mark_Addleman annotated #84567 "untitled" at http://paste.lisp.org/display/84567#1
10:49Mark_Addlemanif i'm not doing something stupid with the code, i'll file a bug report. what's the process for that?
10:52lisppaste8Mark_Addleman pasted "untitled" at http://paste.lisp.org/display/84568
10:53lisppaste8Mark_Addleman annotated #84568 "untitled" at http://paste.lisp.org/display/84568#1
10:54lisppaste8Mark_Addleman annotated #84568 "untitled" at http://paste.lisp.org/display/84568#2
10:54lisppaste8Mark_Addleman annotated #84568 "untitled" at http://paste.lisp.org/display/84568#3
10:55lisppaste8Mark_Addleman annotated #84568 "untitled" at http://paste.lisp.org/display/84568#4
10:55lisppaste8Mark_Addleman annotated #84568 "untitled" at http://paste.lisp.org/display/84568#5
10:56rhickeyMark_Addleman: locals are cleared only on tail calls
10:56rhickeyMark_Addleman: locals are cleared only on tail calls
10:57Mark_Addlemanrhickey: i don't follow. isn't the the local lazy? i understand why it would retain the latest value from the seq, but why more than that?
10:58rhickeyfollowing the count cal with print means local s is held until the print call
10:58lbjAh ok, makes sense
10:58rhickeydorun walks while local s holds head
10:59rhickeyrealizing entire list
10:59rhickeylazy != ephemeral
10:59Mark_Addlemanaccording to the docs, dorun does not retain the head. doall does
11:00opqdonutright
11:00opqdonutit's s that retains the head
11:00Mark_Addlemanah! alright
11:00opqdonutit has to be held on to in case the println needs it
11:00Mark_Addlemanthanks for that
11:00rhickeythis has nothing to do with dorun/doall holding the head, local s is holding the head
11:02Mark_Addlemanok, so what i want is a generator. i want to return an infinite number of dates (where each date is one second later than the previous one). i don't need to retain the head.
11:02ChouserI'm certainly sympathetic with Traver's frustration with his own project, but I find his broader conclusions uncompelling. I hope he finds the personal satisfaction he's seeking.
11:03Mark_Addlemani know how to write a function that does that, but i want that function to play well with the seq library... that's where i went awry
11:04Chouserjava.util.Dates?
11:05Mark_Addlemanyes
11:05Chouserif you use something like 'iterate', you shouldn't have to worry about cleared locals, tail calls, etc.
11:07Mark_Addlemanok... i've seen the iterate function but i haven't wrapped my head around how to use it
11:08Chouser,(take 3 (iterate #(let [d (.clone %)] (.setSeconds d (inc (.getSeconds d))) d) (java.util.Date.)))
11:08clojurebot(#<Date Sat Aug 01 08:11:29 PDT 2009> #<Date Sat Aug 01 08:11:30 PDT 2009> #<Date Sat Aug 01 08:11:31 PDT 2009>)
11:09Mark_Addlemani see. i was using a true stateful function with a ref to store my counter (thinking there had to be a functional solution).
11:09Mark_Addlemanthanks for the pointer
11:12lbjBy the by - Anyone know of a simple thin interface to unix syslog from Java ?
11:18dysingerlbj to write or read ?
11:18Mark_Addlemanyou want to post to syslog?
11:18dysingerlog4j has a syslog adapter
11:18dysingerbut thats write only
11:18lbjTo write
11:18lbjI'm looking at syslog4j atm
11:19dysingerthat's why I'm using log4j under commons logging
11:19lbjJust wondering if one had tried something and came back with a good report
11:19dysingeris because I can pipe it to syslog for production
11:19dysingerI have not wired it up yet but that's the plan
11:19lbjOk
11:20dysingerno other popular loggers can pipe to console in dev & syslog in production
11:20dysingerthat I know of
11:20lbjSo where are you piping it now?
11:21lbjI'll take a loo at log4j
11:21lbjsyslog4j looks very simple too though
11:21Mark_Addlemandepending on what you're trying to do, log4j can be too much candy for a nickle
11:21Chouserlbj: clojure.contrb.logging ?
11:22lbjOh you know I never look in contrib :)
11:22Chouserthat just wraps other libs though, like log4j. I think.
11:23lbjAh ok, Ill check it out
11:24lbjGoogle Code still comes up as the first hit when I search for Clojure contrib, consider shutting it down ?
11:27lbj(defmacro log4j-logging) is a macro which takes no arguments and returns a struct - why is that a macro ?
11:36lbjChouser: I sense you had a hand in this :)
11:41bairespaceI keep seeing the suggestion that clojure-in-clojure might be adapted to run on the objective C runtime
11:41bairespace& I'm wondering: could a similar thing be done wrt the emacs runtime? or wrt other lisps?
11:41Chouserlbj: logging? not at all.
11:42Chouserbairespace: in order to run clojure inside emacs? or emacs on the iPhone?
11:44bairespacechouser: clojure inside emacs
11:50lbjBack up the iPhone - Somebody found a way to execute Clojure on it ?
11:51lbjbairespace: http://github.com/technomancy/clojure-mode/tree/master <-- Technomancy has an install function which will pull down all dependencies and show you an example of .emacs
11:51bairespaceChouser: clojure inside emacs.
11:52bairespacelbj: thanks.
11:52Chouserbairespace: an interesting idea. don't see why not.
11:52Chouserbairespace: it wouldn't be full Clojure of course -- not threads, etc. but it might be possible for some subset of clojure code to be compiled to elisp
11:54lbjback to the iphone.... :)
11:54bairespaceI was thinking there might be some other snag: slowness, maybe. Luke Gorrie's distel did something similar for a subset of erlang, I think.
11:56lbjdysinger: I dont see syslog as an output option for log4j, Windows NT Log Service is supported however
12:14bairespaceChouser: only need to call or create elisp code from Clojure, really. Especially if it was convenient to use more than one such adaptation of Clojure in the same program--with Clojurescript, say.
12:15bairespacegot to go...
12:19Mark_Addlemanlbj: http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/net/SyslogAppender.html
12:25lbjMark_Addleman: Thanks
12:44lbjLet me just see if I got this straight. If I wrap my functions in a log macro, which then uses send-off to start some logging service, then send-off it self will regulate how many threads to launch at a time so that this does not destroy overall performance of the app ? Or do I need to be more strict with my ressources?
12:46Chousukelbj: agents have a thread pool
12:46Chousukeso it won't spawn new threads for every send-off
12:53lbjSo I wont need to be more strict, but also be prepared for some delay. Sounds good
14:57alrex021When using for example :only keyword when importing specific function from another namespace, why are square brackets used? e.g. (use '[clojure.contrib.math :only (round)])
14:57alrex021trying to get my head around this
14:58Chousukeit's a list of specific functions to import
14:58Chousukein your case, a list with one item
14:58alrex021I though lists where represented with () and not like vectors []
14:58alrex021I mean
14:58Chousukeah, wait, I misread
14:59alrex021sorry I see square brakets before the use '\
14:59alrex021if no keywords, then it looks like (use 'clojure.balabla.bla)
14:59Chousukeyeah
14:59Chousukethe plain symbol is just a shortcut
15:00Chousukethe vector specifies a library and its options.
15:00alrex021oh I see, so it has to be a vector in those cases
15:00Chousukeyeah.
15:01Chousuke(use 'foo.bar) is short for (use '[foo.bar])
15:01Chousukebut it doesn't work if you have :as or :only etc.
15:01Chousukeso you need the vector.
15:02Chousukethere was some talk about improving the import syntax, but I don't think anyone did anything :/
15:07alrex021yup, confusing for new comer to the language like myself
15:09alrex021I understand shortcuts like #(..... %) for fn [] body ....but no so much the one above :)
15:10Chousukethe ns macro syntax is not too complex after you get it... but it isn't that well documented either.
15:10Chousukethe documentation is kind of scattered
15:11alrex021I'm reading the clojure book for the second tome
15:11alrex021time...things ae making more sense this time around
15:11Chousukeheh
15:12ChousukeI suppose it's true that you need to read a book at least twice to make any sense out of it.
15:12alrex021I tell you what, first time coming to any lisp dialect, what a mind f***
15:13Chousukeheh
15:13ChousukeI think it's the functional programming that gets people at first.
15:13Chousukeand the parentheses, until they understand it's really no worse a syntax than reserved words and curly brackets
15:13alrex021that book maid very little sense first time, makes you feel a bit helpless especially having over a decade in programming behind me....well oop and less fp
15:15alrex021but starting to really enjoy it now... I have a strong web dev background so I see myself joining the web framework dev efforts in clojure space
15:15alrex021if I get that far ;)
15:18alrex021u r abs right. it is the fp that get ppl
15:25hserusin my case, im currently stumbling at the lazy concepts :)
15:25hserusgot a quick question on that, is there a pattern on when to evaluate a lazy sequence?
15:27hoeckhserus: what do you mean by "evaluating"?
15:29hserusi mean realizing a lazy sequence (basically doing a dorun)
15:30hseruswhat do you usually refer this as?
15:30hoeckmaybe "forcing" a lazy sequence
15:31hoeckonly when the computation itself has side effects
15:32hoeckand you want those side effects now
15:32hserusright, when i want to test a function that returns a lazy sequence (and since that is the default, i guess in most cases) i end up forcing the lazy sequence
15:34hoeckyeah, and printing (e.g. at the repl) always forces the lazy sequence
15:34hserusyup, learnt is the hard way.. i was wondering why my unit tests fail, but the same code works on repl
15:39Chousukesometimes you want to force stricness so that you don't get "too lazy"
15:39Chousukestrictness*
15:40ChousukeI mean, there are situations where you end up generating so many thunks that it blows the stack.
15:40hseruscurrently, for my web app, an example where im doing this is just before persistence of my entities..
15:40hserusis that correct?
15:41ChousukeI can't say.
15:41Chousukebut if it works, it's probably okay :P
15:41hserushehe
15:42Chousukeforcing strictness only gets you potentially suboptimal performance if you end up doing it in places where you could afford to be lazy.
15:43hserusmy doubts has been around unit testing, so is it fine that i have to force sequences in my tests for functions that return lazy sequences?
15:47hoeckonly if the lazy-seq returning functions, for some good reason, have side effects you want to test
15:49lbjHow is arity dispatching handled when in a macro ?
15:50hoeckhserus: if you only compare the results with a literal list, like (= '(1 2 3) (my-fn)), then you don't have to (doall (my-fn)), = does this when necessary
15:51hserushoeck: even when my-fn returns a lazy seq?
15:52hoecklbj: at compile time, the compiler counts the expressions passed to the macro
15:53lbjhoeck, I meant practically :) I would have imagined something like this to work (defmacro tst ([x] `(tst 5 ~x)) ([x y] `(+ ~x ~y))), but no dice
15:57hoecklbj: it works, try (macroexpand-1 '(tst 1))
15:58lbjInteresting - It expands correctly in both cases, but throws a 'new instance' exception when run... ?!
15:58hoeckhserus: '=' will just evaluate as much elements as it needs to compute a result
15:59lbjuser> (macroexpand-1 '(tst 1 2))
15:59lbj(clojure.core/+ 1 2)
15:59lbjHow can this blow up with an exception ?
16:00lbjArgh, my bad, misplaced symbol
16:00lbjsorry
16:00danlarkin,(let [s "/\\\""] (= (name (symbol s)) s))
16:00clojurebotfalse
16:00danlarkinis that a bug?
16:07hoeck,(name 'a/b)
16:07clojurebot"b"
16:08danlarkind'oh
16:08danlarkinit's thinking it's the namespace I guess?
16:08iBongany idea why I get a "function import is void" error when trying to eval a source file buffer, but it runs fine when pasted into the REPL?
16:11hoeckdanlarkin: well, "/" is at reserved for namespace-name separation, so it makes no sense to use it as a symbol character except for divide
16:11danlarkinHmmm
16:12hoeckdanlarkin: so symbol just reads "/bla" as symbol bla without a namespace
16:12danlarkinhoeck: ah yes, of course, you're right
16:13hoeckdanlarkin: mhhh, only the name function returns the correct name, str returns "/bla"
16:14danlarkinyeah, now I have to decide it I should use name or subs str
16:15hoeckdanlarkin: I guess one should be careful when generating symbols from strings, using symbol, the reader is more strict and doesn't read symbols like '/bla
16:16danlarkinwell this is just covering corner cases in my tests
16:27falkorhi, I am trying clojure and am having a 110% newbie problem...
16:30hserusfalkor: what is it?
17:12l0st3d,(do (def t 0) (binding [t 1] (println t)))
17:12clojurebotDENIED
17:15l0st3dHi, I'm learning clojure atm - correct me, but shouldn't (def t 0) (binding [t 1] (println t)) print "1" ? - it prints "0" on my machine
17:17fffejlost3d: it prints 1 for me if that helps
17:17danlarkinl0st3d: prints 1 for me too
17:17fffejperhaps try updating to the latest version?
17:17l0st3dok thanks guys
17:21fffejIf I've got a pattern like (doseq [x (iterate f 0)] body) is there any way to interupt the body of the doseq? At the moment I'm throwing an exception to get out of it which feels completely wrong (it's for a GUI and the user can interupt (by means of setting an atom) the process
17:31hoeckfffej: you could wrap the seq generation in a take-while
17:32fffejhoeck: thanks, that sounds perfect
17:32hoeckfffej: (doseq [x (take-while (fn [_] @abort) (iterate f 0))] ..)
17:33fffejthanks, works a treat
17:40lisppaste8iBong pasted "let abuse?" at http://paste.lisp.org/display/84590
17:40lbjI just tried to let a servlet accept an upload of 250Mb and according to my logging the upload went fine, and the file landed remotely as it should, but afterwards Firefox crashed. Any idea why ?
17:41iBongI find myself writing lots of code like this, it seems somehow "imperative", just wondering if it's a bad habit or if its just a question of style (I find these kind of let blocks make my code more readable)
17:43fffejiBong: I think it's only let abuse if there's side effects, I use let a lot too because (as you say) it makes it more readable
17:43iBongno side-effects
17:43fffejso no abuse (in my limited experience!)
17:43iBongthat's good to hear then
17:45fffejwhat is "new new"?
17:46rhickeyfffej: like proxy but faster
17:47fffejrhickey: sounds good!
18:07dysingeram excited about our clojure team build out ;)
18:08Anniepoois there a good reason, given 'don't wrap java unnecessarily', for shell-out?
18:14dysinger"new new" sounds like a character from Teletubbies
18:16AnniepooRich Hickey secretly has a TV in his tummy - pass it on
18:17rhickeydysinger: cool - how many devs are you up to?
18:19dysinger4 and maybe 5 this month
18:20rhickeyawesome
18:20rhickeyfinding good people?
18:20dysingerthey are lined up
18:20dysingerI just had to mention it on twitter
18:20dysingereverybody is people in here that you know
18:21Anniepoohaving a meetup?
18:21dysingers/everybody is/every person is
18:21dysingerwhatever - you got me
18:22dysingerAnniepoo: no building a team of devs to work on clojure projects.
18:22Anniepooah, cool
18:23rhickeystart of some docs for new new: https://www.assembla.com/wiki/show/clojure/New_new
18:29mattrepldysinger: sent you a pm re: clojure jobs
18:33tomojthere are jobs for clojure? O_o
18:34chouser_,(map #{1 3 4 5 6} #{1 2 3 5 6 7})
18:34clojurebot(1 nil 3 5 6 nil)
18:36rhickeyinteresting visit by chouser?
19:19pokey9what is sqrt in clojure?
19:24Anniepooyou can use the java Math/sqrt
19:25Anniepooor the math API in clojure.contrib
19:25Anniepoohttp://code.google.com/p/clojure-contrib/wiki/MathApiDoc
19:26Anniepooif you use the latter you'll have to do (:use clojure.contrib.math) in your ns at the top of your file
19:27Anniepoons is kinda like java's package / import
19:27Anniepoodo you know Java?
19:30dysingerAnniepoo: yes
19:30dysingeron both
19:30dysingerwell sort of - it's not a direct mapping
19:31dysingerbut close
19:31Anniepooyes, I'm assuming he's a beginner to Clojure, and offering a useful metaphor
19:32dysingerwhos "he" ?
19:33Anniepoopokey9
19:33dysingerOh I got turned around - I thought you were asking not commenting.
19:34Anniepoo(I'm also assuming pokey9 is a man, rather than a woman, it seems the Bayesian thing to do, but
19:34AnniepooI'm probably not being a good feminist by doing it)
19:35Anniepoo16:19] <pokey9> what is sqrt in clojure?
19:35pokey9Anniepoo, i have CLisp installed in my .emacs as well, and like to use the slime command for lisp interaction with that
19:35pokey9but i put the Clojure code in my .emacs file so now when i do M-x slime it does Clojure REPL
19:36pokey9how do i differentiate so i can do CLisp sometimes and Clj others?
19:36Anniepoodunno, somebody else will have to address that, I'm an IntelliJ user
19:36dysingerThere is an alternate way of starting slime that lets you pick
19:36dysingerI forget what it is - one sec
19:39dysingerpokey9: it's C-u M-x slime and it will ask you which impl to use
19:40pokey9dysinger, thanks. My alternative was going to be to comment out whichever one i didnt want to use in the .emacs file every time. So this is an improvement :)
19:40dysingerIf you search cliki wiki for slime there is a bunch of tips
19:42JAS415clojure is nice for doing stuff
19:57prospero_if I want to have one thread sleep until another has completed a task, do I need to use java concurrency primitives?
20:06Anniepooprospero, do you mind my asking why you want to use Java threads in the first place?
20:07AnniepooOne of Clojure's advantages is that it has better concurrancy mechanisms
20:07JAS415what if you have to do something that is timed
20:07JAS415like i want my doodad to update every 5 minutes
20:08AnniepooI think you'd use a Java timer, but that's NOT an authoritative answer, I'm kind of a beginner myself
20:08prospero_Anniepoo: I'm working with OpenGL
20:08Anniepooah, cool
20:09AnniepooI'm a graphics person too
20:09prospero_and it needs to be on a particular thread
20:09Anniepoosure
20:09Anniepooswing's same way
20:09prospero_right now I'm working with GPGPU
20:09Anniepooooh, sweet
20:09prospero_and I'd like to be able to treat it as thread-agnostic, even though it isn't
20:10Anniepoosure
20:10prospero_so the best way I can figure is wrap up the call in a macro which acquires a semaphore, pushes off a request to the render thread, and then releases the semaphore at the end of the render call
20:10Anniepoook, then yes, just use the Java interop like normal java
20:10prospero_I just wasn't sure if there was a more clojure-ish way to do it
20:11Anniepoocheck out ref's
20:11Anniepoothat's what that mechanism is for
20:11Anniepoodo you have Stuart Halloway's book?
20:15prospero_yes
20:16prospero_STM seems a little bit of a weird fit for the problem, even if it could pull it off
20:56rabidsnailMy script runs fine in the repl, but when I try to load it using clojure.main or clojure.lang.Script, I get a java.lang.ExceptionInitializerError.
20:58rabidsnailhere's the backtrace: http://paste.lisp.org/display/84597
21:08mattreplrabidsnail, can you paste your script?
21:09mattreplit looks like you're attempting to load a properties file that isn't on your classpath
21:10rabidsnailhttp://paste.lisp.org/display/84599
21:10rabidsnailI just downloaded clojure.jar again and now it works
21:12JAS415neat
21:30Anniepoostrange
21:30Anniepoo,(sh "notepad.exe")
21:30clojurebotjava.lang.Exception: Unable to resolve symbol: sh in this context
21:31Anniepoo,(use 'clojure.contrib.shell-out)
21:31clojurebotnil
21:32Anniepoo,(sh "notepad.exe")
21:32clojurebotjava.security.AccessControlException: access denied (java.io.FilePermission <<ALL FILES>> execute)
21:32Anniepoohmmm
21:32AnniepooI'm trying to launch an external process from Clojure, via the sh
21:33AnniepooI've also tried using java.lang.Runtime
21:34Anniepooon my (windows XP) machine if I (sh "notepad.exe") it returns an empty string but no notepad window pops up
21:34ChouserAnniepoo: I wrote shell-out, but have tested it only on Linux.
21:35Anniepoosame behavior for calling Runtime#exec directly
21:37ChouserYou asked earlier why it's worth wrapping Runtime -- for trivial cases (string in, string out) 'sh' is a much simpler API
21:37Anniepoook, I see that
21:38Anniepoothat was when I was 'this is a trivial thing to do
21:38Anniepoonow I'm still trying to do it
21:38Chouserheh
21:41Anniepooit's not the path, cause it does what you expect if you say (sh "notarealfile.exe")
21:41Anniepooin my repl it returns ""
21:42Anniepooin my code it's just not launching, either photoshop or notepad
21:42AnniepooI'd use linux but I need to use projectors ;c)
21:45mebaran151Anniepoo, projectors?
21:46Anniepoosorry, inside joke - Rich Hickey came to a special baclojure meeting during JavaOne, they
21:46Anniepoowere going to do speed talks, each person does 10 minutes. All these engineers had linux on laptops and none could get
21:47Anniepoothem to work with the room projector.
21:47mebaran151hahaha, that's pretty funny
21:47mebaran151the newer xorgs though don't have that problem as much, especially with xrandr
21:48mebaran151my coworker was so surprised when it just worked: (we'd spent an afternoon fighting jetty so we were expecting more Linux wars...)
21:48AnniepooI had visions of somewhere across town a bunch of marketing flacks smoothly running presentations off windows vista
21:50mebaran151no no , off Mac OS X laptops with cruddy bad blitting graphics cards
21:51JAS415i wrote a restful api interfacing library writing library, do you think people would find that useful?
21:52JAS415so like, i wrote a twitter interface in a few lines of code that compiles mostly to calls to apache httpclient and oauth signpost library
21:52mebaran151man fighting the pomp and circumstance of bdb is beginning to get a bit tiresome: anybody know of a nice simple functional btree library
21:52mebaran151just for storing ordered collections
21:53mebaran151JAS415, sounds pretty neat: wrap it up in a JAR and tell the world!
21:53mebaran151(if you want a nice async http library check out xlightweb as well)
21:53mebaran151(I have a basic wrapping of it if you want to borrow it)
21:55JAS415okay, i'm just nervous because my code always works for what *I* use it for but never stands up to academic scrutiny
21:56Anniepooignore the academic scrutiny
21:56mebaran151oh people on the mailing list have been pretty chill
21:56mebaran151they'll even fix it for you
21:57mebaran151I'm probably going to split out my bdb clj bindings if anybody wants them
21:58AnniepooI'm on a standards working group (groan). We have a loudmouth who tells everybody how it is and why their ideas suck
21:58mebaran151I'm still trying figure out a good way to integrate secondary indexes, or whether I'd might as well try to do all the joining myself
21:58Anniepooone day she proposes something that is easy to test (I've forgotten what), and tries to actually write it.....
21:59Anniepooafter we saw her code we took her pronouncements less seriously
21:59mebaran151ha
21:59mebaran151I'm so sick of Oracle Engineering
21:59mebaran151Oracle should change their name to Over Engineering
22:00mebaran151only they would have a Factory class for a Config class that gets passed to another factory
22:02JAS415I dunno, maybe i'm not a team player, but I just write code so that it works and don't worry about it until it is proven to not work...
22:03mebaran151well it's nice to have a quick test suite
22:03mebaran151most useful in deployment actually: when you put the code up, run the tes suite ad make sure all the libraries got up okay
22:08Anniepoonice.
22:08Anniepoonow I've corrupted my project file, apparently
22:08Anniepoonot my day
22:17mebaran151in eclipse?
22:20JAS415which is why i use emacs now
22:20mebaran151I'm in netbeans: I could never really stick with emacs
22:20mebaran151always was a vim guy
22:21mebaran151but now I'm spoiled by the gui goodness of netbeans
22:22JAS415I just really like being able to hit ctrl+alt+q and have my code indent itself
22:22JAS415that's actually the only thing i missed when i was trying to use eclipse or emacs
22:22mebaran151you can use alt-r with clojure plugin
22:22mebaran151ctrl a and alt r
22:23mebaran151and shotgun line up
22:23JAS415ah really?
22:23JAS415i guess the other thing was i kept printing things that were longer than the eclipse repl would handle
22:23JAS415by emacs above i meant to say netbeans*
22:24JAS415anyway i normally assume that my failure to use a tool properly is my fault rather than the IDE's
22:24JAS415you know what you know, as they say
22:25mebaran151oh there's an option somewhere for that
22:25mebaran151but usually, when I want something printed
22:25mebaran151I want ALL OF IT (grrr)
22:26JAS415well in eclipse I would generally crash eclipse completely
22:26JAS415I would tell it to grab some xml output and parse it to a zip
22:27mebaran151eclipse lieks to eat all of my RAM
22:27mebaran151for no apparent reason
22:27JAS415it would print the first 100 lines or so and then die horribly
22:27mebaran151so the clojure plugin on eclipse is not ready for the big time yet?
22:27JAS415not if you want to do repl development
22:28JAS415which is really my style
22:28JAS415if you just want to build projects it is fantastic honestly
22:29mebaran151I like to throw some code at the repl every now and again
22:29JAS415nice simple creation of directories and sub directories and stuff
22:29mebaran151I'm glad they got ... file management working :P
22:29JAS415i kind of have a weird background i guess
22:29JAS415for work I use common lisp and we don't have a full IDE for it
22:29JAS415it is old and broken in horrible ways
22:29JAS415so I do a lot of repl debugging and print statements
22:30mebaran151no emacs?
22:30JAS415to figure out what the hell is happening
22:30JAS415i have emacs but no slime
22:30mebaran151oh
22:30mebaran151pity
22:30JAS415so i'm copy/pasting
22:30mebaran151I never did get into using a breakpointer either
22:30mebaran151I do throw debuging
22:30JAS415yeah is just because we use goldhill common lisp which is a *bit* before slime
22:30mebaran151as in, let's see how far we can get before we throw
22:31JAS415yeah the problem is that sometimes your customers figure out a clever way to wreck your code with throw debugging
22:31JAS415just because people are inherently baysian and likely to follow the same gui paths that they did before
22:31mebaran151usually before I release, I go through and destroy all my throws
22:32JAS415so you get a new human and they take a different path and you find different errrors
22:33mebaran151that's why you got reduce the number of humans :)
22:33JAS415that's right, that's why we gotta fight the marketing and sales guys tooth and nail
22:33mebaran151only in Javaland would the standard library have a full fledged sql library but no simple library for basic sorted hash btree persistence
22:36JAS415i'm not sure i know what hash btree persistence is, but I adapted the 'memoize' function in clojure.core to extend to printing out hashtables when they get updated
22:36JAS415so you you get a function that is cached between user sessions
22:37JAS415and obviously there are limitations as a lot of things don't have printable representations
22:39JAS415anyway i'm looking for a better way to do it as it is annoying to have to write the whole map out to file every time it gets updated
22:41iBongwhat's the standard way to remove a seq of keys from a map?
22:43gkodissoc
22:43hiredman,(apply dissoc {:foo 1 :bar 2 :a 3 :c 4} [:a :c])
22:43clojurebot{:foo 1, :bar 2}
22:43hiredman,(reduce dissoc {:foo 1 :bar 2 :a 3 :c 4} [:a :c])
22:43clojurebot{:foo 1, :bar 2}
22:44mebaran151JAS415, I was just saying a dictionary btree
22:44mebaran151something like bdb where you store keys and values, without the 20 thousand extra classes to make the whole task as difficult as possible
22:46mebaran151and you would rewrite the whole structure on updates
22:49mebaran151*wouldn't rewrite
22:51JAS415mebaran, after much googling i have figured out what a dictionary btree is :-)
22:51JAS415you'll have to excuse my ignorance as my training is philosophy :-P
22:51mebaran151oh me too actually
22:52mebaran151tried to open a Proverbial Philosophy Store, and that just Didn't Work Out (tm)
22:52JAS415haha
22:53JAS415I've been told that philosophy is a major with no practical application but computer science seems to fit it just fine...
22:53mebaran151yep, pretty easy transition
22:54JAS415i dunno, what is cs except math and language
22:55mebaran151not even as much pure math as there should be...
22:57Anniepoook, I know i have to add the source and the output paths to my classpath for the compile statement to work
22:57JAS415knowing is half the battle
22:58JAS415i think that the other half is figuring out how to configure a classpath
22:58Anniepoobut if my file is namespace edu.uh.foo located in src/edu/uh/foo then will I add the foo directory or the
22:59Anniepoosrc directory?
22:59JAS415i think you would add edu
22:59mebaran151the directory above all those think
22:59AnniepooI freaking corrupted my intellij project file
22:59mebaran151did you have an git or hg version backup?
22:59mebaran151it is cases like this where recloning is the one true way towards Enlightenment
23:00Anniepoono, I'm working on this alone so I don't have a recent backup
23:01JAS415well if you look at like a jar file
23:01JAS415you'll see that its by subdirectories
23:02JAS415so like the namespace me.apibuilder.foo would be me/apibuilder/foo.clj
23:02mebaran151that sounds about right
23:02Anniepoook, then hang on
23:05JAS415so for example the classpath to contrib jar for me is: /clojure/clojure-contrib/clojure-contrib.jar which means that java starts looking inside the 'jar' file (which is a trumped up tar file)
23:05lisppaste8Anniepoo pasted "say what?" at http://paste.lisp.org/display/84605
23:05JAS415so i look inside the jar
23:05JAS415and i see path
23:06JAS415clojure/contrib/*.clj
23:06Anniepooyes, I understand java jar files
23:06clojurebot
23:06JAS415yeah i didn't when i started this stuff
23:06Anniepoobut I'm utterly baffled, when I compile, I throw this exception
23:07Anniepoowhat this rather unremarkable function has to do with ANYTHING is beyond me
23:07JAS415that is saying that the path doesn't exist
23:07Anniepoowhich path?
23:07mebaran151hey cemerick
23:08cemerickevening :-)
23:08AnniepooI understand "the path specified" doesn't exist
23:08mebaran151the ExceptionInitializer errors in Clojure are a little nasty
23:09AnniepooLOL
23:09JAS415*photoshop-startup-directory* "C:\\Program Files\\Common Files\\Adobe\\Startup Scripts CS3\\Adobe Photoshop\\")
23:09Anniepoohow, pray tell, does it even KNOW I'm eventually turning that string into a file?
23:09Anniepoo(and that is indeed a valid directory)
23:10JAS415i *think* you can use forward slashes instead of escaping the \
23:10JAS415i kind of forget but i think thats ok
23:10mebaran151yep
23:10AnniepooI can't say (def *what-I-would-like-to-say-now* "!@##$%@")???
23:10mebaran151WinXP is smart enough to figure out forward slashes
23:11carkhello all
23:11Anniepoostrange part is, this all was working for a while
23:11JAS415waitwait
23:11JAS415sh *photoshop-exe*
23:11JAS415that is where you use it like a path right?
23:12jwhitlarkclojurebot: def true?
23:12cark,(.numerator (/ 3 2))
23:12clojurebot3
23:12carkis there a core function for this ?
23:12clojurebotfor is a loop...in Java
23:13JAS415(def *photoshop-exe* "C:\\Program Files\\Adobe\\Adobe Photoshop CS3\\Photoshop.exe")
23:13JAS415(def *photoshop-start-dir* "\"C:\\Program Files\\Adobe\\Adobe Photoshop CS3\\\"" )
23:13Anniepooyes, but #_ on that followed by a dummy
23:13Anniepoogives the same error for the dumme
23:13JAS415you got extra slash on photoshop start dir?
23:13mebaran151it actually shouldn't matter
23:13JAS415hum
23:13mebaran151the extra slash
23:13JAS415bummer
23:14Anniepoono, I don't
23:14AnniepooI have an escaped quote
23:14Anniepoothe whole thing is in quotes
23:14JAS415oooooh
23:15Anniepoofurther, comment around the entire thing, both the
23:15lisppaste8Anniepoo annotated #84605 "untitled" at http://paste.lisp.org/display/84605#1
23:15AnniepooI comment the whole mass out as a sanity check
23:15JAS415and sh just sends it to shell
23:15Anniepoostick in (defn do-photoshop-script [foo] nil)
23:15JAS415?
23:16Anniepooand I get the same thing, can't find file specified
23:17Anniepoopointing at the line with my dummy replacement
23:17JAS415hmm
23:17JAS415what line is it then?
23:18lisppaste8Anniepoo annotated #84605 "untitled" at http://paste.lisp.org/display/84605#2
23:18Anniepoo35 for the one with the dummy func
23:18Chouserso I've got this nested vector dumped out to a .clj file -- 89K worth.
23:18Chouserand it won't load: java.lang.ClassFormatError: Invalid method Code length 188191 in class file user$eval__952 (data.clj:8)
23:19mebaran151Chouser, are there any secret btree implementations for clojure that don't rely on more classes than I can shake a stick at?
23:19ChouserI'm a bit stumped on how to work around this.
23:19Anniepoohey, is *root-dir* reserved for something?
23:19Anniepoothat smells generic
23:19JAS415doesn't seem so
23:20JAS415ser=> *root-dir*
23:20JAS415*root-dir*
23:20JAS415java.lang.Exception: Unable to resolve symbol: *root-dir* in this context (NO_SOURCE_FILE:0)
23:20JAS415user=>
23:20mebaran151Chouser, this probably seems incredibly silly, but have you tried splitting it up into two files or so and just conjoining both results?
23:20Chousermebaran151: on-disk btree, like a simple database?
23:21mebaran151yeah
23:21mebaran151something real simple
23:21mebaran151I'm working BerkeleyDB right now
23:21Anniepooah!
23:21JAS41589k i wouldn't expect to be too big
23:21Chousermebaran151: I would... yeah, bdb.
23:21mebaran151but I've made so many Factories, I feel like the soviet union
23:21AnniepooI put (comment ....) around the entire file
23:21Chouserha!
23:21JAS415and?
23:21Anniepoofollowed by
23:21Anniepoo(defn make-floortile-file [a b] "howdy pardner")
23:21JAS415lol
23:21Anniepooand it complains about the last line
23:22JAS415wow
23:22Anniepoo( I didn't include the ns in the comment)
23:22cupertinochad_Hi all. Can I ask a newbie question? I just asked it on the mailing list, but I am impatient, so I thought I'd try here ;-)
23:22JAS415ok
23:22Chousercupertinochad_: go for it
23:22mebaran151Chouser, I spend half my time tryig to avoid bdb's insane attemts to reserialize things
23:22carkchouser : are you using the reader or is it in a function ?
23:22mebaran151they really want you to just use the collections api, which demands annotations and nonesuch
23:23cupertinochad_I have a newbie question about anonymous functions. Why does the first form below work and the second form does not?
23:23cupertinochad_user> ((fn [] "foo"))
23:23cupertinochad_"foo"
23:23cupertinochad_user> (#("foo"))
23:23Chousercark: it's just a really big vector. (load-file "foo.clj") fails
23:23cupertinochad_; Evaluation aborted.
23:23carkchouser : why do you need to evaluate ?
23:23mebaran151,(#("foo"))
23:23clojurebotjava.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn
23:23Chousercupertinochad_: #("foo") becomes (fn [] ("foo"))
23:23mebaran151ah yes
23:23carkchouser : you could try only loading
23:23JAS415cuper, because i think #( ) has special read syntax
23:23mebaran151Chouse beat me true it
23:23Chousercark: oh! yes!
23:24JAS415its secrekt
23:24JAS415chouser: i've written and read bigger than 89k files in clojure, nothing bad happened
23:24JAS415is it possible that there is a nesting limit?
23:25Chouserit's not nested deeply 3 levels I think.
23:25cupertinochad_Hmm. So if I want a no-argument anonymous function that just returns a constant, how do I do that? Do I have to use (fn [] "foo")?
23:25JAS415that shouldn't be a problem
23:26carkchouser : just slurp the file and use the read function, i think that would work
23:26JAS415(constantly "foo")
23:26JAS415i think
23:26carkhum or directly read the stream actually
23:27Anniepoook, so I think the line that's ACTUALLY not finding it's file is
23:27Anniepoo(compile 'edu.uh.hhp.sl.automation.lessonPrimEditor.ui.LessonPrimPane)
23:27Chousercark: indeed! perfect! thanks
23:27JAS415cupertinochad: ((constantly "foo"))
23:28cupertinochadThank you.
23:29carkChouser: cool =)
23:29cupertinochadAnother newbie question: Where do I find the source for macros like #(expr)?
23:30Anniepoook, so I am indeed in 'source and object have to be on the classpath' hell
23:30JAS415oh shit, i dunno, you can download the source and look obviously...
23:30cark,(macroexpand '#(expr))
23:30clojurebot(fn* [] (expr))
23:30JAS415woah
23:30JAS415i was thinking in terms of the source of the macro itself
23:31Chousercupertinochad: LispReader.java, line 548
23:31carkmhh reader macros are special
23:31carkwhich is a shame ! (but dont tell rhickey)
23:32cupertinochadThanks again. Slime lets me hit M-. to jump to a function def, but I didn't know where to find reader macros
23:34ChouserFnReader for reading #(): http://tinyurl.com/l67t5h
23:35Chouserhiredman has started looking at rewriting that in Clojure, but I'm not sure if he plans to continue.
23:36cupertinochadChouser: And thanks for the link, too!
23:37cupertinochadIs there an archive of the IRC channel that I can peruse?
23:37Chousersure! It can be fun and enlightening to poke around in the .java sources.
23:37Chouser~log
23:37clojurebotsee logs
23:37Chouser~logs
23:37clojurebotlogs is http://clojure-log.n01se.net/
23:42Anniepoonot finding Clojure much fun right now
23:43cark,(.round 0.0003333M (new java.math.MathContext 4))
23:43clojurebot0.0003333M
23:43carkthat seems strange
23:43mebaran151_Anniepoo, what's doing?
23:43carkhow would i achieve a rounding to 4 digits ?
23:44AnniepooI'm in classpath hell
23:44Anniepoogimme a moment, I'm documenting it in lisppaste
23:45mebaran151_awww man, there ain't nothing worse than classpath wars
23:46mebaran151_I got into a brief argument on #java with a guy who was adamant that we should all love the classpath dearly; I disagreed
23:48r2q2JAS415: Are you putting your twitter library on github?
23:49lisppaste8Anniepoo annotated #84605 "untitled" at http://paste.lisp.org/display/84605#3
23:51mebaran151_if I wanted to give the world my beautiful (har har) bdb library, should I just spam the mailing list with it, or are there better packaging procedures?
23:52JAS415yeah i'm in the process of putting it on github
23:52Chousermebaran151_: there's a thread for announcing libs, or you can just announce it. It's the best we've got so far. :-/
23:55Anniepoosadly, the documentation of how it interprets the classpath is pretty lacking
23:55mebaran151_have you tried just make a new clojure project and manually copying your code over :/
23:56mebaran151_sometimes if things get bad deleting everything can be a lovely way to get back at th machines
23:56Anniepooyes
23:56Anniepoothat's what I'm doing
23:56AnniepooI'm trying to make a new project
23:56mebaran151_yeah it sometimes sucks when things like this go wrong
23:56mebaran151_use mercurial though to version stuff, even for single projects
23:56mebaran151_that way you can always rollback to a less broken state, and it's actually really easy to use
23:57Anniepooyes, in retrospect of course I should have had it in svn
23:57Anniepoobut that's not going to be very useful now