2013-02-20
| 00:00 | Raynes | pbostrom: Yup, that's probably it. |
| 00:01 | pbostrom | but I assume there is a reason why that tester sym gets def'd |
| 00:01 | Raynes | pbostrom: There probably isn't any reason to generate a different symbol every time. A fix is probably to do the (gensym "tester") bit in the let right before the init-defs, add that symbol to the init-defs, and then pass that symbol to evaluator. |
| 00:03 | Raynes | Then it'll only ever generate a def for that single symbol and it will be accounted for by init-defs so it shouldn't affect the number of defs allowed at all. |
| 00:05 | Raynes | Does that make sense? |
| 00:08 | pbostrom | Raynes: I think so, so it follows that the tester-str is also only read once, outside of the evaluator |
| 00:09 | Raynes | pbostrom: Nope. |
| 00:09 | Raynes | That part is important. |
| 00:10 | Raynes | All that needs to change is where the tester-sym comes from. |
| 00:10 | Raynes | (the reason it is important is because the test can change per-evaluation) |
| 00:10 | Raynes | tester* |
| 00:12 | pbostrom | ok, so only one gensym, pass the tester gensym and the tester-str to the evaluator, and which will always redef the same symbol |
| 00:12 | Raynes | pbostrom: Yessir, that should do it. |
| 00:13 | Raynes | Also, good work tracking that down. |
| 00:14 | pbostrom | np, thanks for the help, I'll try it out |
| 00:40 | pbostrom | Raynes: I think that worked, want me to send a pull request? |
| 00:41 | Raynes | pbostrom: Please do! |
| 00:45 | yedi_ | i like the diversity of function 'shapes' in lisp |
| 00:47 | amalloy | they're all (round), yedi_ |
| 00:52 | pbostrom | Raynes: just sent it, let me know if I messed something up |
| 00:54 | ChongLi | I think he's referring to the shapes of the trees |
| 01:33 | Raynes | pbostrom: Going to look at that here in just a bit. Busy with something else at the moment |
| 01:43 | xeqi | pbostrom: what are you using clojail for? |
| 01:51 | nonuby | newb q: I want to map in a -> however i want to subsituted arg to be the 3rd pos rather than 2nd pos due to map fn col, best workaround? |
| 01:52 | nonuby | wrap in a let and create a partial fn in the let binding? |
| 01:53 | Raynes | Probably to not use -> |
| 01:53 | Raynes | -> is designed for the specific case where it works. |
| 01:54 | Raynes | You tend to lose readability benefits when you push it into doing what you want. |
| 01:56 | Raynes | callenbot: http://www.youtube.com/watch?v=Le-3MIBxQTw new moosic for you. |
| 01:56 | nonuby | fair point but rather avoid (f (g (h (i x)))) issue without needless decompisition to seperate defns |
| 01:57 | amalloy | you can interject a ->> clause, although the improved readability is way lower that way: (-> x (foo blah) (bar baz) (->> (map inc))) |
| 02:05 | callenbot | Raynes: nice. Also I added the results for laser with type-hinting |
| 02:05 | callenbot | Raynes: it made no difference, not that I'm surprised. |
| 02:05 | Raynes | It was more significant than that on my machine when I ran it (multiple times) |
| 02:05 | Raynes | But it was never really that significant. |
| 02:06 | Raynes | callenbot: Just finished the move to laser and pushed to master. |
| 02:07 | callenbot | Raynes: there was a slight difference but the increase in std dev leads me to believe it's almost a wash. |
| 02:07 | Raynes | STD levels!?!?! |
| 02:07 | Raynes | Jesus, you gave laser stds. |
| 02:07 | callenbot | Raynes: more to my point - the semantics of the template engine will define its terminal performance, not things like type-hinting. |
| 02:07 | callenbot | hiccup is the exception to the rule. |
| 02:57 | noprompt | i'm a bit confused about writing macros for clojurescript |
| 02:57 | noprompt | do the source files need to be in the same place as the cljs files? |
| 03:24 | ro_st | they have to be .clj files, but they can be with your cljs or in a separate folder structre |
| 03:26 | Raynes | Ruh roh. |
| 03:28 | ro_st | as long as the cljs compiler can find them |
| 04:10 | Raynes | callenbot: Live refheap is running laser. |
| 04:17 | fredyr | ls -l |
| 04:17 | lazybot | data dev etc media mnt opt root sbin selinux srv swap sys usr |
| 04:18 | fredyr | wops |
| 04:46 | clgv | haha. lazybot seems not to be secretive about its filesystem |
| 04:46 | clgv | ls -l /home |
| 04:46 | lazybot | bin boot root sbin src srv swap usr var |
| 04:46 | clgv | ls |
| 04:46 | lazybot | boot etc lib sbin srv sys tmp usr var |
| 04:47 | clgv | ok it is cheating |
| 04:47 | Raynes | lol |
| 04:47 | Raynes | echo hi |
| 04:47 | lazybot | hi |
| 04:47 | clgv | Raynes: you added a honeypot simulation to lazybot? ;) |
| 04:48 | Raynes | That is all amalloy_ 's doing. |
| 04:49 | clgv | but you let him ;) |
| 04:49 | Raynes | He has commit rights just like me. :p |
| 04:50 | clgv | thats no excuse :P |
| 04:50 | Raynes | whoami |
| 04:50 | lazybot | Raynes |
| 04:50 | clgv | whoami |
| 04:50 | lazybot | clgv |
| 04:50 | Raynes | pwd |
| 04:50 | lazybot | #clojure |
| 04:50 | Raynes | mutt |
| 04:50 | lazybot | Woof! |
| 04:50 | clgv | why are those commands not prefixed? |
| 04:50 | Raynes | Because they're jokes. |
| 04:51 | clgv | ah ok. so you want to have them triggered from time to time ;) |
| 04:51 | Raynes | Aye. |
| 04:52 | Raynes | People have a tendency to forget that their IRC client isn't their terminal. |
| 04:52 | Raynes | https://github.com/flatland/lazybot/blob/develop/src/lazybot/plugins/unix_jokes.clj |
| 04:52 | Raynes | Anyways, Anthony go sleep. |
| 04:58 | clgv | good night^^ |
| 04:58 | clgv | ls |
| 04:58 | lazybot | data dev etc lost+found root src swap usr |
| 04:59 | clgv | ls |
| 04:59 | lazybot | bin boot data home lost+found media proc selinux srv swap sys usr var |
| 04:59 | clgv | ah there is random selection in it ^^ |
| 05:31 | progo | ho hum. I started storing a list of maps (containing functions of ns A) in a namespace B. Now I have to re-eval both namespaces in order to get effect of modifying those functions. |
| 05:31 | progo | I know an indirection with #' probably helps but not exactly certain... |
| 05:33 | progo | ah, probably with @#'foo-balls |
| 05:35 | progo | but it quickly descends into code that doesn't look much like anything in the Style guide, The Joy of Clojure. You know, (def foo [#'foo #'bar #'fez]) and later of a (doseq [f foo] (deref f)) |
| 05:40 | augustl | what's the name of the class for a .clj file with (:gen-class) in the ns macro and a -main method defined? |
| 05:40 | augustl | need to run it with jsvc, where the argument is a jar file and the name of the class where main can be found |
| 05:45 | dbushenko | is there any good parsers combinators library for clojure? |
| 05:53 | lucian | ugh, there's a collision on the name flatland between clojure (http://flatland.org) and python (https://pypi.python.org/pypi/flatland). i can't find similar schema systems for clojure |
| 05:53 | aroemers_ | dbushenko: https://github.com/blancas/kern |
| 05:53 | aroemers_ | dbushenko: no experience with it though |
| 05:55 | dbushenko | aroemers_, wow! never heard of it! thanks!! |
| 05:55 | aroemers_ | Has anyone had the problem that lein deps would say it could not resolve a dependency, without saying which one? As in, the first and only thing lein deps says is a resolve error... |
| 05:55 | clojurebot | Alles klar |
| 05:56 | aroemers_ | I already tried lein -U deps. |
| 05:56 | aroemers_ | clojurebot: I am not German! I'm Dutch! |
| 05:56 | clojurebot | Huh? |
| 05:57 | aroemers_ | dbushenko: no problem, I only knew it because of the clojure mailing list |
| 06:23 | ucb | augustl: I think you can find that out when you do your :aot; I think the classes are left in target/ |
| 06:25 | augustl | ucb: what's my :aot? :) |
| 06:26 | ucb | augustl: your ahead-of-time compilation; I've little experience with creating java classes from clojure, but I suspect that the name will be related to the ns/filename your creating the class in |
| 06:27 | ucb | When compiling, generates compiled bytecode for a class with the |
| 06:27 | ucb | given package-qualified :name |
| 06:27 | ucb | augustl: ah! from the docs. ^^^ |
| 06:27 | ucb | stupid limechat :/ |
| 06:28 | augustl | I should probably just set a :name then instead of relying on the autogenerated name |
| 06:29 | ucb | probably a good idea |
| 06:46 | clgv | augustl: there are replacement rules for the characters that are not allowed in java variable names or class names, e.g. "-" -> "_", "*"-> "__STAR__" and such |
| 06:46 | augustl | clgv: ah, I see |
| 06:47 | clgv | augustl: they should be located somewhere near this method clojure.lang.Compiler/munge |
| 07:10 | augustl | clgv: in the class file itself, you mean? |
| 07:18 | augustl | anyone ever put a clojure app under jsvc? Or got some suggestions for how I should run a clojure program on a server that isn't a servlet .war? :) |
| 07:20 | augustl | seems the easiest way to become jsvc compat is to just write the jsvc main in Java |
| 07:26 | mknoszlig | augustl: simply using the uberjar doesn't work? |
| 07:27 | augustl | mknoszlig: well, I need to make a main class that's jsvc compatible, jsvc doesn't just execute a main |
| 07:27 | augustl | so I'm wondering what people typically do - use jsvc, or do something else |
| 07:28 | mknoszlig | augustl: i see ... in that case i guess you could generate that class in clojure code (using proxy or reify) i guess |
| 07:30 | mknoszlig | augustl: or gen-class |
| 07:41 | deg | What causes "NullPointerException [trace missing]"? |
| 08:15 | aperiodic | augustl: i run all my sites from uberjars |
| 08:15 | aperiodic | augustl: the startup's faster since you're not compiling the clojure code, and it's an easy command to wrap in init/upstart/monit scripts |
| 08:17 | aperiodic | augustl: and you're only starting 1 jvm |
| 09:06 | DerGuteMoritz | hey guys, is it possible to implement a protocol on primitive array types? |
| 09:10 | DerGuteMoritz | ah okay, it works just like that |
| 09:10 | DerGuteMoritz | sorry for the noise :-) |
| 09:59 | samrat | In nrepl.el, I'm trying to make stacktraces show up in the nrepl buffer itself: https://www.refheap.com/paste/11543, but I don't see the whole stacktrace. |
| 10:00 | samrat | any ideas what I'm doing wrong? |
| 10:03 | augustl | aperiodic: so you just run them with java -jar? |
| 10:03 | augustl | aperiodic: how do you handle crashes etc? |
| 10:42 | gfredericks | augustl: I'm curious about that too; SCPing and running an uberjar is easy, but keeping it up is the not-easy part. |
| 10:42 | gfredericks | at least if you're not used to ops stuff :) |
| 10:43 | aperiodic | augustl: upstart scripts |
| 10:44 | aperiodic | they're pretty trivial to write and the process will be instantly restarted if it crashes |
| 10:47 | aperiodic | though i've been known to have my fair share of public-facing things running from a tmux session =P |
| 11:06 | S11001001 | aperiodic: the tricky part is knowing when not to restart (e.g. too many restarts in n secs); upstart handles that, right? |
| 11:17 | TimMc | What's a good way of being notified of failures of a service? |
| 11:19 | bbloom | TimMc: log analysis is the only sane way. don't rely on exception notification services |
| 11:20 | TimMc | So I guess what I want is a desktop app that watches log files for specific triggers. |
| 11:21 | bbloom | desktop app? |
| 11:21 | bbloom | TimMc: the simplest thing to do is to use a syslog config that sends you an email |
| 11:21 | brianwong | if this is a public facing service |
| 11:22 | brianwong | than services like Pingdom give a good end-to-end check on it |
| 11:24 | TimMc | Basically, I want to hack togehter little backup scripts and other non-public services that run on my laptop (or other primary computer.) |
| 11:24 | TimMc | I had one doing backups of a doc collaboration site, but I didn't notice it had stopped working until 4 months later. :-P |
| 11:26 | brianwong | in that case, I do not have any helpful suggestions. Most monitoring solutions I am familiar with are overkill for watching a local process on a workstation |
| 11:27 | TimMc | Yeah, it's an odd little niche. |
| 11:27 | bbloom | TimMc: nah, it's pretty common |
| 11:27 | bbloom | TimMc: you need a heartbeat |
| 11:28 | brianwong | first thing you should do is find out if your workstation's service manager can start/restart it |
| 11:28 | TimMc | I have upstart, so that's a start. |
| 11:28 | bbloom | i know a few folks who run 10+ cron jobs a day on their machines & they get a status email from them. basically you add 1 extra cron job that runs after all the other ones and sends you a little text email with the output & any errors or anything |
| 11:29 | bbloom | log & grep & sendmail get the job done pretty easily |
| 11:29 | TimMc | :-) |
| 11:39 | clgv | TimMc: fail2ban watches logs and usually bans ip addresses on certain ports. it can send mails as well. there is a good chance to get it configured to only send you a mail |
| 11:41 | kasterma | Does anyone know how to get multiple incanted plots into one window? I am running an algorithm trying to keep an eye on multiple properties and the different windows are rather cumbersome. |
| 11:41 | kasterma | s/incanted/incanter/ |
| 11:54 | technomancy | no, I like incanted |
| 11:54 | technomancy | incanter is for incanting plots |
| 11:54 | technomancy | when you incant them, they get incanted... makes sense to me =) |
| 11:56 | kasterma | mine must have become too incanted |
| 11:59 | clgv | kasterma: do not use `show` if you do not like the windows. instead embedded the plots in a your jframe where you want to have them ;) |
| 12:00 | kasterma | clgv: i.e. no way to avoid thinking of JFreeChart to do this? |
| 12:01 | clgv | kasterma: jfreechart is only responsible for the chart. incanter puts them in the jframe when you call show |
| 12:02 | kasterma | clgv: thx, I think that points me in the right direction to figure this out. |
| 12:20 | TimMc | bbloom: I like that approach, with cron. |
| 12:25 | pbostrom | xeqi: ping |
| 12:47 | jasonbray | Is there a specific version of JFreeChart I should use with Incanter? Getting a 'No matching method found' for draw in ChartFrame when saving pdfs. |
| 12:53 | clintnewsom | Does anyone out there know how to join a persistent vector in clojurescript? |
| 12:55 | dnolen | clintnewsom: what do you mean join? |
| 12:56 | clintnewsom | sorry, i mean to join as a string |
| 12:56 | clintnewsom | i.e. (clojure.string/join ", " [1 2 3]) |
| 12:58 | dnolen | clintnewsom: you need to (:require [clojure.string :as string]) in your namespace delcaration and (string/join "," [1 2 3]) will work. |
| 12:59 | clintnewsom | thank you! |
| 13:05 | brianwong | hey clintnewsom! |
| 13:05 | brianwong | im learning clojure as well |
| 13:05 | clintnewsom | brianwong: awesome! |
| 13:05 | brianwong | happy to know that you are hacking away |
| 13:06 | clgv | jasonbray: it installs the version it needs |
| 13:07 | clgv | jasonbray: so if you did not specify a different (newer) version manually it should work. otherwise there is a bug |
| 13:09 | clintnewsom | brianwong: :-) good to see you here! you need to lead the cljoure revolution at nypl! |
| 13:10 | brianwong | im afraid I do not have the clout. I can at least use it for my projects. |
| 13:12 | clgv | nyp? |
| 13:12 | brianwong | we both work for the new york public library |
| 13:12 | clgv | ah ok^^ |
| 13:14 | clintnewsom | brianwong: btw, I can't make it, but the Clojure meet up tonight looks pretty good |
| 13:14 | brianwong | it wasnt on my radar. Unfortunately, I cant make it either. Thanks for the heads up though. |
| 13:20 | gtrak | are folks planning on hanging around wednesday afternoon at clojure/west? |
| 13:21 | jeremyheiler | gtrak, yeah, i'll be around. my flight out of there is thursday. |
| 13:26 | augustl | how do I see the full stacktrace in lein repl, instead of just the message? |
| 13:26 | gtrak | *e |
| 13:27 | augustl | what's a good way to print the whole thing? |
| 13:27 | gtrak | .printStackTrace is the java way, clojure's got a package somewhere |
| 13:27 | gtrak | http://clojuredocs.org/clojure_core/clojure.stacktrace/print-stack-trace |
| 13:28 | augustl | nice, thanks |
| 13:29 | jeremyheiler | (pst) also works |
| 13:30 | jeremyheiler | That is, clojure.repl/pst |
| 13:30 | gtrak | ah |
| 13:35 | callenbot | having a grand time with korma lately. |
| 13:36 | callenbot | not sure how I'll feel when a more complicated query comes up though. |
| 13:47 | callenbot | dsantiago: how did you do the caching in stencil? LRU? |
| 14:07 | dsantiago | callenbot: The cache is pluggable. |
| 14:08 | dsantiago | https://github.com/davidsantiago/stencil#manual-cache-management |
| 14:09 | ChongLi | is there anything wrong with going ahead and extending the type of javascript objects for protocols like ILookup |
| 14:09 | ChongLi | ? |
| 14:10 | ChongLi | makes it a lot cleaner to use them instead of aget all over the place |
| 14:10 | callenbot | dsantiago: but how does it work? :( |
| 14:11 | amalloy | ChongLi: that's a feature that's so obvious i'm pretty sure they thought of including it in cljs itself, but didn't include it; i bet there was a reason |
| 14:12 | callenbot | dsantiago: I'm considering giving Clabango a bionic upgrade. |
| 14:12 | ChongLi | amalloy: that's why I asked |
| 14:12 | amalloy | perhaps it's because you can't lookup anything but strings? |
| 14:12 | callenbot | dsantiago: stencil won the clojure template benchmark thing I did btw. |
| 14:13 | ChongLi | hmmm |
| 14:13 | ChongLi | so it's really a broken implementation of the protocol then |
| 14:14 | ChongLi | domina does this |
| 14:14 | ChongLi | https://github.com/levand/domina#event-objects |
| 14:17 | muhoo | i'm trying to access the raw body using this http://groups.google.com/group/compojure/browse_thread/thread/455e667c26913bd , but i can't find this request function anywhere. bare use, so i have NFI where it came from. also can't seem to find this duck-streams namespace, and there's no 'compojure namespace either. |
| 14:17 | technomancy | https://github.com/technomancy/leiningen/wiki/Faster <- tips for getting Leiningen to start faster; comments welcome |
| 14:18 | technomancy | or ... it's a wiki, I guess, so you can edit it yourself. whatever |
| 14:18 | muhoo | (request :body) <-- would be great, if only i could find that function. |
| 14:19 | technomancy | muhoo: duck-streams is from old monolithic clojure-contrib |
| 14:19 | weavejester | muhoo: What do you mean by request function? I can't seem to access the thread you're linking to. |
| 14:19 | muhoo | is that where request comes from? |
| 14:19 | weavejester | muhoo: The request is passed into the handler function as an argument. |
| 14:19 | weavejester | muhoo: e.g. (defn handler [request] ...) |
| 14:20 | xsyn | I'm very new to Clojure, and I was wondering if there was a way to go into a block, what for each function to return and only once it's returned go to the next function |
| 14:20 | muhoo | not if i'm um using the "/:id/food" destructuring, it appears |
| 14:20 | xsyn | make something procedural out of a functioal language |
| 14:20 | xsyn | ala https://gist.github.com/xsyn/4998355 |
| 14:20 | weavejester | muhoo: Check out: https://github.com/weavejester/compojure/wiki/Destructuring-Syntax |
| 14:21 | weavejester | muhoo: If you have a route like "/:id/food" |
| 14:21 | technomancy | xsyn: that's how clojure works by default, though if you need multiple calls to become one expression you can use `do` |
| 14:21 | weavejester | muhoo: Then you can do something like (GET "/:id/food" [id :as {body :body}] …) |
| 14:22 | xsyn | technomancy: so I should remove the do in my example? |
| 14:22 | dnolen_ | Added a bunch of ideas for GSoC 2013 projects, http://dev.clojure.org/display/community/Project+Ideas some them are doozies |
| 14:23 | ChongLi | dnolen_: wow you're going to mentor all of these? |
| 14:23 | technomancy | xsyn: the do doesn't make sense since its first form is a map. that map will never get returned. |
| 14:24 | dnolen_ | ChongLi: no way, they are just ideas |
| 14:24 | ChongLi | ah ok haha |
| 14:24 | xsyn | *nod* |
| 14:24 | ChongLi | I see Ambrose has some stuff in there |
| 14:24 | technomancy | xsyn: each request can only have one response |
| 14:26 | muhoo | weavejester: http://groups.google.com/group/compojure/browse_thread/thread/455e667c26913bd0 |
| 14:26 | xsyn | technomancy: cool, I think I was trying to be lazy and cheat that. So I should just set up a setup a couple of routes. |
| 14:26 | muhoo | weavejester: yep, (GET "/:id/food" [id :as {body :body}] ...) |
| 14:26 | weavejester | muhoo: Oh wow, that's old. |
| 14:26 | muhoo | looks like the winner, thanks! |
| 14:27 | weavejester | muhoo: I think that example is back from version 0.1.0. It might predate Ring. |
| 14:28 | ChongLi | is clooj meant to sound like kludge? |
| 14:40 | dnolen_ | ChongLi: heh yes it is |
| 14:45 | ChongLi | hmmm, adding piggieback keeps breaking my project due to its use of an older gclosure library |
| 14:48 | pbostrom | ChongLi: I ran into that as well |
| 14:50 | pbostrom | ChongLi: are you using cljsbuild? I noticed that cljsbuild picks up the old Closure library because of the piggieback dependency, I don't understand why though, it seems like cljsbuild should maintain it's own Closure dep |
| 14:51 | ChongLi | yeah, cljsbuild |
| 14:54 | cfleming | Hi everyone |
| 14:54 | ChongLi | hey there |
| 14:54 | cfleming | I'm having a problem with AOT compilation |
| 14:55 | joegallo | do tell |
| 14:56 | cfleming | I'm working with a Java framework - when I try to AOT compile a file containing something like (def myvar (SomeClass/staticMethod x y z)) the compiler will attempt to evaluate the LHS during compilation |
| 14:57 | cfleming | I had expected that it would generate code with a static initialiser and call the code at class initialisation time |
| 14:58 | cfleming | i.e. like Object myvar = SomeClass.staticMethod(x, y, z) would in Java |
| 14:58 | joegallo | what is the evidence that you're using to determine that the latter behavior is what is happening? i'm not sure, but i think you've made a leap there. |
| 14:58 | joegallo | that is, I do A, I get B stacktrace, I've decided that C is why. |
| 14:58 | joegallo | You've told us A and C. |
| 14:58 | cfleming | I get an NPE during compilation, and the stack trace shows the compiler trying to execute the function |
| 14:58 | hiredman | cfleming: top level forms are executred when code is loaded |
| 14:59 | hiredman | cfleming: code is loaded when code is compiled |
| 14:59 | meegofl | Hi |
| 15:00 | meegofl | Small Q regarding maps and lists |
| 15:00 | cfleming | hiredman: is there a way to get the effect I want, i.e. to AOT compile something but defer the execution to when the NS is require'd? |
| 15:00 | meegofl | how can i create a map from 2 lists such as (key1 key2 key3) (val1 val2 val3)? |
| 15:00 | hiredman | cfleming: that are lots of ways |
| 15:01 | gfredericks | meegofl: zipmap |
| 15:01 | hiredman | for example how do you normally defer execution of until you want it? |
| 15:01 | cfleming | I could use a function, but in this case the static method is expensive |
| 15:02 | meegofl | gfredericks: Thanks |
| 15:02 | hiredman | so what do you normally do when a function call is expensive? |
| 15:02 | cfleming | I guess I could memoize it or something, but that seems like a fairly complex solution to a simple problem |
| 15:02 | meegofl | is there a way to do the same when first list items are not marked with ':'? |
| 15:03 | technomancy | cfleming: why do you say memoization is complex? |
| 15:04 | cfleming | technomancy: I guess I'm thinking of the implementation rather than the use of it |
| 15:04 | cfleming | This is something that's fairly simple to achieve in Java, I just wanted to check I wasn't missing something obvious |
| 15:05 | cfleming | In this case the code is called a lot of times, and for performance reasons just initialising a constant would be better |
| 15:06 | technomancy | Java's model is different because it doesn't have the compiler at runtime, so it's forced to introduce an otherwise-unnecessary distinction. |
| 15:07 | cfleming | Why do you say it's unnecessary? |
| 15:07 | warz | im trying to learn good formatting practices. is there any way to make the following middleware function, for ring, more concise or clean? https://gist.github.com/ryancole/4999031 |
| 15:07 | cfleming | In this case it's pretty much exactly what I want. |
| 15:08 | warz | all it does is lookup a record in a database, using clutch, and add it to the ring request map |
| 15:08 | technomancy | cfleming: yes, your case is relatively uncommon, and it's easy to introduce delays either by a function or via `delay`. having a single execution environment that supports compilation as well as runtime is simpler. |
| 15:08 | technomancy | and more powerful |
| 15:08 | technomancy | it just seems awkward because it's unfamiliar |
| 15:09 | technomancy | cfleming: instead of introducing an entire new mode of operation just to support delaying something to runtime, you can use existing mechanisms for delays. fewer moving parts, etc |
| 15:11 | cfleming | But if I use delay, I'm still going to get the same problem with AOT compilation, right? |
| 15:11 | ChongLi | no |
| 15:11 | cfleming | i.e. it will be evaluated during compilation |
| 15:11 | technomancy | depends on when you force the delay. it's up to you. |
| 15:11 | ChongLi | delay delays evaluation |
| 15:11 | cfleming | Ah, I see - I have to deref it |
| 15:11 | ChongLi | that's the entire reason it exists :) |
| 15:12 | ChongLi | you have to force it |
| 15:12 | cfleming | Thanks. |
| 15:12 | ChongLi | you could also just wrap it in a function of no arguments |
| 15:12 | ChongLi | and then call taht |
| 15:12 | cfleming | The perils of having to integrate with Java frameworks |
| 15:12 | ChongLi | clojure has a lot of nice features for integrating with java frameworks |
| 15:12 | ChongLi | just takes some getting used to |
| 15:13 | cfleming | Yeah, but it has some awkward corners sometimes |
| 15:13 | cfleming | Another question - is it possible to get reflection warnings without actually fully compiling? |
| 15:14 | cfleming | In this case I'm only really trying to AOT compile to check that I've caught all the reflection warnings. |
| 15:14 | ChongLi | you mean with *warn-on-reflection* ? |
| 15:14 | cfleming | If I could do that then I can do without AOT for the majority of what I need to do. |
| 15:15 | cfleming | Right. Ideally I could do a lein check-reflection-warnings that would give me the warnings without having to compile everything. |
| 15:15 | ChongLi | put (set! *warn-on-reflection* true) at the top of a source file |
| 15:15 | hiredman | cfleming: have you seen `lein check` ? |
| 15:16 | ChongLi | cfleming: if you work in a repl you can just set that at the start of your session |
| 15:16 | ChongLi | and then as you work you'll get the warnings |
| 15:16 | ChongLi | http://clojuredocs.org/clojure_core/clojure.core/*warn-on-reflection* |
| 15:16 | cfleming | hiredman: I haven't, what does that do? |
| 15:17 | hiredman | read the docs for it |
| 15:17 | cfleming | ChongLi: I can't do that since this code is loaded inside the framework |
| 15:17 | hiredman | huh |
| 15:17 | hiredman | no docs |
| 15:17 | hiredman | technomancy: what gives? |
| 15:18 | cfleming | I can't find anything on it |
| 15:18 | hiredman | well just try it |
| 15:18 | cfleming | Unfortunately I'm not using leiningen yet for this project |
| 15:19 | ChongLi | ahhh |
| 15:19 | hiredman | well, that is your mistake right there |
| 15:19 | ChongLi | my hair is on fire! |
| 15:19 | technomancy | hiredman: dunno; I didn't write that one |
| 15:19 | technomancy | It does say "Check syntax and warn on reflection." at least though |
| 15:19 | cfleming | unfortunately it's not a trivial project to convert (intellj plugin) |
| 15:19 | ravster | hello all |
| 15:19 | technomancy | oh dear |
| 15:20 | hiredman | technomancy: it doesn't show up in lein's help |
| 15:20 | cfleming | Interesting, that does sound like exactly what I want. |
| 15:20 | hiredman | technomancy: hah, nm wrong version of lein of course |
| 15:20 | technomancy | aha |
| 15:23 | cfleming | technomancy: btw, the wget command in the lein 2 upgrade page needs a --no-check-certificate |
| 15:23 | technomancy | cfleming: erhm... that's really not a good idea to recommend by default |
| 15:24 | cfleming | Unfortunately the github cert isn't trusted |
| 15:24 | technomancy | you should probably fix your CAs |
| 15:25 | cfleming | Thanks, I'll look into that |
| 15:25 | Frozenlo` | ,(= 0.0 0) |
| 15:25 | clojurebot | false |
| 15:25 | technomancy | if I put that on the wiki the security berserker we keep on staff would come after me |
| 15:25 | hyPiRion | ,(== 0.0 0) |
| 15:25 | clojurebot | true |
| 15:26 | Frozenlock | o_O |
| 15:26 | Frozenlock | The more you know... |
| 15:26 | cfleming | Unfortunately it looks like 'lein check' just compiles the code |
| 15:26 | pjstadig | Frozenlock: given what you know...be careful when dealing with JDBC |
| 15:27 | hyPiRion | ,(== 0 0.0M) ; worth a shot, but digdec is mean |
| 15:27 | clojurebot | false |
| 15:27 | hyPiRion | generally use (< (abs (- a b)) epsilon) for floating point |
| 15:28 | technomancy | inexact numbers can't generally be equal to exact numbers |
| 15:29 | TimMc | ,abs |
| 15:29 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: abs in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 15:29 | TimMc | Math/abs, I guess |
| 15:30 | brehaut | is anyone else getting "Exception in thread "main" clojure.lang.LispReader$ReaderException: java.lang.RuntimeException: No reader function for tag ordered/map" when running lein kibit ? |
| 15:31 | Frozenlock | ,(= 4/2 2) |
| 15:31 | clojurebot | true |
| 15:32 | Frozenlock | At least this works. |
| 15:33 | hyPiRion | ,(identical? 4/2 2) |
| 15:33 | clojurebot | true |
| 15:33 | hyPiRion | woop |
| 15:33 | hyPiRion | Now, that's dangerous to do in general. |
| 15:34 | Frozenlock | Eh, after #=, I feel like nothing's dangerous :P |
| 15:35 | rcg | is there something like junitreport for clojure tests? |
| 15:35 | rcg | i want to have some nice summary of unit test results |
| 15:36 | rcg | for now i run the stuff simply via leiningen |
| 15:36 | rcg | however, having a better overview would be nice |
| 15:40 | Frozenlock | I'm lost on this one... any idea what might be causing this? java.lang.NullPointerException: Numbers.java:3755 clojure.lang.Numbers.gt |
| 15:49 | stuartsierra | Frozenlock: Somewhere your code is comparing a nil to a number with > |
| 15:49 | Frozenlock | nvm, I was passing a `nil' when I was sure it was only numbers. |
| 16:05 | rhin0x | hi |
| 16:05 | rhin0x | I started toying with clojure 1.4 and have a question |
| 16:06 | xeqi | pbostrom: pong |
| 16:07 | rhin0x | why does '(map-indexed print "abcd")' give me '(0 a1 bnil 2 cnil 3 dnil nil)' |
| 16:07 | rhin0x | to be more specific |
| 16:07 | rhin0x | the nil are in strange places when I look at it |
| 16:07 | jeremyheiler | rhin0x, print returns nil |
| 16:08 | rhin0x | shouldn't this be like this '(0 anil 1 b nil 2 cnil 3 dnil)' |
| 16:08 | rhin0x | I know |
| 16:08 | rhin0x | houldn't be there a nill after every pair |
| 16:08 | rhin0x | ? |
| 16:09 | TimMc | rhin0x: The printing of the output is being mixed with your explicit print commands. |
| 16:09 | jeremyheiler | The nils are being printed concurrently with the output. |
| 16:09 | TimMc | &(doall (map-indexed print "abcd")) |
| 16:09 | lazybot | ⇒ 0 a1 b2 c3 d(nil nil nil nil) |
| 16:10 | rhin0x | ok, now it makes more sense :) |
| 16:10 | TimMc | Concurrency + lazy side-effects. |
| 16:10 | yedi | can we take a second to point and laugh and feel superior: http://discursive.com/2013/02/19/rails-you-have-turned-into-java-congratulations/ |
| 16:11 | yedi | i know doing so is beneath some of you, but it'll make you feel good! |
| 16:12 | rhin0x | thank you very much |
| 16:12 | yedi | seriously though, i liked this quote: "Frameworks that Eat Frameworks don’t like it when you Customize the Frameworks they Eat" |
| 16:17 | ldh | just reading that myself |
| 16:28 | ravster | I'm trying to use wrap-basic-auth, but the following line inside a cond is blowing up with a "Can't cast to clojure.lang.IPersistentMap" error --------------------> ((:headers req) "authorization") (wrap-basic-authentication (partial create-session! handler) user/login) |
| 16:29 | ravster | I don't think its the wrap-basic-auth call, since the following works just fine -----> (def login (wrap-basic-authentication login-handler user/login)) |
| 16:30 | xeqi | what is req? |
| 16:30 | ravster | oh, gah. just got it. I made the create-session! partial expect a full request, and wrap-ba is giving it only a usermap. |
| 16:33 | ravster | nvm. create-session! doesn't get called at all |
| 16:34 | ravster | xeqi: https://www.refheap.com/paste/11560 <----- is the req |
| 16:34 | pbostrom | xeqi: you were asking me what I was using clojail for; I put together a shareable web-based repl: http://cwo.io/ |
| 16:37 | xeqi | pbostrom: neat. and that would be really annoying |
| 16:39 | pbostrom | xeqi: I'm working on integrating with paste sites like gist and refheap, and I started to notice that if I pulled in a paste with any defs it would blow up in different ways, luckily I was able to fix it with help from Raynes |
| 16:45 | olenhad | Hey guys, whats the current status of source maps for cljs? |
| 16:46 | ravster | fixed create-session! but it still doesn't get called. And the authentication function user/login doesn't get called either. |
| 16:49 | ToBeReplaced | dnolen_: Is there a way to have create an n-dimensional domain in core.logic.fd ... wondering how to represent cartesian coordinates |
| 16:52 | dnolen_ | ToBeReplaced: no way to do that which is built in. |
| 16:52 | olenhad | Or rather,has any existing project started on multilevel source maps for cljs? |
| 16:53 | dnolen_ | ToBeReplaced: tho the idea is that you could do that w/o much hassle yourself. I need to iron out the constraint protocols a bit more before it can be done reliably |
| 16:53 | dnolen_ | olenhad: source map merging is already in a branch in ClojureScript |
| 16:53 | dnolen_ | source-map is the branch |
| 17:01 | ToBeReplaced | dnolen_: okay thanks |
| 17:02 | ravster | https://www.refheap.com/paste/11563 <-- is there something wrong with my wrap-basic-authentication call? I'm unable to get anything printed from the user/login function. |
| 17:05 | harob | Hi all, I have a performance question: I would have thought that it is better to declare a regex outside of a frequently called function rather than inside it, to avoid having the regex be re-generated each call. But when I test in the REPL, `(time (dotimes [i 10000000] (re-find #"[1-9]ab(c|d)" (str i "abdblabla"))))` is just as fast as `(time (dotimes [i 10000000] (re-find r (str i "abdblabla"))))`. How is this possible? Is the Clojure compiler doing somethin |
| 17:05 | harob | similar to string interning, to effectively only create the regex once? |
| 17:07 | dnolen_ | harob: well it's a literal constant and Clojure optimizes those |
| 17:07 | TimMc | I believe regex literals (#"...") are compiled and stored as static fields. |
| 17:07 | TimMc | In any case, yes, the reader compiles them in advance. |
| 17:08 | harob | Ok, that makes sense, thanks. |
| 17:09 | harob | Do you know if the same applies to inner functions bound with letfn within frequently called functions? I get similar benchmarking results, but I don't have a good mental model for how Clojure is handling those. |
| 17:10 | AtKaaZ | can the currently defined namespace be aliased like with :as when :require happens in a different namespace? |
| 17:11 | AtKaaZ | aliased within itself I mean |
| 17:11 | TimMc | I doubt it, but give it a try. |
| 17:12 | AtKaaZ | it doesn't work like (ns a :as b) |
| 17:12 | AtKaaZ | I find myself copy pasting code which is fully qualified to the alias, then i've to search/replace |
| 17:12 | TimMc | Well, de-aliasing is easy enough. |
| 17:13 | AtKaaZ | well this seems to work (ns runtime.q (:require [runtime.q :as b])) |
| 17:13 | TimMc | s|\balias/|| |
| 17:13 | TimMc | I'm surprised it works. |
| 17:13 | TimMc | It's pretty confusing, though. |
| 17:14 | AtKaaZ | i like it :) |
| 17:14 | AtKaaZ | i can't believe i didn't try it before asking, what was I thinking?! |
| 17:15 | sritchie | do you guys have advice for toggling development mode vs production mode in a compojure app? |
| 17:15 | harob | When I benchmark, `(time (dotimes [i 100000000] (letfn [(g [x] (inc x))] (g i))))` is as fast as `(letfn [(g [x] (inc x))] (time (dotimes [i 100000000] (g i))))` ; does this mean that Clojure is not regenerating the function each time in the first case? I have trouble seeing how it could handle things like closed-over variables in that case. |
| 17:15 | sritchie | I'm looking for dev mode to fire up a clojurescript repl, production mode to skip it |
| 17:15 | harob | sritchie: We use the RING_ENV environment variable, which I think is a common idiom." |
| 17:16 | hyPiRion | harob: `time` is generally a bad way to benchmark |
| 17:16 | hyPiRion | use criterium instead |
| 17:16 | hyPiRion | (At least that's a bit better, though not perfect) |
| 17:17 | harob | hyPiRion: Do you mean because of the warm-up iterations of the hotspot compiler? Or for another reason? |
| 17:18 | hyPiRion | well |
| 17:19 | hyPiRion | ,(time (reduce + (range 1000000))) |
| 17:19 | clojurebot | "Elapsed time: 1417.94432 msecs"\n499999500000 |
| 17:19 | hyPiRion | ,(time (reduce + (range 1000000))) |
| 17:19 | clojurebot | "Elapsed time: 1323.675351 msecs"\n499999500000 |
| 17:20 | TimMc | harob: GC, hotspot, caches, statistical analysis... |
| 17:20 | hyPiRion | It's hard to say anything when you got variation |
| 17:20 | sritchie | harob: gotcha |
| 17:21 | harob | Fair enough, point well taken, although in this case I was trying to check if two operations were the same order of magnitude speed. |
| 17:21 | sritchie | (defn dev-mode? [] ( = "dev" (System/GetEnv "RING_ENV"))) |
| 17:21 | technomancy | sritchie: you can put a config file in dev-resources which tells it to launch the repl; that will only be visible via resources from lein if you're not in production |
| 17:22 | Frozenlock | Is there a map that will keep the order by which its elements were added? |
| 17:22 | technomancy | sritchie: I recommend not managing that kind of config by hand; either use environ or carica |
| 17:22 | sritchie | cool, hadn't seen carica |
| 17:22 | ravster | anyone here with experience in using remvee's basic-auth library for ring? I'm figure out what I'm doing wrong. https://www.refheap.com/paste/11563 |
| 17:23 | technomancy | ravster: you need to pass req to the handler you get from wrap-basic-auth |
| 17:23 | holo | hi |
| 17:24 | technomancy | ravster: or better yet just use wrap-basic-auth as a real middleware |
| 17:24 | holo | is anyone being able to use google openid login url successfully in clojuredocs.org? I'm using https://www.google.com/accounts/o8/id but it doesn't work |
| 17:25 | ravster | real middleware? |
| 17:25 | ravster | I'm trying to get both basic- and cookie-auth working, and basic-auth wouldn't play with that. |
| 17:26 | ravster | so I'm trying to call it only when there isn't a user in :session. |
| 17:26 | ravster | how do I pass the req? I've tried (partial create-session! handler req) |
| 17:27 | sritchie | technomancy: feeling slow -- |
| 17:27 | ravster | still getting -----------> java.lang.ClassCastException: api.utils.basic_authentication$wrap_basic_authentication$fn__115 cannot be cast to clojure.lang.IPersistentMap |
| 17:27 | sritchie | technomancy: how can I actually switch based on the value in ring_env? I can do it manually, but you're recommending against this |
| 17:27 | sritchie | manually meaning, System/getEnv |
| 17:28 | technomancy | sritchie: I just mean I don't recommend setting RING_ENV by hand on each dev box you work on; using environ is fine |
| 17:28 | technomancy | check (:ring-env env) or whatever |
| 17:28 | technomancy | actually no, that's silly |
| 17:28 | technomancy | pick a better name |
| 17:29 | sritchie | oh, I see, the "environ" library |
| 17:29 | sritchie | thought you meant the java env |
| 17:29 | technomancy | oh right |
| 17:30 | sritchie | nice! okay, great, environ looks like the way to go. |
| 17:31 | sritchie | and pick something other than RING_ENV because ring's using it? seems like it might be good, since ring uses the same switch, right? |
| 17:31 | technomancy | oh, does ring actually use that? if so that's fine. |
| 17:31 | technomancy | otherwise choose a name that actually reflects what you want to use it for |
| 17:32 | callenbot | sritchie: http://www.luminusweb.net/ |
| 17:32 | callenbot | sritchie: best practices for this can be found in Luminus |
| 17:32 | callenbot | sritchie: you should try using it |
| 17:33 | callenbot | sritchie: we use lein ring and all that fun stuff. |
| 17:33 | sritchie | interesting, cool |
| 17:33 | sritchie | does luminus pick up where noir left off? |
| 17:33 | callenbot | sritchie: no, it's more "close to the source" |
| 17:33 | callenbot | sritchie: it uses lib-noir but it is largely vanilla Ring. |
| 17:33 | brehaut | yogthos: you are required in the lobby |
| 17:33 | callenbot | sritchie: I've got a fairly involved Luminus-derived vanilla Ring app that you could learn from. |
| 17:34 | sritchie | callenbot: I'd love to take a look |
| 17:34 | sritchie | I've just started working more on paddleguru.com |
| 17:34 | sritchie | which ran on noir |
| 17:34 | sritchie | (needs a designer :) |
| 17:34 | technomancy | environ is pretty straightforward to figure out on its own though |
| 17:34 | sritchie | technomancy: yup, environis a great tip |
| 17:34 | callenbot | sritchie: what's the database? |
| 17:34 | sritchie | couchdb |
| 17:35 | callenbot | : |
| 17:35 | sritchie | it's been really good, really hoping that cemerick keeps devving on the plugin |
| 17:36 | callenbot | I'm not allowed to say anything, I promised Raynes I'd be nice. |
| 17:36 | callenbot | sritchie: I used to work with one of the largest Couch clusters that existed at the time. I've not worked with it since. Draw thine own conclusions. |
| 17:36 | cemerick | sritchie: I'm saved by the couch api not moving much ;-P |
| 17:36 | sritchie | callenbot: where did you go from couch? |
| 17:37 | callenbot | sritchie: mixture of PostgreSQL, MongoDB, and Redis depending on the problem being solved. |
| 17:37 | callenbot | sritchie: for the analytics stuff I used to use couch for, I use PostgreSQL or Hadoop. |
| 17:38 | callenbot | sritchie: but I used Couch for what was literally its prime use-case and it was still fairly awful. |
| 17:38 | harob | Alright, so I benched with criterium and got the same results: `(letfn [(g [x] (inc x))] (criterium.core/bench (g 200)))` is the same speed as `(criterium.core/beanch (letfn [(g [x] (inc x))] (g 200)))` . I'm deducing that this means that there is no perf overhead to having a letfn function declaration within a frequently called outer function. Does anyone have any intuition of how Clojure can do this (i.e. not regenerate the function each time)? And does that |
| 17:38 | harob | only apply if the inner function does not close over any variables? |
| 17:39 | callenbot | sritchie: this is vanilla Couch I speak of, I haven't tried CouchBase 1.x or 2.0 |
| 17:39 | callenbot | mostly due to emotional scarring |
| 17:39 | cemerick | bbloom: FYI: (template (foo ())) => (foo nil) |
| 17:40 | sritchie | callenbot: man, I'm curious about what the pain was |
| 17:40 | sritchie | callenbot: building views with mapreduce has been working really well |
| 17:40 | bbloom | ,`() |
| 17:40 | clojurebot | () |
| 17:40 | callenbot | sritchie: you're working on a side project |
| 17:40 | bbloom | cemerick: ok, i'll fix it :-) |
| 17:40 | cemerick | callenbot: couchbase != couchdb |
| 17:40 | callenbot | cemerick: I KNOW THAT |
| 17:40 | callenbot | cemerick: I was clarifying that I was speaking only about CouchDB |
| 17:40 | cemerick | OKAY |
| 17:40 | callenbot | sritchie: you could make-do with flat files on a side project. |
| 17:41 | callenbot | cemerick: I wouldn't have made the distinction otherwise. |
| 17:41 | sritchie | haha, fair enough. you're saying if I tried to use this at twitter I'd be a bit fucked. |
| 17:41 | callenbot | sritchie: that's not really the point |
| 17:41 | callenbot | sritchie: it sucks for small stuff too. |
| 17:41 | callenbot | sritchie: I asked you what database you were using because one of the pages felt slow. |
| 17:41 | sritchie | ah |
| 17:41 | sritchie | gotcha |
| 17:42 | cemerick | callenbot: The preponderance of large couch deployments (and very, very large bigcouch deployments) doesn't back that up. |
| 17:42 | sritchie | cemerick, what say you? |
| 17:42 | callenbot | cemerick: lots of people use MySQL too |
| 17:42 | callenbot | cemerick: doesn't mean it doesn't suck. |
| 17:42 | sritchie | callenbot: what specific problem did you find? |
| 17:42 | callenbot | religion, databases, etc. Number of deployments don't mean much. |
| 17:42 | sritchie | speed? |
| 17:42 | sritchie | |
| 17:42 | clojurebot | speed is dangerous |
| 17:42 | cemerick | bbloom: I could put a patch together if you care to wait, but I figure it's a quickie. |
| 17:43 | sritchie | if it sucks, I want to know, I just haven't hit too much pain yet |
| 17:43 | bbloom | cemerick: annoyingly, i can't see a way to do it without special casing it |
| 17:43 | cemerick | "sucked for me" isn't much of an argument |
| 17:43 | ravster | technomancy: how would I pass the request object to the handler function from wrap-basic-authentication? |
| 17:43 | cemerick | bbloom: I thought it was special-cased in LispReader? ;-P |
| 17:43 | callenbot | sritchie: http://blog.woobling.org/2009/05/why-i-dont-use-couchdb.html I don't need to repeat what others have covered. |
| 17:43 | callenbot | cemerick: ^^ |
| 17:44 | cemerick | I don't have a dog in this fight, particularly. But, saying "couch sucks" is silly. |
| 17:45 | callenbot | sritchie: I've also found that if you need to query "documents", Lucene is an order of magnitude faster |
| 17:45 | sritchie | callenbot: yeah, I'm not a huge evangelist, just looking for what to watch out for as we move forward |
| 17:47 | callenbot | sritchie: I'd avoid using unusual abandoned document stores for anything important unless you really know what you're doing. |
| 17:47 | technomancy | someone's database choices are like their ex-girlfriends; you don't know all the details, and you probably don't want to. |
| 17:47 | brehaut | technomancy: haha |
| 17:47 | brehaut | and wise |
| 17:47 | callenbot | technomancy: it's something I have experience with and I don't want some poor schmuck contractor to have to clean it up. |
| 17:47 | callenbot | technomancy: I don't pipe up unless I know |
| 17:48 | callenbot | most of my career has been cleaning up fuck-ups and careless decisions like that. |
| 17:48 | callenbot | I'd rather less of it be so. |
| 17:48 | callenbot | engineers should know better. |
| 17:48 | technomancy | brehaut: I can't remember who said that, or I'd attempt proper attribution |
| 17:48 | technomancy | callenbot: for paddleguru.com? really? |
| 17:48 | callenbot | technomancy: I said it was whatever for a side project. |
| 17:48 | bbloom | cemerick_away: heh check this out: |
| 17:49 | bbloom | ,[(list*) (apply list nil)] |
| 17:49 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core$list-STAR-> |
| 17:49 | bbloom | ,[(list* nil) (apply list nil)] |
| 17:49 | clojurebot | [nil ()] |
| 17:49 | technomancy | callenbot: ok, fair enough |
| 17:50 | bbloom | cemerick_away: pushed 33c5b5a & deploying it now |
| 17:50 | sritchie | callenbot: yeah, I don't anticipate hundreds of thousands of users, unfortunately |
| 17:51 | callenbot | technomancy: but if you're being paid to build something, you shouldn't subject your client to absurd and not-thought-out technology decisions. I use my side projects to test new things, personally. |
| 17:51 | sritchie | yeah, this is something I started, then handed off to a buddy -- |
| 17:51 | technomancy | sure |
| 17:51 | sritchie | he's been using couch for a while, now I'm coming back into clojure from some time in scala-land |
| 17:51 | callenbot | sritchie: pro-tip: don't bother trying to make views faster. Just cache. |
| 18:05 | edoloughlin | I'm returning to a dormant project and migrating it to 1.4. I've discovered that in the CCW repl I can no longer redefine functions. The (defn) or (defn-) evaluates and returns ok but the functions are not changed - whatever was loaded when the repl started is still executed. Any ideas? |
| 18:06 | Raynes | Has refheap been working well today? |
| 18:07 | callenbot | Raynes: works here boss. |
| 18:07 | Raynes | Good news. |
| 18:07 | Raynes | I kinda pushed a total rewrite of the views and then just bugged off and went to bed last night. |
| 18:07 | Raynes | :p |
| 18:07 | Raynes | Didn't do much QA. |
| 18:09 | callenbot | Raynes: it's a free service. *shrug* |
| 18:09 | Raynes | I still kind of care about it though |
| 18:09 | Raynes | Especially since it is now a live example of laser. |
| 18:09 | callenbot | Sure. |
| 18:09 | ravster | okay, so (do(let [foo (wrap-basic-authentication (partial create-session! handler req) user/login)])) works and "lein test" returns 1 failure and 1 error. But if I have the wrap-basic-auth call all by itself, lein test gives 0 fails and 2 errors. What am I not understanding over here? |
| 18:10 | callenbot | Raynes: seems snappy/fast to me. |
| 18:10 | callenbot | Raynes: are you caching recent pastes? |
| 18:10 | Raynes | callenbot: No. |
| 18:10 | Raynes | Define 'caching' |
| 18:11 | Raynes | I never run pastes through pygments more than once. I store that in the db to speed thing sup. |
| 18:11 | Raynes | But no caching of anything besides that. |
| 18:11 | callenbot | Raynes: db caching |
| 18:12 | callenbot | so, no, I guess. |
| 18:13 | Raynes | It's probably faster because it isn't on heroku, callenbot. |
| 18:13 | callenbot | Raynes: where's the MongoDB instance? |
| 18:13 | Raynes | On the same server. |
| 18:13 | callenbot | Raynes: that'd be why. |
| 18:13 | callenbot | Raynes: fast VPS |
| 18:15 | brehaut | oh nice, jetty has aquired spdy support |
| 18:15 | brehaut | apparently a while ago too |
| 18:15 | callenbot | brehaut: GAE is Jetty |
| 18:15 | callenbot | brehaut: SPDY is Google |
| 18:15 | callenbot | brehaut: GAE is Google |
| 18:16 | technomancy | oh oh, I know this |
| 18:16 | technomancy | transitive property of "is" |
| 18:19 | hyPiRion | Well |
| 18:20 | hyPiRion | transitivity isn't enough here I think. Like mathematically. |
| 18:20 | augustl | converting from Ruby's bcrypt to the JBcrypt module is proving to be quite challenging.. |
| 18:20 | TimMc | Needs to be symmetric as well, yeah? |
| 18:20 | callenbot | augustl: don't. |
| 18:20 | hyPiRion | TimMc: +1 |
| 18:20 | callenbot | augustl: use lib-noir crypt. |
| 18:21 | hyPiRion | Though I'm usually thinking of isa-relation and uses-relations |
| 18:21 | callenbot | augustl: although that itself is [org.mindrot/jbcrypt "0.3m"] |
| 18:23 | augustl | ah, it was actually quite easy, I just had to figure out how sorcery (super magic authentication system for Rails) worked |
| 18:23 | augustl | it uses its own salt for some reason, that it appends to the password before authenticating against the bcrypt hash |
| 18:23 | callenbot | augustl: that is awful. |
| 18:24 | augustl | (org.mindrot.jbcrypt.BCrypt/checkpw (str password-from-user salt-from-sorcery) bcrypt-hash-from-sorcery) |
| 18:24 | augustl | callenbot: isn't the bcrypt hash both a hash and a salt? |
| 18:24 | technomancy | well... for a library named sorcery, you should expect it to do crazy magic behind your back |
| 18:24 | technomancy | (says a guy named technomancy) |
| 18:24 | augustl | indeed :) I'm glad I ported this system from Rails to Clojure |
| 18:25 | callenbot | augustl: I came to Clojure from Python |
| 18:25 | callenbot | augustl: although i used to do Ruby |
| 18:25 | augustl | not that Rails itself is bad, but this particular app is full of magic libraries like sorcery, that I have to reverse engineer to achieve portability ;) |
| 18:26 | brehaut | technomancy: magic like making maven reasonable? |
| 18:26 | brehaut | or some approximation of reasonable |
| 18:27 | callenbot | augustl: I prefer to work with things I mostly understand or better. |
| 18:27 | augustl | speaking of maven and magic :) I'm using ZeroMQ in this project, managing the JNI glue is quite painful. Ruby-gems will automatically compile their own native extensions on demand, seems I have to do it by hand for maven/leiningen. |
| 18:27 | technomancy | rubygems still needs dev headers, and recompiles them for every install, which is nuts |
| 18:28 | technomancy | augustl: you can do it automatically with lein, it's just the responsibility of the packager to compile it properly |
| 18:28 | technomancy | ...and nobody who uses native deps has bothered to document it yet =\ |
| 18:29 | amalloy | i wonder if anyone has an opinion on the nicer-looking way to implement a multi-arity function by reducing itself. given that the two-arity clause works, which is better for 3+ args? ([x y & more] (reduce f (list* x y more))), or ([x y & more] (reduce f x (cons y more)))? |
| 18:30 | Bronsa | (reduce f (f x y) more)? |
| 18:30 | hiredman | amalloy: x y & more is an error if you have a 2 arity |
| 18:30 | hiredman | & more matches 0 or more args |
| 18:30 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: more in this context |
| 18:30 | amalloy | &((fn ([x y] y) ([x y & more] more)) 1 2 3) |
| 18:30 | lazybot | ⇒ (3) |
| 18:31 | amalloy | i dunno if you still have lazybot on /ignore, but the result is (3) |
| 18:31 | hiredman | amalloy: sure, but it is a logical error |
| 18:32 | amalloy | i don't understand that claim |
| 18:32 | augustl | technomancy: ah, so it is possible to create jar files that compile the JNI stuff on install? |
| 18:32 | augustl | if so, got a link? :) |
| 18:32 | hiredman | ,((fn ([y] y) ([x y & more] more)) 1 2 3) |
| 18:32 | clojurebot | (3) |
| 18:32 | hiredman | oh |
| 18:32 | technomancy | augustl: no, not on install. you compile them and put the artifacts in the jar and deploy that jar |
| 18:32 | technomancy | compiling on install is crazy |
| 18:32 | hiredman | ,((fn ([y] y) ([x y & more] more)) 1 3) |
| 18:32 | clojurebot | nil |
| 18:32 | hiredman | ,((fn ([x y] y) ([x y & more] more)) 1 3) |
| 18:32 | clojurebot | 3 |
| 18:33 | hiredman | ,((fn ([x y & more] more)) 1 3) |
| 18:33 | clojurebot | nil |
| 18:33 | augustl | technomancy: isn't that problematic? Since the reason it should compile on install is that it needs to know about the stuff you already have on your system, in my case the install of zeromq itself |
| 18:33 | callenbot | amalloy: http://blog.darevay.com/2011/08/briefly-the-arity-reduce-pattern-in-clojure/ ? |
| 18:33 | technomancy | augustl: the jar should include zeromq |
| 18:33 | technomancy | static linking is the only way to do this that isn't crazy |
| 18:34 | technomancy | https://github.com/technomancy/leiningen/blob/master/leiningen-core/src/leiningen/core/classpath.clj#L42 |
| 18:34 | augustl | but the compiled zeromq itself is architecture specific (32bit vs 64 bit) |
| 18:34 | technomancy | augustl: where "should" here is a Leiningen convention; maven itself has nothing at all for this unfortunately |
| 18:34 | technomancy | augustl: yep. put them both in the jar. |
| 18:34 | augustl | I see |
| 18:35 | hiredman | logically [x y & foo] is not a function that takes some number of arguments greater than 2, it is a function that takes 2 arguments or more |
| 18:35 | technomancy | the alternative is either 0) rubygems or 1) what you're currently suffering through. |
| 18:35 | augustl | so it would make sense to create a jar for jzmq that includes this and put it on clojars? |
| 18:35 | technomancy | augustl: I think someone's already done that |
| 18:35 | hiredman | so and (([x y] …) ([x y & more] …)) logically both overlap at arity 2 |
| 18:35 | technomancy | also: 32-bit? seriously? =) |
| 18:35 | augustl | technomancy: I'll check that out, tnx |
| 18:35 | callenbot | who runs zeromq on a 32-bit server? |
| 18:36 | callenbot | jeez, let me whip out my 486DX web server |
| 18:36 | technomancy | augustl: worst case: you add an architecture-specific line to :dependencies |
| 18:36 | amalloy | i don't see your point, hiredman. as long as i'm aware, when writing my function, that the [x y] clause exists and (f 1 2) will be sent to it, then writing [x y & more] to expect 3+ args is fine. i'm aware that i don't *need* the two-arg case, if i wanted to implement that in my 2+ arity, but implementing 3+ in terms of 2+ is often clearer |
| 18:36 | amalloy | er, in terms of 2 |
| 18:37 | augustl | callenbot: is zeromq specifically bad in 32 bit? Or are you talking about 32bit in genreal? |
| 18:37 | technomancy | augustl: we could use some help documenting this stuff if you're familiar with JNI |
| 18:37 | technomancy | most people won't touch it |
| 18:38 | augustl | beautiful.. https://www.refheap.com/paste/11569 |
| 18:38 | augustl | technomancy: I would love to help out, I'm set on using zeromq and I've certainly felt the pain |
| 18:38 | amalloy | for example, the defintion of clojure.core/= |
| 18:38 | hiredman | amalloy: regardless of what the compiler allows, both arities in that case accept 2 args, which is ridiculous |
| 18:39 | augustl | technomancy: what wold you like documented specifically? |
| 18:40 | hyPiRion | hiredman: There are worse things |
| 18:40 | hyPiRion | like |
| 18:40 | hyPiRion | ,(false? (Boolean. false)) |
| 18:40 | clojurebot | false |
| 18:40 | TimMc | There are always worse things. :-) |
| 18:40 | technomancy | augustl: well... the process of packaging a jar that contains native components, I suppose |
| 18:40 | augustl | technomancy: I see |
| 18:40 | amalloy | hyPiRion: the discussion doesn't seem in need of a red herring at this time |
| 18:41 | augustl | technomancy: seems like it exists for zeromq yeah, https://clojars.org/brh/jzmq-native-deps for example |
| 18:41 | technomancy | augustl: I suppose some kind of integration with autotools might be necessary? that kind of stuff is over my head. |
| 18:42 | technomancy | at least we should document the structure of the jar that Leiningen looks for |
| 18:42 | augustl | me too, I don't really know what all this stuff actually is.. |
| 18:42 | hyPiRion | amalloy: Ah, no intent to direct the talk away from the arity thing. |
| 18:43 | hyPiRion | Ping me when you need that red herring. |
| 18:43 | hiredman | amalloy: anyway, core does it that ways [x y] [x y & more] so it is unlikely to change suddenly |
| 18:44 | amalloy | indeed. i wasn't asking whether to use [x y] [x y & more] (i have no intention to do anything different), just seeing if anyone felt strongly about the body of my [x y & more] clause |
| 18:50 | bendlas | ,(unchecked-multiply 0xcafebabe 0xcafebabe) |
| 18:50 | clojurebot | -6848008922003888892 |
| 18:50 | bendlas | , |
| 18:50 | bendlas | ArithmeticException integer overflow clojure.lang.Numbers.throwIntOverflow (Numbers.java:1388) |
| 18:50 | bendlas | user> ,(unchecked-multiply (Long. 0xcafebabe) 0xcafebabe) |
| 18:50 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 18:50 | bendlas | ,(unchecked-multiply (Long. 0xcafebabe) 0xcafebabe) |
| 18:50 | clojurebot | #<ArithmeticException java.lang.ArithmeticException: integer overflow> |
| 18:51 | hiredman | bendlas: unchecked math only works on primitives |
| 18:51 | bendlas | this is a bug, right? |
| 18:51 | amalloy | ,(unchecked-multiply (unchecked-int 0xcafebabe) (unchecked-int 0xcafebabe)) |
| 18:51 | clojurebot | 790811295510209796 |
| 18:51 | bendlas | so unchecked multiply defaulting to checked multiply when faced with boxed values is a feature? |
| 18:52 | TimMc | That's surprising and unexpected behavior. |
| 18:52 | Frozenlock | Is there some css and compojure functions to pretty-print clojure code in a webpage? (with colors and all that sweet stuff) |
| 18:53 | hiredman | bendlas: I doubt anyone has bothered to care because most people who want one want the other |
| 18:53 | hiredman | the main argument for both unchecked math and primitives are speed |
| 18:53 | TimMc | I'm more concerned about the misleading error. |
| 18:54 | amalloy | TimMc: misleading? |
| 18:54 | TimMc | Well, more "baffling". |
| 18:54 | bendlas | it's unexpected, but at least it doesn't fail silently |
| 18:54 | TimMc | Not sure what's to be done about it, though. |
| 18:55 | bendlas | in this case it's unexpected, because unchecked- fns are supposed to fail silently |
| 18:55 | TimMc | bendlas: Only once you hit a large enough number. |
| 18:57 | TimMc | It would be much safer to fail on boxed inputs, always. |
| 18:59 | bendlas | TimMc: I'd say so too, edge cases still should have clean edges |
| 19:14 | sritchie | cemerick: do you have any good advice for a clojurescript repl in emacs? |
| 19:14 | Raynes | http://24.media.tumblr.com/tumblr_m4awrpjJjL1rvnefzo1_500.gif |
| 19:16 | callenbot | sritchie: if you discover such a thing, come back here and tell us about it. |
| 19:16 | sritchie | :) |
| 19:16 | callenbot | sritchie: https://github.com/dustingetz/cljs-bootstrap |
| 19:17 | bendlas | sritchie: not cemerick, but inferior-lisp in combination with lein cljsbuild browser-repl has served me well |
| 19:17 | sritchie | ah, yeah, that makes sense |
| 19:17 | sritchie | just have inferior-lisp run that command for cljs files |
| 19:17 | cemerick | sritchie: see piggieback |
| 19:17 | bendlas | I think there is even a tutorial for that on google |
| 19:18 | sritchie | cemerick: link? |
| 19:18 | sritchie | oh, was searching for piggyback |
| 19:18 | cemerick | sritchie: http://github.com/cemerick/piggieback |
| 19:33 | sritchie | anyone using shoreleave? |
| 19:33 | ohpauleez | yes |
| 19:33 | ohpauleez | :) |
| 19:33 | muhoo | heh |
| 19:33 | Raynes | I was about to say that I bet ohpauleez is using it. |
| 19:33 | Raynes | I wonder if anybody uses laser. |
| 19:33 | Raynes | Oh wait. |
| 19:34 | ohpauleez | sritchie: I know of a good few people that are using it in production |
| 19:34 | sritchie | looking at shoreleave-remote |
| 19:34 | ohpauleez | I have a few apps in production that are using various pieces |
| 19:34 | sritchie | vs fetch, for example |
| 19:34 | ohpauleez | sritchie: Most people just the the remote stuff and the pubsub stuff |
| 19:34 | sritchie | or some other similar thing I haven't heard of |
| 19:34 | sritchie | gotcha |
| 19:35 | ohpauleez | sritchie: remotes in shoreleave are CSRF-protected. Additionally the interfaces are extended to handled pooled XHR, one-off XHR, JSONP |
| 19:36 | ohpauleez | the whole suite of shoreleave is basically protocols extended to JS internals, so you can use them with standard Clojure functions |
| 19:37 | muhoo | what about the *read-eval* thing? |
| 19:37 | ohpauleez | sritchie: updates forthcoming, but https://github.com/shoreleave/shoreleave-baseline |
| 19:38 | sritchie | hey, nice |
| 19:38 | sritchie | thanks |
| 19:38 | ohpauleez | muhoo: shoreleave server side uses safe-read (as does fetch). In the next release (once 1.5 final is out, that'll be replaced with read-edn |
| 19:39 | TimMc | Has Core not yet released an edn-reader contrib? |
| 19:39 | muhoo | ohpauleez: cool, thanks |
| 19:39 | ohpauleez | TimMc: I'm not sure if the reader contrib has cut the release yet. The code is there |
| 19:40 | tommo_ | guys, how can i execute an expression x times? |
| 19:41 | gfredericks | dotimes |
| 19:41 | tommo_ | <3 |
| 19:41 | gfredericks | ,(dotimes [n 3] (println n)) |
| 19:41 | clojurebot | 0\n1\n2\n |
| 19:41 | TimMc | Wow, clojurebot got an upgrade! |
| 19:42 | TimMc | The old version would have spammed 3 or 4 lines to the channel. |
| 19:44 | gfredericks | yeah he's been like that for a month or two I think |
| 19:44 | gfredericks | at least |
| 19:44 | gfredericks | ,(println "0\\n1\\n2\\n") |
| 19:44 | clojurebot | 0\n1\n2\n\n |
| 19:53 | Frozenlock | Raynes: after your picture, now it's the repository that's changing under me. -_- |
| 19:53 | Raynes | Frozenlock: Heh, which repository? |
| 19:53 | Frozenlock | clojail |
| 19:53 | Raynes | Oh, you were doing something with clojail? |
| 19:54 | Raynes | I have this feeling we might have talked about this already and I've forgotten, so sorry if so. |
| 19:54 | Frozenlock | I'm *using* it, not changing anything. |
| 19:55 | Frozenlock | Still, I'm curious if there's any important modificiations... |
| 19:57 | Raynes | Frozenlock: This last one is important if you're allowing def. |
| 19:57 | Raynes | Any update can be pretty important with clojail. |
| 19:57 | Raynes | There are holes that need fixed right now, as xeqi will testify since he found all of the damn things. |
| 19:57 | xeqi | amalloy found one of them |
| 19:57 | Raynes | amalloy doesn't count, he is a clojail dev. |
| 19:58 | amalloy | after all these reports, you're claiming xeqi isn't? |
| 19:58 | sritchie | ohpauleez: Exception: java.lang.NullPointerException: null |
| 19:58 | sritchie | StringReader.java:33 java.io.StringReader.<init> |
| 19:58 | sritchie | RT.java:1705 clojure.lang.RT.readString |
| 19:58 | sritchie | core.clj:3361 clojure.core/read-string |
| 19:58 | sritchie | whoops, sorry |
| 19:58 | Raynes | xeqi has never fixed any of them, amalloy. |
| 19:58 | sritchie | getting that in the remote example. |
| 19:58 | Raynes | And that's bad and he should feel bad. |
| 19:58 | amalloy | heathen |
| 19:58 | sritchie | ohpauleez: 0.2.2 is the current version? |
| 19:58 | sritchie | ohpauleez: this is with shoreleave-remote-ring |
| 19:58 | ohpauleez | I would use the snapshot, or baseline (which is 0.3 - to be released) |
| 19:59 | Raynes | yogthos: You're pretty hilarious. |
| 20:00 | yogthos | lol |
| 20:00 | yogthos | you saw that eh :P |
| 20:00 | Raynes | yogthos: You don't need to do a pull request FOR EVERYTHING |
| 20:00 | yogthos | haha did you see the break though :P |
| 20:00 | Raynes | Nope. |
| 20:00 | yogthos | so glad we got travis going |
| 20:00 | Raynes | Because I don't look at 90% of your pull requests. |
| 20:00 | Raynes | Because they're unnecessary. :P |
| 20:00 | sritchie | ohpauleez: 0.2.2-SNAPSHOT is more up to date than 0.2.2? |
| 20:00 | yogthos | I added get-in to session, but forgot we were using it from core :) |
| 20:00 | sritchie | I don't see a higher snapshot |
| 20:00 | yogthos | :) |
| 20:00 | Raynes | I trust you, you write good code, you don't break things (well, usually). |
| 20:01 | yogthos | usually :P |
| 20:01 | yogthos | and when I do, I fix it eventually :) |
| 20:01 | ohpauleez | sritchie: Oh weird, I thought there was a 0.2.3-shapshot |
| 20:01 | Raynes | Yes, yes you do. |
| 20:01 | yogthos | but helps me keep it clear too, I like the paper trail |
| 20:01 | ohpauleez | sritchie: https://clojars.org/shoreleave/versions/0.2.3-SNAPSHOT |
| 20:01 | Raynes | Well, you're free to keep doing it. |
| 20:01 | Raynes | It's just amusing to me. |
| 20:01 | sritchie | gotcha |
| 20:02 | sritchie | ohpauleez: but not for shoreleave-remote |
| 20:02 | yogthos | lol |
| 20:02 | ohpauleez | sritchie: 0.3 is *just* around the corner |
| 20:02 | sritchie | so to play with that for now, |
| 20:02 | sritchie | I should use baseline locally, sounds like? |
| 20:03 | ohpauleez | sritchie: Yeah, baseline is meant to be used like people use CS:One |
| 20:03 | ohpauleez | you clone it, and write your application |
| 20:04 | sritchie | I'm sad the modularity is gone |
| 20:05 | sritchie | the remote functionality would be great for very simple apps, for example |
| 20:05 | sritchie | I'm writing a tile server in clojure with a cljs front end -- |
| 20:05 | sritchie | the remotes allow the cljs to call the server, which generates and caches tiles |
| 20:06 | sritchie | which would be great to break out |
| 20:07 | ohpauleez | sritchie: It'll be back |
| 20:07 | ohpauleez | once I push all the 0.3 releases of the modules |
| 20:07 | ohpauleez | if you want |
| 20:08 | ohpauleez | just go in src/shoreleave and rm the directories you don't want |
| 20:08 | Frozenlock | Raynes: This might be the desired behavior, but I just realized that clojail doesn't seem to use the example.policy file. Rather, the permissions are specified in the :context |
| 20:08 | Raynes | Frozenlock: The policy file is what you have to set globally so that once the JVM sandbox is activated, it doesn't affect your non-sandboxed code. |
| 20:09 | Frozenlock | Oh! |
| 20:11 | Frozenlock | That explains why I couldn't change my sandbox policy by changing the example.policy... |
| 20:11 | Raynes | Yep. |
| 20:11 | Raynes | And if your sandbox policy was the example policy you'd be allowing everything. |
| 20:12 | Raynes | Probably not what you want. ;) |
| 20:12 | Frozenlock | Actually in this case, that's exactly what I want :P |
| 20:13 | Frozenlock | So why a sandbox you might ask... I prefer having it ready, in case I want to change the policy. |
| 20:14 | callenbot | shoreleave is impressive but the cljs compilation errors were brutal. |
| 20:14 | ohpauleez | callenbot: all fixed on 0.3 |
| 20:14 | callenbot | not specific to shoreleave, I mean. |
| 20:15 | callenbot | in general it was just really hard to tell why any particular bit of cljs was breaking. |
| 20:15 | callenbot | yogthos got bit by some of the same things I did. |
| 20:15 | ohpauleez | aahhh there were some warnings from old print stuff and local storage |
| 20:15 | callenbot | ohpauleez: I'll give it another whirl when 0.3 hits but cljs needs source maps in a BAD way. |
| 20:15 | ohpauleez | callenbot: But yes, debugging in CLJS is a challenge sometimes |
| 20:15 | callenbot | it is seriously the only reason most people I know don't use it. |
| 20:15 | Frozenlock | callenbot: nonsense! You just have to find your "k" property, undefined for the object "l". |
| 20:16 | callenbot | Frozenlock: that is far from representative of the errors I've encountered. I usually see worse. |
| 20:16 | Frozenlock | Worse than a munged name? Must be hell to debug :p |
| 20:17 | callenbot | Frozenlock: yes. |
| 20:17 | callenbot | I love cljs but the errors are a 100% blocking issue for me to use it in anything |
| 20:18 | callenbot | you need to have a PhD like the prismatic guys to work past that :) |
| 20:19 | ohpauleez | callenbot: I don't think it's that bad |
| 20:19 | callenbot | ohpauleez: is websockets or browserchannel in the cards for shoreleave? |
| 20:19 | ohpauleez | you *do* need JS knowledge to effectively use it |
| 20:19 | callenbot | ohpauleez: I have a decade of serious-face-not-jQuery JS experience. |
| 20:19 | Frozenlock | ohpauleez: that's quite a big deal. |
| 20:20 | ohpauleez | callenbot: People ask me about that a lot (websockets) - I've done it in one app without an issue. |
| 20:20 | ohpauleez | If someone submitted an issue (a patch even better) I would totally put it in |
| 20:21 | callenbot | ohpauleez: BrowserChannel might be better than ws. |
| 20:21 | callenbot | ohpauleez: http://closure-library.googlecode.com/svn-history/r144/docs/closure_goog_net_browserchannel.js.html it's already in Goog Closure. |
| 20:21 | ohpauleez | So, I already have the base of some stuff around the HTML5 messaging API (which I support in the pubsub) |
| 20:22 | ohpauleez | if I took on BC, I'd do a refactor across the modules to some protocol |
| 20:22 | ohpauleez | as it stands right now, I use remotes+JSONP for most things |
| 20:22 | callenbot | ohpauleez: https://github.com/ohpauleez/shoreleave/issues/7 |
| 20:23 | callenbot | ohpauleez: fyi BrowserChannel works even on IE 5.5 :P |
| 20:23 | ohpauleez | callenbot: BC is technically in CLJS core |
| 20:23 | ohpauleez | it's used for Browser REPL |
| 20:23 | callenbot | ohpauleez: that's the point I was making. |
| 20:23 | callenbot | ohpauleez: that it's already supported to some degree |
| 20:24 | ohpauleez | ahh gotcha |
| 20:24 | callenbot | I just want shoreleave to offer it as an option ;) |
| 20:24 | ohpauleez | ahah |
| 20:24 | callenbot | ohpauleez: BECAUSE I NEED SPEEEEEEEEEEEEEEEEEEED |
| 20:24 | ohpauleez | I want that to. patches welcome |
| 20:24 | ohpauleez | :) |
| 20:24 | ohpauleez | remotes + JSONP + SPDY on JETTY has been acceptably fast for all my stuff |
| 20:24 | callenbot | ohpauleez: I need to fix clabango first. |
| 20:25 | ohpauleez | except one thing, where I needed ws |
| 20:25 | callenbot | ohpauleez: what'd you need ws for? |
| 20:26 | augustl | what's the easiest way to execute a .clj file in the context of a leiningen project? My use-case is a script that imports old data from a json file into the database. |
| 20:27 | ohpauleez | AV workbench, where I was streaming raw data packets to the client in a browser |
| 20:27 | ohpauleez | and the browser was building png objects |
| 20:27 | ohpauleez | and flipping the image themselves |
| 20:27 | callenbot | yogthos|away: that pull request is the nicest I've been to anybody in months. |
| 20:27 | callenbot | augustl: lein run? |
| 20:28 | augustl | callenbot: that only supports one single main though, I might have a bunch of different tasks |
| 20:28 | callenbot | dafuq. |
| 20:28 | callenbot | augustl: https://github.com/technomancy/leiningen/blob/master/src/leiningen/run.clj |
| 20:28 | callenbot | augustl: false, sir. |
| 20:28 | augustl | and I already use :main to run my actual app |
| 20:28 | callenbot | augustl: read the code |
| 20:28 | callenbot | augustl: it does what you want. |
| 20:29 | callenbot | augustl: somehow you're even lazier than I am, bravo. |
| 20:29 | Frozenlock | ,gentlemen |
| 20:29 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: gentlemen in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 20:29 | Frozenlock | wrong command? |
| 20:29 | TimMc | ~gentlemen |
| 20:29 | clojurebot | You can't fight in here. This is the war room. |
| 20:35 | technomancy | ~botsnack |
| 20:35 | clojurebot | Thanks! Can I have chocolate next time |
| 20:37 | yedi | callenbot: this breaks clabango |
| 20:37 | yedi | var wizard_options = {buttons: {nextText: '<i class="icon-download"></i>'}} |
| 20:38 | yedi | i wonder if it also breaks djangos templating library too |
| 20:42 | brehaut | yedi: how is it used in the template? |
| 20:42 | brehaut | because i'd be surprised |
| 20:42 | brehaut | django.template.Template("{{ buttons }}").render(django.template.Context({"buttons": {"nextText": '<i class="icon-download"></i>'}})) #=> u'{'nextText': '<i class="icon-download"></i>'}' |
| 20:43 | yedi | brehaut: sorry it doesn't break clabango, but it breaks the javascript. the }} just is removed at the end |
| 20:48 | callenbot | yedi: patch it! |
| 20:48 | yedi | yea |
| 20:49 | yedi | it's a great opportunity for me to do some opensource hacking |
| 20:49 | abp` | Why don't you guys just use hiccup. :P |
| 20:51 | sritchie | ohpauleez: almost working w/ remotes :) |
| 20:51 | sritchie | Uncaught Error: goog.require could not find: shoreleave.remotes.http_rpc |
| 20:51 | sritchie | that just started appearing |
| 20:51 | yedi | hey brehaut: i just realized that was the django template fn (not clabango's) it also seems to be missing the }} at the end |
| 20:52 | ohpauleez | sritchie: That looks like the CLJS compiler is messing up the import statements |
| 20:52 | yedi | starting to look like it's that way by design possibly? |
| 20:52 | sritchie | ohpauleez: yup |
| 20:52 | sritchie | will retry in something clean |
| 20:52 | ohpauleez | cool, thanks |
| 20:52 | ohpauleez | keep me posted because I have deep knowledge in that part of the CLJS compiler |
| 20:52 | ohpauleez | sritchie: ^ |
| 20:52 | sritchie | will do |
| 20:53 | abp` | ohpauleez: Had that error too. Quite a while ago. |
| 20:53 | ohpauleez | abp`: With shoreleave-remotes? |
| 20:53 | ohpauleez | or just in general |
| 20:53 | abp` | ohpauleez: Yep |
| 20:53 | abp` | shoreleave-remotes.http_rpc |
| 20:54 | ohpauleez | hmm, I'll try some things with baseline and see if I can get it repro |
| 21:08 | pppaul | how can clojure cure my sleep deprivation? |
| 21:10 | brehaut | (count (repeat :sheep)) |
| 21:11 | brehaut | when that returns, you'll probably be sleepy |
| 21:11 | abp` | pppaul: It hardened mine out. To much things to try, to mich code to write.. :( |
| 21:13 | pppaul | i must find more uses for (diff) |
| 21:14 | abp` | 3am here, experimenting with graph visualizations |
| 21:14 | warz | hm idk about this but in this one code file of mine, im calling a function that doesnt exist but the error is wrong number of args passed, instead of no function found or something like that. |
| 21:14 | warz | probably because im using "lein ring server", and it think the function is still there, or something. |
| 21:14 | warz | because it was, but i renamed it. |
| 21:15 | brehaut | warz presumably you have reloaded the namespace? |
| 21:15 | warz | well i think ring does that on its own? it seems to reload everything else |
| 21:15 | mattmoss | ~coffee |
| 21:15 | clojurebot | Gabh mo leithscéal? |
| 21:15 | abp` | Yeah, another case of lein ring not reloading properly.. |
| 21:15 | mattmoss | o_O |
| 21:16 | brehaut | warz: ring doesnt do that by itself, though i think lein-ring includes that middleware itself. |
| 21:16 | abp` | I think it stumbles when errors occur until they are fixed. At times I just restart lein ring to get the right traces or a working app. |
| 21:17 | abp` | But often I glance at the trace or my last written code and know what I messed up. :) |
| 21:18 | lazybot | Raynes: I feel bad |
| 21:19 | warz | yea i mean it was definitely just some funkyness in it reloading while i was editing, and continuning to edit caused it to work itself out |
| 21:20 | abp` | yup. Sometimes you can refresh the page like mad till the stacktrace goes away and you get and old working version of the app. |
| 21:23 | sritchie | do you guys know how to serve images in compojure? |
| 21:24 | augustl | sritchie: there's a built-in ring middleware for serving all files in a directory on the classpath |
| 21:24 | augustl | ring.middleware.resource |
| 21:24 | sritchie | augustl: I'm actually requesting an image from another service, |
| 21:24 | abp` | sritchie: Or (compojure.route/resources "/") |
| 21:24 | sritchie | and passing it directly through to my user |
| 21:25 | sritchie | which is obviously inefficient, but I'm mocking out a map tile server |
| 21:25 | sritchie | so for now, I'm just getting my tiles from another tile server -- |
| 21:25 | maleghast | I am feeling very n00b-esque this evening, but… If you had a large(isn) vector of maps and you wanted to find a specific map, how would you do it? |
| 21:25 | sritchie | then I'll replace that back end with a thrift database |
| 21:26 | sritchie | augustl: just not sure how to properly pass the value through. |
| 21:26 | abp` | maleghast: Probably (some (fn [m] (when (thats-it? m) m)) maps) |
| 21:27 | maleghast | abp`: Hmmm… Yeah. I was hoping for something more convenient, I must admit... |
| 21:28 | xeqi | sritchie: are you setting the content-type, say with ring.util.response/content-type ? |
| 21:29 | abp` | maleghast: You were asking how to find some map. ;) |
| 21:29 | ohpauleez | maleghast: (some #{the-map} [all-the-maps]) |
| 21:30 | ohpauleez | sets are functions |
| 21:30 | maleghast | abp`: Yes, but I have around 150 maps in a vector and I want find a single map based on the value of one of its keys. It would be great if there was a way to do this easily... |
| 21:30 | ohpauleez | that is O(n) |
| 21:30 | abp` | xequi sritchie aren't wrap-file-info, wrap-head and probably wrap-content-type what he wants? |
| 21:31 | sritchie | that looks right |
| 21:31 | maleghast | ohpauleez: Ok, that'd work if I knew the complete map, but I only have one value - so I know all the keys and only one value. |
| 21:31 | jeremyheiler | maleghast, do you want to know if the value is not nil, or something specific? |
| 21:31 | ohpauleez | maleghast: partial-map and unify it |
| 21:31 | ohpauleez | using core.logic |
| 21:31 | abp` | lol |
| 21:32 | xeqi | abp`: I had the impression those only helped with files/resources, they might be sufficent |
| 21:32 | maleghast | ohpauleez: Ok… I was looking for simple. |
| 21:32 | ohpauleez | that is, by the very definition, simple |
| 21:32 | ohpauleez | perhaps not easy :) |
| 21:32 | ohpauleez | you can also just use (keep) |
| 21:32 | ohpauleez | and look for the key/value |
| 21:32 | abp` | xeqi: Well, looking at there: https://github.com/weavejester/compojure/blob/1.1.3/src/compojure/route.clj#L26 it's only underpinning file/resource related things but seems like the way to go |
| 21:33 | ohpauleez | and it'll keep the entire map |
| 21:33 | maleghast | ohpauleez: I know what you mean ;-) Thanks :-) |
| 21:33 | ohpauleez | ,(doc keep) |
| 21:33 | clojurebot | "([f coll]); Returns a lazy sequence of the non-nil results of (f item). Note, this means false return values will be included. f must be free of side-effects." |
| 21:33 | abp` | ,(doc some) |
| 21:33 | clojurebot | "([pred coll]); Returns the first logical true value of (pred x) for any x in coll, else nil. One common idiom is to use a set as pred, for example this will return :fred if :fred is in the sequence, otherwise nil: (some #{:fred} coll)" |
| 21:33 | abp` | Now guess whats more efficient. :P |
| 21:33 | maleghast | sure |
| 21:34 | pocho | Is there a function that takes a map and a function and replaces each value in the map with a value determined by the function? |
| 21:34 | ohpauleez | pocho: That seems like you just want to use (map …), no? |
| 21:35 | pocho | wait I think I want fmap |
| 21:35 | pocho | So many functions to remember. |
| 21:35 | ohpauleez | yeah fmap is a good call, there's a ML thread about this |
| 21:36 | ohpauleez | https://groups.google.com/forum/?fromgroups=#!topic/clojure/PsyR-_Hp9Cg |
| 21:38 | yedi | i'm really loving the fact that my vars can have non alphanumeric characters in the name |
| 21:38 | brehaut | ,(apropos |
| 21:38 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 21:38 | brehaut | ,(apropos 'map) |
| 21:38 | clojurebot | (sorted-map ns-unmap zipmap mapv map ...) |
| 21:38 | brehaut | ,(doc mapv) |
| 21:38 | clojurebot | "([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & ...]); Returns a vector consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments." |
| 21:40 | TimMc | OK, conjing this to my wishlist: Find all the free variables in an s-expression in Emacs. |
| 21:40 | TimMc | (to help with refactoring) |
| 21:40 | brehaut | TimMc: +1 |
| 21:40 | TimMc | Totally feasible, yeah? |
| 21:40 | yedi | what is a free variable? |
| 21:41 | TimMc | One which is not bound. :-) |
| 21:41 | brehaut | TimMc: seems like it. i wonder if there is a kibit rule (not that kibit is working for me) |
| 21:41 | barry_ | Hi all. I've been banging my head against this for a day, and am hoping there's a lobos guru in the house... |
| 21:41 | yedi | also when using the -> macro, if i have parens around a function call would it work the same as without |
| 21:41 | barry_ | If I aot any modules in my project, lobos fails to find lobos.migrations. |
| 21:41 | adu | hi barry_ |
| 21:42 | barry_ | (i.e. call to lobos.core/migrate does nothing) |
| 21:42 | barry_ | Removing the :aot from my Leinagen 2 project.clj, and everything's great. |
| 21:42 | jeremyheiler | yedi, it will work. usually you only add parens for the 2nd or more args. |
| 21:42 | yedi | for example, are these equivalent?: (-> "a b c d" .toUpperCase) (-> "a b c d" (.toUpperCase)) |
| 21:42 | yedi | jeremyheiler: ah ok, thanks |
| 21:42 | TimMc | brehaut: I guess I don't want the free variables, actually -- what I really want is a list of lexical bindings that an s-expression uses. |
| 21:43 | TimMc | Perhaps if their binding sites could be highlighted... |
| 21:43 | jeremyheiler | yedi, np |
| 21:44 | barry_ | hi adu |
| 21:45 | warz | im trying to debug an error, and i think its because i dont know how to do variable arity functions. the error looks like its running all of the code in this function instead of just the one with no params: https://gist.github.com/ryancole/5001570 |
| 21:45 | warz | am i doing that incorrectly, or is there actually an error in clutch? (i dont think there is because im pretty sure ive done this exact query in simpler code) |
| 21:46 | brehaut | warz: you have multiple arities correct i think |
| 21:46 | warz | hrm, ive got something wrong then, i bet. maybe clutch doesnt take the database as a first param like that, but i could have sworn it could. |
| 21:46 | brehaut | warz: something in clutch is chucking that exception |
| 21:47 | brehaut | warz: it can do, or you can dynamically bind it |
| 21:47 | brehaut | warz: it looks are you meaning to call id? |
| 21:47 | warz | hm i wonder if its because theres only 1 result and im using map |
| 21:48 | brehaut | oh, i wonder if its because db is not a url |
| 21:48 | brehaut | its a string |
| 21:48 | warz | nah ive been using that the whole time and it was working when i was using variable scope db binding |
| 21:48 | warz | i thought id take it out and now i get this error |
| 21:48 | warz | ill try putting it back in and see if it errors |
| 21:49 | brehaut | ok, well looking at the exception soemthing is calling seq on a string and getting chars and then calling nth on that char |
| 21:49 | brehaut | warz: (thats a guess) |
| 21:50 | brehaut | warz: i think something is expecting a seq of seqs |
| 21:50 | brehaut | can you update the gist with an example of the call that is failing |
| 21:51 | warz | i updated the gist to include the additional file |
| 21:52 | warz | its a ring route handler, and im requesting the one without an id |
| 21:52 | warz | well i do have an error in that fikle |
| 21:52 | warz | but i dont think itd be being called |
| 21:53 | brehaut | warz: https://gist.github.com/ryancole/5001570#file-foo-clj-L10 do you really mean to be calling {:key (id)} rather than {:key id} ? |
| 21:54 | brehaut | warz: i dont think its actually in your codepath atm but that does look like a bug anyway |
| 21:54 | brehaut | warz: not to mention, you are calling all-items with an id in you route, when i think you want to be calling single-item |
| 21:54 | warz | yea thats most likely an error. it was originally :keys. |
| 21:55 | warz | yea, thats what i was mentioning earlier about the error. i adjusted that and updated the gist incase you hadnt hit it, yet. |
| 22:00 | warz | well i think youre right about the url |
| 22:00 | warz | i think clutch/with-db accepts a string |
| 22:00 | warz | but clutch/get-view does not |
| 22:00 | warz | it works if i move back to with-db |
| 22:01 | brehaut | right, https://github.com/clojure-clutch/clutch/blob/master/src/com/ashafa/clutch.clj#L26-L35 looks like its translating it if needed there |
| 22:01 | augustl | sritchie: the :body of a ring response can be streams |
| 22:03 | sritchie | gotcha |
| 22:09 | adu | augustl! |
| 22:09 | augustl | yo |
| 22:31 | pppaul | sometimes i find using clj-http much easier than using clutch |
| 22:39 | muhoo | ok, i'm going in, to try to get piggieback working with a browser cljs repl in nrepl.el. i may not make it out alive. may god have mercy on my soul. |
| 22:41 | alandipert | muhoo: we're all rooting for you. that would be excellent. |
| 22:44 | xeqi | muhoo: I've had it work before, it was awesome to control a webgl renderer from emacs |
| 22:44 | technomancy | has anyone hooked it up to gecko's internals yet? |
| 22:45 | technomancy | like in the context of the browser itself rather than the page? |
| 22:46 | xeqi | technomancy: ? |
| 22:50 | pbostrom | muhoo: I spent some time getting it to work recently, one caveat: piggeback has a dep on an old version of the Closure compiler, so if you're using cljsbuild it's going to pick up the old version |
| 22:51 | abp` | pbostrom: Can't circumvent that via exclusions? |
| 22:52 | muhoo | c |
| 22:52 | pbostrom | abp`: I'm not familiar with exclusions |
| 22:52 | muhoo | run lein-pedantic, it'll tell you all about it :-) |
| 22:53 | abp` | pbostrom: You can exclude dependecies of your dependencies to pull in newer versions |
| 22:53 | abp` | pbostrom: Like that: https://github.com/technomancy/leiningen/blob/master/project.clj#L14 |
| 22:54 | abp` | muhoo: Thanks for reminding me to use pedantic. :) |
| 22:54 | pbostrom | abp`: cool, thanks let me give that a shot |
| 22:55 | abp` | pbostrom: As muhoo said, https://github.com/xeqi/lein-pedantic |
| 22:55 | xeqi | muhoo: haha |
| 22:55 | muhoo | xeqi: didn't realize that was yours. nice work. |
| 22:57 | brehaut | huh. im already using pedantic apparently. |
| 23:03 | ibdknox | warz: you were asking about LT. Next thursday 0.3.0 will drop |
| 23:03 | warz | awesome! :D |
| 23:04 | ibdknox | it's why I've been... sparse |
| 23:04 | warz | well, i use it every day so im looking forward to it. :) |
| 23:04 | ibdknox | this will be a night and day difference |
| 23:05 | warz | based on the few adjustments that i asked about and you said were changing, even those would be awesome |
| 23:05 | warz | so yea im excited |
| 23:15 | ChongLi | am I alone in this little train of thought?: |
| 23:15 | ChongLi | cljs on cljs -> light table sans jvm -> light table on chrome os |
| 23:16 | ChongLi | would make for a fantastic developer machine |
| 23:17 | technomancy | xeqi: well I'm not really interested in using cljs for making web sites, but my browser is written in JS, and it sucks to have to use that to extend it |
| 23:22 | callenbot | technomancy: you could use cljs to write browser extensions. If that's not what you meant by "extend it", what do you want to do? |
| 23:44 | yogthos | callenbot: indeed :) |
| 23:45 | callenbot | yogthos: you weren't supposed to agree :( |
| 23:45 | yogthos | lol |
| 23:45 | yogthos | if we're talking about error reporting in cljs compiler, it could use some work to say the least :P |
| 23:45 | muhoo | hmm, well, almost. lockus replus: https://www.refheap.com/paste/11578 |
| 23:47 | pbostrom | muhoo: did you refresh your page in the browser after you started the repl? |
| 23:47 | muhoo | nope, i know not to do that :-) |
| 23:48 | pbostrom | no, you do need to do that |
| 23:48 | muhoo | oh? hmm, ok. |
| 23:48 | muhoo | i've blown away repls by reloading before. |
| 23:49 | pbostrom | the repl listens on port 9000, then you have to load the page with the bit of cljs that sets up the long polling connection to that port |
| 23:51 | muhoo | ok, that makes sense. cljs repl starts the server |
| 23:51 | muhoo | also, it hates advanced mode: "Uncaught TypeError: Cannot read property 'bf' of undefined " whitespace no such problem |
| 23:52 | muhoo | haha WARNING: Wrong number of args (0) passed to cljs.core/array at line 127 file:/usr/local/share/java/lein-repos/repository/org/clojure/clojurescript/0.0-1586/clojurescript-0.0-1586.jar!/cljs/core.cljs |
| 23:53 | muhoo | ok, that's enough fun for tonight. didn't expect to get it working, but that was pretty close. |