#clojure logs

2013-05-05

00:01muhooany advice as to how to make clojure jdbc postgres accept an #inst ?
00:02muhoo"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."
00:02muhoowat
00:02RaynesNot using an #inst works.
00:03Raynesmuhoo: http://docs.oracle.com/javase/6/docs/api/java/sql/Date.html
00:03muhooRaynes: thx
00:03Raynesmuhoo: Give it (java.sql.Date. (.getTime your-date))
00:05muhooheh, it returns an inst :-P
00:05muhoo,(java.sql.Date. (.getTime (java.util.Date.)))
00:05clojurebot#inst "2013-05-05T04:01:21.862-00:00"
00:06muhoo(type (java.sql.Date. (.getTime (java.util.Date.))))
00:06arrdem,#inst
00:06clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
00:06muhoo,(type (java.sql.Date. (.getTime (java.util.Date.))))
00:06clojurebotjava.sql.Date
00:06muhoook ok, it prints as an #inst
00:12tomojhuh, I never saw java.sql.Date
00:12tomojI thought it was supposed to be ""normalized""?
00:12muhooaand, postgres is dropping the time from it :-(
00:13muhoo2013-05-04 00:00:00-07
00:13tomoj..right
00:13muhooscrew it, i'm going to have to write my own date/time functions it seems
00:15muhooi'm really regretting using sql for this now. starting to understand why people like nosql db's for clojure so much.
00:17tomojI don't like apples. I understand why people like non-apples so much
00:19muhootomoj: incidental complexity
00:26cljerhello guys, I'm trying to install vimclojure in mac, but it doesnt work
00:27cljerI'm not even doing the nailgun server, all I'm installing is extracting the vimclojure in my ~/.vim directory
00:27cljerand setting the 2 lines in .vimrc
00:28cljerbut it doesn't work. did anyone solve htis problem?
00:29RaynesDon't bother with vim-clojure.
00:29RaynesSee https://github.com/guns/vim-clojure-static and https://github.com/tpope/vim-fireplace instead.
00:29cljerRaynes: oh let me check
00:31muhoo,(-> (SimpleDateFormat. "yyyy-MM-dd HH:mm:ss Z") (.format (java.util.Date.)))
00:31clojurebot#<CompilerException java.lang.IllegalArgumentException: Unable to resolve classname: SimpleDateFormat, compiling:(NO_SOURCE_PATH:0:0)>
00:31muhoook, well, whatev, that works.
00:32cljerawesome Raynes. It worked!!!
00:32cljerthanks a lot
00:32axle_512(inc Raynes)
00:32lazybot⇒ 29
00:32RaynesIf I convert those into thousands of dollars I'd have tons of money.
00:32axle_512hahaha
00:33RaynesCreated on this date: Lazybot Virtual Currency.
00:33s4muellazycoin
00:33axle_512better than bitcoins
00:33axle_512nice, s4muel, I like it
00:36uvtcWhat's the ratio of lazycoins to Schrute Bucks?
00:37s4muelDont know. variant, depending on the beets futures market
00:37axle_512same as ratio of unicorns to leprechauns.
00:37uvtcding ding ding! :)
00:39axle_512Does unicode work here in irc? λ
00:39axle_512seems it does.
00:40s4muelaxle_512: that's client-dependent
00:40s4muelcmon now.
00:40s4muel(also, it does.)
00:40axle_512ok
00:50Tuna-Fishaxle_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
00:53axle_512Thanks, Tuna-fish… so most of IRC now supports UTF-8, but not necessarily all the client applications?
01:00muhoofor the record, the winning solution appears to have been (clj-time.coerce/to-timestamp (java.util.Date.))
01:11cljerhi all, I started a nrepl. how do I load that from fireplace, and actually use it inside vim?
01:13callencljer: sudo apt-get install emacs
01:14tos9...
01:14callencljer: more seriously, :Connect
01:14tos9cljer: It should just work.
01:14callen(but you should use emacs)
01:15tos9cljer: (i.e., if you typed lein repl and then started up vim, you shouldn't need to type Connect).
01:15cljerhaha. thats a steep learning curve
01:17cljertos9, I don't understand hwo I don't have to type Connect if i have a repl started
01:17tos9cljer: 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.
01:20tomojhow do credential fns fit into oauth2
01:21tomojfriend-oauth2 seems to ignore them afaict?
01:24cljerthanks callen & tos9.. i hve clojurevim-static for now. will explore fireplace some other day
02:02muhoowow 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
02:02muhoosome kind of urlencoding/bencoding glitch
02:18akurilinHey 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?
02:20muhooakurilin: i like the environs package
02:20muhoohttps://github.com/weavejester/environ
02:22tomojthere's also https://github.com/sonian/carica
02:25akurilinmuhoo, 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?
02:28tomojhow the fuck is clojure-mode+slime completing ::friend/w to ::friend/workflow
02:29tomojoh
02:29tomojcoincidence :)
02:32mthvedtcan namespaces made with create-ns be garbage collected
02:32amalloy,(doc remove-ns)
02:32clojurebot"([sym]); Removes the namespace named by the symbol. Use with caution. Cannot be used to remove the clojure namespace."
02:33mthvedti mean without manual intervention
02:34mthvedtvisualvm seems to think not.
02:35amalloyof course not
02:35amalloythey're reachable by anyone who wants to use things in the namespace
02:35noidiwhat are you trying to do? creating loads of namespaces at runtime is a strange thing to do.
02:36mthvedtwell, suppose you're writing something that generates code
02:36mthvedtthat refers to other generated code
02:36mthvedton the fly
02:36tomojwhoa
02:36tomojI've wanted that many times
02:36tomojI always just kill the jvm
02:37amalloytomoj: remove-ns?
02:37tomojyeah
02:37amalloymthvedt: if you do that, the robots will take over
02:38mthvedti'm experimenting with implementing a paper on recursive ascent parsing
02:38tomojplease make the robots take over
02:39mthvedtyou can do that kind of stuff with class loaders but i really don't want to use class loaders
03:00noidiwhat's the meaning of the `once` metadata in the macroexpansion of `future`? `(future-call (^{:once true} fn* [] ~@body)))
03:02murtaza52how 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
03:02murtaza52repeatedly doest work, bcoz the return value is not used for the next fn call
03:04noidi,(reduce #(%2 %1) 0 (repeat 3 inc))
03:04clojurebot3
03:04noidihere's one way
03:04noidiah, lazy seq. that means reductions.
03:04noidi,(reductions #(%2 %1) 0 (repeat 3 inc))
03:04clojurebot(0 1 2 3)
03:05murtaza52nope there is a fn in clojure.core which I cant recall
03:05noidiiterate?
03:05murtaza52I am basically trying to have a counter, which is being passed to a map fn
03:06murtaza52yes iterate !! thanks
03:12amalloynoidi: ^:once means that you promise to only call the function once
03:13amalloythat promise lets the compiler avoid holding onto memory that it would otherwise keep in the function's closure during execution
03:17noidiamalloy, thanks
03:26mthvedtanswer 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
03:28noidigenerating so many namespaces that memory use becomes a problem sounds like they're not meant to be used by a human
03:28noidiand if that's the case, why do you even need namespaces?
03:30noidijust leave everything anonymous and hang on to function references, or stick everything in a single ns and generate names with gensym :)
03:31mthvedtthe point is eval'd code can only refer to things in *ns*
03:35mthvedtand it would be inconvenient if making the eval'd code i want led to things that can never be garbage collected
03:35mthvedtat least not in the normal fashion
03:36mthvedt*just watched visualvm gc a million namespaces*
04:23_{^_^}_the repl in Factor makes me jealous
04:23_{^_^}_imagine if the clojure repl looked like that
04:25taliosanyone know if theres any clojure support for Sonar being worked on (http://www.sonarsource.org)?
04:28terom_{^_^}_: there is some kind of visual repl in http://keminglabs.com/c2/ although haven't tried that
05:16akurilinHow 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?
05:17akurilinMy specific really basic scenario is: use the project settings to define the default DB all calls will go to.
05:21tomojdidn't you already ask that?
05:21tomojand get two answers?
05:24akurilintomoj, This is slightly different. The suggestions were great, I do have separate environment configurations now.
05:24akurilintomoj, Now I'm trying to find the best point in time in the app's lifecycle to actually apply them. Just once, at boot.
05:27tomojI guess it depends on the situation
05:28tomojfor e.g. datomic what I do is wrap a middleware that assocs a conn into the request from a delay
05:29tomoj(defn wrap-conn [app] (let [conn (delay (d/connect (env :datomic-uri)))] (fn [req] (app (assoc req :my.ns/conn @conn)))))
05:29tomoj... (def app (-> ... wrap-conn))
05:30akurilinI'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.
05:30tomojbleh
05:30akurilinGuess that makes it less functional.
05:31tomojif you're using korma you're sorta out of the realm of my recommendations :)
05:32akurilinHah, how so?
05:33tomojwell, I've never used it
05:33akurilinOh I see, I thought you meant it had a bad rap around these parts.
05:44tomojI don't think so. you correctly inferred my opinions at least, but since I've never used it I won't give them
05:48tomojthough I will say that the default db thing at least is nuts IMO. lots of korma seems pretty nice though
05:49tomojit's not boilerplate if it's a near-minimally explicit and local representation of the relevant facts
05:49tomojof course those representations tend to be more verbose than is fashionable..
05:49tomojs/minimally/minimal/
05:50akurilinfair enough. I'll switch to the more explicit call, makes things easier to reason about for me as well.
05:50tomojI suppose the idea is that you only defdb once?
05:50tomojthe docs for create-db are baffling
05:50tomoj"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"
05:50tomojbut since you _can_ use it the obvious way, korma is win
05:50akurilinYeah you defdb once and internally it just remembers the last time you did it.
05:50tomojI guess almost all libraries out there force you to do the confusing shit
05:50akurilinCan make things a bit messy if you accidentally go too defdb happy with different configurations
05:51tomojor the use case in the create-db docs, creating connections dynamically instead of with defdb
05:51akurilinI'm mostly happy for the syntax. For someone starting out, it's much friendlier than jdbc
05:51tomojnow 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
05:52lalilunaHope you are having a sunny Sunday as well.
05:52tomojakurilin: yeah, looks very pleasant
05:52tomojand that select* etc exist is excellent
06:52luxbockI'm trying to simulate poker hands using Clojure
06:53luxbockperformance 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?
06:53luxbockor does it even make a difference?
06:56RaynesI'd do both and see how fast you can get the non-atom version before deciding on one or the other.
06:56RaynesYou definitely want to try to not have to use a stateful solution unless it is slow enough to be a real problem.
06:56RaynesWhich seems pretty unlikely.
06:58tomojwhy do you need to create a new deck?
06:58luxbockperformance 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
06:59luxbockso that's a lot of simulation
06:59tomoj(subvec deck 1) ?
06:59luxbocktomoj: well I was looking at someone elses code and they used an atom for the deck
07:00luxbockwhere every function that deals a card modifies the deck-atom
07:00tomojwhy?
07:00clojurebotwhy is startup slow is busy compiling the `for` macroexpansion
07:00Raynestomoj: You're asking weird questions.
07:01RaynesI imagine he doesn't know why since he was looking at someone else's code and is asking the question himself.
07:01tomojoh, of course
07:01tomojit doesn't make any sense to me that you would need to use an atom for performance
07:02luxbockI'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
07:03luxbockbut for it to be usable, it has to be really fast as the simulations that will be of use to me are very complicated
07:03Pupnik-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
07:03tomojdon't use an atom
07:04tomojyou would still have to do whatever data structure op you'd do in the atom-less version inside the swap
07:04tomojit could only be slower
07:04tomojthough, it is 4am so maybe I am missing something
07:05luxbockalright cool, that's what I wanted to hear
07:05RaynesAgreed. 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.
07:05Pupnik-something handling such small data is probably going to be really fast no matter how you do it
07:06tomojI just realized that the library I am writing — a one-function library — implements deck dealing
07:37shadow_princecan I use leiningen functions from leiningen repl?
07:51necronia-join #debian
10:25bbloomlynaghk: 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:25bbloomalso lynaghk & tomoj: yes, angular is damn good.
10:31gdevjava update available, time to reevaluate whether I want the ask toolbar or not
10:35gdevlol 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:35bbloomre: 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:36bblooms/i think/i know, but they may also do the SSA/state-machine thing else where/
10:55gdevlein spec -a doesn't seem to work in windows unless I'm doing something wrong (besides using my windows laptop)
11:00gdevapparently it reruns the tests when you make changes to the test files but not the source files...how is that helpful?
11:29technomancyRaynes: I have worked on code that used a raw AtomicReference
11:30technomancythough 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:30technomancyAtomicInteger isn't too yuky though
11:36technomancygdev: figuring out which source changes correspond to which tests is really hard to do well
11:36gdevtechnomancy:) well the documentation should make such bold promises =D
11:37gdev*shouldn't
11:37gdevi'm looking at the clojure koans code to see how they do it
12:11muhoowow this looks pretty awesome https://github.com/MichaelDrogalis/dire
12:12muhoousing it to print the actual query string that caused the postgres sql exception
12:12muhoowithout having to create a wrapper function with try/catch
12:14tomoj(= __ (count (range start end step)))
12:14muhooit's a pretty huge hairball though, pulls in midje as a transitive dependency :-/
12:14tomoj(max 0 (int (Math/ceil (/ (- end start) step)))) ?
12:16muhoois it considered more polite to have test-related dependencies as a :dev profile dependency?
12:17noidiyes
12:29muhoonoidi: thanks, done.
12:37noidimuhoo, it's not just about politeness, the test dependencies are useless without the tests, which are not packaged into the distributed jar :)
12:38muhooeven better, thanks
13:39tomojcore-async <3 https://www.refheap.com/paste/3d6ecfea054a85abf5be25d37
13:49tomojit looks like if you define your own 'serious' types it should be very easy to wire up the state machine
13:49tomojjust provide a matching task-wrapper
13:52tomojdoes it require binding conveyance?
13:52tomojI note core-futures does not appear to do any conveyance
13:53tomojwell looks like it wants get-thread-bindings at least
13:53tomoj(core
13:53tomoj(core-async)
14:16tomojbut it's passing around the bindings in the state monad
14:17tomojget-thread-bindings should be easier to implement than bound-fn in cljs, right?
14:24hiredmantomoj: 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:27hiredman"why not release it as a library so people can use it with a released version of clojure?"
14:31tomojyeah, 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:31tomojjust to try it
14:31hiredman:/
14:32tomojnot that it bothered me much, because this is so interesting
14:32hiredmanthey passed for me
14:32tomojmaybe I just didn't wait long enough
14:33noidiwhat's core-async?
14:33tomojI forgot, I have my cpu clamped low
14:33hiredmanthere is https://github.com/clojure/clojure/blob/master/test/clojure/test_clojure/generators.clj#L78-80 though
14:33tomojnoidi: http://github.com/relevance/clojure/compare/master...core-futures
14:33noidithe name's pretty much ungoogleable
14:33hiredmannot very confidence inspiring
14:34mpenetthere is some info there: http://dev.clojure.org/display/design/Async+blocks
14:34mpenet(very little)
14:36tomoj"Added by Rich Hickey"
14:36tomojhttp://dev.clojure.org/pages/viewpage.action?pageId=7700515
14:36tomojrich's version
14:38tomojhttps://github.com/relevance/clojure-async-blocks
14:38tomojguess that was abandoned?
14:41noidioh 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:43arcatan8)
14:55tomojnoidi: comonad coalgebras?
14:57Okasutomoj: Zygohistomorphic prepromorphisms.
14:58tomojsardine : whale :: tomoj : Okasu
14:59tomojso traversables are just functors shapely over lists (??), and we can sub lists for reducers, so maybe we need functors shapely over reducers?
15:00tomojI assume subbing foldl for foldr isn't a serious problem
15:00tomojer. substitute reducers for lists and foldl for foldr?
15:08tomojthe seq-wrapper in clojure-async-blocks looks interesting
15:10tomojhttps://www.refheap.com/paste/12630ba724fececac8be724f0
16:07learnerax
16:07axle_512hey
16:08learneraxle_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:08axle_512learner: great! Glad to hear it worked.
16:12axle_512Is there a good way to unit test a private function (defn-
16:13axle_512would it work to put the tests in the same namespace as the code I want to test, or is this bad form?
16:14Okasuleathekd: Awesome! :)
16:15OkasuI have to try it too at some point.
16:15axle_512okasu: 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:19muhoois there some extension to clojure/java that will show me the actual arguments of a call when an exeption is thrown?
16:20technomancymuhoo: ritz is the easiest way to do that
16:20muhoothanks. been meaning to check that out. i guess it's time to thrash and break my emacs setup by installing ritz
16:21axle_512found 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:21technomancymuhoo: hard to mess it up if you keep ~/.emacs.d in git =)
16:21technomancyat least hard to mess it up permanently
16:21muhooi've been using package-list-packages
16:22technomancyit should be safe to just rm -rf packages out of ~/.emacs.d/elpa if you are done with them
16:43gfredericksso 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:43gfrederickswhy on earth would that happen?
16:53gfredericksI wonder if n00bs would have an easier time learning as-> before -> and ->>
16:56mthvedtthe clojure docs suggest you shouldn't change *ns*
16:56bbloomgfredericks: 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:56mthvedtso is (binding [*ns* whatever] (eval …)) considered evil?
16:57gfredericks,(doc *ns*)
16:57clojurebot"; A clojure.lang.Namespace object representing the current namespace."
16:57amalloybbloom: the fact that -> implicitly adds parens around non-lists goes a long way towards confusing newcomers
16:57gfredericksamalloy: syntactic duck-wrapping!
16:57mthvedtgfredericks: it's somewhere in the clojure namespace docs, not clojuredocs
16:57mthvedtthe clojure page about namespaces
16:58bbloomamalloy: an example in the doc string would go a very long way
16:58gfredericksmthvedt: I think binding *ns* is totally reasonable if you're doing eval. I.e., it is no more evil than eval is.
16:58gfredericksmaybe what you read referred to (set! *ns* ...)
16:59bbloomamalloy: assuming, of course, we can also teach noobs to fearlessly eval (doc foo)
16:59bbloom:-)
16:59mthvedtgfredericks: good, what i'm doing is evil enough as it is
16:59amalloygfredericks: you can't really set! *ns* at runtime anyway, since it's only bound when compiling
17:02gfredericks,*ns*
17:02clojurebot#<Namespace sandbox>
17:03amalloygfredericks: eval counts as compiling too :P
17:03gfredericks,@*ns*
17:03clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Namespace cannot be cast to java.util.concurrent.Future>
17:03gfredericks,@#'*ns*
17:03clojurebot#<Namespace sandbox>
17:03gfrederickshow can I observe this "not-compiling" state?
17:04amalloygfredericks: write a program whose -main does (set! *ns* ...)
17:04amalloyalso, 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:06gfredericksthat makes more senses
17:21rlbI'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:24akurilinDoes Paredit have a command for removing the current expression, bubbling up whatever's inside?
17:31gfrederickssplicing?
17:31gfredericksparedit-splice-sexp
17:31arkxM-s
17:32bbloomor for my fellow vim-ers who don't like paraedit, there is tpope's surround: ds(
17:39muhoooh 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:39muhoofor -> doseq fixed it.
17:39muhoolaziness strikes again!
17:40gfredericks(defmacro for->doseq [expr] (assert (= 'for (first expr))) (cons `doseq (rest expr)))
17:41akurilingfredericks, what I tried was basically delete whatever is in the outer expression and then splice the inner one in.
17:41gfredericksI 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:41akurilingfredericks, (a (b)), delete a, then splice. Seems to have worked.
17:41amalloyakurilin: you want M-r
17:42akurilinamalloy, I'm on vim-paredit, trying to find a corresponding trick :)
17:42amalloy(a |(b)), M-r => (b)
17:42gfredericksman I need to figure out how to use these M-foo combos :(
17:42akurilinamalloy, Is there a name for that command? "Replace" of some sort?
17:43amalloyraise
17:43gfredericksragamuffins
17:45muhoogfredericks: i think the tattooing-on-forehead thing will help me remember it before 4 years are up
17:46muhooi'm only about 17 months in so far.
17:46akurilinamalloy, ok great, found one, thanks! It's neat, it works on both symbols, or entire subforms, so you get to be pretty flexible.
17:47akurilinmuhoo, I'm on my 2nd day with paredit, what's it like up there 17 months later? :)
17:48muhoooh, i haven't dealt with paredit yet. if i did, everything would grind to a screching halt
17:48akurilinIt 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:48akurilinBuilds character.
17:49muhooi already got enough character for a full broadway show
17:49akurilinI hear ya.
17:49muhoooddly, i can go smoothly between emacs and vim and rarely if ever screwed up
17:50muhoobeen using both for over a decade now though. it's muscle memory.
17:50akurilinThat'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:51muhooouch
17:51akurilinFor 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:52muhooi can't do that. i lasted like a couple hours with intellij before i threw it out the window, screaming.
17:52akurilinDon't know how that hasn't caused programmer uprising around the world yet :)
17:53muhooit'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:54akhudekI like intellij :-(
17:54akhudekI can never remember the names of the 30+ namespaces and having them in a side bar is nice.
17:54muhoogood 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:55akhudekeclipse I can't do though, too slow and crashy, tried several times
17:56muhoothere 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:57muhoook, back to db wrestling for me.
17:57gfredericksdrop db: KO
18:19bbloomapparently my bank's "secure message center" only allows the following non-alphanumeric characters:
18:19bbloom! @ # $ % & ( ) + " : ? . , \ =
18:19gfredericksin the secure messages?
18:20gfredericksI kind of want to go work in a bank just out of morbid curiosity
18:20bbloomI 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:20gfredericksI have no words for that
18:21bbloommy 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:21bbloomi thought i was going out of my mind
18:22akhudekterrifying
19:31akurilinSo as far as login/session management, are most folks rolling their own these days, or did everybody switch to using Friend?
19:31akurilinEvaluating my options here.
19:32callenakurilin: I just use libnoir's encrypted cookies.
19:32callennot a fan of friend myself. too much code for too little benefit.
19:36akurilincallen, 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:00akurilinInteresting, 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:01akurilinAs in, keeping no useful data whatsoever in the cookie itself.
20:02amalloyakurilin: that's another common approach. i don't have enough experience to know which is most popular
20:04whiloi 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:04whiloany hints/ideas?
20:07amalloy(aget x y] => x[y]
20:07whilooh ok, it is not array specific? cool...
20:07whilothx, works!
20:08amalloy*shrug* it compiles to the javascript code "x[y"], which that page claims is the javascript you need to work with buffers
20:08amalloyi don't know what any of it means, but there's no way that could not-work
20:09whilo:-) really cool, now i have a sequence on buffer without copying it
20:29akurilinOh 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:30weavejesterakurilin: A common secret key can be specified.
20:30akurilinI was about to type "friggin weavejester, thought of everything"
20:30akurilinAnd there you are.
20:31amalloyakurilin: i wrote a mongodb session store too, to persist across server instances without storing stuff on the client
20:31akurilinweavejester, 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:32weavejesterakurilin: 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:33akurilinweavejester, 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:34akurilinamalloy, 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:35weavejesterakurilin: Hm, I don't see how it could be...
20:35amalloyakurilin: not really. we already had mongo running. and it's not like 4clojure has millions of concurrent users
20:36akurilinweavejester, 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:38akurilinI'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:38amalloyi 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:41akurilinYeah, 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:41amalloyright, if you store the server's secret-key in plaintext on the client's computer, it's not exactly secret from them :P
20:42akurilinA key that you'd use on the server side to retrieve the secret key :P
20:42weavejesterWell, you could have a key per user, but then you'd need a key or password or something to access all those keys.
20:43weavejesterSo in the end it amounts to the same thing.
20:43weavejesterBesides, 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:45akurilinI'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:49akurilinweavejester, And yes, that'd be the the worst case scenario for sure.
20:50totimkopfholy smokes this channel is huge
20:51dnolentotimkopf: must be a good sign ;)
20:52totimkopfyep, I saw it mentioned in Land of Lisp and I went to investigate more stuff about it and here I am
20:53totimkopf(as well as other lisp dialects like arc)
20:53clojurebotlisp is the red pill
20:55AimHereIt's the red pill or the kool-aid, one of the two
20:59totimkopfAimHere, you mean using 100% clojure code opposed to a balance of Java and Clojure might be too much koolaid for some cases?
21:07dnolentotimkopf: I don't think he was really saying anything
21:08totimkopfoh
21:18inkybuttonhi, i think i have found a small error in the code example for http://clojure.org/agents
21:19inkybuttoncurrently 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:19inkybuttonbut 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:38xeqianyone know of a org.clojure/jvm.tools.analyzer tree -> sexp converter?
23:42tieTYTwhen 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:42tieTYThow do I debug this? It doesn't give me any other line
23:43tieTYT(pst) does not give me line numbers in my source file
23:44tieTYTah it was a mistake in my :require
23:48gdevmarking this issue closed
23:50tieTYTI wish it had a better error message
23:50tieTYTmoving 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:53ToxicFrogtieTYT: ~/.lein/profiles.clj
23:53ToxicFrogCreate it if it doesn't exist.
23:53tieTYTok, thanks
23:54ToxicFrogThis 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)