2015-03-13
| 00:15 | ccurrie | hey folks, leiningen question. I'm new to clojure. I'd like :java-source-paths to have a computed value based on :target-path, but I can't figure out the right syntax. I can't even get simple things to work. :java-source-paths ["src/java"] works fine, but :java-source-paths [(str "src/java")] is breaking trying to call :as-file on PersistentList, which makes me thing I'm missing something fundamental. |
| 02:54 | lxsameer | hey guys, I'm looking for a clojure ebook to read. Do you have any book suggestion ? |
| 02:55 | arrdem | _Clojure Programming_ by Chas Emerick et all is good. |
| 02:55 | arrdem | _The Joy of Clojure_ by Michael Fogus is also good but less introductory iirc |
| 02:56 | lxsameer | thanks guys |
| 03:04 | nsjph | i refer to cloj programming a bit more than joy of |
| 03:05 | nsjph | im also a fan of the pragprog editing style |
| 03:30 | appleflap | hi! when i try (require 'om.core) in the new cljs repl, i get the error: Cannot find module '/Users/sander/Code/cljs/hello_world/.cljs_node_repl/goog/react.inc.js' -- is there anything i can do to make cljs look a directory level higher for the file? |
| 03:31 | appleflap | (react.inc.js is put there by cljs.closure/build) |
| 03:33 | appleflap | when i copy react.inc.js to goog/, i get a "React is not defined" error in om/dom.js |
| 03:37 | irctc4 | hi, is there way to initialize global variables at start of the program so that all namespaces sees them? Like your program was a function and you wrote (let [vars (initialize)] (program-executes-in-vars-scope)) |
| 03:38 | appleflap | irctc4: are you looking for https://clojuredocs.org/clojure.core/binding ? |
| 03:38 | clojurebot | Cool story bro. |
| 03:39 | gko__ | What do you think of Luminus vs bunch of libs (lein app) for a simple Web server (input form -> output data from database server (no input to database))? Luminus seems overkill, but bunch of libs require lots of DIY (?) for things such as edit file.clj -> file.clj is reloaded automatically, etc...? |
| 03:40 | wink | i didn't look at it for a months, but overkill? |
| 03:40 | wink | it's a bit of nice duct tape that holds a few libs together :) |
| 03:41 | wink | (not to downplay quality, but it's not like rails or something) |
| 03:41 | gko__ | or are there other alternatives "mid-way" between these two options? |
| 03:42 | michaelr` | hey |
| 03:43 | michaelr` | can anyone share a light color scheme for cursive? |
| 03:44 | irctc4 | appleflap: I think no. The story is folowing: I've separeted functionality in several namespaces and have global params for them that are stored in conf file. I tried first to read it at start from main and pass it, but the usega is very nested and they are passing over and over throug function parameters. |
| 03:50 | arrdem | irctc4: can you refheap your code? |
| 04:17 | figoe | There's a Java class defined like this public class Foobar <A extends SomeInteface> { ... } How do I construct it? |
| 04:18 | figoe | In Java, it's constructed as: Foobar<B> obj = new Foobar<B>(); |
| 04:18 | figoe | How do I do that in clojure? |
| 04:19 | arrdem | So the type parameter <t> is an illusion of javac. It doesn't actually exist at the bytecode level (implemented via erasure). As a result, Clojure doesn't know anything about type parameters. |
| 04:19 | figoe | Right.. but how do I initiate the object in clojure then? |
| 04:20 | figoe | (Foobar.) |
| 04:20 | figoe | (Foobar.)? |
| 04:20 | arrdem | (let [x (Foobar.)] ...) |
| 04:20 | figoe | No need for B? |
| 04:20 | arrdem | Nope. |
| 04:21 | Empperi | ah... java and it's type erasure... |
| 04:21 | Empperi | how I hate that in java |
| 04:21 | figoe | Hmm, okay... let me try that... I'm not good at Java, better at clj actually ;) |
| 04:21 | figoe | But gotta working with some java libraries |
| 04:21 | arrdem | Clojure: how much java did you really need anyway? :P |
| 04:21 | figoe | Only when we interface with some interesting java library :) |
| 05:49 | sveri | Hi, I included prismatic/schma into my project and now get this error: #<CompilerException java.lang.RuntimeException: No such var: sm/protocol, compiling:(plumbing/fnk/schema.clj:22:13) anyone knows what is going on? |
| 06:13 | wizzo | hi. if i use take-last on a vector is it still going to run as fast as subvec or will it get turned to a sequence in the background? |
| 06:14 | justin_smith | $source take-last |
| 06:14 | lazybot | take-last is http://is.gd/ciXuD9 |
| 06:14 | justin_smith | wizzo: yeah, that definitely won't use subvec |
| 06:14 | wizzo | ahhh ok thanks |
| 06:15 | wizzo | yeah :( |
| 06:15 | wizzo | oh well not a big deal |
| 07:16 | SirRobin | when writing macros in cljs: how do I refer to a macro from another namespace? |
| 07:16 | ssideris | sveri: I don't have a solution but I had the same problem yesterday |
| 07:16 | ro_st | you have to write your macros in .clj files |
| 07:17 | SirRobin | cljs.core.async/go gives me: WARNING: Use of undeclared Var cljs.core.async/go at line ... |
| 07:17 | ro_st | and (:require-macros [your.clj-macros-ns :as macros]) |
| 07:17 | SirRobin | ro_st: yes, but in the .clj file, how do I refer to the go macro? |
| 07:18 | ro_st | (ns foo (:require-macros [cljs.core.async.macros :refer [go]]) |
| 07:18 | ro_st | ) |
| 07:19 | ro_st | that'd be from a .cljs file |
| 07:19 | ro_st | if you wrote your own macro with (defmacro …), that'd have to be in a .clj file |
| 07:19 | SirRobin | yes |
| 07:19 | SirRobin | I have my own macro in a clj, and in that macro I want to use "go" |
| 07:20 | ro_st | oh that's much easier |
| 07:20 | SirRobin | for async functions, in that macro I use "cljs.core.async/chan", but that doesn't work for macros |
| 07:21 | ro_st | have you tried plain old (:require [cljs.core.async.macros :refer [go]])? |
| 07:23 | dnolen | SirRobin: CLJS macros in core.async don't live in the same logical ns |
| 07:23 | SirRobin | ro_st: yeah, of course that worked :) writing macros fries my brain, thanks |
| 07:24 | ro_st | you're not alone SirRobin |
| 07:24 | dnolen | You want cljs.core.async.macros/go not cljs.core.async/go |
| 07:24 | SirRobin | aaaah |
| 07:24 | dnolen | it's a bit confusing as most libraries now have adopted the pattern that macro ns and the runtime ns have the same name |
| 07:24 | dnolen | would be a breaking change for core.async but probably one for the better |
| 07:24 | ro_st | good thing it's still in alpha -grin- |
| 07:25 | dnolen | heh yeah |
| 07:25 | SirRobin | dnolen: I should have noticed that, that's what we use in :require-macros |
| 07:25 | ro_st | people would complain, but it's not like they weren't forewarned |
| 07:51 | CookedGryphon | Hey, I'm using clj-http-lite with 1.7-alpha5 |
| 07:52 | CookedGryphon | and it's complaining about the update function being unbound |
| 07:52 | CookedGryphon | I wouldn't have expected that, I would have expected it to pick *one* of the two implementations |
| 07:53 | stuartsierra | CookedGryphon: Probably a version dependency conflict. |
| 07:55 | CookedGryphon | don't think so |
| 07:56 | CookedGryphon | I think it needs update adding to :refer-clojure :exclude, but unbound var is definitely not what I'd expect |
| 07:56 | CookedGryphon | I'm aot compiling as well, which might make some difference |
| 07:57 | justin_smith | CookedGryphon: here's what I imagine - you have the newer clj-http-lite that got rid of the newly conflicting "update" function, so other code that wants to use clj-http-lite hits an error when it wants to call the update function (which no longer exists) |
| 07:58 | stuartsierra | https://i.imgflip.com/h9gtq.jpg |
| 07:58 | justin_smith | heh |
| 07:58 | Bronsa | there was a bug wrt aot and shadowing core vars, should be fixed in the next alpha |
| 07:59 | CookedGryphon | ah, thanks |
| 07:59 | CookedGryphon | justin_smith: I am using the latest clj-http-lite |
| 07:59 | CookedGryphon | and it still has the update function |
| 07:59 | justin_smith | oh, OK |
| 07:59 | CookedGryphon | I think I'm just hitting the bug Bronsa mentioned |
| 08:00 | justin_smith | I know one of the libs has updated to remove update already |
| 08:00 | justin_smith | maybe the regular clj-http |
| 08:00 | Bronsa | CookedGryphon: yeah http://dev.clojure.org/jira/browse/CLJ-1604 |
| 08:00 | CookedGryphon | any ideas for workarounds where I don't have to pull in my own version of clj-http-lite, while I wait for the next alpha? |
| 08:00 | Bronsa | pre alpha5 it used to throw a NPE, alpha5 works in some cases and in others leaves the var unbound |
| 08:00 | Bronsa | alpha6 will have it fixed for good |
| 08:01 | puredanger | hoping to have the next alpha soon |
| 08:02 | CookedGryphon | thanks guys, most helpful |
| 08:39 | sveri | ssideris: I opened an issue for it: https://github.com/Prismatic/schema/issues/194 if you want you can add your stuff to it, maybe it helps finding the root cause |
| 08:39 | ssideris | sveri: great, thanks |
| 08:50 | mpenet | dnolen: do you know if someone is working on implementing the cljs part of promise-chan, offer! etc on c.c.async? |
| 08:51 | dnolen | mpenet: I was going to do it eventually but if you want to take it on go for it! |
| 08:51 | dnolen | seriously want promise-chan for CLJS |
| 08:52 | mpenet | no feel free to do it, I was just wondering if/when. I need the jvm version like yesterday and I know it's waiting for the cljs part for a release. |
| 08:52 | clojurebot | Pardon? |
| 08:53 | mpenet | I didn't touch cljs in a long time, I guess I'd probably waste tons of time on doing that compared to you |
| 09:00 | dnolen | mpenet: not sure when I'll get to it, lots of more fundamental cljs things for me to work through these days |
| 09:02 | mpenet | alright, thanks for the info |
| 10:13 | borkdude | I guess not, but is it possible to undo only a region in emacs? |
| 10:14 | schmir | borkdude: yes |
| 10:14 | herrwolfe | borkdude: http://www.emacswiki.org/emacs/SelectiveUndo |
| 10:14 | borkdude | nice! |
| 10:17 | eraserhd | I has a question: I'd like to break out the JNI pieces of Avi into a separate dependency, but is there a way to distribute a jar with native extensions? |
| 10:17 | eraserhd | It doesn't seem like I could upload it to maven... what do people do? |
| 10:25 | crack_user | hello guys |
| 10:25 | enrico_ | \l |
| 10:26 | crack_user | some one have a good resource to introduction in functional programing? |
| 10:27 | alcazoid | crack_user: clojure for brave? |
| 10:29 | crack_user | alcazoid: i will check that |
| 10:30 | vipaca | I'm having trouble refactor a function that takes as option a map with meta-data in it. I keep getting the generic Don't know how to create ISeq from: clojure.lang.Symbol. This gist should illuminate some of the details https://gist.github.com/anonymous/a96e87b9cfe663e45373 |
| 10:31 | justin_smith | vipaca metadata in it, or on it? |
| 10:31 | vipaca | Its probably something stupid. |
| 10:31 | vipaca | on it??? |
| 10:31 | lazybot | vipaca: How could that be wrong? |
| 10:32 | justin_smith | ,^{:message "message1"} Exception |
| 10:32 | clojurebot | java.lang.Exception |
| 10:32 | justin_smith | ,(meta ^{:message "message1"} Exception) |
| 10:32 | clojurebot | nil |
| 10:33 | justin_smith | how would you get the metadata out again? it doesn't seem like that's actually working |
| 10:33 | Ibm-irc | -73- Someone here can help me with Unity 3d ? |
| 10:34 | justin_smith | ,(meta ^{:message "message1"} {}) |
| 10:34 | clojurebot | {:message "message1"} |
| 10:34 | justin_smith | vipaca: where is "ok" defined? |
| 10:35 | vipaca | ring.util.http-response |
| 10:37 | vipaca | justin_smith this is working but the responses are common and I would like to DRY this code up. So being able to pass the structure around would be ideal. |
| 10:37 | vipaca | but I can't figureout if it can be done outside of the macro makes use of it |
| 10:37 | vipaca | I assume that's defapi |
| 10:38 | justin_smith | vipaca: yeah, that GET* macro clearly does not like error-responses |
| 10:38 | justin_smith | it's treating it as a symbol, it isn't resolving it to the var |
| 10:38 | vipaca | is there a way not to loose meta info |
| 10:38 | justin_smith | vipaca: use a type that supports metadata |
| 10:38 | vipaca | it seems like I should be able to quote the meta data |
| 10:38 | justin_smith | vipaca: most java classes do not support clojure metadata |
| 10:39 | vipaca | justin_smith I'm way over my head here can you break down what you mean by use a type that supports metadata in this use case? |
| 10:39 | justin_smith | ,(meta ^{:message "message1"} {}) |
| 10:39 | clojurebot | {:message "message1"} |
| 10:39 | justin_smith | that had metadata |
| 10:40 | justin_smith | ,(meta ^{:message "message1"} Exception) |
| 10:40 | clojurebot | nil |
| 10:40 | justin_smith | that had no metadata |
| 10:40 | justin_smith | clojure datatypes support metadata, most java classes do not |
| 10:41 | hyPiRion | The java class clojure.lang.PersistentVector does! |
| 10:41 | vipaca | ok I gotcha now its Exceptions fault then. |
| 10:41 | justin_smith | hyPiRion: most :) of course all the clojure datatypes are java classes |
| 10:41 | hyPiRion | tehee |
| 10:42 | vipaca | wow that is so helpful I didn't realize the meta was being packed in the Exception object. |
| 10:42 | vipaca | I thought it was being used by macro directly in the hash structure, which did seem wierd because there would be three element tuples. |
| 10:42 | justin_smith | vipaca: what did you expect that metadata to do? |
| 10:43 | vipaca | The one question I have is why does the meta argument not need parathesis? Seems like for the first time this would have made it more clear. |
| 10:43 | justin_smith | ^ is a reader macro |
| 10:43 | justin_smith | it attaches the next form, to the form after it |
| 10:44 | vipaca | geez two macro's! |
| 10:44 | vipaca | Thank you justin_smith I really appreciate your help |
| 10:44 | justin_smith | vipaca: so, this is the code that actually implements GET* https://github.com/metosin/compojure-api/blob/master/src/compojure/api/meta.clj#L205 |
| 10:44 | vipaca | I'll pop back on later and let the channel know if I got it clean up or not. |
| 10:45 | justin_smith | vipaca: the answer to your question of why the literal map works and the symbol does not is hiding somewhere in the function definition |
| 10:46 | vipaca | I definatley looked at the signature for that function during investigating this issue, but again I think I'm over my head at this point to get through that function. Thanks again I have to run. |
| 10:50 | oskarth | Trying to debug a channel issue using Om. I have a go loop in IWillMount that reads from an event (chan), and a (put! event...) in another view component. The channel works the first time, and if I switch view, but not if I stay in the same view. If I use a sliding-buffer the put! returns true, but if I just use a regular chan it doesn't return anything, so |
| 10:50 | oskarth | it seems as if the problem is in taking things from the channel. Does anyone have any idea what could be wrong? |
| 10:50 | Deraen | vipaca: Metadata is restructured during macroexpansion and compojure-api doesn't know how to handle the symbol error-responses |
| 11:16 | tbaldrid_ | oskarth: I'd need to see the code |
| 11:17 | oskarth | tbaldrid_: https://github.com/oskarth/unfolds/blob/master/src/cljs/unfolds/core.cljs#L252 and ~L200 for event loop |
| 11:19 | tbaldridge | oskarth: I think we need more info about "the channel works the first time", perhaps add some logging to the onClick and also the event loop and that might help? |
| 11:19 | tbaldridge | for example, are we sure onClick is sending to the correct channel? Or that onClick is being called more than once? |
| 11:19 | oskarth | tbaldridge: I mean that it sends through whatever it's supposed to |
| 11:20 | oskarth | tbaldridge: onclick is being called more than once (sliding-buffer => true after 2nd click) |
| 11:21 | mmitchell | attempting to get lein-ring to reload code on file saves - i get a java.lang.StackOverflowError (ns_tracker.dependency) when making subsequent requests. Anyone seen that before? |
| 11:21 | oskarth | tbaldridge: how can I know for certain it's sending to the correct channel? might be something weird happening there, but don't know how to debug it |
| 11:22 | justin_smith | mmitchell: any chance you introduced a circular namespace dependency? |
| 11:22 | mmitchell | justin_smith: hmm i don't _think_ so. Haven't ever seen any warnings or anything |
| 11:23 | oskarth | tbaldridge: it seems as if re-mounting the main app-view component is what makes it work again, so it could be that the chan is just the right one the first time around but not the second time, for some reason |
| 11:24 | justin_smith | mmitchell: it wouldn't be a warning on a fresh start, it would be an error. But if the namespaces were already loaded before the circularity was introduced, it might not hit that error (require does nothing if the namespace is already loaded, unless you use the :reload key) |
| 11:24 | tbaldridge | oskarth: yeah this seems like a problem with how you're using Om, I don't really see a problem with the core.async code. |
| 11:25 | mmitchell | justin_smith: oh i see, sounds tricky to debug hmm |
| 11:25 | oskarth | tbaldridge: ok, thanks. I'm trying some things with init-state now, hopefully it works. Do you have any good resources for how to debug channels in general? Having a hard time inspecting them |
| 11:26 | justin_smith | mmitchell: for example, this introduces a circular dependency, but it doesn't trigger the error because the namespace is already loaded https://www.refheap.com/98412 |
| 11:26 | tbaldridge | oskarth: most of the time I just log the puts/takes form a channel. And go from there. The best way to debug something like this is to log how data flows through it, |
| 11:26 | tbaldridge | at least that's my view on it |
| 11:27 | mmitchell | justin_smith: i see yep. I'll have a look at each of my ns's, hope that's it! |
| 11:27 | justin_smith | mmitchell: it's not tricky to debug. Restart the app completely, and the compiler will tell you which (if any) namespaces have cyclical deps |
| 11:28 | oskarth | tbaldridge: and what if you can put something but then not take it? Any hope left? |
| 11:28 | oskarth | like some kind of meta data on the channel, or something |
| 11:28 | mmitchell | oh sorry, that's what i originally thought would happen but as a warning instead of error. OK then no circular deps! |
| 11:29 | justin_smith | cool |
| 11:29 | mmitchell | ring middleware.reload/wrap-reload causes the same behavior |
| 11:30 | tbaldridge | oskarth: that's often where more data is needed. "Cannot take" what does that mean, did it try to call take! did it call take on the right channel? Is something else taking from the channel?. All this can be done with logging, or even with a logging macro that can be disabled in production |
| 11:30 | justin_smith | mmitchell: hmm, I don't know what other than a dependency cycle would make those things stack overflow |
| 11:30 | oskarth | tbaldridge: I mean that there's a go loop block that normally takes from that channel, but then it doesn't |
| 11:31 | oskarth | tbaldridge: probably some problem with how I use Om though, will look into it more, thanks again :) |
| 11:31 | tbaldridge | oskarth: right, and I'm saying that doesn't provide enough information. The question is if it ever tried? Did something else cause it to block, did you miss a recur somewhere and so it's no longer looping, etc. |
| 11:31 | mmitchell | justin_smith: ok gtk. I'll try simplifying/cutting-out some of the app code and try again. I must be doing something weird here |
| 11:55 | mmitchell | justin_smith: oh i think it might be because my app is built on the Component lib. So even though the code has changed and its reloaded, the "System" is not reloaded. Reviewing this now - https://github.com/stuartsierra/component#reloading |
| 11:56 | mmitchell | I should say: the "System" is not _restarted_ -- that hmm why the stack overflow |
| 11:57 | stuartsierra | mmitchell: 'component' is not compatible with the wrap-reload middleware |
| 11:57 | mmitchell | stuartsierra: thanks for the confirmation, that actually makes sense now that i think about it |
| 11:58 | stuartsierra | wrap-reload just naively require's all the namespaces, relies on Var dynamism to work |
| 11:59 | mmitchell | right, no concept of Lifecycle. Trying out your user.clj stuff now. |
| 12:01 | mmitchell | Although, one thing I was hoping I could do (to make it easier for other devs) is to reload code and restart the System when files do change. Maybe I'd need to hook into tools.namsepace to do something special there? |
| 12:02 | oskarth | tbaldridge: fyi I fixed it by passing init-state into other comps, and having the event-chan def be before the go block. https://github.com/oskarth/unfolds/commit/887d9bb93355b03b8d2774818f8086db3182d47b Not sure exactly what did it, might minimize and see if dnolen can find out what went wrong |
| 12:34 | dnolen | oskarth: don't have any time to look at it but you have to be very careful w/ core.async and the React life-cycle |
| 12:34 | dnolen | oskarth: at some point need to go back and rip out core.async from all the Om tutorials |
| 12:34 | oskarth | dnolen: ok, would you like a minimized version or is it irrelevant? |
| 12:35 | gfredericks | is it weird to want to get the result from a call to send and therefore using a promise? |
| 12:35 | dnolen | oskarth: don't want a minimized version, I would only look at it if you can actually the problem yourself |
| 12:35 | dnolen | sorry too bandwidth constrained these days for stuff like this |
| 12:35 | gfredericks | (defn send-and-return [ag f & args] (let [p (promise)] (send ag ...) @p)) |
| 12:35 | dnolen | s/actually/actually find |
| 12:35 | oskarth | dnolen: np understand, issue is rsolved now too |
| 12:36 | oskarth | might have a look at it and send PR to documentation |
| 12:36 | oskarth | if I can figure it out ;) |
| 12:36 | dnolen | oskarth: that would be sweet, thanks |
| 12:37 | KevinCorcoran | gfredericks: ha, just did the same thing. in my case, it was an indication that we were attempting to force something to be sync that really didn't need to be. using a watch is a much better option, if possible. |
| 12:37 | mmitchell | stuartsierra: ok i have your user.clj (dev) code setup with my componentized app. I see my System restarting, but the code I changed (and file saved) is not getting picked up. Anything obvious I should look for? |
| 12:37 | kap | hello clojurists! I have a question, i have my dependency set in lein, it should be enough for importing some lib require right? |
| 12:38 | gfredericks | KevinCorcoran: I'm using the agent for locking mostly I think |
| 12:38 | gfredericks | kap: you have to require in whatever namespace you're using it from |
| 12:38 | KevinCorcoran | if that's really all you want, maybe just use clojre.core/locking? |
| 12:38 | KevinCorcoran | i know it's kind of a red-headed step child, but ... |
| 12:39 | kap | yes, but lein compile does not see it, it is precisely clojure.tools.cli/parse-opts |
| 12:39 | kap | Caused by: java.lang.IllegalAccessError: parse-opts does not exist |
| 12:40 | gfredericks | kap; how are you requiring it? |
| 12:40 | gfredericks | and using |
| 12:41 | kap | the error is on line 1, so it is the require... |
| 12:41 | kap | (:require [clojure.tools.cli :refer [parse-opts]] [clojure.string :as string]) |
| 12:41 | kap | in a ns |
| 12:41 | hiredman | you are likely pulling in an old version or something |
| 12:42 | kap | mmm...i "lein deps" and in my .m2 I have 0.3.1 |
| 12:42 | kap | but probably yours is the right explanation |
| 12:43 | hiredman | look at `lein deps :tree` |
| 12:44 | kap | hiredman you are right |
| 12:44 | kap | but my defproject says something different Oo |
| 12:46 | kap | do i miss some task, some deps :clear-cached |
| 12:46 | kap | ? |
| 12:47 | hiredman | what makes you say I am right? |
| 12:47 | justin_smith | kap: that's not how the m2 cach works |
| 12:48 | justin_smith | kap: every version you ever use for any project will be in the cache (unless you clear it), what is used by your project is defined by the dependencies and exclusions you declare |
| 12:48 | hiredman | just because you see an older version of tools.cli in the output of `lein deps :tree` that doesn't mean it is the one lein is using, different libraries can depend on different versions and they will all be shown in the output of `lein deps :tree` |
| 12:48 | kap | because lein deps :tree returned 2.* for clojure.tools.cli |
| 12:48 | kap | ok |
| 12:48 | hiredman | was there only one entry for clojure.tools.cli? |
| 12:48 | kap | yes |
| 12:49 | hiredman | did you save your project.clj file after editing? |
| 12:49 | kap | now it says 0.3.1 for clojure.tools.cli, but still does not compile |
| 12:49 | kap | [org.clojure/tools.cli "0.3.1" |
| 12:50 | kap | no i had not saved (sorry) |
| 12:50 | kap | but the problem is still there... |
| 12:50 | hiredman | have you restarted your repl since you saved your project.clj? |
| 12:51 | kap | java.lang.IllegalAccessError: parse-opts does not exist, compiling:(solver.clj:1:1) |
| 12:51 | kap | i am comiling with lein compile |
| 12:51 | gfredericks | `lein clean` first maybe? |
| 12:52 | kap | oh great thanks! |
| 12:52 | kap | now it compiles :) |
| 12:52 | gfredericks | phew |
| 12:52 | kap | sorry guys, lein newbie here |
| 12:52 | kap | :D |
| 12:53 | kap | we all started from scratch right :D |
| 12:54 | delaney | quick quesiton about the data structures. say i have a map and assoc on :a and cycle between setting to 1 & 2... does the background structure literally just use the old one (guessing via hashcodes) or does it create new parts of the tries with the diff? |
| 12:55 | delaney | basically if i having X -> Y -> Z -> X... is the last X not only == to the first X, but is it in jvm terms the exact same memory address |
| 12:55 | gfredericks | you can check with identical? |
| 12:56 | gfredericks | ,(def data {:a 1}) |
| 12:56 | clojurebot | #'sandbox/data |
| 12:56 | gfredericks | ,(-> data (assoc :a 2) (assoc :a 1) (identical? data)) |
| 12:56 | clojurebot | false |
| 12:56 | gfredericks | ,(-> data (assoc :a 1) (identical? data)) |
| 12:56 | clojurebot | true |
| 12:57 | Bronsa | uh |
| 12:57 | Bronsa | ,(class data) |
| 12:57 | clojurebot | clojure.lang.PersistentArrayMap |
| 12:57 | Bronsa | ,(def data (hash-map :a 1)) |
| 12:57 | clojurebot | #'sandbox/data |
| 12:57 | Bronsa | ,(-> data (assoc :a 1) (identical? data)) |
| 12:57 | clojurebot | true |
| 12:57 | Bronsa | nice |
| 12:58 | justin_smith | ,(-> data (assoc :a 2) (assoc :a 1) (identical? data)) |
| 12:58 | clojurebot | false |
| 12:59 | gfredericks | I should hope that one never works |
| 12:59 | justin_smith | oh, gfredericks already did that one |
| 12:59 | justin_smith | yup yup |
| 13:02 | l1x | justin_smith: thans again for the help yesterday, i havent had much time, what is a vararg method? |
| 13:02 | delaney | so no its not using the same memory |
| 13:02 | delaney | i guess my question, is why not? |
| 13:02 | delaney | i mean there is a hashcode that will never change to map to a memory address |
| 13:03 | l1x | that library still does not function in clojure and I still dont understand why, the previous version just worked fine |
| 13:03 | dnolen | https://github.com/clojure/clojurescript/wiki/Reporting-Issues |
| 13:03 | l1x | at least the connector creation is working |
| 13:03 | gfredericks | delaney: that's a lot of overhead though |
| 13:04 | justin_smith | l1x: a vararg method is a method that takes any number of args when called from java. In clojure that just means the last arg is an array. |
| 13:04 | justin_smith | as in java array, not vector |
| 13:04 | l1x | thank you! |
| 13:05 | or9ob | Hello folks, question on cycling through two collections at the same time: http://stackoverflow.com/q/29037732/117750 |
| 13:05 | l1x | so i i would like to implement it in clojure i would reduce the params into an array and this is how i call the java method |
| 13:05 | or9ob | Please answer here if you don't like SO and I'll collate it. Or answer on SO and get those brownie points |
| 13:05 | delaney | gfredericks: well i was thinking about realtime game state, a lot of thing are changing but there is also a lot of return to old state (like with inputs). |
| 13:05 | gfredericks | or9ob: use (cycle ["A" "B"]) |
| 13:06 | gfredericks | delaney: this is something you can opt into *if you know you really need it* |
| 13:06 | delaney | oh? |
| 13:06 | gfredericks | the jvm is pretty good at GC so I wouldn't bother unless you've measured differences |
| 13:06 | gfredericks | delaney: by "opt in" I mean you can do it by hand |
| 13:06 | delaney | right |
| 13:06 | or9ob | @ gfredericks inside the for? That doesn't seem to work |
| 13:06 | gfredericks | the jvm has some kind of soft reference or something |
| 13:06 | justin_smith | l1x: for example String/format http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#format(java.util.Locale,%20java.lang.String,%20java.lang.Object...) |
| 13:07 | delaney | good point, always end up doing entity pooling etc, guess this is just a simplier version of that |
| 13:07 | or9ob | Please see the SO link |
| 13:07 | gfredericks | or9ob: (map vector things (cycle ["A" "B"])) gives you tuples |
| 13:07 | justin_smith | l1x: you might notice how the last arg is Object... |
| 13:07 | or9ob | What about the other collection? |
| 13:07 | l1x | yes |
| 13:07 | gfredericks | ,(take 10 (map vector (range (cycle ["A" "B"])))) |
| 13:07 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to java.lang.Number> |
| 13:07 | gfredericks | ,(take 10 (map vector (range) (cycle ["A" "B"]))) |
| 13:07 | clojurebot | ([0 "A"] [1 "B"] [2 "A"] [3 "B"] [4 "A"] ...) |
| 13:07 | l1x | the ... means it support more of those |
| 13:07 | gfredericks | or9ob: ^ like so |
| 13:07 | justin_smith | l1x: that means in java it could be called with any number of object args |
| 13:08 | justin_smith | ,(String/format "%s, %s, %s" (into-array Object [:a "b" 'c])) |
| 13:08 | clojurebot | ":a, b, c" |
| 13:08 | justin_smith | so in clojure we create an array of the apropriate type, and make that the last arg |
| 13:08 | l1x | justin_smith: i was wondering what should i do in clojure? just have a mandatory array param? have a list that i turn into array? |
| 13:08 | justin_smith | l1x: in order to wrap a varargs java method? |
| 13:09 | l1x | yes |
| 13:09 | l1x | exactly |
| 13:09 | or9ob | gfredericks: so I'll have to take the result of that, and then doseq over it to put it into channels? |
| 13:09 | bacon1989 | he wants (apply ...) |
| 13:09 | bacon1989 | i think |
| 13:09 | l1x | i used to have this ([one] do something) ([one two] (do something) ([one two & more] (do something else)) |
| 13:09 | gfredericks | or9ob: yep |
| 13:09 | justin_smith | l1x: I would do (defn format [fmt & args] (String/format fmt (into-array Object args)) |
| 13:10 | justin_smith | if you are wrapping something that is varargs on the jvm level |
| 13:10 | l1x | yes |
| 13:10 | justin_smith | replace Object with the apropriate class, of course |
| 13:10 | l1x | yep |
| 13:10 | justin_smith | Object being the type that String/format wants in this case |
| 13:10 | l1x | alright i might do this one |
| 13:10 | or9ob | cool, thanks, gfredericks. I was wondering if there was a way to do that with doseq directly. |
| 13:10 | gfredericks | nope |
| 13:17 | mmitchell | weird. i can get the reloaded workflow to reload an initial code change, but only the first time. After that, nothing reloads, even though the namespaces are being reloaded (see it in the logs) and the system restarts. hmmph. |
| 13:18 | justin_smith | mmitchell: it seems like component and autoreload just wouldn't play nice with each other |
| 13:18 | mmitchell | ah yes. I stopped using the reload (lein-ring and middleware) and am only using the reloaded workflow now |
| 13:19 | mmitchell | this little snippet - https://github.com/stuartsierra/component#reloading |
| 13:21 | justin_smith | so after manually reloading changed namespaces, you reset? |
| 13:23 | mmitchell | justin_smith: i'm just changing a ns file, saving it. Then calling reset |
| 13:30 | mmitchell | strange, so if i change a function, evaluate it in emacs, then restart my System, it works. But the ns reload thing doesn't seem to be doing anything. I might misunderstanding something |
| 13:31 | justin_smith | mmitchell: you need both for the ns to be reloaded, and for the components to be restarted |
| 13:31 | justin_smith | either of those alone won't do much |
| 13:33 | mmitchell | justin_smith: when you say i need both, you mean reload the ns + restart the System? |
| 13:33 | justin_smith | yes |
| 13:33 | mmitchell | that's what I'm doing hmm |
| 13:34 | justin_smith | how do you reload the ns? |
| 13:34 | mmitchell | clojure.tools.namespace.repl/refresh |
| 13:34 | mmitchell | and also trying clojure.tools.namespace.repl/reload-all |
| 13:35 | mmitchell | and i can actually see that clojure.tools.namespace.repl is reloading changed files through its logging |
| 13:35 | javjarfer | hi there! Anyone knows how to use the function "set-screen-wrapper!" from play-clj to avoid the repl break when a exception is thrown? |
| 13:41 | stuartsierra | mmitchell: sorry, got busy, will be leaving soon |
| 13:41 | mmitchell | stuartsierra: np! continuing my adventures here :) |
| 13:50 | mmitchell | i wonder if it's because I'm using the repl that lein-ring spawns? |
| 13:51 | justin_smith | mmitchell: as long as the repl and the server are in the same clojure process, it should work |
| 13:51 | justin_smith | you could start the server from the repl, or start a repl from the server |
| 13:52 | mmitchell | true yeah |
| 14:15 | mmitchell | so i can see now that my repl session properly reloads code, and a System restart also does what's expected. The problem is that lein-ring (the jetty server) is not picking up the same changes. |
| 14:16 | justin_smith | instead of passing handler to lein-ring, pass #'handler |
| 14:16 | justin_smith | that way it does a fresh lookup on each request |
| 14:17 | justin_smith | (or whatever you name your handler / app arg, of course) |
| 14:17 | weavejes_ | justin_smith: I believe Lein-Ring already does that, and a var wouldn't work in the project.clj file anyway. |
| 14:17 | justin_smith | ahh, OK |
| 14:17 | justin_smith | then I don't know why he's not seeing a reload |
| 14:19 | l1x | https://www.irccloud.com/pastebin/rmxELREf |
| 14:19 | l1x | justin_smith: what do you think about this ^ |
| 14:20 | justin_smith | l1x: you should provide the type for the array |
| 14:20 | justin_smith | (into-array String topics) iirc |
| 14:20 | l1x | ohh |
| 14:20 | l1x | yes you are right |
| 14:21 | justin_smith | it won't match the method def if the type is wrong |
| 14:21 | justin_smith | I mean if the first arg is a string, it will be automatic |
| 14:21 | justin_smith | but might as well be explicit when you can |
| 14:22 | l1x | well, i want to be explicit |
| 14:22 | l1x | i guess |
| 14:22 | l1x | is there an easy way to list all of the elements in the java array? |
| 14:23 | justin_smith | (into [] a) |
| 14:23 | justin_smith | ,(into [] (.getBytes "hello")) |
| 14:23 | clojurebot | [104 101 108 108 111] |
| 14:26 | l1x | great you can also map .toString on each iteam |
| 14:26 | justin_smith | sure |
| 14:26 | l1x | https://www.irccloud.com/pastebin/DeTN7PHb |
| 14:27 | justin_smith | (into-array String (map str args)) |
| 14:27 | l1x | i need to check for nil though |
| 14:27 | l1x | cause (fn 1) works and than & b is nil afaik |
| 14:27 | justin_smith | just use str, str is .toString plus smart nil handling |
| 14:28 | l1x | i mean before i call the java method |
| 14:28 | justin_smith | and the String declaration in the into-array will make sure it is the right type, even if empty |
| 14:28 | l1x | cool |
| 14:28 | justin_smith | that's what I mean |
| 14:28 | justin_smith | (into-array String (map str args)) |
| 14:37 | l1x | thanks Justin! |
| 14:37 | l1x | https://gist.github.com/l1x/d8af14720ddb8d19a313 |
| 14:37 | l1x | this is the last thing i cannot explain |
| 14:37 | l1x | i supply the props |
| 14:37 | l1x | and it says it does not know the supplied params |
| 14:37 | l1x | i suspect i need to import one class |
| 14:38 | l1x | https://apache.googlesource.com/kafka/+/0.8.2.1/clients/src/main/java/org/apache/kafka/clients/consumer/ConsumerConfig.java |
| 14:40 | justin_smith | l1x: as in, make sure the class's static initializers get run? |
| 15:11 | mmitchell | I can get reload to work with embedded-jetty! Wonder why jetty doesn't see my changes when running through "lein-ring ring server" and reloading namespaces + restarting the System |
| 15:32 | l1x | justin_smith: not sure how to do that |
| 15:32 | justin_smith | I think that, currently at least, importing does the initializations |
| 15:32 | justin_smith | though something about this may have changed with one of the recent 1.7 releases? it rings a bell. |
| 15:33 | l1x | thanks, just import it? |
| 15:33 | l1x | ok i try that |
| 15:34 | amalloy | well, referring to a class at all causes it to be loaded, which causes its initializers to be run |
| 15:34 | amalloy | import refers to a class, but it's not the only way to do so; you could probably just write the qualified classname as a single top-level form if you wanted |
| 15:34 | l1x | thanks amalloy this might be the problem |
| 15:35 | justin_smith | Oh, OK. I thought there was some bug (affecting javafx iirc?) where the fix was not running the initializers on import. |
| 15:35 | justin_smith | I may be confusing something about this. |
| 15:36 | amalloy | i think there are some libraries (probably javafx) where loading the classes too soon causes disasters |
| 15:36 | amalloy | you can't avoid running initializers when you import, so the solution is to not import, but load the class via reflection once you're actually ready to use it |
| 15:37 | justin_smith | amalloy: hmm... maybe I am remembering an unmerged patch from jira that affected how import works |
| 15:37 | l1x | [org.apache.kafka.clients.consumer KafkaConsumer Consumer ConsumerConfig ] |
| 15:37 | cemerick | Is there an emacs incantation that will keep *nrepl-server XXX* buffers pinned to the bottom, unless I scroll away from it? |
| 15:38 | l1x | this is what i got in my namespace |
| 15:38 | amalloy | maybe. i haven't heard of such a thing, so it sounds like you know better than i |
| 15:38 | l1x | but it still does not understand the config |
| 15:38 | l1x | does the order matter? |
| 15:39 | justin_smith | cemerick: there is auto-revert-tail-mode for files that are changing on disk |
| 15:39 | justin_smith | cemerick: maybe there is something similar for process buffers... |
| 15:39 | cemerick | justin_smith: yeah, "this buffer is not visiting a file" |
| 15:39 | justin_smith | (setq comint-scroll-to-bottom-on-input t) if cider uses comint |
| 15:40 | justin_smith | I forget if cider uses comint or not |
| 15:41 | cemerick | appears not :-P |
| 15:41 | cemerick | justin_smith: thanks for the suggestions :-) |
| 15:41 | amalloy | l1x: why do you think this has anything to do with class initializers? |
| 15:42 | justin_smith | cemerick: can't hurt to try the "output" version too |
| 15:42 | justin_smith | it may be opposite of the java concepts of in/out |
| 15:42 | justin_smith | would not surprise me |
| 15:42 | cemerick | heh |
| 15:42 | cemerick | no luck |
| 15:42 | justin_smith | amalloy: the source he linked to showed a class with static initializers to set up config |
| 15:43 | cemerick | I'll live. Could just start the REPL elsewhere, I suppose |
| 15:44 | justin_smith | cemerick: you could put a hook on cider-repl-emit-output |
| 15:45 | cemerick | justin_smith: Probably more elisping than I'm up for; would need to check if point was at the end of the buffer, etc. I'd probably have to look up what (interactive) means *again*, etc. |
| 15:46 | cemerick | I'm sure there's-a-package-for-that |
| 15:46 | justin_smith | checking out the source, they derive cider-repl-mode from fundamental-mode |
| 15:46 | justin_smith | there are so many nice free things to be had if you use comint or something instead... |
| 15:54 | l1x | amalloy: i am not sure |
| 15:54 | l1x | the java version works perfectly |
| 15:59 | mmitchell | weavejester: have you been able to get tools.namespace to reload namespaces, then restart a Component System and see the changes in the server? I can only get it to work if I use the ring-jetty-component library. Which means restarting jetty when refreshing my app. |
| 15:59 | mmitchell | oops, i mean get it all to work under "lein ring server"? |
| 16:00 | weavejester | mmitchell: I'm not sure I understand. How are you using "lein ring server" together with components? I can't think of an obvious way they could be connected. |
| 16:01 | arohner | mmitchell: weavejester: you can make it work if you define {:ring {:handler}} to be the handler created by component |
| 16:02 | arohner | and your handler is reloadable |
| 16:02 | arohner | but ofc, jetty doesn't restart |
| 16:02 | mmitchell | yes ^^ exactly |
| 16:02 | mmitchell | ah, so jetty must restart then? |
| 16:02 | weavejester | So you have a "wrapper" handler that points to the handler created by the component? |
| 16:02 | mmitchell | yes something like that |
| 16:03 | arohner | mmitchell: restarting jetty isn't necessary, but it is nice. I prefer to just start jetty myself |
| 16:03 | arohner | but in production, using beanstalk, I do: |
| 16:03 | arohner | (alter-var-root #'system (fn [_] (com/start (new-system options)))) (alter-var-root #'ring-handler (constantly (-> system :app :app))) |
| 16:03 | weavejester | TBH the idea of using "lein ring server" together with components is kinda odd. You have to make a wrapper to make it work, and I don't see what benefit it would have otherwise. |
| 16:04 | arohner | then project.clj {:ring {:handler rasterize.system/ring-handler}} |
| 16:04 | justin_smith | it's really not hard to just use run-jetty |
| 16:04 | mmitchell | arohner: yeah that's the same thing i do |
| 16:04 | arohner | weavejester: yeah, I'd prefer not to need it, but it's required by lein-beanstalk |
| 16:04 | arohner | or rather, uberwar |
| 16:05 | weavejester | arohner: Oh, right, that's because it's generating a servlet. I can see how that would be tricky to reconcile with the component model. |
| 16:05 | justin_smith | arohner: you can use lein ring to make an uberwar and run-jetty from -main |
| 16:05 | justin_smith | because the uberwar will not get -main called |
| 16:06 | arohner | justin_smith: AWS beanstalk "requires" a .war, and runs inside of tomcat |
| 16:06 | weavejester | mmitchell: Anyway, it depends on how you're referencing the component handler. |
| 16:06 | justin_smith | arohner: right, I am saying you can still run without lein ring locally, during dev, when things like reloading actually matter |
| 16:06 | weavejester | mmitchell: Lein-Ring watches for changes to files, then reloads those files and all dependant ones. |
| 16:06 | arohner | justin_smith: yep, I do that |
| 16:07 | weavejester | mmitchell: So you need to make sure that reloading your handler namespace recreates your component |
| 16:07 | arohner | mmitchell: I have a ring middleware for reloading: https://gist.github.com/arohner/c5e0fa45229c408301e2 |
| 16:08 | arohner | reloading the handler, that is |
| 16:08 | arohner | otherwise I just restart the system |
| 16:08 | mmitchell | arohner: and jetty too? |
| 16:08 | arohner | in dev, I start jetty as part of the system |
| 16:08 | mmitchell | weavejester: ok thanks, i'll keep that in mind and have another crack at it |
| 16:08 | mmitchell | arohner: ah ok, that is actually working for me too now |
| 16:08 | weavejester | mmitchell: Are you using lein-ring to create uberwars? |
| 16:08 | mmitchell | yes |
| 16:09 | mmitchell | works great |
| 16:09 | weavejester | Ah, okay |
| 16:09 | mmitchell | couldn't live without lein ring uberwar |
| 16:09 | mmitchell | :) |
| 16:09 | arohner | now I just wish it were easier to use jetty w/ beanstalk |
| 16:09 | weavejester | That's good to know. Fortunately these days I don't need to work with servlet containers :) |
| 16:10 | mmitchell | lucky you! i've been thinking about trying out http-kit, haven't yet had the time though |
| 16:11 | justin_smith | mmitchell: it's pretty straightforward - though you might want to manage some things like startup / shutdown / log rotation that the containers do for you |
| 16:12 | mmitchell | justin_smith: good points |
| 16:36 | mmitchell | so weavejester, I think the problem comes down to lein-ring-server and (clojure.tools.namespace.repl/refresh). It's like the handler link link gets permanently broken when refresh is called. |
| 16:36 | mmitchell | even though in the repl I can call my handler and it works |
| 16:48 | weavejester | mmitchell: I'd honestly have to see how you've created your handler component wrapper to tell |
| 16:48 | mmitchell | weavejester: yeah for sure! sorry, not providing enough details here. I'll see if I can extract the meaningful bits sometime |
| 16:49 | weavejester | mmitchell: Have you excluded your handler wrapper from the refresh function? |
| 16:51 | mmitchell | weavejester: no I haven't. that may be why i'm having the problem |
| 16:53 | weavejester | mmitchell: If you're removing the handler namespace altogether, maybe that's causing the problem. Under a normal reload the var would just be updated/replaced, but refresh blanks the slate. |
| 16:53 | weavejester | mmitchell: So you want a namespace that contains a handler that points to your component |
| 16:53 | l1x | amalloy: |
| 16:53 | mmitchell | weavejester: yeah makes sense. I bet that's it |
| 16:53 | mmitchell | will try |
| 16:53 | l1x | i was wondering what is the difference |
| 16:53 | l1x | found this |
| 16:53 | l1x | public KafkaConsumer(Properties properties, ConsumerRebalanceCallback callback, Deserializer<K> keyDeserializer, Deserializer<V> valueDeserializer) { |
| 16:53 | weavejester | mmitchell: And then use (disable-unload!) or (disable-reload!) to stop refresh from clearing that namespace |
| 16:54 | l1x | and try to go through calling each by hand |
| 17:20 | gfredericks | so I'm thinking of adding a test.chuck thing for asserting that a generator generates an x such that (pred x) "often enough" |
| 17:20 | gfredericks | and I'm not sure if there's a way to do this without generating noisy false failures |
| 17:21 | gfredericks | like if I set it to only fail if p<0.0001, is the test still useful? |
| 17:22 | arrdem | I can't see how this would be useful TBH |
| 17:23 | arrdem | I mean I see how a generator which can only generate an interesting coverage case with P(0.0001) is useless.. |
| 17:23 | arrdem | but trying to ensure that your generators are "meaningful" seems problematic |
| 17:25 | arrdem | I suppose this opens up the entire category of meta-tests... |
| 17:26 | gfredericks | wait maybe I miscommunicated |
| 17:26 | gfredericks | what did you mean by "interesting coverage case"? |
| 17:27 | gfredericks | I'm saying the test only fails if it's 99.99% sure that (pred x) is not true often enough |
| 17:27 | l1x | amalloy: nevermind i am able to reproduce the problem in Java |
| 17:34 | hiredman | I have in the past written tests, typically for concurrent stuff, which I wanted to express things like a tendency of results to be in a certain order |
| 17:35 | sandbags | cljx is stabbing me right through the eye |
| 17:35 | sandbags | is native support for clj/cljs coming soon? |
| 17:36 | hiredman | to test code that pulls things from queues, and the queues have weights so the results should tend to be sorted by what queue the input came in on |
| 17:42 | hiredman | I think what I ended up doing for that test was doing some number of runs, taking the average positions of each item, and comparing the levenshtein distance between items in their average position and the sorted collection |
| 17:43 | sandbags | anyone else using Cursive? One one machine I can load a cljx file into the REPL no problem, on the other I get "No reader function for tag +cljs". Supposedly same project on both machines. |
| 17:43 | sandbags | i've had so many problems getting this project across to the other machine though, starting to lose the will to live |
| 17:44 | arrdem | ##(read-string "#+cljs :foo") |
| 17:44 | lazybot | java.lang.RuntimeException: No reader function for tag +cljs |
| 17:44 | arrdem | ##*clojure-version* |
| 17:44 | arrdem | ##(print *clojure-version*) |
| 17:44 | lazybot | ⇒ {:major 1, :minor 7, :incremental 0, :qualifier alpha1}nil |
| 17:44 | sandbags | arrdem: i guess what you are telling me is that help is not at hand on that front |
| 17:45 | sandbags | my searches for "No reader function for tag +cljs" have not been illuminating |
| 17:45 | arrdem | cfleming: ping |
| 17:46 | arrdem | sandbags: yeah that means that a version of Clojure without support for feature expressions is trying to read a feature expression form. |
| 17:46 | arrdem | sandbags: as reproduced above |
| 17:46 | Bronsa | feature expressions are not coming to clojure, the new proposal is about "feature conditionals" |
| 17:46 | sandbags | arrdem: sorry, i understand what the error means ... what i do not understand is why i am seeing it in this case and not on the other machine |
| 17:46 | sandbags | with the same version of IDEA, Cursive, CLJX, project etc... |
| 17:47 | arrdem | sandbags: Not a cursive guru, hence why I pinged cfleming, who may actually have a clue since he's the main cursive dev. |
| 17:47 | sandbags | on my laptop i am able to load .cljx sources into the REPL no problem |
| 17:47 | sandbags | oh cool, thanks |
| 17:48 | arrdem | sandbags: my gut is that something (I have no idea what) is in fact different about your REPL setup, but I'll defer to cfleming as to what that could be. |
| 17:48 | arrdem | Bronsa: yeah I've been watching that thread with interest. |
| 17:48 | sandbags | arrdem: i'm with you on that |
| 17:48 | sandbags | but struggling to know where to look next |
| 17:49 | arrdem | To ask the obvious question, is cursive at the same version on both machines? |
| 17:49 | sandbags | maybe i can tempt him an exception i just got in cursive :) |
| 17:49 | sandbags | hrmm... i think so |
| 17:50 | sandbags | ah |
| 17:50 | sandbags | 0.1.48 on the working machine |
| 17:50 | sandbags | 0.1.49 on the non-worky one |
| 17:50 | sandbags | i wonder |
| 17:50 | sandbags | i guess i should update the working one and see if it breaks |
| 17:50 | sandbags | and then make myself very depressed |
| 17:51 | arrdem | spoken like a true engineer. |
| 17:51 | arrdem | hey at least you can send cfleming a bug report then :P |
| 17:51 | sandbags | well i may be saved by the fact that IDEA doesn't seem to want to let me update it :) |
| 17:55 | sandbags | darn |
| 17:55 | sandbags | looks like something changed in Cursive |
| 17:55 | sandbags | 0.1.48 -> 0.1.49 and its b0rked on my laptop too |
| 17:55 | sandbags | great |
| 17:57 | sandbags | oh well, i secretly wanted to get back to playing Darkest Dungeon anyway |
| 17:57 | sandbags | thanks arrdem |
| 18:47 | l1x | amalloy: i found the problem, it is on the java library side, there is something that is not implemented yet. it was just not obvious at the first sight. thanks for the hint |
| 19:09 | creese | I'm getting "could not find or load class clojure.main" when I run the uberjar. What can cause this? |
| 19:09 | justin_smith | creese: are you sure it's the uberjar? when uberjars are generated a regular jar is created too |
| 19:10 | justin_smith | the uberjar will usually have "standalone" in the name |
| 19:10 | creese | it does |
| 19:14 | creese | the uberjar was built using 1.8 but is run from 1.7, could that be the cause? |
| 19:16 | amalloy | creese: i think you should paste the entire error message to refheap or something. don't make anyone debug from just a single line |
| 19:16 | creese | I have the one line |
| 19:17 | justin_smith | no stack trace? |
| 19:17 | creese | right |
| 19:17 | justin_smith | is clojure.jar inside the uberjar? |
| 19:17 | justin_smith | is clojure a dep your app declares? |
| 19:18 | creese | of course |
| 19:18 | justin_smith | to both? |
| 19:19 | creese | what do you mean, both? |
| 19:19 | justin_smith | I asked two questions |
| 19:19 | creese | yes to the 2nd |
| 19:19 | justin_smith | the uberjar is a zip file, you can open it and see what is inside |
| 19:19 | justin_smith | emacs and vim can open it like a directory |
| 19:22 | creese | clojure.jar is not inside when I unzip |
| 19:22 | creese | I do see dir clojure/ |
| 19:28 | madalynn | any one in here use cemerick friend? I had a question about how people use authorization or role aspect of friend. It seemed weird to me you should authorize something with a static variable like ::admin or ::user, since for example you can possible have 1000s of users and you only want users to see their specific information. |
| 19:30 | justin_smith | madalynn: if it's per-user info, that isn't authroization, that's authentication (verifying who they are), friend has facilities for both |
| 19:31 | madalynn | justin_smith the authentication just assocs an identity to the request. authorization checks the identity has a role |
| 19:31 | madalynn | for example i can authorize as user then get rejected from an admin path |
| 19:31 | justin_smith | right, if nobody has special in-app priveledges, you don't care about authorization |
| 19:31 | justin_smith | ::admin is for a role, not for differentiating a specific user |
| 19:32 | madalynn | justin_smith understood, but lets say a user and my user id is 1, i want to be able to access pages that all users can access lets say a common user guide, but i also want to be able to access my particular profile |
| 19:33 | madalynn | i can't wrap the profile path, lets say "/user/1" with ::user |
| 19:33 | justin_smith | madalynn: I think the best choice there is to let "current user profile" be a single page, and let the authentication drive what the content is |
| 19:33 | justin_smith | and wrap that in an authenticated check, not an authorized check |
| 19:34 | justin_smith | and then "other user profile" would likely check authorization for showing certain data |
| 19:36 | madalynn | at justin_smith lets assume we have this very typical url layout /user/1/products or user/3/products |
| 19:36 | madalynn | and supages from there |
| 19:36 | madalynn | so user/3/products/wishlist and user/3/products/wishlist/2 certianly you can't make these single pages |
| 19:37 | justin_smith | then use authentication + authorization, and offer certain options if the visitor is that user, or an admin |
| 19:37 | justin_smith | but regardless, the keyword based stuff obviously only makes sense for checking generic roles, not specific users |
| 19:37 | madalynn | i tried this once with friedn what i did was dynamically create roles so i would dynamically create a namespaced keyword ::user/1 and then i would say (derive ::user/1 ::user) |
| 19:38 | justin_smith | a unique role for every user sounds like a terrible idea to me |
| 19:38 | justin_smith | why not just compare an id in the session or something? |
| 19:40 | madalynn | justin_smith, thats essentially what i'm doing, but as far as i see it this was the only way i could do it using the friend framework. i was just wondering if anyone else had a similar use case. all my roles were dynamically generated based on variables in the requesting url |
| 19:40 | madalynn | just trying to see what others thought |
| 19:43 | justin_smith | I don't think friend is even meant for that kind of fine grained stuff. I would use the authentication to get the proper user id and user data, and use that id and data in checks (wrapping them also in an authenticated requirement) |
| 19:45 | madalynn | justin_smith i think essentially you just confirmed what i was thinking, that the use case for friend did not fit my use case. at the time i spent a lot of time struggling to make it work.. |
| 19:49 | cfleming | sandbags: Sorry, was afk there |
| 19:49 | cfleming | arrdem: pong |
| 19:52 | creese | justin_smith: I think it's a problem with my project.clj |
| 19:57 | creese | but only the version changed |
| 20:00 | creese | https://www.refheap.com/98430 |
| 20:01 | creese | https://www.refheap.com/98431 |
| 20:28 | sandbags | cfleming: hi, i sent you some details via pm |
| 20:29 | cfleming | sandbags: Thanks. In 0.1.49 I upgraded the bundled leiningen to 2.5.1, which I suspect is the cause of this, although I'm not sure why. |
| 20:30 | cfleming | sandbags: Which version of lein do you use on the command line? |
| 20:30 | sandbags | 2.5.1 |
| 20:31 | cfleming | Ok, if you start a REPL with lein repl :headless, and connect to it from Cursive using a Remote REPL, does that work? |
| 20:31 | cfleming | BTW I haven't received anything via pm, but I saw the conversation with arrdem earlier. |
| 20:31 | sandbags | odd |
| 20:32 | sandbags | i've not been on IRC for a bit so maybe its nickserv related |
| 22:13 | casion | reminder guys |
| 22:13 | casion | http://bedroomproducersblog.com/2015/03/13/get-uvi-digital-synsations-for-free-199-regular-price/ |
| 22:14 | casion | wrong window. sorry. |