#clojure logs

2015-03-06

04:09stardivinertest
04:11godd21 line run; 1 failure; 0 successes
04:34TEttingerwow, sleepy in here today. I see two messages in my scrollback
04:34chiffrTEttinger: Friday daze ;)
04:57zoti have a midje test that triggers a parked thread, blocking my tests. is there any way short of restarting repl to manage/handle this case?
05:08noidiyou could do the operation in a future and deref it with a timeout
05:14schmirwhat's the best clojure book for clojure newbies?
05:16mnngfltgschmir, I like this one: http://shop.oreilly.com/product/0636920013754.do
05:18schmirmnngfltg: LOL 'No, Parentheses Actually Won’t Make You Go Blind'
05:23schmirmnngfltg: Thanks. I'll buy that for my new coworker...
05:31mnngfltgschmir, you're welcome
05:31zotnoidi: that's what i ended up doing, copying a macro to handle it. it's not perfect, but for testing, won't be too evil as long as the contents don't spawn tooooo many orphanable threads :)
06:16noncom|2i am working in a repl, but i have to change java code frequently. is there a way to reload a java class?
06:52noncom|2wow, it is so friday here :)
06:57jballancnoncom|2: more likely it's just too early in negative-UTC-offset-world
06:57noncom|2right, could be!
06:57noncom|2it is about 7 am in new york i guess
06:58jballancyup
07:02ordnungswidrighow can I wait for a list of channels to unblock in core.async? (map <!! list-of-channels) ?
07:06hyPiRionPretty sure you want something that's not lazy for that
07:06hyPiRionlike, (dolist [ch list-of-channels] (<!! ch))
07:08ordnungswidrighypririon: ok, now assume I have an error channel where which I will read alternatively. i.e. if there's a val in the error channel then use that, else the list returned.
07:09ordnungswidrigI tried something like (alts!! [err-chann (async/map <!! list-of-chans)])
07:18agarmanhaving an issue with cider & nREPL --> https://www.refheap.com/98150 ... any chance someone has an idea of what I borked?
07:19the_freyI find that when I hit the cider and write clojure it all goes tits up too
07:20agarmanthis is recent issue for me. I was doing Java stuff for a couple months and now back to Clojure and made the mistake of updating emacs-live and my lein profiles.clj
07:34wizzohi. is there a way to get just a section of a byte-array. like just from byte 5 to 10 or whatever
07:39muhukwizzo: you can convert it to a seq, or you can copy those elements to a new array.
07:41wizzomuhuk: it is 12mb i wasn't sure if it was a good idea to make it a seq or not
07:41wizzoi'll probably just not read the whole thing in memory if that's an insane idea
07:44Glenjaminwizzo: possible a combination of (byte-array) and a (for)
07:46wizzoglenjamin: do you have an example of that working? i'm not really getting it from the docs
07:47Glenjamin,(let [b (byte-array (range 100))] (byte-array (for [i (range 10 20)] (aget b i))))
07:47clojurebot#<byte[] [B@418700a3>
07:47Glenjaminsomething along those lines
07:48wizzothank you! i'll have a play around with it
08:09sandbagsanyone know how to shut up the "cljx no longer provides Leiningen hooks; please use :prep-tasks in your project.clj instead" messages every time you run a lein command with cljx installed? Esp. annoying when I do use :prep-tasks
09:14profilHey guys, I am building a tcp server and I want to use PING/PONG messages just like irc. Right now I use a loop inside a future to send ping messages every Nth second. Would it be better to use core.async's go block instead? The future macro will create a new thread which I think may a bit heavy for this case. Any ideas?
09:16sujeetprofil, if you're doing aio, use aio
09:16sujeetyou don't need to thread it
09:16profilsujeet: I am using aleph and just mapping over the stream, how would I fit my ping loop inside that?
09:49ocharles_does anyone know if it's possible to use s/check (prismatic schema) on a record, where the schema was defined with s/defrecord?
09:49ocharles_Right now, I get "not (instance? type)" which is valid, but I only want to valid the underlying map against the same schema
09:49whidden /msg NickServ identify pegasus
10:16matthewwestI'm aiming to be a part of GSOC this year, and I'm especially interested in maybe adapting clojure/tools.reader to be able to run on a JS runtime such as Node.js.
10:16matthewwestI'm looking to understand why it currently doesn't work, but not how to get started.\
10:17matthewwestDoes anyone know if clojure currently uses clojure/tools.reader to read in sourcecode?
10:17Glenjaminmatthewwest: jvm clojure currently doesn't use tools.reader
10:17Glenjaminbut clojurescript does
10:18Glenjaminit doesn't currently run on Node.js because there's a bunch of JVM-specific things in the codebase
10:18matthewwestAlright, that's helpful.
10:18Glenjaminthere's some WIP on tools.reader here: https://github.com/nasser/tools.reader/tree/nodejs
10:18Glenjamini dunno how far along it is
10:18matthewwestIs it an eventual language target to use tools.reader for the JVM?
10:19Glenjamincertainly none of the tests are ported
10:19Glenjaminno idea, i suspect not but Bronsa will know more if he's around
10:20matthewwestAlright, I'll just need to poke around and figure out what's going on.
10:21matthewwestOnce my academic term ends I'll have a bit more time to devote (at least until the next one starts)
10:22BronsaGlenjamin: matthewwest no, no plans to make t.reader the default Clojure reader
10:23matthewwestIs that because since it's a hosted language anyway, there's no purpose in bootstrapping?
10:26Bronsaa number of reasons, since clojure is not self-hosted there's no point in using a slower reader just for the sake of having it written in clojure
10:26Bronsaalso there would be bootstrapping issues
10:30matthewwestThanks
10:40Venhi -- people using the cursive plugin here? It's completly failing to resolve defn, ns, defmacro and the others :). I have a sdk configured
10:43krasException in thread "main" java.lang.UnsupportedClassVersionError: clj_antlr/ParseError : Unsupported major.minor version 51.0
10:43kraswhy do I get this error when I "lein run"?
10:44krassomething to do with the JRE version?
10:55profilsujeet: How do you mean use aio? I can use manifolds periodically, but how do I get it to stop executing when the stream is closed? And how do I create a periodic loop without using either clojure's future or manifold.deferred's future?
11:25octei'm listening to modification events for files with inotify, and when a file is completly written i want to do something. to ensure it's completly written i want to wait a few seconds after the last modify event for each file and then do something
11:25octewhat would be a good way to do that?
11:30muhukocte: Thread/sleep ?
11:30justin_smithocte: sounds like you want a debounce
11:31octejustin_smith, yeah
11:31Glenjaminhttps://gist.github.com/loganlinn/4719107#file-debounce-clj-L12
11:31octeit's pretty easy to do in javascript since it's single threaded
11:31octecool, thanks
11:31Glenjaminthere's an mildly annoying lack of license on that gist
11:32justin_smithdebounce should be in clojure.core, or at least in core.async
11:32justin_smithand I think it can be done without two atoms
11:39timvisheris there anything that's more 'battle tested' than loom as far as nice clojure libraries for dealing with graphs
11:55justin_smithocte: Glenjamin: this one is public domain. Since you always want the last bounce's time when debouncing, it doesn't need atoms. Maybe it should have a locking block for the odd case where two bounces were waiting on the same time stamp? https://www.refheap.com/98153
11:56justin_smithanother difference is that each debounce call can provide its own args, only the args for the last one before the timeout are used
11:57justin_smith*each call to the debounced function
11:57justin_smithneed coffee
11:58octewhy an array?
11:58justin_smithocte: because it is mutable
11:59justin_smithI guess any Box would have worked though
12:00justin_smith*any mutable Box
12:01justin_smithocte: so each attempt puts its timestamp in the box, and only runs the function if after waiting the required time its timestamp is still in the box
12:02justin_smithsince the timestamp is intentionally "last writer wins", it is fine to just let the calls race
12:04octehm, it doesn't seem to work the same
12:05octei'll try to see how
12:05justin_smithocte: mine runs in the thread that calls it
12:05justin_smithso you can choose to put a call in a future, or to just wait for it to complete / cancel in your own thread
12:06justin_smith(that may not be the only difference)
12:07octeyes, that was one thing
12:08vasjustin_smith how do you take your coffee? *carries out tray with spoons and variegated sundries*
12:08octei think that in the first, while the debounced function is running, further calls to it doesnt run it multiple times
12:08octeif you see
12:08justin_smithvas: black
12:08vaswell then *pitches tray out window*
12:09justin_smithocte: nor should mine (unless you mean after the debounce period, mine will run multiple times, but with a debouncing interval enforced)
12:11justin_smitheg. one use of debouncing is to have a debounced message handler or channel, where you want repeated invocation, but constraining the rate with the debounce logic
12:12octewell, i only want one to run for each file so it's better to ignore further invocations while it's actually being processed
12:12octewhich is a property the first implementation seems to have
12:13justin_smithyeah, if you want one-shot logic that could be tacked onto my version, but isn't inherent to it
12:13octehow would i do that? :)
12:16justin_smithocte: simplest version I can think of is to close over a delay with the function - (let [status (delay (f status)) final-status (debounce #(deref status))] ...)
12:16justin_smithin that manner, the delay only does the work the first time, it's cached afterward
12:16justin_smithI missed the wait arg for the debounce there of course
12:33lvhIs there something cool in Clojure for wrapping POJOs that are basically just data containers?
12:34lvhe.g. I have this class with ctor GroupConfiguration(String name, int cooldown, int minEntities, int maxEntities, Map<String,String> metadata); I'd be nice if I could autogenerate something that knew how to turn a map with the appropriate keys into one of those things. Preferably automagically with introspection run once at compile time :-)
12:34justin_smithlvh: for accessing them or creating them? for the latter we just use hashmaps
12:34lvhjustin_smith: I'm interfacing with an existing Java API, I want to use hashmaps on the clj side but I can't; the Java API really wants this POJO
12:40Glenjamin(doc bean)
12:40clojurebot"([x]); Takes a Java object and returns a read-only implementation of the map abstraction based upon its JavaBean properties."
12:41Glenjamini dunno about the reverse though
12:48justin_smithlvh: it would be easy enough with deftype, except for the fact that you can only implement methods that are in an interface, so you would need to define a custom protocol or interface for the type that had the standard get/set methods
12:49justin_smithlvh: it's one of the places where clojure's opinionated nature starts to show
12:51puredangerI wrote a macro that can take a map and call the appropriate setters on a Java object here:
12:51puredangerhttp://stackoverflow.com/questions/27308061/whats-the-idiomatic-way-to-do-this-java-function-in-clojure/27308254#27308254
12:51justin_smithpuredanger: interesting, I think something very much like that is used by a c3p0 wrapper I use
12:52Glenjamin"unbean" would be a fun name for that :)
12:52lvhpuredanger: Thanks for the pointer :-) This POJO does have one thing going for it: it's immutable ;-)
12:52justin_smithGlenjamin: texas-style
12:52lvhso I guess some ctor inspection is in my future
12:52puredangerlvh: well that's good :)
12:52Glenjaminhttps://github.com/arohner/unbean
12:52puredangerthe downside of a positional constructor is of course needing to know the positions
12:52puredangerbut certainly seems like something you could abstract
12:53Glenjamini guess bean isn't quite accurate, as this is contructor in, getters out
12:53lvhpuredanger: right. But I should be able to do all of that introspection at compile time, right?
12:53octejustin_smith, cool, that works! the delay i mean
12:54puredangersure, if you use reflection. and assuming there is some standard mapping from param names to map fields
12:54puredangeractually, do you get param names in reflection?
12:54puredangerI know this was an old problem, not sure of current state
12:54iamjarvois there a way to update an atom asynchronously>
12:54lvhiamjarvo: reset!
12:55puredangerthat's not asynchronous
12:55lvhHuh, it's not?
12:55justin_smith(future (swap! a f))
12:55justin_smithno need to deref the future if you don't care about the return value
12:55puredangerswap! and reset! guarantee that the change is complete when they return
12:55lvhah
12:56puredangeragent send is asynchronous
12:56puredangeror wrapping in future
12:56iamjarvolvh thanks
12:56puredangeralthough the cost of wrapping in future is likely significantly higher than the reset!
12:56lvhiamjarvo: Don't thank me, I gave the wrong answer ;)
12:56iamjarvoha i was just reading about ti
12:56iamjarvoit*
12:56justin_smithyeah, if you want async update, you may want an agent instead of an atom anyway
12:57iamjarvothanks all
13:12lvhpuredanger: So, this class does have a Builder nested class, which probably makes the macroing a lot simpler
13:15bchamHey I have a question about hash-maps and their potential key values. It's very straight forward.
13:15bchamhttp://www.codeshare.io/rg0vn
13:16bchamwhy is it, in that code that lines 14 and 15 print nil?
13:18hiredmankeywords are not numbers
13:19hiredmanyou map has a number as a key, you are looking up the value for a keyword, there is no value, so nil
13:19bchamYou mean that keywords cannot be numbers? Because shouldn't the (str ) wrap make it into a string and thus can be turned into a keyword?
13:20justin_smithbcham: keyword is not the same as key
13:21bchamjustin_smith: There's my issue I need (name )?
13:21bchamit seems
13:21hiredmanno
13:21hiredmanlook, your map doesn't have keyword keys
13:21hiredmana map can have keys that are of any type
13:21hiredmankeys are not always keywords
13:22justin_smith(get {{"apple" "red"} "fruity"} {"apple" "red"})
13:22justin_smith,(get {{"apple" "red"} "fruity"} {"apple" "red"})
13:22bchamGotcha, now I understand. My misunderstanding was that "keyword" was doing what "name" actually does. Because the code " (@hash-links (name "112785")) ; nil"
13:22bchamworks
13:22clojurebot"fruity"
13:22justin_smith,(= (name "112785") "112785")
13:22clojurebottrue
13:23bchamthank you for humoring my learning.
13:23justin_smithbcham: notice in the above silly example with the apple, I use a hash-map as the key in a hash-map
13:24oskarthDoes anyone know of any good alternative to cljs-ajax?
13:24bchamjustin_smith: yeah I see that! Thanks
13:29sritchieoskarth: what’s wrong with cljs-ajax?
13:30oskarthsritchie: tired of all these different places params end up, there's a key called :params on client side, but it can end up in either body, params or query-params depending on various things
13:30sritchieoskarth: that’s not cljs-ajax’s fault -
13:30sritchieoskarth: that’s the middleware stack on the clojure side
13:30oskarthaware, but it complicates things
13:30sritchieeach middleware that intercepts params merges them into its own key, then merges all of them into :params
13:30sritchieoskarth: my pt is you’ll have that problem if you hit your server w/ curl
13:31sritchienothing to do with cljs-ajax
13:31oskarthfor example, ring-edn and query-params (with format edn) using non-edn format
13:32oskarthjust asking for an alternative :) disagree with the diff behaviors for GET/POST etc, don't believe it's necessary
13:40lvhSo, I'm doing (.. (Something/whatever) (aMethod (:some-key some-map))) a bunch of times. Is there a neat way to only call those methods when (:some-key some-map) isn't nil? Example: https://gist.github.com/lvh/bd35d7506bc0f127cbb9
13:41lvhI tried to do it with ->> and when-let but I can't get it to work
13:42cflemingVen: How did you set up your project? With Lein?
13:42Vencfleming: yes
13:42lvhMaybe something like (->> (LaunchConfiguration/builder) (when-let [v (:load-balancers lc)] apply #(.loadBalancers))) ?
13:42Vencfleming: a long time before I set up cursive, though :)
13:43cflemingVen: Are your files under a source root? (blue folder in the project view)?
13:43Vencfleming: src/ isn't a blue dir, an in "project settings" there's "excluded" but no way to mark as source
13:44cflemingVen: Right click the folder and you can mark as source
13:44cflemingVen: But if you set your project up with lein the problem is that your src folder isn't configured in your project.clj
13:44lvhExcept of course (apply #(.someMethod) ..) doesn't really do what you want
13:45Vencfleming: do you have a doc link on how I should configure it in project.clj?
13:45Vencfleming: also I see no link to make it a source folder
13:46cflemingVen: Right click the folder in the project view->Mark directory as->Source folder
13:46Vencfleming: found project.cj config
13:47cflemingVen: Source paths are taken from :source-paths, :resource-paths, :java-source-paths
13:47cflemingVen: Assuming this is Clojure and not CLJS
13:47Vencfleming: alright, much better! it now finds my own defs. but still, any other external defs, even "defn", "ns" and so on so forth are unrecognized
13:48mgaarelvh: is .. what you want? you might be looking for doto
13:48cflemingVen: Do you have a Clojure jar attached to your project?
13:48lvhmgaare: I'm currently using .., but that doesn't let me express the when-let part
13:48lvhmgaare: I don't want to call the method at all when (nil? (:k m))
13:48Vencfleming: if the jar is indeed "clojure-complete", then yes -- but intellij did warn me about not recognizing the jar
13:49mgaarelvh: you could take a look at cond->
13:49cflemingVen: Under External Libraries in the Project view, you should have one saying Leiningen: org.clojure/clojure:<some version>
13:50Vencfleming: ah, I don't
13:50Venthat's definitely it
13:50mgaarein your case it'll be somewhat duplicative
13:50cflemingVen: Do you have clojure as a dep in your project.clj?
13:50Vencfleming: no
13:50Vencfleming: actually! [org.clojure/clojure "1.6.0"]
13:51lvhmgaare: Cool! that is kind of what I want; also my current when-let thing seems to work: (when-let [v (:load-balancers lc)] apply #(.loadBalancers % v))
13:51mgaarelvh: I've occasionally written utility functions that handle this kind of thing too
13:51cflemingVen: That is very strange. Try refreshing your project (open the Leiningen toolwindow, Refresh)
13:52cflemingVen: I have to go, sorry, I'll be around later on probably
13:52Vencfleming: it does say "there are no lein project to display"
13:52lvhyeah, I think this is going to have to be a macro, unless there's a thing that does what the (.method) special form does except where method is given as a string
13:52Venalright, thanks anyhow :)
13:52Venthat'll do it, definitely
13:52cflemingVen: Oh - Right click on project.clj, add as lein project
13:52VenI just did :)
13:52Venthanks!
13:52cflemingNP - good luck!
13:53Vencfleming: amazing :)
14:12sritchieoskarth: for sure -
14:12sritchieoskarth: I was just confused as to why you thought an alternative for cljs-ajax would do anything about your params issue
14:12sritchieoskarth: since the “problem” is on the ring side, nothing to do with cljs-ajax
14:12sritchieoskarth: an alternative is to use jquery: http://api.jquery.com/jquery.ajax/
14:12sritchieoskarth: but it won’t help
14:13oskarthsritchie: I think it's just some edge case with edn as transport, resolved it by reverting to json
14:13oskarththe problem is not on the ring side
14:14sritchieoskarth: the ring-edn middleware adds :edn-params and merges them into :params
14:14oskarthnope :)
14:14oskarthnot in this case
14:14oskarthwas about GET and query-params non-edn format
14:15oskarthanyway, have to go. If I were to run into problems again I think I'll go with just a thin wrapper over xhr, seems like the most transparent abstraction to me
14:16oskartha la https://github.com/swannodette/om-sync/blob/master/src/om_sync/util.cljs#L34 or https://github.com/hackerschool/community/blob/master/client/src/community/util/ajax.cljs
14:29lvhI wrote a macro that tries to call some methods on a POJO, but there's always a space between the dot and the method name e.g. (. x) instead of (.x), which fails because that name doesn't exist
14:29lvhhttps://gist.github.com/lvh/bd35d7506bc0f127cbb9
14:29lvhkw-to-sym is a simple function that turns :some-keyword-name into 'someKeywordName
14:39aperiodiclvh: you can't concatenate symbols in a macro in the way you seem to be trying to with #(.~m ...)
14:40muhuklvh: you need to join them as strings, then convert.
14:40muhuklvh: (str "." m)
14:40Bronsaor just use the . form
14:40aperiodiclvh: you can, however, use the dot special form
14:41aperiodic(. object method)
14:41aperiodicmethod doesn't need to have a dot at the front there
14:41Bronsa(. % ~m ..)
14:41muhukwhich is a better idea IMO
14:41aperiodichttp://clojure.org/java_interop#Java%20Interop-The%20Dot%20special%20form
14:48ARM9what's the data structure behind defrecord
14:48ARM9does it just use something basic like a c struct? or is it a hash map
14:49BronsaARM9: for it stores declared fields in class slots, for extra keys it uses a hashmap
14:52ARM9class slots, is that a java thing
14:52ARM9so it stores the data the way java does for a class?
14:52BronsaARM9: i mean, as regular class fields yes
14:53ARM9alright cool, thanks
14:54jcromartiewhat would cause this type of error?
14:54jcromartiejava.lang.ClassCastException: foo.Bar cannot be cast to foo.Bar, compiling:(foo.clj:28:3)
14:54jcromartiesorry it's anonymized
14:54jcromartiethis is during aot
14:54stuartsierrajcromartie: Protocols and records.
14:54jcromartiewith a defrecord that implements a protocol
14:54jcromartieyes
14:54jcromartieso
14:54jcromartiewhat are we doing wrong?
14:54stuartsierraIt can happen if you reload the a namespace which has already been AOT-compiled.
14:57jcromartiethis happens during lein uberjar
14:57jcromartieliterally
14:57jcromartielein clean && lein uberjar
14:57jcromartie(sorry I'm not trying to be obtuse on purpose)
15:03stuartsierraSomething is getting compiled / loaded twice. Sorry, can't be more specific.
15:11jcromartieis there a way to see what's being compiled and loaded?
15:12jcromartieis (:gen-class) unnecessary?
15:15the_dankomr. cfleming, does cursive offer an "organize imports" functionality for java classes? like eclipse does
15:18stuartsierrajcromartie: `:gen-class` is unlikely to be the issue.
15:22jcromartieI'm trying to create a minimal test case to reproduce
15:22jcromartieit's very strange
15:24stuartsierraSome of the AOT loading issues may have been fixed in Clojure 1.7.
15:28puredangeris Bronsa here?
15:43jcromartiestuartsierra: got it...
15:43jcromartiewe had an app that depended on a lib
15:43jcromartiethe lib called protocol functions at load time
15:43jcromartieas part of a (def ...)
15:44jcromartiethe app that required the lib had :profiles {:uberjar {:main whatever :aot :all}}
15:44jcromartieand the main namespace had (:gen-class)
15:45jcromartiemoving to {:main ^:skip-aot whatever :profiles {:uberjar {:aot :all}} fixed it
15:46stuartsierrawow
15:48amalloyclojurebot: :gen-class is likely to be the issue
15:48clojurebot'Sea, mhuise.
15:48justin_smith~aot
15:48clojurebotaot was so ahead of its time
15:49justin_smithwell, he's not wrong
15:58cflemingthe_danko: Not in Clojure code, unfortunately - lots of people have requested that though, there's an issue in the tracker
16:10the_dankocfleming thanks
16:15ToxicFrogArgh
16:15lvhHow do I do lookahead assertions in regexes? I was hoping (re-matcher #"[a-z]+(?=[A-Z]|$)|[A-Z][a-z]*" "anABCMethod") might work, but, no luck.
16:16ToxicFrogJust wasted an hour debugging an issue caused by the fact that map always returns a list, rather than returning the same type it was passed
16:16amalloylvh: (?=) works in clojure. if it doesn't do what you want, your regex is broken
16:16ToxicFrogSo (map foo [x y z]) is a list rather than a vector and the two behave very differently in maros
16:16ARM9isn't it technically a sequence
16:16ARM9a lazy one at that
16:16SagiCZit is a sequence
16:16SagiCZ,(type (map inc (range 5)))
16:17clojurebotclojure.lang.LazySeq
16:17amalloyit looks like you don't want lookahead at all though, and you're just grouping things wrong
16:17lvhamalloy: Hm. Okay. So maybe my regex is broken. I was expecting that regex to match at the very least "abc", since the first part is 1-or-more lowercase chars, and the second part is zero-or-more Capitalized groups
16:17SagiCZyou can get a vector this way
16:17SagiCZ,(mapv inc (range 5))
16:17clojurebot[1 2 3 4 5]
16:17lvhamalloy: Instead, I'm getting no matches at all.
16:17amalloy#"[a-z]+(?:[A-Z][A-Za-z]*)" looks like more what you meant
16:17amalloyer, #"[a-z]+(?:[A-Z][A-Za-z]*)?"
16:17amalloyforgot the ?
16:18lvhI think that would parse someABCMethod differently
16:19lvh("some" "ABC" "Method") vs ("some" "A" "B" "C" "Method"); if that makes any sense
16:19amalloysure, but so what? you don't have any capturing groups
16:19amalloyi can't tell from your malformed regex what you want to capture in some future version of the regex
16:20amalloyanyway, mine "parses it like", if such a thing can really be usefully said, ("some" "A" "BCMethod")
16:21FrozenlockAny library suggestion to work with SQL? (sqlingvo, korma?)
16:22amalloyclojure.java.jdbc
16:23Frozenlockamalloy: I'll immediately look at it, thanks!
16:24lvhamalloy: Sorry, yes; I am trying to capture them. I'm trying to turn a bunch of Java variable names into Clojure-looking keywords.
16:25amalloythen i would say the most obvious thing wrong with your original regex is that you seem to believe [A-Z][a-z]* is the same as [A-Za-z]*
16:26lvhThat's why I care how it would match; I'm going to (join "-" (map lower-case bits)) afterwards.
16:37SagiCZlvh: have you heard of regexpal.com ? its really easy, like zero learning curve and helps me with my pathetic regex atempts
16:42FrozenlockThere's also re-builder in emacs http://www.masteringemacs.org/article/re-builder-interactive-regexp-builder
16:58AeroNotixDoes :java-source-paths affect how lein finds clojure classes with :gen-class?
16:58AeroNotixI seem to not be able to properly compile things when I have a repo with java
16:58creeseHow do you tell clj-http not to throw exceptions for 40x, 50x, errors?
16:59AeroNotixcreese: use http-kit :L)
16:59creeseis that project more current?
16:59AeroNotixprobably
16:59hiredmanread the readme and do what it says?
17:00creeseit says to use :throw-exceptions false, but that has no effect
17:01creeseI'm inside a go block, I wonder if that's breaks certain assumptions
17:01pipik
17:01hiredmanwell 1. do do io in a go block 2. why do you think it has no effect?
17:01hiredmandon't do
17:01clojurebotPardon?
17:02creesethe io happens in a callback
17:02creeseit has no effect because I always get a traceback even if I try to catch
17:03lurkOnTheWallI'm trying to get fireplace working, and I have the leiningen plugin, but I can't seem to connect to the nREPL server.
17:03lurkOnTheWallI'm getting errno 111 connection refused.
17:03AeroNotixwhen I add :java-source-paths and then use the java package in a :gen-class then try to compile+import the gen-class'd joint, it complains about some classes missed.
17:04AeroNotixmissing*
17:04AeroNotixany ideas?
17:04hiredmancreese: so the clj-http option definitely works, if you think you are setting the option and it is not working, that is because you are failing to set it for some reason
17:05hiredmaneither you are doing io in a go block or you are not, you say "I am inside a go block"
17:05creesedefinately in a go block
17:05creesethe exception comes from the callback
17:05hiredmancreese: and how are you passing the option to clj-http?
17:06lurkOnTheWallhmmm... I may have installed cider-nrepl, but not cider
17:06hiredmanwhat callback?
17:06hiredmanclj-http is synchronous, no callbacks
17:06creeseI know
17:06creeseclj-http is called from a go block
17:07AeroNotixI am inside a cupboard
17:07AeroNotixam I doing io?
17:07hiredmanthen you are doing io in a go block
17:07creesewhat's wrong with that?
17:08hiredmanblocking io blocks, and go blocks all share a threadpool
17:09hiredman(bounded)
17:10creesethe exception is coming from thread "async-dispatch-2", can I assume that means it's within a go block?
17:10hiredmanhow are you trying to catch the exception?
17:11creeseI want clj-http to not throw it at all
17:11creesebut :throw-exceptions false has no effect
17:11hiredmancreese: so how are you tell in to not throw?
17:13hiredmanI know that setting the options works, I don't know how you are trying to set them that it doesn't work, you could be putting the option in the wrong place in the map
17:13creese(client/post url {:body (json/write-str data) :content-type :json :accept :json} {:as :json :throw-exceptions false})
17:14creeseok
17:14hiredmanor since core.async is at play, you could have spun off code running in a go loop or something, that is printing errors, fixed it in in your code, and never stopped the go-loop so you still see errors from the old code running
17:15joegallopretty sure that's supposed to just be one map...
17:15hiredmanyeah
17:16creeseok, that did it
17:16creeseI read the docs wrong
17:16creesecool
17:16joegallono worries, it happens
17:17hiredman(and stop doing io in a go block)
17:20lurkOnTheWallI'm not sure that lein's target/repl-port is being set correctly. How could I check that?
17:23ToxicFrogI think this may be a new, horrible record, at least for me: https://gist.github.com/ToxicFrog/2a24438134717968158d
17:23ToxicFrog117 lines of compiler crash vomit to scroll through to get to the error message.
17:24lurkOnTheWallidk what happened, but it's working now.
17:24AeroNotixwhen I add :java-source-paths and then use the java package in a :gen-class then try to compile+import the gen-class'd joint, it complains about some classes missing.
17:30puredangerToxicFrog: the first line of the message tells you the problem and location doesn't it? there is no reason the tool (lein) has to show you the stack trace here.
17:30ToxicFrogpuredanger: no reason at all! And yet it does.
17:42iamjarvois there a recommended way to use jars with clojure?
17:42iamjarvoarticles im finding are older
17:42puredangerjust put them on the classpath :)
17:43iamjarvohrm i read that gets difficult. any experience with this? https://github.com/kumarshantanu/lein-localrepo
17:43iamjarvoim also new to java so im exploring
17:44puredangerthe easiest way to deal with jars etc is to use Leiningen and let it manage them for you in your local Maven cache
17:44puredangerif you are experimenting, "lein try" is pretty handy https://github.com/rkneufeld/lein-try
17:45iamjarvothanks
17:57iamjarvoturns out this was already available with lein deps org.apache.poi/poi
18:25timothywHey all, quick q.
18:25timothywFor emacs cider (https://github.com/clojure-emacs/cider)
18:25timothywHow can I get ac-cider working ? (https://github.com/clojure-emacs/ac-cider)
18:25timothywThe given instructions don't work (not showing completions on my system)
18:42paxanclojure.core.match question. Is it possible to specify a clause with pattern dynamically? Two examples coming…
18:42paxan(match [{:yo 123}] [{}] :yes :else :no) ; => :yes
18:42paxan(let [p {}] (match [{:yo 123}] [p] :yes :else :no)) ;=> :no
18:43amalloyno
18:43timothyw… Nevermind. I just had to reboot my VM for some reason :)
18:43timothywprobably just a zombie process or something
18:57paxanI've grokked how to use core.match with dynamic clauses…
18:57paxan(eval (let [v {:yo 123} p (read-string "{:yo _}")] `(match [~v] [~p] :yes :else :no))) ;=> :yes
18:57paxan(eval (let [v {:abc 123} p (read-string "{:yo _}")] `(match [~v] [~p] :yes :else :no))) ; => :no
18:58paxanthe above demonstrates a pattern, p, obtained, say, from a command line arg.
18:58martinklepsch,(let [a #{:a :b} b #{:c :a}] (clojure.set/difference (clojure.set/union a b) (clojure.set/intersection #{:a :b} #{:c :a})))
18:58clojurebot#<CompilerException java.lang.ClassNotFoundException: clojure.set, compiling:(NO_SOURCE_PATH:0:0)>
18:59martinklepschis there a more elegant way of doing that?
19:00amalloymartinklepsch: this is computing the symmetric difference, right?
19:01amalloyi'd say it's easier to understand when written as (union (difference a b) (difference b a)), but of course that's the same number of operations
19:06martinklepschamalloy: ah neat, didn't know how do describe it.
19:07martinklepschamalloy: thanks
19:24lvhHm.
19:25lvhI have a nested enum inside some other class. Is Outer$Inner/CONST_NAME not how I access those?
19:25lvhI figured it's a static field, and Outer$Inner is how you do nested classes, right?
19:25amalloyit is
19:25amalloydid you forget to import Outer$Inner?
19:26lvhAh; I didn't import it separately :)
19:26lvhThanks!
19:27amalloyremember, inner classes are a fiction of javac. it's really just an ordinary class with a funny name, and if you want to use it you have to import it (or refer to it fully-qualified), just like any class
19:28lvhRight, makes sense. I guess I was hoping for those imports to be automatically resolved, or something.
19:29lvhBut given how it's all lies anyway, it makes sense :)
19:39vasHow do you switch a handler from "dev" to "production" (so that stack traces just return a 404 instead)?
20:54jcromartiewhat does "lein clean" do if it doesn't clean out target/
20:56TEttingerjcromartie: maybe the output dir isn't target?
20:56jcromartiemaybe
20:57jcromartiethis is a brand-new "lein new app"
21:02TEttingerso what's in target ?
21:04jcromartietarget/uberjar/classes etc.
21:05jcromartieseems like target/uberjar is preserved during "lein clean"
21:11TEttingerjcromartie, is the uberjar running? it might be locked
21:13jcromartiethe effect is that "lein uberjar" doesn't actually compile the code again
21:14jcromartie"rm -r target && lein uberjar" will compile the namespaces again
21:14TEttingerthat's odd
21:14jcromartieyah
21:14jcromartieLeiningen 2.5.0 on Java 1.7.0_75 Java HotSpot(TM) 64-Bit Server VM
21:15TEttingerlein uberjar won't recompile if the sources haven't changed
21:15TEttingerso there's that
21:18jcromartiewell anyway, this is tangential to what I'm trying to do
21:18jcromartieI'm trying to narrow down this issue with AOT and defrecord
21:26creeseWhat's the best way to debug a macro?
21:27jcromartie(macroexpand-1
21:27jcromartie,(macroexpand-1 '(when true :foo))
21:27clojurebot(if true (do :foo))
21:36amalloycreese: also, strive to write macros simple enough that you don't have to debug them
21:54TimMcamalloy: Arbitrarily small pieces of code can require debugging. :-)
21:55amalloyTimMc: did i say small?
21:57TimMcheh
21:57TimMcI think my point still stands.
21:59amalloyof course, "don't write bugs" is not trivially-followable advice, but it's still useful advice. a lot of people who need help writing macros are building this giant thing, most (or all) of which shouldn't be a macro at all
22:01TEttingerthis piece of code could be entertaining to debug http://www.ioccc.org/1984/mullender.c
22:01TEttingervalid C code, for a certain kind of machine
22:02justin_smithwhat a silly way to write machine code
22:02TimMcOh, yes -- I think you have to pass a compiler flag to avoid a warning, though?
22:02amalloyand run a machine older than the stones
22:03amalloyis that the right idiom? it doesn't feel right. older than the ____
22:04amalloythe hills
22:05TEttingerTimMc, it was an entry in 1984, I doubt compilers cared much
22:05justin_smithI think "older than amalloy" is the accepted hyperbole
22:15justin_smithactually, "old as dirt" is the version I always heard in rural Vermont at least
22:15justin_smithor "old as the hills"
22:16amalloyyou're probably right, old as the hills sounds best to me
22:17justin_smiththere's also "older than the stars", which is a book, and has a nice ring to it
22:19TEttingerold as time, old as memory, old as AOL CDs in the mail...
22:20justin_smitholder than the cue cat™
22:21xemdetiais there a better tarball out there right now that has a file index
22:21justin_smith?
22:22xemdetiaWhen you do tar -tf on a 14 GB file it takes a while :)
22:22justin_smithoh, so a replacement for tar with faster file index?
22:22xemdetiawell, with a file index. The reason why it is so slow is that tar does not have a file index since it is designed for tape
22:22justin_smithright
22:23xemdetiaI was writing one for fun a while ago
22:23xemdetiaI forget what happened to that
22:23justin_smithtar = TApe ARchive
22:23TEttingertaar
22:23justin_smithTEttinger: for some reason everyon started spelling it wrong
22:23TEttingerheh
22:35andyfxemdetia: Zip ?
22:36xemdetiaandyf, maybe I will have to check if it does perms like tar
22:36xemdetiaI don't know I am just waiting for like 300 GB to process from a silly command and I dream of something else
22:36andyfCompression only occurs independently between files, I believe, not across files like tar.gz or whatever compression you use
22:38xemdetiayeah it's not the compression as much as just getting a good ol' manifest quick
22:38andyfI 'm surprised wikipedia's comparison of archive formats page doesn't mention that property, nor whether they maintain unix file permissions
22:44TimMcgfredericks: We still haven't figured out a name for the kid! So far I'm leaning towards mysql_escape_baby
22:45justin_smithTimMc: for bonus points, name the next kid mysql_real_escape_baby
22:45justin_smithto encourage healthy sibling rivalry
22:46TimMcOh, that is a much better name, yes!
22:46nuwanda_robert');drop table students :)
22:46gfredericks,(format "baby-%04d" (rand-int 10000))
22:46clojurebot"baby-2226"
22:46TimMc:-D
22:46justin_smithgfredericks: well, you could just make their social security number part of their name
22:46xemdetiaandyf, I agree. I believe rar has an index but that's patent-hard
22:46TimMcjustin_smith: They don't have one ye. Deadlock.
22:47andyfLooks like info-zip should maintain unix permissions, from what I have read, not personal testing
22:47justin_smithTimMc: well, you could get around that with a delay
22:47justin_smithor a promise
22:47gfredericksTimMc: you could also consider some contrived manner of having the baby determine its own name
22:48gfredericksor also you could use "Gary Fredericks"
22:48TimMcI think the state needs a string, not a reference.
22:49TimMcgfredericks: Gurgle Psffwtt McCormack
22:49TimMcthe Hic'th
22:49justin_smithTimMc: I think the future is in ungoogleable names
22:50justin_smiththings like "boobs" or "free ipad" that are totally impossible to google search for
22:50justin_smiththus guaranteeing privacy
22:50TimMcI've thought of that.
22:50justin_smith"mail order viagra, esquire"
22:51TimMcI did some NLP work so I know how to fool some of the algorithms.
22:51gfredericksalso "Barack Obama"
22:51TimMcFnu The
22:52TimMcA name-placeholder + a stopword.
22:52justin_smithfoo
22:53justin_smiththat one has a built in scheme for naming all the kids
22:53justin_smithfoo, bar, baz, quux
23:00TEttingercould just name him Lil' Satan
23:00gfredericksor node.js
23:01TEttingeroh!
23:01TEttingerunicode snowman
23:01gfredericksnot even the unicode character just the two words "Unicode Snowman"
23:01TEttinger"please sign your name in cursive." "...uh... ☃"
23:02TimMcU+2028 LINE SEPARATOR
23:02TEttingerhahaha
23:02TEttingerU+FEFF BOM
23:05gfredericksU+20FG
23:05justin_smith"unbreakable space" would be a pretty kickass name
23:06TEttinger,\u20fg
23:06clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Invalid digit: g>
23:06TEttingeragh
23:06TEttinger,\u20ff
23:06clojurebot\⃿
23:06TEttingerheh
23:06andyfBase 17 is hard
23:07gfrederickssecurity by obscurity
23:07TEttinger,17r20fg
23:07clojurebot10097
23:07TEttinger,(Integer/toString 10097 16)
23:07clojurebot"2771"
23:07TEttingeralternatively
23:07TEttinger,(char 10097)
23:07clojurebot\❱
23:07TEttingerhuh
23:07TEttingerthat's nice
23:08gfrederickshow on earth do they track unnamed kids at the hospital
23:08TEttingerthen again, you don't know if it's base 17 or up to base 36, or even base64
23:08TEttinger"wiggly one"
23:08gfredericksI guess they can't rely on just names in general anyhow
23:10TEttinger"one of the 15 with the parents who say no vaccines, it doesn't matter, they'll be headed to the morgue in a few years anyway"
23:10justin_smithspeaking of babies and systems, the craziest thing was that idea in the US of making one number that is simultaneously a unique identifier and also an authentication secret
23:10TEttingerheh
23:10justin_smithlike, did they spend more than an hour or two thinking about the consequences of that?
23:12gfrederickswas it designed to be an auth secret?
23:12justin_smithgfredericks: yeah, that may have just been a thing that ended up happening
23:12TEttingerkinda like Sony's authentication scheme for PS3 releases. scheme singular, they used the same phrase to authenticate any software for PS3, so the moment it was cracked anyone could bypass the hardware hypervisor
23:12justin_smithhaha
23:12justin_smithTEttinger: you'd think with security practices like that they'd get hacked eventually or something
23:13TEttingerlol
23:13TEttingerthis was long before the sony pictures hack, but it seems like security was not exactly on the mind of anyone at sony
23:13clojurebotGabh mo leithscéal?
23:27TimMcgfredericks: Well, she's currently registered at the pediatrician's office as "Baby Girl Thorn" :-/
23:28TimMcgfredericks: http://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/ #40
23:29justin_smithoh, there's a unicode character for "thorn" Þ
23:29TimMcyup
23:29justin_smithPeople’s names fit within a certain defined amount of space.
23:29justin_smithhaha
23:30amalloymy name is infinite, because it includes by reference all experiences i have had up to the current instant in my life, including a recitation of my name
23:31metellusgood thing you thought up that handy nickname
23:33justin_smithhttp://i.imgur.com/lJrFq.jpg
23:59vasjustin_smith: what if i require a floating point quantity of ladies?