#clojure log - May 05 2013

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

0:01 muhoo: any advice as to how to make clojure jdbc postgres accept an #inst ?

0:02 "org.postgresql.util.PSQLException: Can't infer the SQL type to use for an instance of java.util.Date. Use setObject() with an explicit Types value to specify the type to use."

0:02 wat

0:02 Raynes: Not using an #inst works.

0:03 muhoo: http://docs.oracle.com/javase/6/docs/api/java/sql/Date.html

0:03 muhoo: Raynes: thx

0:03 Raynes: muhoo: Give it (java.sql.Date. (.getTime your-date))

0:05 muhoo: heh, it returns an inst :-P

0:05 ,(java.sql.Date. (.getTime (java.util.Date.)))

0:05 clojurebot: #inst "2013-05-05T04:01:21.862-00:00"

0:06 muhoo: (type (java.sql.Date. (.getTime (java.util.Date.))))

0:06 arrdem: ,#inst

0:06 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

0:06 muhoo: ,(type (java.sql.Date. (.getTime (java.util.Date.))))

0:06 clojurebot: java.sql.Date

0:06 muhoo: ok ok, it prints as an #inst

0:12 tomoj: huh, I never saw java.sql.Date

0:12 I thought it was supposed to be ""normalized""?

0:12 muhoo: aand, postgres is dropping the time from it :-(

0:13 2013-05-04 00:00:00-07

0:13 tomoj: ..right

0:13 muhoo: screw it, i'm going to have to write my own date/time functions it seems

0:15 i'm really regretting using sql for this now. starting to understand why people like nosql db's for clojure so much.

0:17 tomoj: I don't like apples. I understand why people like non-apples so much

0:19 muhoo: tomoj: incidental complexity

0:20 * muhoo sighs and pulls in https://github.com/clj-time/clj-time

0:26 cljer: hello guys, I'm trying to install vimclojure in mac, but it doesnt work

0:27 I'm not even doing the nailgun server, all I'm installing is extracting the vimclojure in my ~/.vim directory

0:27 and setting the 2 lines in .vimrc

0:28 but it doesn't work. did anyone solve htis problem?

0:29 Raynes: Don't bother with vim-clojure.

0:29 See https://github.com/guns/vim-clojure-static and https://github.com/tpope/vim-fireplace instead.

0:29 cljer: Raynes: oh let me check

0:31 muhoo: ,(-> (SimpleDateFormat. "yyyy-MM-dd HH:mm:ss Z") (.format (java.util.Date.)))

0:31 clojurebot: #<CompilerException java.lang.IllegalArgumentException: Unable to resolve classname: SimpleDateFormat, compiling:(NO_SOURCE_PATH:0:0)>

0:31 muhoo: ok, well, whatev, that works.

0:32 cljer: awesome Raynes. It worked!!!

0:32 thanks a lot

0:32 axle_512: (inc Raynes)

0:32 lazybot: ⇒ 29

0:32 Raynes: If I convert those into thousands of dollars I'd have tons of money.

0:32 axle_512: hahaha

0:33 Raynes: Created on this date: Lazybot Virtual Currency.

0:33 s4muel: lazycoin

0:33 axle_512: better than bitcoins

0:33 nice, s4muel, I like it

0:36 uvtc: What's the ratio of lazycoins to Schrute Bucks?

0:37 s4muel: Dont know. variant, depending on the beets futures market

0:37 axle_512: same as ratio of unicorns to leprechauns.

0:37 uvtc: ding ding ding! :)

0:39 axle_512: Does unicode work here in irc? λ

0:39 seems it does.

0:40 s4muel: axle_512: that's client-dependent

0:40 cmon now.

0:40 (also, it does.)

0:40 axle_512: ok

0:50 Tuna-Fish: axle_512: FYI, irc passes along bytes, not characters. Users have to agree to charsets. This caused rather a lot of problems in the countries that need to use non-ascii chars when IRC was (slowly) migrated to UTF-8

0:53 axle_512: Thanks, Tuna-fish… so most of IRC now supports UTF-8, but not necessarily all the client applications?

1:00 muhoo: for the record, the winning solution appears to have been (clj-time.coerce/to-timestamp (java.util.Date.))

1:11 cljer: hi all, I started a nrepl. how do I load that from fireplace, and actually use it inside vim?

1:13 callen: cljer: sudo apt-get install emacs

1:14 tos9: ...

1:14 callen: cljer: more seriously, :Connect

1:14 tos9: cljer: It should just work.

1:14 callen: (but you should use emacs)

1:15 tos9: cljer: (i.e., if you typed lein repl and then started up vim, you shouldn't need to type Connect).

1:15 cljer: haha. thats a steep learning curve

1:17 tos9, I don't understand hwo I don't have to type Connect if i have a repl started

1:17 tos9: cljer: Did you try it? It connects based on the file that lein writes out. http://clojure-doc.org/articles/tutorials/vim_fireplace.html is helpful but a bit out of date.

1:20 tomoj: how do credential fns fit into oauth2

1:21 friend-oauth2 seems to ignore them afaict?

1:24 cljer: thanks callen & tos9.. i hve clojurevim-static for now. will explore fireplace some other day

2:02 muhoo: wow that's interesting. if a string has a %20 in it, or a data structure has a string with a %20 in it, nrepl.el won't display it when runnign nrepl-eval-last-expression

2:02 some kind of urlencoding/bencoding glitch

2:18 akurilin: Hey guys, quick question. What's a good option for telling a clj web app + its tests what environment it's in? Environment variables are certainly a way, but is there anything else? Doesn't lein server accept profile switches?

2:20 muhoo: akurilin: i like the environs package

2:20 https://github.com/weavejester/environ

2:22 tomoj: there's also https://github.com/sonian/carica

2:25 akurilin: muhoo, So to clarify, I define a set of different profiles in ~/.lein/profiles.clj and am able to access their respective :env map through environ?

2:28 tomoj: how the fuck is clojure-mode+slime completing ::friend/w to ::friend/workflow

2:29 oh

2:29 coincidence :)

2:32 mthvedt: can namespaces made with create-ns be garbage collected

2:32 amalloy: ,(doc remove-ns)

2:32 clojurebot: "([sym]); Removes the namespace named by the symbol. Use with caution. Cannot be used to remove the clojure namespace."

2:33 mthvedt: i mean without manual intervention

2:34 visualvm seems to think not.

2:35 amalloy: of course not

2:35 they're reachable by anyone who wants to use things in the namespace

2:35 noidi: what are you trying to do? creating loads of namespaces at runtime is a strange thing to do.

2:36 mthvedt: well, suppose you're writing something that generates code

2:36 that refers to other generated code

2:36 on the fly

2:36 tomoj: whoa

2:36 I've wanted that many times

2:36 I always just kill the jvm

2:37 amalloy: tomoj: remove-ns?

2:37 tomoj: yeah

2:37 amalloy: mthvedt: if you do that, the robots will take over

2:38 mthvedt: i'm experimenting with implementing a paper on recursive ascent parsing

2:38 tomoj: please make the robots take over

2:39 mthvedt: you can do that kind of stuff with class loaders but i really don't want to use class loaders

3:00 noidi: what's the meaning of the `once` metadata in the macroexpansion of `future`? `(future-call (^{:once true} fn* [] ~@body)))

3:02 murtaza52: how do I get a lazy seq of repeated execution of a fn and its arg, with the result being passed for the next execution of the fn

3:02 repeatedly doest work, bcoz the return value is not used for the next fn call

3:04 noidi: ,(reduce #(%2 %1) 0 (repeat 3 inc))

3:04 clojurebot: 3

3:04 noidi: here's one way

3:04 ah, lazy seq. that means reductions.

3:04 ,(reductions #(%2 %1) 0 (repeat 3 inc))

3:04 clojurebot: (0 1 2 3)

3:05 murtaza52: nope there is a fn in clojure.core which I cant recall

3:05 noidi: iterate?

3:05 murtaza52: I am basically trying to have a counter, which is being passed to a map fn

3:06 yes iterate !! thanks

3:12 amalloy: noidi: ^:once means that you promise to only call the function once

3:13 that promise lets the compiler avoid holding onto memory that it would otherwise keep in the function's closure during execution

3:17 noidi: amalloy, thanks

3:26 mthvedt: answer to my earlier question: it looks like if you create an ns and immediately remove it, the orphaned ns is still usable and you can intern and eval with it

3:28 noidi: generating so many namespaces that memory use becomes a problem sounds like they're not meant to be used by a human

3:28 and if that's the case, why do you even need namespaces?

3:30 just leave everything anonymous and hang on to function references, or stick everything in a single ns and generate names with gensym :)

3:31 mthvedt: the point is eval'd code can only refer to things in *ns*

3:35 and it would be inconvenient if making the eval'd code i want led to things that can never be garbage collected

3:35 at least not in the normal fashion

3:36 *just watched visualvm gc a million namespaces*

4:23 _{^_^}_: the repl in Factor makes me jealous

4:23 imagine if the clojure repl looked like that

4:25 talios: anyone know if theres any clojure support for Sonar being worked on (http://www.sonarsource.org)?

4:28 terom: _{^_^}_: there is some kind of visual repl in http://keminglabs.com/c2/ although haven't tried that

5:16 akurilin: How do folks handle initial server configuration for a ring app as soon as lein server is executed? Anything better than just use a config.clj file from where the main handler is?

5:17 My specific really basic scenario is: use the project settings to define the default DB all calls will go to.

5:21 tomoj: didn't you already ask that?

5:21 and get two answers?

5:24 akurilin: tomoj, This is slightly different. The suggestions were great, I do have separate environment configurations now.

5:24 tomoj, Now I'm trying to find the best point in time in the app's lifecycle to actually apply them. Just once, at boot.

5:27 tomoj: I guess it depends on the situation

5:28 for e.g. datomic what I do is wrap a middleware that assocs a conn into the request from a delay

5:29 (defn wrap-conn [app] (let [conn (delay (d/connect (env :datomic-uri)))] (fn [req] (app (assoc req :my.ns/conn @conn)))))

5:29 ... (def app (-> ... wrap-conn))

5:30 akurilin: I'm using Korma, at it lets you set a default db so that you don't have to specify the connection every single time you make a call. It reduces the boilerplate, but now you have to deal with running that set-default command at some point.

5:30 tomoj: bleh

5:30 akurilin: Guess that makes it less functional.

5:31 tomoj: if you're using korma you're sorta out of the realm of my recommendations :)

5:32 akurilin: Hah, how so?

5:33 tomoj: well, I've never used it

5:33 akurilin: Oh I see, I thought you meant it had a bad rap around these parts.

5:44 tomoj: I don't think so. you correctly inferred my opinions at least, but since I've never used it I won't give them

5:48 though I will say that the default db thing at least is nuts IMO. lots of korma seems pretty nice though

5:49 it's not boilerplate if it's a near-minimally explicit and local representation of the relevant facts

5:49 of course those representations tend to be more verbose than is fashionable..

5:49 s/minimally/minimal/

5:50 akurilin: fair enough. I'll switch to the more explicit call, makes things easier to reason about for me as well.

5:50 tomoj: I suppose the idea is that you only defdb once?

5:50 the docs for create-db are baffling

5:50 "hey, here's this nice function that just does an obvious thing so you can use it in an obvious way. you should probably use it in a confusing way instead"

5:50 but since you _can_ use it the obvious way, korma is win

5:50 akurilin: Yeah you defdb once and internally it just remembers the last time you did it.

5:50 tomoj: I guess almost all libraries out there force you to do the confusing shit

5:50 akurilin: Can make things a bit messy if you accidentally go too defdb happy with different configurations

5:51 tomoj: or the use case in the create-db docs, creating connections dynamically instead of with defdb

5:51 akurilin: I'm mostly happy for the syntax. For someone starting out, it's much friendlier than jdbc

5:51 tomoj: now it's even worse than trying to figure out namespace loading order to determine which defdb was last, now I have to worry about the operational semantics underneath the top level

5:52 laliluna: Hope you are having a sunny Sunday as well.

5:52 tomoj: akurilin: yeah, looks very pleasant

5:52 and that select* etc exist is excellent

6:52 luxbock: I'm trying to simulate poker hands using Clojure

6:53 performance wise, am I better off creating a deck as an atom, and removing dealt cards using swap!, or could I just keep creating a new deck every time I need to deal a card, where the dealt cards are not included?

6:53 or does it even make a difference?

6:56 Raynes: I'd do both and see how fast you can get the non-atom version before deciding on one or the other.

6:56 You definitely want to try to not have to use a stateful solution unless it is slow enough to be a real problem.

6:56 Which seems pretty unlikely.

6:58 tomoj: why do you need to create a new deck?

6:58 luxbock: performance is somewheat critical as my end goal is to be able to simulate collections of strategies vs. each other, where each strategy consists of a range of hundreds of hands, where each hand has to be tested against another strategy

6:59 so that's a lot of simulation

6:59 tomoj: (subvec deck 1) ?

6:59 luxbock: tomoj: well I was looking at someone elses code and they used an atom for the deck

7:00 where every function that deals a card modifies the deck-atom

7:00 tomoj: why?

7:00 clojurebot: why is startup slow is busy compiling the `for` macroexpansion

7:00 Raynes: tomoj: You're asking weird questions.

7:01 I imagine he doesn't know why since he was looking at someone else's code and is asking the question himself.

7:01 tomoj: oh, of course

7:01 it doesn't make any sense to me that you would need to use an atom for performance

7:02 luxbock: I'm a novice in both clojure and programming in general, I'm just doing this as a learning experiment, and if it's something that works well enough then it will also be of real benefit to me

7:03 but for it to be usable, it has to be really fast as the simulations that will be of use to me are very complicated

7:03 Pupnik-: when you have a function that takes cards out of the deck (dealing etc) return the new deck and feed that back into your game loop

7:03 tomoj: don't use an atom

7:04 you would still have to do whatever data structure op you'd do in the atom-less version inside the swap

7:04 it could only be slower

7:04 though, it is 4am so maybe I am missing something

7:05 luxbock: alright cool, that's what I wanted to hear

7:05 Raynes: Agreed. I don't think you'd get much faster using an atom. You'd probably have to drop down to Java arrays and lots of horrible, horrible code.

7:05 * Raynes eats a piece of cheese.

7:05 Pupnik-: something handling such small data is probably going to be really fast no matter how you do it

7:06 tomoj: I just realized that the library I am writing — a one-function library — implements deck dealing

7:37 shadow_prince: can I use leiningen functions from leiningen repl?

7:51 necronia-: join #debian

10:25 bbloom: lynaghk: i'm re-reading logs (b/c my name was mentioned), so i'm a little late… but RE: taking a sabbatical: do it! best thing i ever did :-)

10:25 also lynaghk & tomoj: yes, angular is damn good.

10:31 gdev: java update available, time to reevaluate whether I want the ask toolbar or not

10:35 lol TDD breaks down when you fall asleep at your desk after writing a test then the next morning you can't figure out why you're getting so many errors

10:35 bbloom: re: core_async…. SSA & a state machine is a good idea. not as general as having CPS or tail calls or whatever, but the state machine approach works *great* for C# -- scala uses the Selective CPS transform approach, i think

10:36 s/i think/i know, but they may also do the SSA/state-machine thing else where/

10:55 gdev: lein spec -a doesn't seem to work in windows unless I'm doing something wrong (besides using my windows laptop)

11:00 apparently it reruns the tests when you make changes to the test files but not the source files...how is that helpful?

11:29 technomancy: Raynes: I have worked on code that used a raw AtomicReference

11:30 though I don't think it was for speed; I think it's because it gets you both the old and new values back in one call

11:30 AtomicInteger isn't too yuky though

11:36 gdev: figuring out which source changes correspond to which tests is really hard to do well

11:36 gdev: technomancy:) well the documentation should make such bold promises =D

11:37 *shouldn't

11:37 i'm looking at the clojure koans code to see how they do it

12:11 muhoo: wow this looks pretty awesome https://github.com/MichaelDrogalis/dire

12:12 using it to print the actual query string that caused the postgres sql exception

12:12 without having to create a wrapper function with try/catch

12:14 tomoj: (= __ (count (range start end step)))

12:14 muhoo: it's a pretty huge hairball though, pulls in midje as a transitive dependency :-/

12:14 tomoj: (max 0 (int (Math/ceil (/ (- end start) step)))) ?

12:16 muhoo: is it considered more polite to have test-related dependencies as a :dev profile dependency?

12:17 noidi: yes

12:29 muhoo: noidi: thanks, done.

12:37 noidi: muhoo, it's not just about politeness, the test dependencies are useless without the tests, which are not packaged into the distributed jar :)

12:38 muhoo: even better, thanks

13:39 tomoj: core-async <3 https://www.refheap.com/paste/3d6ecfea054a85abf5be25d37

13:49 it looks like if you define your own 'serious' types it should be very easy to wire up the state machine

13:49 just provide a matching task-wrapper

13:52 does it require binding conveyance?

13:52 I note core-futures does not appear to do any conveyance

13:53 well looks like it wants get-thread-bindings at least

13:53 (core

13:53 (core-async)

14:16 but it's passing around the bindings in the state monad

14:17 get-thread-bindings should be easier to implement than bound-fn in cljs, right?

14:24 hiredman: tomoj: it seems interesting, it raises lots of questions like "why ssa instead of the traditional functional language ir, cps?" and "why is this in relevance's fork, will it ever be in clojure/clojure?"

14:27 "why not release it as a library so people can use it with a released version of clojure?"

14:31 tomoj: yeah, and the tests seemed to hang for me and maven.test.skip didn't work, so I had to comment the tests out temporarily, mvn install, and create a new project just to have a 1.6.0-master dep

14:31 just to try it

14:31 hiredman: :/

14:32 tomoj: not that it bothered me much, because this is so interesting

14:32 hiredman: they passed for me

14:32 tomoj: maybe I just didn't wait long enough

14:33 noidi: what's core-async?

14:33 tomoj: I forgot, I have my cpu clamped low

14:33 hiredman: there is https://github.com/clojure/clojure/blob/master/test/clojure/test_clojure/generators.clj#L78-80 though

14:33 tomoj: noidi: http://github.com/relevance/clojure/compare/master...core-futures

14:33 noidi: the name's pretty much ungoogleable

14:33 hiredman: not very confidence inspiring

14:34 mpenet: there is some info there: http://dev.clojure.org/display/design/Async+blocks

14:34 (very little)

14:36 tomoj: "Added by Rich Hickey"

14:36 http://dev.clojure.org/pages/viewpage.action?pageId=7700515

14:36 rich's version

14:38 https://github.com/relevance/clojure-async-blocks

14:38 guess that was abandoned?

14:41 noidi: oh no, first monoids and now monads in clojure.core's source code! I sure hope the Haskell and Scala communities come up with some new category theory weirdness or soon Rich will have nothing to make fun of :(

14:43 arcatan: 8)

14:55 tomoj: noidi: comonad coalgebras?

14:57 Okasu: tomoj: Zygohistomorphic prepromorphisms.

14:58 tomoj: sardine : whale :: tomoj : Okasu

14:59 so traversables are just functors shapely over lists (??), and we can sub lists for reducers, so maybe we need functors shapely over reducers?

15:00 I assume subbing foldl for foldr isn't a serious problem

15:00 er. substitute reducers for lists and foldl for foldr?

15:08 the seq-wrapper in clojure-async-blocks looks interesting

15:10 https://www.refheap.com/paste/12630ba724fececac8be724f0

16:07 learner: ax

16:07 axle_512: hey

16:08 learner: axle_512: Okasu: Guys, just in case if you haven't got my msg. LiveRepl worked like a charm. Thanks for pointing out such a useful resource axle_512:

16:08 axle_512: learner: great! Glad to hear it worked.

16:12 Is there a good way to unit test a private function (defn-

16:13 would it work to put the tests in the same namespace as the code I want to test, or is this bad form?

16:14 Okasu: leathekd: Awesome! :)

16:15 I have to try it too at some point.

16:15 axle_512: okasu: I bet this could be use for hot-code patching for server. (Redefine a function on the fly in a running server — though not sure if it's safe or not)

16:19 muhoo: is there some extension to clojure/java that will show me the actual arguments of a call when an exeption is thrown?

16:20 technomancy: muhoo: ritz is the easiest way to do that

16:20 muhoo: thanks. been meaning to check that out. i guess it's time to thrash and break my emacs setup by installing ritz

16:21 axle_512: found an answer to my earlier question: Used ns-resolve to create a var in my testing namespace that refers to the private function in my other namespace.

16:21 technomancy: muhoo: hard to mess it up if you keep ~/.emacs.d in git =)

16:21 at least hard to mess it up permanently

16:21 muhoo: i've been using package-list-packages

16:22 technomancy: it should be safe to just rm -rf packages out of ~/.emacs.d/elpa if you are done with them

16:43 gfredericks: so let's say I'm doing offline cljs dev; everything's going fine. I add domina to my deps list (making sure it's a version I have in my ~/.m2), and all of a sudden `lein X` fails with: Could not transfer artifact org.clojure:clojurescript:pom:0.0-1069 from/to central

16:43 why on earth would that happen?

16:53 I wonder if n00bs would have an easier time learning as-> before -> and ->>

16:56 mthvedt: the clojure docs suggest you shouldn't change *ns*

16:56 bbloom: gfredericks: i think noobs just need to be taught how to use macroexpand … it's really quite easy to understand -> and friends once you fearlessly start expanding macros

16:56 mthvedt: so is (binding [*ns* whatever] (eval …)) considered evil?

16:57 gfredericks: ,(doc *ns*)

16:57 clojurebot: "; A clojure.lang.Namespace object representing the current namespace."

16:57 amalloy: bbloom: the fact that -> implicitly adds parens around non-lists goes a long way towards confusing newcomers

16:57 gfredericks: amalloy: syntactic duck-wrapping!

16:57 mthvedt: gfredericks: it's somewhere in the clojure namespace docs, not clojuredocs

16:57 the clojure page about namespaces

16:58 bbloom: amalloy: an example in the doc string would go a very long way

16:58 gfredericks: mthvedt: I think binding *ns* is totally reasonable if you're doing eval. I.e., it is no more evil than eval is.

16:58 maybe what you read referred to (set! *ns* ...)

16:59 bbloom: amalloy: assuming, of course, we can also teach noobs to fearlessly eval (doc foo)

16:59 :-)

16:59 mthvedt: gfredericks: good, what i'm doing is evil enough as it is

16:59 amalloy: gfredericks: you can't really set! *ns* at runtime anyway, since it's only bound when compiling

17:02 gfredericks: ,*ns*

17:02 clojurebot: #<Namespace sandbox>

17:03 amalloy: gfredericks: eval counts as compiling too :P

17:03 gfredericks: ,@*ns*

17:03 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.Namespace cannot be cast to java.util.concurrent.Future>

17:03 gfredericks: ,@#'*ns*

17:03 clojurebot: #<Namespace sandbox>

17:03 gfredericks: how can I observe this "not-compiling" state?

17:04 amalloy: gfredericks: write a program whose -main does (set! *ns* ...)

17:04 also, i wasn't clear: *ns* is bound, but it's not thread-bound. so you can read it but not set! it, i believe

17:06 gfredericks: that makes more senses

17:21 rlb: I'm trying to make sure I understand commute -- is this reasonably accurate? Within a transaction, a call to commute returns the value of applying fn to the "in-transaction" value of the ref (determined at the txn start), but if the ref changes during the transaction, the value will be set (a second time) to (fn current-value-outside-txn) when the transaction commits.

17:24 akurilin: Does Paredit have a command for removing the current expression, bubbling up whatever's inside?

17:31 gfredericks: splicing?

17:31 paredit-splice-sexp

17:31 arkx: M-s

17:32 bbloom: or for my fellow vim-ers who don't like paraedit, there is tpope's surround: ds(

17:39 muhoo: oh gawd, that was awesome. for an hour i was banging my head against the wall as to why only 51 of my entries were getting added to the db

17:39 for -> doseq fixed it.

17:39 * muhoo headdesk

17:39 muhoo: laziness strikes again!

17:40 * muhoo tattoos "i will always use doseq or doall for anything having to do with the db" to his forehead

17:40 gfredericks: (defmacro for->doseq [expr] (assert (= 'for (first expr))) (cons `doseq (rest expr)))

17:41 akurilin: gfredericks, what I tried was basically delete whatever is in the outer expression and then splice the inner one in.

17:41 gfredericks: I think of doseq as a loop over a collection for side effects, and for as a list comprehension expression. Maybe it's from having used clojure for four years, but I don't mix the two up much anymore.

17:41 akurilin: gfredericks, (a (b)), delete a, then splice. Seems to have worked.

17:41 amalloy: akurilin: you want M-r

17:42 akurilin: amalloy, I'm on vim-paredit, trying to find a corresponding trick :)

17:42 amalloy: (a |(b)), M-r => (b)

17:42 gfredericks: man I need to figure out how to use these M-foo combos :(

17:42 akurilin: amalloy, Is there a name for that command? "Replace" of some sort?

17:43 amalloy: raise

17:43 gfredericks: ragamuffins

17:45 muhoo: gfredericks: i think the tattooing-on-forehead thing will help me remember it before 4 years are up

17:46 i'm only about 17 months in so far.

17:46 akurilin: amalloy, ok great, found one, thanks! It's neat, it works on both symbols, or entire subforms, so you get to be pretty flexible.

17:47 muhoo, I'm on my 2nd day with paredit, what's it like up there 17 months later? :)

17:48 muhoo: oh, i haven't dealt with paredit yet. if i did, everything would grind to a screching halt

17:48 akurilin: It reminds me of when I started with vim a few years ago. The first week I gave up at least a couple of times a day, goign back to Notepad++.

17:48 Builds character.

17:49 muhoo: i already got enough character for a full broadway show

17:49 akurilin: I hear ya.

17:49 muhoo: oddly, i can go smoothly between emacs and vim and rarely if ever screwed up

17:50 been using both for over a decade now though. it's muscle memory.

17:50 akurilin: That's pretty amazing. My biggest pet peeve is hammering CTRL-W outside of vim when I want to delete a word. It works especially poorly when hacking javascript in a browser :(

17:51 muhoo: ouch

17:51 akurilin: For me it's not so much switching between editors, as it is going from a proper editor to the real world, where backspace and del are the only options.

17:52 muhoo: i can't do that. i lasted like a couple hours with intellij before i threw it out the window, screaming.

17:52 akurilin: Don't know how that hasn't caused programmer uprising around the world yet :)

17:53 muhoo: it's habit. things you learn while you're young become second nature, and changing those later is like trying to work with a handicap or serious injury.

17:54 akhudek: I like intellij :-(

17:54 I can never remember the names of the 30+ namespaces and having them in a side bar is nice.

17:54 muhoo: good on ya. if i did, i'd be a lot more successful. i can't take on java/android work because it's painful to do without intellij or eclipse, and it's even more painful for me to do it with it.

17:55 akhudek: eclipse I can't do though, too slow and crashy, tried several times

17:56 muhoo: there are a couple high-level clojure hackers doing work in eclipse and CCW. i guess if you know it already, then it's easier than trying to learn one of the other alternatives. choice is good.

17:57 ok, back to db wrestling for me.

17:57 gfredericks: drop db: KO

18:19 bbloom: apparently my bank's "secure message center" only allows the following non-alphanumeric characters:

18:19 ! @ # $ % & ( ) + " : ? . , \ =

18:19 gfredericks: in the secure messages?

18:20 I kind of want to go work in a bank just out of morbid curiosity

18:20 bbloom: I copy pasted a date in the format "MM/DD/YY" into a message and received a lovely error message suggesting that i try copy pasting my message through notepad to clear out any special characters

18:20 gfredericks: I have no words for that

18:21 bbloom: my message literally said "What is the transaction named XYZ on MM/DD/YY?" and i couldn't figure out why it refused to send it...

18:21 i thought i was going out of my mind

18:22 akhudek: terrifying

19:31 akurilin: So as far as login/session management, are most folks rolling their own these days, or did everybody switch to using Friend?

19:31 Evaluating my options here.

19:32 callen: akurilin: I just use libnoir's encrypted cookies.

19:32 not a fan of friend myself. too much code for too little benefit.

19:36 akurilin: callen, so if I'm understanding correctly by reading some of the function comments in noir.cookies, you can store a bunch of data in the cookie, encrypt it and then have the client hold onto it?

20:00 Interesting, I hadn't thought of using signatures to ensure cookie validity. I thought most people just generated large random strings to pass to the client, to use later to retrieve information about the user.

20:01 As in, keeping no useful data whatsoever in the cookie itself.

20:02 amalloy: akurilin: that's another common approach. i don't have enough experience to know which is most popular

20:04 whilo: i want to access a buffer through http://nodejs.org/docs/v0.4.7/api/all.html#buffer_index_ in clojurescript. ("get" and other clojure protocol-based approaches won't work, because Buffer is a Node primitive)

20:04 any hints/ideas?

20:07 amalloy: (aget x y] => x[y]

20:07 whilo: oh ok, it is not array specific? cool...

20:07 thx, works!

20:08 amalloy: *shrug* it compiles to the javascript code "x[y"], which that page claims is the javascript you need to work with buffers

20:08 i don't know what any of it means, but there's no way that could not-work

20:09 whilo: :-) really cool, now i have a sequence on buffer without copying it

20:29 akurilin: Oh cool, regarding the above, apparently ring comes with both a simple in-memory session store and an encrypted-HMACed cookie store, albeit with a per-server secret key.

20:30 weavejester: akurilin: A common secret key can be specified.

20:30 akurilin: I was about to type "friggin weavejester, thought of everything"

20:30 And there you are.

20:31 amalloy: akurilin: i wrote a mongodb session store too, to persist across server instances without storing stuff on the client

20:31 akurilin: weavejester, what exactly do you mean for common? It's my understanding that now when you create a cookie-store, all its users share the same secret key?

20:32 weavejester: akurilin: The cookie-store will generate a random key if you don't specify one, which is good for one server or for testing in development. But you can create a random key yourself, and give it to all servers in a cluster.

20:33 akurilin: weavejester, Got it. What I was referring to was the ability to have a per-user secret key, which supposedly can be an extra security measure.

20:34 amalloy, Awesome, I'm definitely going to need something like that eventually. Any reason to go with Mongo over say.. Redis? Do you do some kind of caching in there to avoid db hits?

20:35 weavejester: akurilin: Hm, I don't see how it could be...

20:35 amalloy: akurilin: not really. we already had mongo running. and it's not like 4clojure has millions of concurrent users

20:36 akurilin: weavejester, Well, I'm not an expert in this area at all, but could it be something about potentially guessing/getting hold of the secret key and then having all of your users at risk, rather than just one?

20:38 I'm thinking along the lines of rainbow tables with a single salt rather than one per entry, although perhaps I'm misunderstanding how ring does it.

20:38 amalloy: i think his point is, how can you use a separate key per user, if the only way to know who the user *is* is by their session data

20:41 akurilin: Yeah, you might need some kind of additional value stored on the client to map to the per-user key. And yes, now it just got much harder to reason about, and probably 5 times more hackable.

20:41 amalloy: right, if you store the server's secret-key in plaintext on the client's computer, it's not exactly secret from them :P

20:42 akurilin: A key that you'd use on the server side to retrieve the secret key :P

20:42 weavejester: Well, you could have a key per user, but then you'd need a key or password or something to access all those keys.

20:43 So in the end it amounts to the same thing.

20:43 Besides, if you have access to the application's configuration, which would be required to get the session key, you'd have access to databases etc. that are far more interesting.

20:45 akurilin: I'm assuming the recommendation is to generate the secret key with something like SecureRandom beforehand, and keep it pretty large, to avoid any chance of brute-forcing, right?

20:49 weavejester, And yes, that'd be the the worst case scenario for sure.

20:50 totimkopf: holy smokes this channel is huge

20:51 dnolen: totimkopf: must be a good sign ;)

20:52 totimkopf: yep, I saw it mentioned in Land of Lisp and I went to investigate more stuff about it and here I am

20:53 (as well as other lisp dialects like arc)

20:53 clojurebot: lisp is the red pill

20:55 AimHere: It's the red pill or the kool-aid, one of the two

20:59 totimkopf: AimHere, you mean using 100% clojure code opposed to a balance of Java and Clojure might be too much koolaid for some cases?

21:07 dnolen: totimkopf: I don't think he was really saying anything

21:08 totimkopf: oh

21:18 inkybutton: hi, i think i have found a small error in the code example for http://clojure.org/agents

21:19 currently it reads "A chain of n agents is created, then a sequence of m actions are dispatched to the head of the chain and relayed through it."

21:19 but what the code actually does is the other way around: that a chain of m agents is created, with a sequence of n actions

21:38 xeqi: anyone know of a org.clojure/jvm.tools.analyzer tree -> sexp converter?

23:42 tieTYT: when I load up a test file into the repl, it gives me this error: IllegalArgumentException No value supplied for key: true clojure.lang.PersistentHashMap.createWithCheck (PersistentHashMap.java:89)

23:42 how do I debug this? It doesn't give me any other line

23:43 (pst) does not give me line numbers in my source file

23:44 ah it was a mistake in my :require

23:48 gdev: marking this issue closed

23:50 tieTYT: I wish it had a better error message

23:50 moving on, I'm reading the midje tutorial https://github.com/marick/Midje/wiki/A-tutorial-introduction it says to add something to my .lein/profiles.clj file. But that file does not exist. Is this tutorial out of date?

23:53 ToxicFrog: tieTYT: ~/.lein/profiles.clj

23:53 Create it if it doesn't exist.

23:53 tieTYT: ok, thanks

23:54 ToxicFrog: This is the user-wide settings file for lein and includes plugins you want available in all projects, including new project types (which you can't put in a project.clj because they need to be callable before the project is created)

Logging service provided by n01se.net