2010-07-10
| 00:12 | bhenry | with ring, how might i serve up static files from a dynamically decided path (based on a "get" variable from the query string)? |
| 00:13 | bhenry | eg localhost:8080/?dir=/Users/myname/Pictures |
| 00:13 | bhenry | http://... |
| 00:15 | bhenry | i'm able to get all the file objects, but the browser won't let me use file:///path coming from http:// |
| 00:47 | ysph | is it possible to instantiate a defrecord class using a map of the fields? |
| 00:53 | ysph | nm, i think my case is better suited for a dictionary anyway |
| 01:55 | ysph | how do you guys go about referencing random utilities that you primarily just use at the repl? do you just put a file somewhere, open it, and then evaluate it? |
| 01:56 | hiredman | the repl loads user.clj from the classpath |
| 01:56 | ysph | ah, good to know |
| 01:58 | ysph | does leiningen set up the classpath in that way, or would i need to link user.clj into the src/ folder? |
| 01:58 | hiredman | you might |
| 02:13 | scottj | I don't think lein includes user.clj |
| 02:14 | hiredman | I think lein doesn't get a say in the matter |
| 02:15 | Bahman | Hi all! |
| 02:25 | jkkramer | ysph: i use this in my .emacs: (setq swank-clojure-init-files (list "/Users/tin/src/clj/user.clj")) |
| 02:27 | ysph | jkkramer: thanks, i'll try that |
| 04:29 | Licenser | good morning my lispy friends |
| 04:32 | Licenser | hiredman: you're around? |
| 04:35 | hiredman | I supose |
| 04:36 | hiredman | whats up |
| 04:38 | Licenser | yay |
| 04:38 | Licenser | you've had found a problem in cj-sandbox/sexpbot right? |
| 04:38 | hiredman | strictly speaking no |
| 04:38 | hiredman | I wouldn't worry about it |
| 04:39 | Licenser | I know from the log I think it is more a clojure thing but it should be cought :P |
| 04:39 | Licenser | I always do clj-sandbox is suposed to be as secure as possible |
| 04:39 | hiredman | it is a clojure issue |
| 04:40 | Licenser | *nods* I just saw the line you executed and the expection, when I understand it right, the gen'ed keyword isn't freed after the exit of the function right? |
| 04:49 | Licenser | hiredman: thanks for the info :) makes tracking the thing way easyer or rather a non-problem |
| 05:03 | Licenser | A question why writing (. clojure.lang.RT (first coll)) and not (. clojure.lang.RT first coll) ? |
| 05:03 | Licenser | is there a difference or are they actually the same? |
| 05:10 | Chousuke | Licenser: only the former works? |
| 05:11 | Licenser | hmm I am kind of confused |
| 05:11 | Licenser | isn't it (. obj (method args)) ? |
| 05:11 | Licenser | just as much as (. obj method args) |
| 05:15 | Licenser | Chousuke: actually they both work |
| 05:15 | Licenser | ,(. clojure.lang.RT (first [1 2 3])) |
| 05:15 | clojurebot | 1 |
| 05:15 | Licenser | ,(. clojure.lang.RT first [1 2 3]) |
| 05:15 | clojurebot | 1 |
| 05:31 | vvsh | hi, i'm new to clojure and really want to get REPL with jline working, but i always t the error "Exception in thread "main" java.lang.ClassNotFoundException: clojure.main" , can give me a hand? |
| 05:31 | Licenser | vvsh: do yo have the clojure.jar in your classpath? |
| 05:32 | vvsh | yes, but the error is not about clojure, is actually about jline - "at jline.ConsoleRunner.main(Unknown Source)" |
| 05:33 | vvsh | i downloaded jline-0.9.94.jar at the current directory( with clojure.jar) |
| 05:34 | vvsh | and executed with this command - java -cp jline-0.9.94.jar:clojure.jar jline.ConsoleRunner clojure.main |
| 05:36 | Licenser | ah I see, sadly I never used the jiinline thing :( |
| 05:36 | vvsh | is there something wrong with the jline jar |
| 05:36 | Licenser | well the exception says it does not find clojure.main |
| 05:36 | Licenser | it is just in the jinline jar |
| 05:36 | Licenser | is the clojure.jar in the same directory? |
| 05:37 | vvsh | jline and clojure jar are in the same directory |
| 05:38 | Licenser | hmmm |
| 05:38 | Licenser | windows or linux? |
| 05:38 | Licenser | *unix |
| 05:38 | vvsh | mac |
| 05:38 | Licenser | so unix no issue there either |
| 05:38 | Licenser | try java -cp clojure.jar clojure.main |
| 05:38 | Licenser | hmm is it the latest clojure? |
| 05:39 | vvsh | java -cp clojure.jar clojure.main is working - 1.1.0 |
| 05:40 | Licenser | oky so that should be fine |
| 05:40 | Licenser | hmm hmm |
| 05:40 | Licenser | while not a solution to your question there was a project on github let me dig it out to you |
| 05:40 | Licenser | *for |
| 05:42 | Licenser | it was a set of scripts to run clojure and things |
| 05:42 | vvsh | cool thanks, |
| 05:43 | vvsh | is it lein, the build tool |
| 05:45 | Licenser | http://github.com/liebke/cljr |
| 05:45 | Licenser | no not lein |
| 05:46 | vvsh | thanks, i will look at it |
| 05:46 | Licenser | I hope it helps |
| 05:47 | vvsh | i will try it, if not working, might give dejour or labrepl a try as well |
| 05:51 | Licenser | oh grrr |
| 05:51 | noidi | vvsh, you can use rlwrap instead of jline |
| 05:51 | Licenser | rlwrap isn't default on OS X afaik |
| 05:52 | vvsh | Licenser: it still have to same problem when trying with - cljr repl |
| 05:52 | Licenser | hmm odd |
| 05:52 | Licenser | very odd |
| 05:52 | vvsh | i don't understand why it can't find clojure.main |
| 05:52 | vvsh | i mean i already add clojure.jar to classpath |
| 05:54 | vvsh | i found this guy got the same problem as me, but don't really understand how he solve it |
| 05:54 | vvsh | http://forums.pragprog.com/forums/91/topics/3466 |
| 05:55 | vvsh | sorry, that's the error about jline |
| 05:57 | Licenser | okay the solution of 1.2 with the namespace overload is a nice idea but it isn't working |
| 05:57 | Licenser | you can't reaload stuff since when you do it crashes with 'already pointing to' |
| 05:57 | Licenser | meaning you've one bug in your code and you#ve to restart your repl ... |
| 05:57 | Licenser | bah |
| 06:00 | vvsh | is there a way to explicitly tell the path to clojure.main in - java -cp jline-0.9.94.jar:clojure.jar jline.ConsoleRunner clojure.main |
| 06:10 | vvsh | Licenser: I'm new to clojure, just wondering in clojure how do i load somethine from classpath? |
| 06:12 | Licenser | vvsh: well a clojure namespace or a java clasS? |
| 06:12 | Licenser | namespaces can be load with use or require, classes via import |
| 06:13 | vvsh | java class i guess, what i want to do is add jline to the class path, then run a normal clojure repl, then import jline - ( java -cp jline-0.9.94.jar:clojure.jar clojure.main, then import ) |
| 06:15 | Licenser | well (import java.ns.path.to.Jinline) |
| 06:18 | vvsh | thanks, but still can't get the repl working, it really annoying now |
| 06:32 | Licenser | vvsh: I can imagine, but I'm not sure what the problem is :( |
| 06:33 | vvsh | yeah, it seems pretty odd, do you know where else can i ask for help? |
| 06:36 | Licenser | vvsh: what editor do you use |
| 06:36 | Licenser | a good idea would be emacs since you get a repl for free there |
| 06:36 | Licenser | o |
| 06:36 | Licenser | r |
| 06:36 | Licenser | tr |
| 06:36 | Licenser | y |
| 06:36 | Licenser | yuck |
| 06:36 | Licenser | or try cljr repl |
| 06:36 | vvsh | vi |
| 06:36 | Licenser | ah there is also a vim clojure package that should be helpful |
| 06:37 | vvsh | i tried cljr repl, but still get the same problem - can't find clojure.main |
| 06:37 | vvsh | i thinking to learn some emacs, so will stay with emacs on this one |
| 06:37 | vvsh | does the repl on emacs using jline or something else? |
| 06:39 | Licenser | nope it uses swank and slime |
| 06:39 | Licenser | no jinline since it is EMAC's controlled (history and stuff) |
| 06:39 | Licenser | also emacs makes a pretty good development env |
| 06:39 | Licenser | at least for clojure :P |
| 06:39 | Licenser | in my eyes currently the best |
| 06:40 | vvsh | yeah, its pretty power |
| 06:40 | vvsh | its more easier for lisp like languages |
| 06:42 | vvsh | another point is i can't use lein repl,(jline cause the same problem :( |
| 06:43 | Licenser | yuck |
| 06:44 | vvsh | that means i can't build any projects, which is a hugh thing |
| 06:45 | hiredman | vvsh: where did you get your clojure jar? |
| 06:45 | hiredman | is it 1.1 or a 1.2 snapshot or … |
| 06:45 | vvsh | from github |
| 06:46 | vvsh | its 1.1 |
| 06:46 | hiredman | how do you know? |
| 06:46 | vvsh | when i run - java -cp clojure.jar clojure.main, it print out version 1.1. |
| 06:47 | hiredman | and what is the exception you get? |
| 06:49 | vvsh | when i running with - java -cp jline-0.9.94.jar:clojure.jar jline.ConsoleRunner clojure.main |
| 06:49 | vvsh | i got " Exception in thread "main" java.lang.ClassNotFoundException: clojure.main" |
| 06:50 | hiredman | pastebin the whole thing somewhere |
| 06:51 | Licenser | good god :( |
| 06:51 | vvsh | http://pastebin.com/vhzGDp6d |
| 06:52 | hiredman | and does the clojure jar contain clojure/main.class |
| 06:54 | vvsh | i don't know much about java, so i don't know if it contain clojure/main.class or not. but when i run - java -cp clojure.jar clojure.main, i get a standard clojure repl |
| 06:55 | Licenser | week a new version clj-sandbox is finally out :) |
| 07:49 | bhenry | with ring, how might i serve up static files from a dynamically decided path (based on a "get" variable from the query string)? |
| 07:50 | bhenry | eg localhost:8080/?dir=/Users/myname/Pictures |
| 07:50 | bhenry | i'm able to get all the file objects, but the browser won't let me use file:///path coming from http:// |
| 09:18 | Raynes | I just added support for defing stuff to sexpbot. |
| 09:21 | mmarczyk | Raynes: cool! any limits? |
| 09:21 | Raynes | mmarczyk: 5 defs. |
| 09:22 | mmarczyk | per person? |
| 09:22 | mmarczyk | per form? |
| 09:22 | Raynes | 5 defs at any given time. |
| 09:22 | mmarczyk | oh. |
| 09:22 | Raynes | It's not allocated per-person. |
| 09:22 | mmarczyk | what then? the old ones get dropped? |
| 09:22 | Raynes | Yeah. |
| 09:22 | mmarczyk | cool :-) |
| 09:23 | Raynes | Licenser added stuff for this earlier in clj-sandbox. |
| 09:23 | Raynes | I just took advantage of it. |
| 09:23 | Raynes | Going to see how it works out. |
| 09:26 | mmarczyk | $(defn fooey [] (reify clojure.lang.IKeywordLookup (getLookupThunk [this k] (reify clojure.lang.ILookupThunk (get [thunk target] (if (identical? (class this) (class target)) :foo)))))) |
| 09:26 | sexpbot | java.lang.NullPointerException |
| 09:26 | mmarczyk | oh. |
| 09:26 | mmarczyk | $(def fooey (fn [] (reify clojure.lang.IKeywordLookup (getLookupThunk [this k] (reify clojure.lang.ILookupThunk (get [thunk target] (if (identical? (class this) (class target)) :foo))))))) |
| 09:26 | sexpbot | java.lang.NullPointerException |
| 09:31 | Licenser | $(def <3 (fn [love & loves] (loop [l (str "I love " love) loves loves](let [[love & loves] loves] (if (nil? love) (str l ".") (if (empty? loves) (str l " and " love ".") (recur (str l ", " love) loves))))))) |
| 09:31 | sexpbot | => #'net.licenser.sandbox.box3471/<3 |
| 09:31 | Licenser | $(<3 "Raynes" "sexpbot" "clj-sandbox" "clojure") |
| 09:31 | sexpbot | => "I love Raynes, sexpbot, clj-sandbox and clojure." |
| 09:32 | Licenser | mmarczyk: classes are often not allowed |
| 09:32 | Licenser | save for raynes allowing . for some reason in sexpbot, which is rather silly :P |
| 09:32 | mmarczyk | $(def ->--- (atom (<3 "Raynes" "sexpbot" "clj-sandbox" "Clojure"))) |
| 09:32 | sexpbot | => #'net.licenser.sandbox.box3471/->--- |
| 09:32 | mmarczyk | $(do @->---) |
| 09:32 | sexpbot | => "I love Raynes, sexpbot, clj-sandbox and Clojure." |
| 09:33 | Licenser | mmarczyk: @->-... is my macro :P |
| 09:33 | mmarczyk | :-P |
| 09:33 | Licenser | thief! |
| 09:33 | Licenser | but the defs are pretty cool I think |
| 09:33 | mmarczyk | yup :-) |
| 09:33 | Licenser | Raynes: satisfied with the solution? :) |
| 09:33 | mmarczyk | pity about reify, though |
| 09:34 | mmarczyk | you could do (def ->--- (reify clojure.lang.IDeref (deref [this] ...))) |
| 09:34 | Licenser | hmm well it could be allowed but I must say I grew hazzatant about adding 1.2 features to the whitelist since they tend to change so often |
| 09:34 | mmarczyk | do they? |
| 09:35 | mmarczyk | I mean, on master? |
| 09:35 | Licenser | well their inner workings might do yes so the border between save and unsafe is very scratchy |
| 09:36 | Licenser | I can't with a good concience whitelist something that might not stay save |
| 09:36 | mmarczyk | ah well |
| 09:36 | mmarczyk | I take this to mean that you'll have no problem whitelisting that stuff after 1.2 comes out |
| 09:36 | Licenser | not at all |
| 09:37 | mmarczyk | I mostly meant "no technical problem" by that :-) |
| 09:37 | Licenser | I hope not :P |
| 09:37 | mmarczyk | cool |
| 09:37 | mmarczyk | :-) |
| 09:37 | Licenser | clj-sandbox does some pretty complicated things with the code, as in compleatly not using the . special form |
| 09:37 | mmarczyk | ? |
| 09:39 | Licenser | you can't use . in the code |
| 09:40 | Licenser | it will be removed, or rather replaced, that is why we can allow you to write . without risking you breaking the sandbox |
| 09:41 | mmarczyk | well, yes, I'd expect that |
| 09:41 | Licenser | I'm not entirely sure how reify and protocolls will play into this but I hope it will go smoothly |
| 09:42 | mmarczyk | right. |
| 09:45 | mmarczyk | "You silly wabbit have 'Object' in a class matcher." :-) |
| 09:48 | Licenser | That is a good Exception isn't it? I'm particular proud of that one! |
| 09:49 | mmarczyk | as well you should be :-) |
| 09:52 | Licenser | I wonder about defn |
| 09:52 | Licenser | (def blah (.withMeta (clojure.core/fn blah ([x] x)) (.meta (var blah)))) |
| 09:52 | Licenser | is what defn does, but when bla does not exist, before the def why would it try to get the meta? |
| 09:53 | mmarczyk | Licenser: the way in which you jump at the opportunity to mock Raynes *in an exception message* is a particularly nice touch, I find :-P |
| 09:53 | Licenser | That is because I love raynes |
| 09:53 | mmarczyk | of course :-) |
| 09:53 | Licenser | after all Raynes is the only one using clj-sandbox |
| 09:54 | Licenser | I soley develop it for him :P |
| 09:55 | mmarczyk | :-) |
| 09:55 | mmarczyk | Licenser: about defn |
| 09:55 | Licenser | yes |
| 09:55 | mmarczyk | (.withMeta ...) |
| 09:55 | mmarczyk | gets rewritten as |
| 09:55 | mmarczyk | (. (fn blah ...) withMeta ...) |
| 09:56 | mmarczyk | no problem with that |
| 09:56 | Licenser | I know |
| 09:56 | mmarczyk | $(. (ArrayList.) toArray) |
| 09:56 | sexpbot | java.lang.IllegalArgumentException: Unable to resolve classname: ArrayList |
| 09:56 | Licenser | well no what I mean is it says this fn (object) has the meta of the var, but the ar does not exist |
| 09:56 | mmarczyk | $(. (java.util.ArrayList.) toArray) |
| 09:56 | sexpbot | java.lang.SecurityException: Code did not pass sandbox guidelines: () |
| 09:56 | mmarczyk | ah, but it does |
| 09:56 | Raynes | I love those useful error messages. |
| 09:56 | mmarczyk | $(def foo (meta #'foo)) |
| 09:56 | sexpbot | => #'net.licenser.sandbox.box3471/foo |
| 09:57 | mmarczyk | $(println foo) |
| 09:57 | sexpbot | => {:ns #<Namespace net.licenser.sandbox.box3471>, :name foo} nil |
| 09:57 | mmarczyk | def creates the Var first, then does a .bindRoot, I think |
| 09:57 | Licenser | hmm I see |
| 09:57 | Licenser | sneaky |
| 09:57 | Licenser | okay then it makes sense, but you've to understand the interna there |
| 09:57 | mmarczyk | you're not meant to care how defn works, you know :-P |
| 09:58 | mmarczyk | unless you feel compelled to write a sandboxing lib for some reason ;-) |
| 09:58 | Licenser | Yea silly me |
| 09:59 | Raynes | I'm happy he did. |
| 09:59 | Licenser | did not kow how defn works? :P |
| 09:59 | Raynes | That way when people whine and complain because sexpbot does something weird, I can say "hey, it's not my fault" |
| 09:59 | Raynes | :D |
| 10:00 | mmarczyk | ah, the perfect relationship |
| 10:01 | Licenser | have fun! |
| 10:01 | mmarczyk | (just googled hotpockets) |
| 10:01 | Licenser | yea sad thing is just that in most plces it actually is sexpbot doing something wird |
| 10:02 | mmarczyk | which is just as well, because this way when people whine and complain because clj-sandbox does something weird, you can say "hey, it's acutally sexpbot's fault" |
| 10:02 | Licenser | *nods* If you could read german I would give you a link to an old article of mine :P |
| 10:03 | mmarczyk | oh, please do |
| 10:03 | mmarczyk | I can, somewhat |
| 10:03 | Licenser | oh then I |
| 10:03 | Licenser | v |
| 10:03 | Licenser | 've to dig it out |
| 10:03 | mmarczyk | waiting patiently. :-) |
| 10:04 | Licenser | http://cycnus.de/index.php?frame=/fun/schuldspirale/funschuldspirale.htm |
| 10:05 | mmarczyk | ok, it'll take me a while though, I'm a slow reader when dealing with German text |
| 10:07 | Licenser | *nods* take your time |
| 10:07 | mmarczyk | :-D |
| 10:07 | mmarczyk | love this |
| 10:08 | mmarczyk | I might translate this into Polish; I think I've already got an idea of whom to substitute for Simon, Sven &c. :-P |
| 10:19 | stuarthalloway | hugod: you around? I am getting started with pallet and am stymied at square one |
| 10:25 | Licenser | mmarczyk: cool |
| 10:43 | djpowell | what's the deal with github.com/clojure? |
| 10:47 | stuarthalloway | djpowell: what do you mean? |
| 10:47 | djpowell | has clojure moved? |
| 10:48 | stuarthalloway | yes |
| 10:48 | stuarthalloway | now that github has organization support |
| 10:49 | stuarthalloway | If there are busted links somewhere let me know |
| 10:49 | stuarthalloway | I updated http://clojure.org/downloads |
| 10:49 | djpowell | ah k. has this been well publicised, I'd never heard about it |
| 10:49 | stuarthalloway | couple of posts to the mailing list, plus fixing pointers |
| 10:49 | stuarthalloway | hope to move the build box this weekend |
| 10:50 | djpowell | ok |
| 11:00 | clojay | I have a .clj file that I'd like to load automatically before every Repl session. How can I modify the standard clj script to ensure this file is loaded? The file itself contains plain functions. |
| 11:07 | djpowell | did you know that if you put a user.clj on the class path it gets loaded automatically? |
| 11:08 | djpowell | also, if you run "java -jar clojure.jar --help" there are some startup flatgs for loading scripts |
| 11:13 | djpowell | stuarthalloway: hmm - clojure.java.shell is still broke |
| 11:13 | stuarthalloway | broke how? |
| 11:13 | djpowell | in http://github.com/clojure/clojure/commit/31b6fb557a3c524c447d312f5c51b6262ffb9b0f you removed the pmap stuff |
| 11:15 | stuarthalloway | I see your point |
| 11:16 | stuarthalloway | the pmap didn't work either, because it forced the same encoding on both streams, which is not how the API now works |
| 11:16 | stuarthalloway | so we need to get back the parallelism, but not with pmap |
| 11:16 | clojay | thank djpowell. Let me try that |
| 11:17 | stuarthalloway | djpowell: hmm, put the two calls in futures? |
| 11:18 | djpowell | i didn't realise that stderr was going to use platform default encoding |
| 11:18 | clojay | djpowell: I get the following error Don't know how to create ISeq from: clojure.lang.Symbol (user.clj:1 |
| 11:18 | stuarthalloway | djpowell: me neither, til recently |
| 11:18 | djpowell | stuarthalloway: but you could just put pmap back and sort the encodings |
| 11:19 | djpowell | or use pvalues or one of those functions |
| 11:19 | hugod | stuarthalloway: I am now, how are you getting on? |
| 11:20 | stuarthalloway | djpowell: will add issue and do it before 1.2 goes final |
| 11:20 | stuarthalloway | hugod: it is quite strange |
| 11:21 | stuarthalloway | when I do the defnode from demo.clj, the VM exits, without warning or explanation |
| 11:21 | djpowell | oh and thanks for sorting the bug out in it, it must have creeped in when i added in-enc |
| 11:22 | stuarthalloway | tested defnode at the REPL, both plain and in emacs |
| 11:22 | stuarthalloway | does that make any sense at all? |
| 11:22 | clojay | My ~/.init.clj file contains a single function my-pretty-print. I load it as follows java -cp "$CP" clojure.main --repl -i "$HOME"/.init.clj. The error I get when I try to call the function from repl is "java.lang.Exception: Unable to resolve symbol: exit in this context". |
| 11:23 | hugod | stuarthalloway: that's strange - are you using a checkout or jar? |
| 11:23 | stuarthalloway | checkout |
| 11:23 | stuarthalloway | let me try the jar |
| 11:23 | clojay | (sorry the error should be java.lang.Exception: Unable to resolve symbol: my-pretty-print in this context) |
| 11:24 | hugod | stuarthalloway: the checkout should be fine - with lein or mvn? |
| 11:24 | stuarthalloway | I was using lein |
| 11:25 | hugod | I'm doing a fresh checkout to try and replicate.... |
| 11:28 | Licenser | hmm lein refuses to download 1.2.0-SNAPSHOT for some reason o.O |
| 11:28 | stuarthalloway | hugod: found it! |
| 11:28 | hugod | stuarthalloway: ok - anything I need to fix? |
| 11:28 | Licenser | anyone had this happening to them yet? |
| 11:28 | stuarthalloway | no, it's a bug in the repl, or clojure itself! |
| 11:28 | stuarthalloway | ,\"[^J]+9.10[^32]+\" |
| 11:28 | clojurebot | \" |
| 11:29 | stuarthalloway | I had copied from the clj file (with the slash escaping), and that constant crashes the replp |
| 11:29 | stuarthalloway | ,(+ 1 2) |
| 11:29 | clojurebot | 3 |
| 11:29 | stuarthalloway | but didn't seem to kill the clojurebut |
| 11:30 | stuarthalloway | I have such a gift for stumbling into weird bugs |
| 11:30 | hugod | $\"[^J]+9.10[^32]+\" |
| 11:30 | sexpbot | Command not found. No entiendo lo que estás diciendo. |
| 11:33 | djpowell | stuarthalloway: (let [out err] (pvalues (stream-to-enc stdout out-enc) (stream-to-string stderr)) ...) seems to work |
| 11:33 | stuarthalloway | djpowell: throw it into https://www.assembla.com/spaces/clojure/tickets/399-make-sure-shell-out-and-err-handled-in-parallel if you want |
| 11:34 | Licenser | $eval \"[^J]+9.10[^32]+\" |
| 11:34 | sexpbot | => \" |
| 11:34 | Licenser | $eval 3 |
| 11:34 | sexpbot | => 3 |
| 11:34 | stuarthalloway | or I will, after I solve the repl bug |
| 11:34 | Licenser | $eval (def x \"[^J]+9.10[^32]+\") |
| 11:34 | sexpbot | java.lang.Exception: Unmatched delimiter: ] |
| 11:34 | Licenser | $eval 3 |
| 11:34 | sexpbot | => 3 |
| 11:34 | Licenser | +c still working |
| 11:38 | mmarczyk | Licenser: 1.2.0-SNAPSHOT of what? it's 1.2.0-master-SNAPSHOT for Clojure |
| 11:39 | Licenser | mmarczyk: my problem was oddly enough the horrible error mesage of mvn not the jar names |
| 11:39 | Licenser | I had a wrong jar for something else, which then told me clojure is wrong - no clue why |
| 11:39 | mmarczyk | ah |
| 11:39 | mmarczyk | the error message imps played a game of dice to determine which jar would get blamed |
| 11:41 | stuarthalloway | hugod: weirder still: the bad constant is an error in clojure repl, but bombs the lein repl |
| 11:41 | stuarthalloway | looks like a lein bug |
| 11:41 | mmarczyk | stuarthalloway: \"[^J]+9.10[^32]+\" is not a valid constant anyway |
| 11:41 | mmarczyk | with the "s escaped |
| 11:42 | stuarthalloway | mmarczyk: agreed! |
| 11:42 | stuarthalloway | but it kills the lein repl with no message |
| 11:42 | mmarczyk | oh? |
| 11:42 | mmarczyk | which Clojure version in project.clj? |
| 11:43 | stuarthalloway | 1.2 master branch is what I have tested so far |
| 11:43 | mmarczyk | just checked with 1.1, same thing |
| 11:43 | mmarczyk | wow :-) |
| 11:43 | stuarthalloway | my best guess, looking at lein code, is that repl catches only Exception, not Throwable |
| 11:44 | stuarthalloway | but just throwing throwable is ok... hmm... |
| 11:44 | mmarczyk | I guess that the problem is that |
| 11:44 | mmarczyk | at [^J |
| 11:44 | mmarczyk | the reader expects something to attach {:tag J} to |
| 11:44 | mmarczyk | but finds end-of-vector |
| 11:45 | mmarczyk | should be an exception rather than an error, no? |
| 11:45 | stuarthalloway | dunno |
| 11:48 | stuarthalloway | mmarczyk: any reader exception kills the lein repl, just try the two characters (] |
| 11:48 | mmarczyk | ouch, indeed |
| 11:48 | stuarthalloway | will post a comment to technomancy |
| 11:49 | clojay | ,(System/Exit 0) |
| 11:49 | clojurebot | java.lang.IllegalArgumentException: No matching method: Exit |
| 11:49 | clojay | hehe |
| 11:49 | stuarthalloway | clojay: are you from C#-land? |
| 11:49 | mmarczyk | clojay: it's exit, but won't work with the bots |
| 11:50 | serp_ | ,(reduce + '(1 2 3)) |
| 11:50 | clojurebot | 6 |
| 11:50 | clojay | stuarthalloway: yes |
| 11:50 | stuarthalloway | your capital methods are showing :-) |
| 11:54 | clojay | stuarthalloway: :) Do you know how can I force the repl to load a file at startup? I tried the -i option and it doesn't seem to work |
| 11:54 | mmarczyk | add-break-thread! doesn't seem to work with lein repl... same issue I guess |
| 11:54 | stuarthalloway | clojay -e "any clojure here" |
| 11:55 | stuarthalloway | including, of course, (load "stuff") |
| 11:55 | stuarthalloway | remember your command line escaping tho |
| 12:01 | mmarczyk | clojay: you can use -i, but then you'll need to add an explicit -r to get the REPL to start |
| 12:01 | clojay | mmarczyk: stuart's method with -e worked, however I have a different problem now |
| 12:02 | mmarczyk | ? |
| 12:02 | clojay | mmarczyk: what's wrong with this? (defn exit (do (System/exit 0))) |
| 12:03 | mmarczyk | clojay: you're missing an argument vector |
| 12:03 | anonymouse89 | what would be an idiomatic way to block until a boolean changes? |
| 12:03 | mmarczyk | (defn exit [] (System/exit 0)) |
| 12:03 | mmarczyk | note the do is superfluous |
| 12:03 | clojay | (defn exit [] (System/exit 0)) |
| 12:04 | clojay | oh good |
| 12:04 | mmarczyk | function bodies are implicitly wrapped in do |
| 12:04 | clojay | same as yours |
| 12:04 | clojay | mmarczyk: great, thanks |
| 12:04 | mmarczyk | np |
| 12:06 | clojay | sometimes I get confused when a () is needed and when it's not. Is there some general rule to immediately realize if it's needed or not? |
| 12:07 | mmarczyk | anonymouse89: if the Boolean is stored in a Ref / Atom / whatever, you could use add-watch and have the watcher deliver to a promise on which you can block with deref wherever it is that you need to block |
| 12:07 | anonymouse89 | More specifically, I want to block until (every? true? (vector-of-things :complete)) is true |
| 12:07 | anonymouse89 | like the equivalent of await but I'm not using agents |
| 12:08 | anonymouse89 | oh, or I could wrap every element of the vector with an agent? |
| 12:08 | mmarczyk | (vector-of-things :complete) ? |
| 12:08 | mmarczyk | that you could |
| 12:09 | anonymouse89 | I mean the things in vec-of-things have a keyword :complete that should be true before continuing |
| 12:09 | mmarczyk | clojay: well, if you need parens but skip them, your code will break |
| 12:09 | clojay | mmarczyk: with trial and error I will learn I guess :) |
| 12:10 | mmarczyk | clojay: basically they denote literal lists, which, unless quoted, are treated as function calls / macro calls... so whenever you're calling a function, you'll need to use () |
| 12:10 | mmarczyk | true enough :-) |
| 12:10 | mmarczyk | anonymouse89: so it's more like (every? (comp true? :complete) vector-of-things)? what are the things? |
| 12:11 | mmarczyk | I mean, if they can actually *change*, they're something mutable -- what exactly? |
| 12:11 | anonymouse89 | they are dispatched computations. so an item is returned immediately, but (item :value) is nil until actually complete |
| 12:11 | anonymouse89 | and (item :complete) is false until complete |
| 12:12 | clojay | that's a very easy way to think about it. I was wrongly thinking about "evaluation" so when I was returning a value trhough a symbol like x, I would pause to think if I need the parenthesis or not. Which I don't of course. So in short, the solution is to think "Is this is a function call?" if not, no parenthesis apply. |
| 12:12 | anonymouse89 | so I'm just trying to wait for all those to become complete before continuing |
| 12:12 | mmarczyk | dispatched to what and how? |
| 12:12 | mmarczyk | I mean, say, for futures |
| 12:12 | mmarczyk | you can just use @ in place of await |
| 12:12 | mmarczyk | same for promises |
| 12:13 | anonymouse89 | deref's block? |
| 12:13 | mmarczyk | for other kinds of "dispatched / delayed / etc." stuff, there might be other methods |
| 12:13 | mmarczyk | anonymouse89: depends what you deref |
| 12:13 | mmarczyk | anonymouse89: on Atoms, Refs, Agents, Vars they don't block |
| 12:13 | mmarczyk | anonymouse89: on Futures they do |
| 12:13 | anonymouse89 | mmarczyk: good to know |
| 12:14 | mmarczyk | anonymouse89: on Promises they do in the sense they'll block 'til sth gets delivered |
| 12:14 | mmarczyk | clojay: right :-) |
| 12:15 | anonymouse89 | mmarczyk: okay, so I think I've reformulated my question. Is there an idiomatic way to try sth every (insert unit of time here) until ... |
| 12:15 | anonymouse89 | or just loop and sleep? |
| 12:15 | mmarczyk | anonymouse89: sure, you can use a (while ...) block |
| 12:16 | mmarczyk | loop/recur is fine, but you'd have no loop bindings, so while is cleaner |
| 12:16 | anonymouse89 | so like: (while not every? true? (vec-of-bools)) |
| 12:16 | mmarczyk | ((while ~@body) = (loop [] ~@body (recur))) |
| 12:16 | mmarczyk | (while (not (every? true? (vec-of-bools))) (Thread/sleep 100)) |
| 12:17 | anonymouse89 | right, I think that's what I'm looking for |
| 12:17 | anonymouse89 | mmarczyk: thanks |
| 12:17 | mmarczyk | presumably you'd use this as the first form in a do (possibly implicit) |
| 12:17 | anonymouse89 | mmarczyk: I'm not sure what implicit means there |
| 12:17 | mmarczyk | anonymouse89: cool, though for special cases where something like a blocking deref is available, the special way to do it might be better / cleaner |
| 12:18 | mmarczyk | anonymouse89: I meant "possibly an implicit do" |
| 12:18 | mmarczyk | as in let, fn etc. |
| 12:18 | mmarczyk | ah, that definition of while above is wrong of course |
| 12:19 | mmarczyk | misses the condition... nvm |
| 12:19 | mmarczyk | the example with (not (every? ...)) will work, though |
| 13:03 | fyuryu | mmarczyk: just looked at your default-map gist and I'm wondering if there's any reason for putting (reify ..) inside getLookupThunk. Unless I |
| 13:04 | fyuryu | mmarczyk:* Unless I'm missing something |
| 13:24 | mmarczyk | fyuryu: getLookupThunk needs to return an ILookupThunk |
| 13:30 | fyuryu | mmarczyk: doh! |
| 13:30 | mmarczyk | :-) |
| 13:30 | fyuryu | mmarczyk: it must be because of the heat |
| 13:32 | mmarczyk | oh, the heat... it's been thirty-ish (on the Celsius scale) here today and it seriously interferes with my present coding effort :-( |
| 13:33 | qbg | No AC? |
| 13:33 | fyuryu | same over here... |
| 13:34 | mmarczyk | no ac. |
| 13:35 | mmarczyk | I'd be perfectly happy with a fan, but alas, I can't see going to get one now *sigh* |
| 13:50 | AWizzArd | mmarczyk: I had 57,5°C in front of my window today, in the direct sun. Now it is 31°C in my apartment, argh! |
| 13:50 | AWizzArd | For people who don’t know what these Celsius numbers mean, use Clojure: http://clojure.org/jvm_hosted :-) |
| 13:51 | mmarczyk | 57.5!? totally crazy |
| 13:51 | AWizzArd | Yes, in the direct sun. |
| 13:52 | AWizzArd | And my thermometer is very accurate. Now just 42 :-) |
| 13:52 | Raynes | Or use sexpbot. $#tc C57#$ |
| 13:52 | mmarczyk | much better ;-) |
| 13:52 | sexpbot | Raynes: 134.60000000000002 |
| 13:52 | mmarczyk | whoa, that's one comprehensive plugin collection :-) |
| 13:52 | Raynes | :p |
| 13:52 | qbg | Pics or it didn't happen |
| 13:53 | AWizzArd | qbg: okay, next time |
| 13:53 | qbg | :) |
| 13:53 | mmarczyk | the worst thing here is that the sun is shining straight into this room's window |
| 13:54 | mmarczyk | and I'm missing some essential equipment now, like a working wi-fi router |
| 13:54 | mmarczyk | or an ethernet cable |
| 13:54 | mmarczyk | either would suffice for me to be able to go to the next room where it's perfectly cool :-P |
| 13:55 | AWizzArd | mmarczyk: buy some aluminium foil, that is the same stuff mirrors are made with, and put them from the outside on your window. |
| 13:55 | mmarczyk | whenever I go shopping for the aforementioned equipment (tomorrow?), I guess I'll also by something reflective to put over... |
| 13:55 | mmarczyk | AWizzArd: right, exactly :-) |
| 13:55 | AWizzArd | I wished Oracle would bring out a weather API, so I could use Clojure to solve such heat challenges. |
| 13:56 | mmarczyk | I was thinking about buying some bricks and getting rid of the window once and for all :-P |
| 13:56 | mmarczyk | but I think that might be problematic in some ways, so I'll make do with the foil. |
| 13:57 | mmarczyk | Window.attach(new AluminiumFoil(2.0, 0.75, Units/METER)) ? |
| 13:59 | LauJensen | We had 43.5 in the sun today, just after noon |
| 14:00 | LauJensen | 32 in the shade |
| 14:00 | AWizzArd | Well, it really helps, because Aluminium reflects nearly the full spectrum of electromagnetic waves, and if you have over a m² window, then this means that you can keep out a significant bit of watts from your room. |
| 14:01 | Hodapp | AWizzArd: wait, so I should have my tinfoil hat actually be an aluminum foil hat? |
| 14:02 | AWizzArd | Hodapp: you are learning fast! |
| 14:04 | AWizzArd | Btw, is there an ETA when build.clojure.org will spit out new jars? (: |
| 14:06 | mmarczyk | Stu H. mentioned a plan to let the build box know about github.com/clojure this weekend |
| 14:06 | mmarczyk | $(def fibs (concat [0 1] (map + fibs (rest fibs)))) |
| 14:06 | sexpbot | java.lang.IllegalStateException: Var net.licenser.sandbox.box3471/fibs is unbound. |
| 14:07 | mmarczyk | $(def fibs (lazy-cat [0 1] (map + fibs (rest fibs)))) |
| 14:07 | sexpbot | => #'net.licenser.sandbox.box3471/fibs |
| 14:07 | mmarczyk | $(nth fibs 10000000000) |
| 14:07 | sexpbot | java.lang.Exception: EvalReader not allowed when *read-eval* is false. |
| 14:07 | mmarczyk | huh...? |
| 14:07 | mmarczyk | $(first fibs) |
| 14:07 | sexpbot | => 0 |
| 14:07 | AWizzArd | Raynes: about the sexpbot's knowledge about Celsius2Fahrenheit... did it had that functionality before I mentioned the numbers above, or did you do some fast magic? ;) |
| 14:08 | mmarczyk | $(nth fibs 1000000) |
| 14:08 | Raynes | I added that ages ago. |
| 14:08 | AWizzArd | k |
| 14:08 | Raynes | I'm not that fast. :p |
| 14:08 | sexpbot | Execution Timed Out! |
| 14:09 | AWizzArd | mmarczyk: killing bots huhm? |
| 14:09 | mmarczyk | :-) |
| 14:10 | mmarczyk | hm, incidentally |
| 14:10 | mmarczyk | $(make-array Double/TYPE 100) |
| 14:10 | sexpbot | => #<double[] [D@460a87a8> |
| 14:11 | mmarczyk | I wonder if I could get in trouble by asking for a particularly large array |
| 14:12 | mmarczyk | perhaps just short of OutOfMemoryError... followed by an allocation-intensive op |
| 14:13 | AWizzArd | mmarczyk: try locally (in your Clojure) to ask for a 10 Terabyte Array |
| 14:14 | mmarczyk | I have, got OOME |
| 14:14 | mmarczyk | and a new prompt :-) |
| 14:17 | mmarczyk | presumably asking the bot to create -- and keep around -- an array which would *just* fit on the heap |
| 14:17 | mmarczyk | would result in OOMEs for subsequent regular ops |
| 14:18 | mmarczyk | how does one check the size of an object in Java? |
| 14:18 | AWizzArd | mmarczyk: what do you mean by that? |
| 14:20 | mmarczyk | well, there's (-> (Runtime/getRuntime) .totalMemory) for total memory available |
| 14:20 | mmarczyk | as well as .freeMemory for free memory |
| 14:20 | AWizzArd | Yes, you can work with the three Runtime methods. |
| 14:20 | mmarczyk | I'm wondering about something similar to ask about a given objects size on the heap. |
| 14:20 | mmarczyk | ^object's |
| 14:20 | AWizzArd | But also have a look at http://download.oracle.com/docs/cd/E17409_01/javase/6/docs/api/java/lang/management/package-summary.html |
| 14:20 | chouser | it's difficult, but close estimates can be found |
| 14:21 | AWizzArd | They offer a MemoryUsage class |
| 14:21 | mmarczyk | hm, interesting, thanks |
| 14:21 | mmarczyk | I found this: http://www.javapractices.com/topic/TopicAction.do?Id=83 |
| 14:22 | AWizzArd | http://download.oracle.com/docs/cd/E17409_01/javase/6/docs/api/java/lang/management/MemoryUsage.html |
| 14:22 | mmarczyk | estimates heap space taken up by objects of a given class by creating a bunch of them while keeping track of the Runtime/foo output |
| 14:23 | mmarczyk | which is not at all what I want, but still fun |
| 14:23 | Bahman | mmarczyk: AFAIK you have to measure memory before and after creating the object and the usage it's their difference. |
| 14:24 | Bahman | And don't forget to call GC before measuring. |
| 14:25 | AWizzArd | (dotimes [i 5] (System/gc)) |
| 14:27 | AWizzArd | mmarczyk: look into your priv pls |
| 14:34 | arohner | while we're on the subject, is there a way to get the size of a single object? |
| 14:39 | stuartsierra | aorhner: define "size" |
| 14:40 | AWizzArd | arohner: most of the time it is just 8-byte pointers on 64-bit systems |
| 14:40 | AWizzArd | should one follow the pointers? |
| 14:40 | arohner | I want the total memory usage for a tree of clojure maps |
| 14:40 | AWizzArd | How big are circular objects? |
| 14:40 | stuartsierra | arohner: you need a Java profiler or debugger |
| 14:41 | arohner | let me put it another way. If the only reference to this clojure map went away, how much memory would be GC'd |
| 14:41 | arohner | stuartsierra: yeah, visualVM is incredibly slow on this datastructure (~1.5GB) |
| 14:41 | arohner | and cumbersome to use |
| 14:42 | stuartsierra | arohner: you can get a rough approximation by creating a bunch of objects, removing references, and calling System.gc while you watch your OS memory usage |
| 14:42 | arohner | sigh |
| 14:43 | arohner | I wrote a little fn that uses clojure.walk to call (class) on every object, and returns a summary of instance counts |
| 14:43 | arohner | that takes ~3 seconds to walk 1.5GB. I just want to convert that into bytes per object |
| 14:44 | AWizzArd | arohner: it is not really clear what this means, there are multiple ways to look at it. |
| 14:45 | stuartsierra | well, figure out how many bytes the instance fields take up, add X bytes for every Java pointer (look that up) |
| 14:45 | AWizzArd | You can surely find out how much memory all objects take. Just scroll up, this was discussed a few minutes ago, see the MemoryUsage class. |
| 14:45 | arohner | AWizzArd: I know. I'm just annoyed that the tools suck. This should be a trivial thing to report |
| 14:47 | stuartsierra | The JVM goes to great lengths to abstract away memory usage. |
| 14:48 | arohner | stuartsierra: which is broken, IMO. Until it can abstract away physical memory usage, you need to know that sometimes |
| 14:48 | stuartsierra | agreed |
| 14:48 | AWizzArd | arohner: in principle you are right, but it really is not such a trivial thing |
| 14:49 | arohner | AWizzArd: sure it is. there are two main operations I care about. |
| 14:49 | arohner | 1) how much memory does it take to malloc an instance of this class? That counts the size of each field in the class, plus the pointers built into the JVM object |
| 14:50 | arohner | 2) how much memory would be free'd if the object were GC'd |
| 14:50 | arohner | obviously 1) is O(1), and 2) requires walking the object graph. I'm ok with #2 taking significantly more time |
| 14:51 | arohner | but visualvm appears to have an algorithmic complexity class bug, in that it can't walk 250MB of memory in a reasonable amount of time |
| 14:52 | arohner | and actually, I'm ok with #2 being done destructively |
| 14:52 | arohner | i.e. actually GC the object, and return the number of bytes GC'd |
| 15:00 | roblally | As I understand it, on modern VMs individual objects are rarely GC'd. The process of GC is handled by higher level algorithms based on root node retention. Not to mention Schroedinger objects with various types of weak references which have indeterminate size. |
| 15:01 | roblally | I say rarely because I'm not sure, but I suspect 'never' to be the case. |
| 15:02 | stuarthalloway | hugod (or other palleters): how do I configure an SshModule? |
| 15:04 | hugod | stuarthalloway: how have you connected to the provider? (org.jclouds.compute/compute-service ... ?) |
| 15:05 | stuarthalloway | using basically the same settings cemerick's blog post |
| 15:05 | stuarthalloway | passed :ssh flag at end of call to compute-service |
| 15:05 | stuarthalloway | do I also need to pass (ssh) under :configure? |
| 15:06 | hugod | the :ssh in compute-service should suffice |
| 15:07 | stuarthalloway | I am running from my own project -- could I be missing a jar? |
| 15:07 | stuarthalloway | I notice that pallet itself has various jars as dev dependencies |
| 15:07 | stuarthalloway | so I made the ones I thought I needed into regular dependencies in my own project |
| 15:07 | mmarczyk | arohner: that's what I'd like to do too... to learn the size of a single object on the heap |
| 15:08 | stuarthalloway | e.g. I added org.jclouds/jclouds-aws |
| 15:08 | hugod | stuarthalloway: the ssh jar is a direct dependency of pallet - so should be picked up |
| 15:08 | mmarczyk | it would be absolutely fantastic if, given a class, I could tell how much memory I'd need to instantiate it... |
| 15:09 | hugod | you'll need the jar for the provider you are using , so adding jclouds-aws is correct for ec2 |
| 15:09 | stuarthalloway | hugod, yes, I see clj-ssh-0.1.0.jar. I will try running the same code from pallet's own repl to see if things go any different |
| 15:10 | hugod | stuarthalloway: if you are using 0.1, please switch to 0.1.1 |
| 15:10 | stuarthalloway | hugod: back atcha! pallet seems to be using 0.1 :-) |
| 15:14 | hugod | stuarthalloway: sorry, if you are using pallet-0.1, please switch to pallet-0.1.1 - I messed up with the project.clj file in 0.1 (the pom.xml is fine though) |
| 15:14 | stuarthalloway | ah, I am on edge anyway |
| 15:21 | hugod | stuarthalloway: so what are you trying? I assume you have an exception asking you to configure an SshModule? |
| 15:21 | stuarthalloway | yes |
| 15:21 | stuarthalloway | I am about to create a gist so you can see it exactly |
| 15:23 | stuarthalloway | ah cool, now that I am running at the pallet repl I get tons of stdout info that I wasn't seeing before |
| 15:23 | stuarthalloway | wonder what sucks that stuff up when using it from another project... |
| 15:24 | hugod | you'll need a logging configuration file |
| 15:24 | stuarthalloway | ah, that's it, I already have one |
| 15:24 | stuarthalloway | now I am getting a mix of the error I saw before, plus com.jcraft.jsch.JSchException: Auth fail |
| 15:25 | hugod | by default, it authorises you id_rsa key - if you are not on OSX, you'll need to make sure it doesn't have a passphrase |
| 15:26 | stuarthalloway | I am on OSX |
| 15:26 | stuarthalloway | http://gist.github.com/470955 |
| 15:28 | stuarthalloway | is part of my problem that a new key pair keeps getting generated each time? |
| 15:29 | stuarthalloway | I now have a slew of keypairs with names like jclouds#praxis-NN |
| 15:29 | stuarthalloway | which would make me think that converge would fail on existing instances that use the keypair from the previous round |
| 15:30 | stuarthalloway | and you are right, it is wanting a passphrase -- I can see it in the log |
| 15:33 | hugod | it should ask for access to your keychain - assuming you use the osx keychain |
| 15:34 | stuarthalloway | hugod -- thanks -- the issue is definitely now local to me :-/ |
| 15:34 | stuarthalloway | should I expect to see a new keypair in EC2 every time I run the code? |
| 15:40 | hugod | stuarthalloway: which keypair are you refering to? |
| 15:40 | stuarthalloway | every time I run the pallet script, it seems to create a new keypair on ec2 |
| 15:41 | stuarthalloway | with a name like jclouds#praxis-NN |
| 15:41 | stuarthalloway | or maybe it is just every time I have changed the definition of the server, since I was playing around with that |
| 15:42 | stuarthalloway | hugod: I found the missing jar |
| 15:42 | hugod | stuarthalloway: I'll ask adriancole_ over on #jclouds - I don't use ec2 myself... |
| 15:43 | stuarthalloway | for some reason lein deps isn't picking up the jsch jar file, even though I am depending on pallet |
| 15:43 | hugod | that's strange - it's a dependency for clj-ssh |
| 15:44 | stuarthalloway | strange indeed, wonder if that's my second lein bug of the day, or maven, or just me |
| 15:44 | hugod | mvn dependency:tree should list jsch unless there is a maven issur |
| 15:48 | rmarianski | p /go evilhackerdude |
| 15:48 | rmarianski | err, sorry |
| 15:50 | stuarthalloway | hugod: org.jclouds/jclouds-jsch is listed as optional in the pallet pom.xml |
| 15:51 | stuarthalloway | ... which makes the dependency non-transitive. Consumers of pallet as a library will thus need to redeclare a dependency. By design? |
| 15:55 | hugod | stuarthalloway: oversight. thanks for catching this, ditto jclouds-log4j and jclouds-enterprise |
| 15:55 | stuarthalloway | hugod: no problem, sorry I am so dumb that it took so much of your time |
| 15:58 | hugod | stuarthalloway: and apologies that it so much of yours to track it down - jar soup is enough to confuse any of us |
| 15:58 | hugod | stuarthalloway: any particular plans for pallet? |
| 15:59 | stuarthalloway | hugod: we are (at present) big into chef |
| 15:59 | stuarthalloway | I would like to see more parens in my cloud admin |
| 16:00 | stuarthalloway | currently just messing around, using it as a stable reference platform for testing different libraries we might use on client projects |
| 16:01 | hugod | ok, I would appreciate your feedback once you have spent some time with pallet |
| 16:01 | stuarthalloway | hugod: you bet! |
| 16:54 | technomancy | oh sweet, the CLI launcher ticket has been scheduled for the release after 1.2 |
| 16:54 | technomancy | better late than never |
| 16:58 | stuarthalloway | technomancy: did you see the bug I filed on lein |
| 16:58 | stuarthalloway | I would fix it if I knew the right thing to do |
| 16:58 | technomancy | stuarthalloway: yeah, actually looking into it right now |
| 16:58 | stuarthalloway | awesome, thanks! |
| 16:58 | technomancy | stuarthalloway: it's because the reader doesn't know how to distinguish between ^D characters and malformed input |
| 16:59 | stuarthalloway | the regular clojure repl does the right thing somehow |
| 16:59 | mudge | what does "No matching ctor found" mean? |
| 16:59 | mudge | what the heck is a "ctor" ? |
| 16:59 | qbg | Constructor |
| 17:00 | Raynes | Couldn't have that cljr project theoretically have been a Leiningen plugin? If there were global plugins, that is. |
| 17:00 | mudge | qbg: ohhh |
| 17:00 | mudge | thanks |
| 17:00 | mudge | i thought it was short for some type of dinosaur, boy was I way off |
| 17:01 | technomancy | Raynes: yeah, I was planning on implenting cljr-like functionality once I had global plugins working |
| 17:01 | technomancy | stuarthalloway: yeah, probably just means I can't use a bare (read) call |
| 17:01 | Raynes | I have a couple of ideas for plugins myself once global plugins work. |
| 17:02 | technomancy | stuarthalloway: I can't use the regular repl because ant's subprocess launcher is totally busted for anything that uses stdin |
| 17:02 | stuarthalloway | doh! |
| 17:02 | technomancy | stuarthalloway: it's very convoluted as a result =\ |
| 17:02 | mudge | stuarthalloway: I'm reading your book. Learning a lot. |
| 17:03 | stuarthalloway | mudge: cool. I had a question yesterday and somebody pointed my to the book :-) |
| 17:03 | mudge | haha |
| 17:07 | arohner | what's a global plugin? |
| 17:08 | technomancy | arohner: "user-level" is what I was calling it. basically for tasks like "lein new" that need to be run outside the scope of a project. |
| 17:08 | technomancy | planned for lein 1.3 |
| 17:09 | arohner | technomancy: cool |
| 17:30 | pietia | does clojure is good to writting crawlers/scrapers? are there any good tools for clojure to parse html? |
| 17:31 | stuarthalloway | enlive |
| 17:33 | pietia | how about the performance ? |
| 17:34 | pietia | in comparison to jruby + mechanize / nokogiri |
| 17:46 | hiredman | htmlunit is pretty nice for scraping/crawling |
| 17:46 | hiredman | walking through forms and pushing buttons and walking through the response |
| 17:47 | hiredman | it's a java library, but very arrowy if I recall |
| 17:48 | technomancy | MenTaLguY: hey, how's it going? |
| 17:49 | MenTaLguY | goes okay |
| 17:49 | MenTaLguY | finally doing some clojure hacking again |
| 17:49 | technomancy | cools |
| 17:49 | MenTaLguY | wish 'lein test' didn't take so long to start/warm up, but that's not your fault |
| 17:50 | technomancy | MenTaLguY: are you able to use a client JVM? |
| 17:50 | MenTaLguY | yes -- isn't that the default? versus -server? |
| 17:50 | technomancy | MenTaLguY: well... sort of. it's not always available. |
| 17:50 | bulters | g'day all |
| 17:50 | technomancy | "lein version" will tell you what it's using |
| 17:51 | technomancy | MenTaLguY: on 64-bit machines you have to get a special JDK to get the client JVM |
| 17:51 | technomancy | on ubuntu it's ia32-sun-java6-bin |
| 17:51 | MenTaLguY | Leiningen 1.1.0 on Java 1.6.0_18 OpenJDK Client VM |
| 17:52 | technomancy | cool |
| 17:52 | technomancy | you can also avoid the startup penalties by re-running the tests in an already-running repl or swank session |
| 17:52 | technomancy | course it's easy to get in a bad state (aka "getting slimed"), but you can avoid that by doing a fresh "lein test" once before committing |
| 17:53 | MenTaLguY | I guess what I really want is something like nailgun |
| 17:53 | MenTaLguY | well, no |
| 17:53 | MenTaLguY | what I really want is a JVM that starts instantly |
| 17:53 | technomancy | are you a vim guy? |
| 17:53 | MenTaLguY | and a pony |
| 17:53 | MenTaLguY | yes |
| 17:53 | technomancy | it integrates with nailgun |
| 17:53 | technomancy | heh |
| 17:54 | technomancy | you can do worse than calling run-tests at the repl though, especially if you're not in the mood for an environment yak-shave |
| 18:08 | AWizzArd | Fast Leiningen question: when one does “lein swank” in the shell, does it then run a repl inside the shell, or will it start a background process that manually needs to be stopped? |
| 18:10 | technomancy | AWizzArd: it just launches a swank server |
| 18:10 | technomancy | it's not really a classic repl |
| 18:10 | technomancy | but it's foregrounded |
| 18:10 | technomancy | btw, any Japanese speakers care to translate this? もうLeiningen使えば無理にIDE使わなくても良いよなぁ。っということでNetbeans周りのToDoは優先度下げた |
| 18:12 | AWizzArd | technomancy: so, is it comparable with an Ant <java> task with fork="true" and spawn="false"? |
| 18:12 | technomancy | I'm not sure what spawn means, but it is a java task that forks |
| 18:14 | AWizzArd | technomancy: when spawn="true" then the forked jvm will outlive ant, so I guess it is supposed to run in the background. Though this does not work for me, while fork true and spawn false does. Thanks for the info. |
| 18:14 | MenTaLguY | hm, so is there a library function similar to (fn [m k f] (assoc m k (f (m k)))) ? |
| 18:15 | technomancy | ,(doc update-in) |
| 18:15 | clojurebot | "([m [k & ks] f & args]); 'Updates' a value in a nested associative structure, where ks is a sequence of keys and f is a function that will take the old value and any supplied args and return the new value, and returns a new nested structure. If any levels do not exist, hash-maps will be created." |
| 18:15 | technomancy | I think that's what you want. |
| 18:17 | AWizzArd | technomancy: is there a way to make Emacs (using Emacs Starter Kit) using a default folder of my choice, when a fresh Emacs is started and I do “M-x f” |
| 18:18 | AWizzArd | i.e. the first M-x f will default me to ~/ for example |
| 18:18 | technomancy | AWizzArd: I think just (setq default-directory "~") in your dotfiles |
| 18:19 | technomancy | not sure what M-x f means though |
| 18:19 | AWizzArd | uh, C-x f |
| 18:19 | AWizzArd | Or, C-x C-f |
| 18:20 | AWizzArd | okay fine, thanks |
| 18:20 | AWizzArd | And the ESK auto suggests files to me, and when I type in a file name that does not exist yet (for example “awizzard.el”) it will open whatever the suggestion says |
| 18:21 | AWizzArd | Is there a way to have it open a buffer with my file, not using the suggestion? |
| 18:24 | technomancy | AWizzArd: yeah, C-f will disable ido-mode temporarily if you hit it while you're choosing a file or buffer |
| 18:25 | AWizzArd | great, thx |
| 18:25 | AWizzArd | again :) |
| 18:25 | technomancy | I should put that in the readme; it's quite a faq |
| 18:27 | technomancy | not all that much is specific to ESK |
| 18:27 | technomancy | it just brings together a bunch of previously-disparate usefulness |
| 18:27 | technomancy | even package.el is now included in Emacs |
| 18:28 | AWizzArd | In my version too? “GNU Emacs 23.2.1 (i386-mingw-nt6.0.6002) of 2010-05-08” |
| 18:30 | technomancy | no, it's only in trunk right now. |
| 18:30 | technomancy | and it's kind of a busted version. |
| 18:30 | technomancy | working on fixing that right now, actually. |
| 18:31 | technomancy | man... lein's uberjar function really is a mess. |
| 18:32 | AWizzArd | why? |
| 18:32 | clojurebot | why not? |
| 18:33 | technomancy | why's package.el busted, or why is uberjar a mess? |
| 18:34 | AWizzArd | überjar |
| 18:34 | AWizzArd | Doesn’t it create überjars? ;) |
| 18:34 | technomancy | I can't figure it out, but most of the messiness centers around a file called META-INF/plexus/components.xml |
| 18:34 | technomancy | which smells like working around maven funkiness |
| 18:35 | technomancy | unfortunately this was all written by _ato, who has disapperaed. =P |
| 18:36 | AWizzArd | oh |
| 19:26 | thunk | Does anyone tell me the idiomatic way to serve static files in compojure? |
| 19:26 | thunk | s/Does/Can/ |
| 19:26 | sexpbot | Can anyone tell me the idiomatic way to serve static files in compojure? |
| 19:27 | AWizzArd | thunk: your Handler can just return the file |
| 19:27 | AWizzArd | i.e. (File. "/the/file/you/want/to/serve.txt") |
| 19:28 | thunk | AWizzArd: Hrm. What's a project's default root directory? |
| 19:28 | thunk | e.g. I'm striking out with (GET "/foo.css" [] (route/files "foo.css")) |
| 19:28 | thunk | with foo.css in ./public |
| 19:29 | thunk | AWizzArd: Ahh, gotcha. |
| 19:34 | thunk | AWizzArd: Thanks, that did the trick. |
| 19:36 | AWizzArd | thunk: you can also add a GET handler accepting * |
| 19:36 | AWizzArd | and then you do security checks in the handler, if it is okay to serve that file, and that way you can serve any file, in principle |
| 19:37 | AWizzArd | just be aware that a user could move around on the server, if your handler is not careful. |
| 19:37 | AWizzArd | Anyone here with a recent clojure.jar? Please test if (do (set! *warn-on-reflection* true) (defrecord Foo [])) throws a Reflection warning for you too. |
| 19:43 | robink | This may be a Java question, but calling ".split" on a string returns a Java string, not a vector of strings. |
| 19:44 | robink | I'm not sure if there's a Clojure analogue to .split. The book I'm reading intimated that it was preferable to call the Java method. |
| 19:44 | AWizzArd | ,(doc clojure.contrib.string.split) |
| 19:44 | clojurebot | java.lang.ClassNotFoundException: clojure.contrib.string.split |
| 19:44 | AWizzArd | ,(doc clojure.contrib.string/split) |
| 19:44 | clojurebot | "([re s] [re limit s]); Splits string on a regular expression. Optional argument limit is the maximum number of splits." |
| 19:44 | robink | Thanks |
| 19:45 | AWizzArd | robink: but btw, String’s .split method does not return a String. |
| 19:45 | robink | AWizzArd: The REPL suggests that it does |
| 19:45 | AWizzArd | It returns an array of Strings and you should have no problems using it. |
| 19:45 | robink | Hm |
| 19:46 | AWizzArd | The String class does not have a .split method returning a String. Only returning String[] |
| 19:46 | robink | Oh, OK |
| 19:46 | AWizzArd | robink: can you please paste the .split expression that you used, and the string it returned? |
| 19:47 | robink | AWizzArd: The actual string? |
| 19:47 | robink | AWizzArd: I get a reference to a String[] |
| 19:47 | AWizzArd | I mean your usecase: (.split "a b c" " ") ==> "a" |
| 19:47 | AWizzArd | Something like that is what you got |
| 19:48 | robink | I didn't get "a" |
| 19:48 | robink | I just got the reference |
| 19:48 | AWizzArd | well, you got a string |
| 19:48 | robink | Yeah |
| 19:48 | robink | OK |
| 19:48 | AWizzArd | can you show that example please? |
| 19:48 | AWizzArd | I would like to try it myself |
| 19:48 | robink | (.split "test.string" ".") |
| 19:48 | robink | returns #<String[] [Ljava.lang.String;@177ba38f> |
| 19:48 | AWizzArd | so, now it works correctly? |
| 19:49 | robink | Not sure how to deal with a string array but that's what I initially got. |
| 19:49 | AWizzArd | aah, ok |
| 19:49 | robink | I'm sure it's correct behavior, but I was assuming Clojure would wrap the type. |
| 19:49 | AWizzArd | well, you can use map/reduce/filter/doseq on String arrays |
| 19:49 | robink | Oh, OK |
| 19:50 | AWizzArd | ,(map count (.split "a b c d e" " ")) |
| 19:50 | clojurebot | (1 1 1 1 1) |
| 19:51 | robink | OK, but what I'd like is ("a" "b" "c" "d" "e") or ["a" "b" "c" "d" "e"] |
| 19:52 | AWizzArd | why? |
| 19:52 | clojurebot | why not? |
| 19:52 | gregh | ,(map identity (.split "a b c d e" " ")) |
| 19:52 | clojurebot | ("a" "b" "c" "d" "e") |
| 19:52 | robink | Oh, OK |
| 19:53 | AWizzArd | or (vec (.split s1 s2)) |
| 19:53 | AWizzArd | But still, why do you want that? |
| 19:53 | robink | AWizzArd: because I'm getting back a Clojure data type. |
| 19:55 | AWizzArd | I don’t understand why that is needed. Typically the result will be used in a form that iterates over the returned values anyway. |
| 20:54 | hugod | AWizzArd: C-j will use whatever you have typed in ido-mode |
| 21:43 | AWizzArd | hugod: thx |
| 22:22 | defn | http://aperiodic.net/phil/scala/s-99/ cool way to learn clojure... |