2015-06-22
| 00:24 | elvis4526 | is it possible to use add-watch with mutliple atoms at the same time ? |
| 00:25 | justin_smith | elvis4526: there's no reason you can't use the same watching function for multiple atoms, if that's what you mean |
| 00:25 | elvis4526 | I'm sorry, I meant like watching atom1 and atom2 and only trigger the callback when both gets changed |
| 00:27 | amalloy | elvis4526: atoms aren't coordinated, at all |
| 00:29 | justin_smith | elvis4526: there's nothing that acts like that, but you could make something (perhaps using a channel, or an atom or delay), that would wait for both atoms to change before triggering some action |
| 00:30 | amalloy | and what happens if a changes twice, then b changes twice? there is a lot of detail to be ironed out in that specification |
| 00:31 | justin_smith | definitely |
| 00:31 | elvis4526 | Yeah okay thanks ! I believe if I would be using Clojure on the JVM I could use agents for that, correct ? |
| 00:32 | justin_smith | elvis4526: you could use an agent that holds the set of modified atoms, and then send it a function that updates, and then perhaps executes something if the right things are present in the agent value |
| 00:39 | elvis4526 | perfect - that's really cool. |
| 02:13 | gniquil | hi all, got a quick question about clearing the symbols defined in a namespace... in my tests, sometimes I would define a test say "deftest abc-test", then after some refactoring, i would change the name of this test, as the code has been refactored, however, when I go into the namespace and run (run-tests), although all the new tests would pass, the old test would still be defined and ran. Is there a way to "clean" this up? |
| 02:22 | H4ns | gniquil: i use (remove-ns 'the-ns-name) often to clean up such things. |
| 02:24 | gniquil | Thanks! that was easy |
| 02:24 | H4ns | gniquil: i.e. i use remove-ns and then reload it. this can create issues with dependent namespaces, but for test namespaces, it should normally work fine. |
| 02:24 | gniquil | funny you can even do that while in the ns |
| 02:24 | gniquil | awesome, again thanks for the help |
| 02:41 | musty | :) |
| 02:42 | musty | Hello clojure expertz. |
| 02:44 | Empperi | can't say hello back since I'm not an expert |
| 02:44 | Empperi | I'm a GOD |
| 04:35 | kwladyka_ | how to recognise reason of exception in Clojure? for example refuse connect to DB, I can get exception message by (.getMessage e), but how can i determinate reason of exception? I want react of this exception in specifics way. |
| 04:37 | kwladyka | For example I am getting "Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections." and how to know is this reason of error and react for that? |
| 04:55 | oddcully | kwladyka: i'd not try to do anything smart here. fail and provide the user with the message |
| 04:57 | kwladyka | oddcully, but i want just to know how to do that. Or is it just bad idea? |
| 05:01 | kwladyka | oddcully, or in another way: I am doing inster! to db and if I get exception about not unique primary_key I don't want just show user big error, because I want call another action then. |
| 05:04 | Pupeno | When I run foreman start in my luminus app, I get this error: 10:04:22 web.1 | Error: Could not find or load main class clojure.main, how can I get more details about the error? |
| 05:10 | Pupeno | This is the line being executed java $JVM_OPTS -cp target/foobar.jar clojure.main -m foobar.core. Does it look correct or do I have to change something there? |
| 06:25 | kwladyka | i solved my problem |
| 06:27 | tim__ | lazy-seqs, "In general, you can think of lazy seqs as "recipes" for how to generate each element in the sequence" |
| 06:28 | tim__ | what if I have a function that returns say 10 results at a time |
| 06:28 | tim__ | say its an API im calling that returns 10 items per call |
| 06:28 | tim__ | can I make this into an infinite sequence ? |
| 06:34 | mmeix | do you need it infinite? |
| 06:35 | Pupeno | mmeix: I think he just wants the lazy-seq to abstract the fact that results comes in batches. |
| 06:37 | tim__ | @Pupenu yeah, @mmeix, it doen't really need to be inifinite I just thought that would be a way to handle it, I was thinking of an lazy seq combined with take-while ( I don't have in database already ) |
| 06:37 | mmeix | ok |
| 06:38 | Pupeno | tim__: it sounds like it should be possible, but I don't know how, I'm new to this and having that *internal mutable state* might not be the most straightforward in Clojure. |
| 06:38 | schmir | wouldn't (mapcat identity (repeatedly f)) do what you want? |
| 06:38 | mmeix | something like iterate my-api-call maybe? |
| 06:39 | schmir | f should return a seq of the 10 results... |
| 06:41 | tim__ | schmir: thanks I'll try that, somone in clojure-beginners suggested lazy-cat as well |
| 06:41 | mmeix | (we have a channel #clojure-beginners?) |
| 06:42 | oddcully | mmeix: see topic |
| 06:42 | tim__ | that's what it said when I logged in :) |
| 06:42 | mmeix | ah ... |
| 06:44 | mmeix | ok, then I can bother them :-) |
| 06:51 | Guthur | has anyone tried arcadia-unity with unity 5 on Win64? |
| 06:51 | Guthur | I have a REPL but can not seem to get it to load any of my script files |
| 06:51 | Guthur | I get: Skipping Assets/Arcadia/Scripts/core/bar.clj, namespace in ns form does not match file name |
| 07:17 | kwladyka | https://www.refheap.com/104347 - why clojure.test has (not (= "23505" (.getSQLState e))) instead of value of this while compare??? |
| 07:18 | kwladyka | so strange |
| 07:20 | oddcully | comparing magic number looks scary |
| 07:20 | kwladyka | (println (.getSQLState e)) works in register-step-1, it shows the value |
| 07:20 | kwladyka | so is it something wrong with clojure.test? |
| 07:44 | Pupeno | What's the appropriate approach to set credentials on luminus with postgresql so it works on production on heroku as well as locally? |
| 07:58 | kwladyka | Where can i looking help with my problem about clojure.test? I don't repository like that on github |
| 07:58 | Jickelsen | I am not an expert but my setup uses environment variables on the heroku side for auth credentials and an open database for dev, or sets the credentials in dev-specific namespaces. But I'd love to hear that this is a terrible idea and that some other way is better. :) |
| 07:59 | tdammers_ | Jickelsen: it's a fairly decent setup, as long as your dev setup is firewalled off the general internet like crazy |
| 08:01 | Jickelsen | I guess it would help too if you had a separate dev database altogether |
| 08:02 | kwladyka | mmm i will ask on clojure/clojure |
| 08:06 | kwladyka | damn... no idea what to do with that |
| 08:19 | noidi | kwladyka, you have quoted the expression, thus preventing the method calls from being evaluated |
| 08:19 | noidi | ,(quote (.foo bar)) |
| 08:19 | clojurebot | (.foo bar) |
| 08:19 | noidi | ,(first (quote (.foo bar))) |
| 08:19 | clojurebot | .foo |
| 08:19 | noidi | ,(type (first (quote (.foo bar)))) |
| 08:19 | clojurebot | clojure.lang.Symbol |
| 08:19 | kwladyka | noidi, thank you!!!!!! |
| 08:20 | kwladyka | but... how to code that to use list? |
| 08:20 | kwladyka | or maybe just use vector? |
| 08:20 | noidi | if you need a sequence of values, it's idiomatic to use a vector literal |
| 08:21 | kwladyka | i just need list of errors to show them to user, I am not enough experience to know what will be better |
| 08:21 | noidi | try this: {:errors [{:message (.getMessage e) :code (.getSQLState e)}]} |
| 08:22 | kwladyka | so vectors will be better? |
| 08:22 | noidi | yes |
| 08:22 | justin_smith | for literals, vectors are always better |
| 08:22 | kwladyka | can you explain why? |
| 08:22 | noidi | vectors are evaluated to themselves |
| 08:23 | kwladyka | mmm so how to know to which one should i use? |
| 08:24 | kwladyka | i thought it is about performance |
| 08:24 | noidi | as a rule of thumb, use lists for function calls and vectors for everything else :) |
| 08:24 | kwladyka | and as i understand vectors are better with reading by index but list with adding/reading to begin/end |
| 08:24 | justin_smith | kwladyka: no, lists are terrible for adding at the end |
| 08:25 | noidi | in the rare case you specifically need a list, you can construct it like this: (list 1 2 3) |
| 08:25 | noidi | in general you don't need to use quoting except when writing macros |
| 08:25 | justin_smith | realistically, (seq [1 2 3]) is just as good |
| 08:25 | kwladyka | noidi, mmm i can do like that but is it really like i should do? |
| 08:25 | justin_smith | kwladyka: in general you don't need to make lists at all |
| 08:26 | kwladyka | it is so confuse :) |
| 08:26 | justin_smith | kwladyka: some functions have good reasons to return lazy-seqs |
| 08:26 | justin_smith | kwladyka: for literals, use a vector. If you need something to prepend to the front, you can use seq to get a data type that does that. |
| 08:26 | justin_smith | otherwise, vectors are better |
| 08:27 | kwladyka | hmm so you never use list for data? |
| 08:27 | justin_smith | not for literals |
| 08:28 | justin_smith | only use a list if you need to remvoe or add items at the front |
| 08:28 | kwladyka | justin_smith, ok thank you |
| 08:28 | justin_smith | and for that, you can use seq to turn a vector into a list, you never need a list literal except in a macro |
| 08:29 | kwladyka | yeah my test working! :) |
| 08:30 | kwladyka | and with this it is time to end learning today, I am enough happy with progress today :) |
| 08:45 | tcrawley | expez: non-SNAPHSOT releases to clojars are immutable, even if you don't promote them |
| 09:30 | expez | tcrawley: it would be nice to be able to correct mistakes :( |
| 09:31 | expez | nobody can download a non-promoted non-snapshot release, right? |
| 09:32 | tcrawley | no, anybody can download it. you have to add a new repo to download promoted releases, which no one does, because 90% of projects aren't promoted |
| 09:32 | tcrawley | the promoted repo isn't really used at all |
| 09:32 | expez | I see |
| 09:33 | tcrawley | so allowing replacement of releases reopens a can of worms that allows silently changing artifacts that may be in use |
| 09:34 | expez | yeah, it makes perfect sense now that I know how it works :p |
| 09:34 | tcrawley | good deal |
| 09:41 | puredanger | tcrawley: it |
| 09:41 | puredanger | tcrawley: it's like you're saying that immutable data is a good thing |
| 09:41 | tcrawley | I know, right? |
| 10:45 | csd_ | Can amnyone provide advice on debugging Cider when symbol lookup fails? I.e. for docs lookup. I'm not getting an error other than symbol not found |
| 11:06 | natto | is there an idiomatic way to dedupe function code across several files, if the code is identical, but references a namespace local? |
| 11:06 | natto | here's a toy example: http://pastebin.com/J2yFmQCG |
| 11:10 | mmeix | by putting it in a utils.clj namespace and referring it? |
| 11:12 | natto | mmeix: how do you do it, if the function refers to like an atom defined in the file that refers utils.clj? |
| 11:12 | mmeix | ah, sorry |
| 11:15 | mmeix | would (defn utils/shorthand-get-id [some-atom] (:id @some-atom)) work? |
| 11:15 | mmeix | not sure, if this is the intent though |
| 11:16 | natto | mmeix: yes it would, but then it stops being a shorthand |
| 11:16 | mmeix | sorry for (defn utils/... |
| 11:16 | mmeix | I see |
| 11:22 | mmeix | I think, in your example my-atom needs a def |
| 11:22 | mmeix | (def my-atom (atom {})) |
| 11:22 | natto | you're right |
| 11:23 | mmeix | and then you would refer it by name |
| 11:24 | natto | oh interesting, resolve the atom name at runtime? |
| 11:24 | mr-foobar | I am trying to install lein on a new ubuntu server. |
| 11:24 | mr-foobar | wget http://leiningen.s3.amazonaws.com/downloads/leiningen-2.1.2-standalone.jar <-- 403 |
| 11:25 | irctc | Hello, I am using https://github.com/xsc/pandect, and I am unable to convert a byte array to string. When i do (println (str my-value)), I get somehting sensible like #bin yfCxXLFMydFZ1XC5PRuSXzNe3u6yLY3X1gqM5IjHxSE=. I want it without the #bin = part, is that possible ? |
| 11:25 | justin_smith | irctc: String. |
| 11:26 | justin_smith | ,(.getBytes "hello") |
| 11:26 | clojurebot | #object["[B" 0x3a53be08 "[B@3a53be08"] |
| 11:26 | justin_smith | ,(str (.getBytes "hello")) |
| 11:26 | clojurebot | "[B@5030944d" |
| 11:26 | irctc | I tried (String. signature) |
| 11:26 | justin_smith | ,(String. (.getBytes "hello")) |
| 11:26 | clojurebot | "hello" |
| 11:26 | irctc | but I get something unreadable |
| 11:27 | justin_smith | irctc: looking at what you pasted above, that looks like base64? |
| 11:27 | irctc | I tried that too, specifically I use sha256-hmac-bytes |
| 11:28 | irctc | @justin well I'm not sure. I don't use base64 myself |
| 11:28 | irctc | I just use plain text |
| 11:29 | irctc | the thing is, sha256-hmac gives me a string, but not the same as in (println (str sha256-hmac-bytes ..)) |
| 11:30 | irctc | But I can't seem to find how to get only the string (without #bin ) when using sha256-hmac-bytes, which is otherwise the correct string |
| 11:30 | justin_smith | irctc: what is the type? if it prints as #bin, that's not a byte-array |
| 11:30 | irctc | ooh I thought it was a byte array |
| 11:31 | irctc | but yes it's probably not |
| 11:31 | irctc | i have an exception on .getBytes |
| 11:31 | justin_smith | irctc: well, there is this function "type" which will tell you what the type is, then you can figure out what you can do with that value |
| 11:32 | justin_smith | ,(type (.getBytes "hello")) |
| 11:32 | clojurebot | [B |
| 11:32 | irctc | Thanks :) |
| 11:32 | irctc | yes the type is [B |
| 11:33 | justin_smith | in that case (String. v "encoding") will correctly give you the value as a string, though you may need to find the right value for encoding |
| 11:33 | irctc | hmm I tried UTF-8 already |
| 11:33 | justin_smith | irctc: https://docs.oracle.com/javase/8/docs/technotes/guides/intl/encoding.doc.html |
| 11:33 | irctc | Is it the default in Clojure ? |
| 11:34 | justin_smith | ,(String. (.getBytes "hi ¬ˆ˚™£") "UTF-8") |
| 11:34 | clojurebot | "hi ¬ˆ˚™£" |
| 11:34 | justin_smith | ,(String. (.getBytes "hi ¬ˆ˚™£") "IBM00858") |
| 11:34 | clojurebot | "hi ┬¼╦å╦ÜÔäó┬ú" |
| 11:34 | irctc | Ok I'll try some encodings then |
| 11:34 | mmeix | natto I think you can do (:id @one/my-atom) in core and don't need a getter function |
| 11:35 | mmeix | (justin correct me, if this is nonsense :-) |
| 11:35 | irctc | OOh no I forgot : I get No matching field found: getBytes for class [B |
| 11:35 | justin_smith | mr-foobar: you should be downloading the lein script, and it will find the standalone |
| 11:35 | justin_smith | irctc: it is bytes, why getBytes from it? |
| 11:36 | irctc | Hmm right sorry.. :) |
| 11:36 | justin_smith | I am just using .getBytes on a string because that is a convenient way to make a byte array with known contents |
| 11:36 | irctc | Ok I get that thanks |
| 11:37 | mmeix | natto also you could do just (def my-atom (atom {:id 1})) in one.clj |
| 11:37 | mr-foobar | justin_smith: the lein script is throwing the error. its a new ubuntu server, so I am running an automated script "wget --no-check-certificate -O https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein" followed by `lein new ...` using salt. |
| 11:37 | natto | mmeix: right, but the shorthand function is of arbitrary complexity |
| 11:38 | justin_smith | mr-foobar: oh, odd, why is it trying to use such an old version? |
| 11:38 | natto | i have a workaround, i think it is ugly, but i don't know how else to do it |
| 11:38 | TimMc | mr-foobar: Yikes, why --no-check-certificate ? |
| 11:39 | mr-foobar | TimMc: lulz .. yeah bad copy-paste. |
| 11:39 | mmeix | natto but you can refer to the atom directly by namespace/name and then extract things from it in core as complicated as you want, I think |
| 11:39 | justin_smith | mr-foobar: look at the first few lines, it should be trying to get 2.5.1 https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein |
| 11:39 | natto | in utils.clj, you (declare shadow-my-atom) (defn bind-atom [a] (def shadow-my-atom a)) (defn shorthand-fn [] (... use shadow-my-atom)) |
| 11:39 | natto | and use that in the other clj |
| 11:40 | mmeix | I think this is too complicated |
| 11:41 | irctc | Sorry to ask again.. isn't [B a Byte Array ? |
| 11:41 | justin_smith | irctc: yes |
| 11:42 | natto | mmeix: in a more elaborate example you'd store config (e.g. POST endpoint URL) in an atom |
| 11:42 | justin_smith | and to make a string from a Byte Array, you use the String constructor (with optional encoding argument) |
| 11:42 | natto | and say you defn a submit-to-server that reads which endpoint based on the config atom |
| 11:42 | mmeix | wouldn't your last defn just be (defn main [] (prn (str "one's id " (:id @one/my-atom) ", " "two's id " (:id @two/my-atom)))) ? |
| 11:42 | csd_ | Is it possible to break up dependencies into two separate vars in project.clj, and then have :dependencies (merge deps_a deps_b), or similar? |
| 11:42 | justin_smith | csd_: this is what profiles do |
| 11:43 | irctc | ok thanks there is something that I miss obviously.. I'll be back :p Thanks |
| 11:43 | justin_smith | csd_: and yes, project.clj can run arbitrary clojure code, though it's often a bad idea |
| 11:43 | natto | mmeix: my toy example was too simple, indeed in the toy case it's best to just read the value directly like you wrote |
| 11:43 | csd_ | justin_smith: i'm working on a project where i need to import deps for the platform which is being imported a jar and id like to distinguish between project and platform deps. |
| 11:44 | csd_ | profiles dont strike me as the right choice in this case |
| 11:44 | justin_smith | csd_: yeah, that sounds like a profile (eg. define one profile per platform and run with said profile merged?) |
| 11:45 | csd_ | hmm ill take a closer look at how they work |
| 11:45 | justin_smith | though if you really need the flexibility you can absolutely use arbitrary clojure code to construct your :dependencies vector |
| 11:45 | csd_ | its more just a clarity thing than a flexibility thing |
| 11:45 | justin_smith | but the default usage of profiles is to merge things, so go with that if you can |
| 11:45 | mmeix | natto I'm not sure I understand correctly, but why would you store config data in different atoms in different namespaces? I guess I didn't understand the use case |
| 11:45 | csd_ | seems cleaner to split it out |
| 11:48 | natto | mmeix: better example http://pastebin.com/x5ZQxKra |
| 11:48 | natto | i have not actually tries this, it doesn't look right, but it does work in clojurescript |
| 11:49 | natto | i.e. re-binding the atom into another namespace and deref-ing it there |
| 11:49 | justin_smith | natto: what do you gain by defining an atom in the client ns, rather than simply swapping new values into an atom created in the util lib? |
| 11:49 | mmeix | this is what I'm wondering too |
| 11:50 | justin_smith | natto: I can tell you what you lose - if other libs also want to use the util lib, the last one to access it in such a way "wins" and destroys all other config |
| 11:50 | justin_smith | natto: if the util namespace owned the atom, you could at least have cooperative setting of the config |
| 11:51 | natto | justin_smith: points taken. I can forgo the atom usage example |
| 11:51 | mr-foobar | justin_smith, TimMc: it works ! the bash script was old. |
| 11:51 | justin_smith | also, I can't see anything in the code as it is that meaningfully uses the feature of an atom - it may as well just be a top level map instead |
| 11:51 | mmeix | the battle of the confs :-) |
| 11:51 | natto | the problem is i'm trying to reuse e.g. the "handshake" code in utils |
| 11:52 | natto | or any other function, sans the arguments |
| 11:52 | mmeix | this seems to much object thinking, I guess |
| 11:52 | mmeix | !to be |
| 11:53 | mmeix | * |
| 11:53 | natto | sort of |
| 11:53 | natto | you can write a util/useful that takes an argument, which you have defined in the referring namespace |
| 11:54 | natto | but after enough calls I get lazy and I write an argument-less version called "shorthand" |
| 11:54 | justin_smith | natto: with an atom, use swap! to cleanly set keys. defining something from outside the namespace is never a good idea |
| 11:54 | natto | ... but now I want to use "shorthand" without redefining across files |
| 11:54 | mmeix | why do you need "shorthand" in the first place? |
| 11:55 | mmeix | if it's just a function to extract a value, you can write it once and use it everywhere |
| 11:55 | justin_smith | natto: also, the right way to do OO style config in clojure is stuartsierra/component, not top level atoms |
| 11:55 | justin_smith | it also happens to be the right way to do functional style config too |
| 11:56 | mmeix | a config is just a map in a defined place, right? |
| 11:56 | natto | ah yes. this is really example fail on my part |
| 12:00 | mmeix | natto by the way, if you need an "argument-less" version of a function, you can use 'partial' (if that is what you want) |
| 12:00 | mmeix | ,(doc partial) |
| 12:00 | clojurebot | "([f] [f arg1] [f arg1 arg2] [f arg1 arg2 arg3] [f arg1 arg2 arg3 & ...]); Takes a function f and fewer than the normal arguments to f, and returns a fn that takes a variable number of additional args. When called, the returned function calls f with args + additional args." |
| 12:01 | mmeix | but I guess, this is not what you meant |
| 12:02 | mmeix | mmeix shutting up and returning to newbie status :P |
| 12:02 | natto | mmeix: actually, that might be the best route, let me think about it |
| 12:02 | natto | but let me give one more try at explaining my use case |
| 12:03 | natto | in ns.util you've a (defn bunch-of-stuff [some-value] ... ) |
| 12:03 | natto | in ns.one you have (def my-ns-global ...) and use a lot of (util/bunch-of-stuff my-ns-global) |
| 12:03 | natto | in ns.two you have (def my-ns-global ...) and use a lot of (util/bunch-of-stuff my-ns-global) |
| 12:03 | natto | you get lazy, and in ns.one you (defn bunch-of-stuff-using-global [] (util/bunch-of-stuff my-ns-global)) |
| 12:03 | natto | but can you somehow define bunch-of-stuf-using-global already, and use it in ns.two referring to two/my-ns-global? |
| 12:04 | natto | mmeix: doing the partial means defining the partial in util |
| 12:04 | natto | then in ns.two, (def bunch-of-stuff-using-global (partialed-bunch-of-stuff my-ns-global)) |
| 12:04 | natto | and that completes the "shorthand" |
| 12:04 | mmeix | uff |
| 12:05 | natto | but can we skip that altogether even? |
| 12:05 | mmeix | quite long hand ... ;-) |
| 12:06 | mmeix | I'm still not understanding, why you would need all those "getter" functions |
| 12:06 | natto | they're not getter functions, they have arbitrary complexity |
| 12:06 | mmeix | but maybe I'm a bit brain dead after a day full of exams here |
| 12:07 | mmeix | (here is Vienna music univ) |
| 12:08 | mmeix | natto forget about the partial thing, it was just on a side note |
| 12:10 | natto | mmeix: at the moment it seems like partial would save me the most typing actually |
| 12:13 | mmeix | but I'm under the impression, that managing global config is more of a structural problem |
| 12:15 | mmeix | and several namespaces fighting for dominance over a app state seems confusing, at least |
| 12:15 | natto | ok, so I'm designing interactive psychology experiments that have e.g. different appearances |
| 12:15 | natto | but lots of the core logic is shared |
| 12:15 | mmeix | ok |
| 12:15 | natto | I've set up profiles.clj to compile a version based on the CLI switch |
| 12:16 | natto | so a different clj file gets included at compile time |
| 12:16 | mmeix | ah ... |
| 12:16 | natto | then I put the shared code into a different file |
| 12:16 | natto | so each variant of the experiment has a global state atom |
| 12:16 | natto | and I want to call things like (update-state) instead of (update-state my-state) |
| 12:17 | csd_ | How can I debug why JARs aren't loading properly into my project? The error message lein gives me is very unhelpful |
| 12:20 | mmeix | natto I guess you would have to ask the wise here (maybe with a real example), I'm not that fluent to give a helpful answer in this case (but I tried :) |
| 12:37 | natto | mmeix: partial works great, thanks |
| 12:37 | mmeix | :-) |
| 12:38 | natto | justin_smith thanks for the link |
| 12:38 | gfredericks | does anybody know how cider-inspect works? |
| 12:38 | gfredericks | I'm using cider 0.9.0 so I assume it's supposed to work |
| 12:40 | gfredericks | I run M-x cider-inspect on a symbol and get an error flashed in the minibuffer like: error in process filter: Wrong type argument: char-or-string-p, ("Class" ": " ("value" "java.lang.String" 0) ("newline") "Value: " "\"#object[clojure.test.check.rose_tree.RoseTree 0x54a26423 \\\"clojure.test.check.rose_tree.RoseTree@54a26423\\\"]\"") |
| 12:40 | gfredericks | maybe it's those dang deftypes |
| 12:42 | gfredericks | yeah now it just hangs because the object is sooper big |
| 12:42 | gfredericks | which I thought was one of the use cases for the inspector o_O |
| 12:52 | Pupeno | I feel I'm missing something here, but deploying Luminus to Heroku and make it connect to PostgreSQL seems non trivial as Luminus cannot pick up DATABASE_URL. I could write the code to do that, but am I the first one to try this? |
| 14:43 | Pupeno | We may be adopting clojure at my company. Any recommendations on a book for the devs that are not familiar with any lisp at all? |
| 14:44 | pbx | Pupeno, i've enjoyed the o'reilly book - http://shop.oreilly.com/product/0636920013754.do |
| 14:44 | pbx | it makes a lot of references to the popular dynamic languages (python, ruby) which helps many people |
| 14:47 | Pupeno | pbx: I think I'm sold, as my team knows python and ruby (one of our working languages) very well. |
| 14:50 | Pupeno | Oh, it's from 2012... still ok? |
| 14:50 | eriktjacobsen | Pupeno: https://leanpub.com/fp-oo |
| 14:51 | pbx | Pupeno, i'm told it is, yes |
| 14:51 | Jickelsen | Trying to use aget to access properties in React. Are there any gotchas I might've missed? (aget js/React "addons") returns nil, and I am including react-with-addons.js in the body before my compiled javascript |
| 14:51 | eriktjacobsen | it isn’t specific to clojure, but uses clojure as the example language. It is supplementary to learning clojure books, but it is better for the “mindset shift” from non function nonlisp programmers |
| 14:51 | dnolen | Pupeno: still OK, Clojure hasn't fundamentally changed significantly in this time. |
| 14:52 | dnolen | and honestly likely to be ok for years to come |
| 14:52 | dnolen | Jickelsen: there's a #clojurescript channel |
| 14:53 | Jickelsen | dnolen: Thanks! |
| 14:54 | Pupeno | Oh, this looks interesting: https://pragprog.com/book/cjclojure/mastering-clojure-macros |
| 14:54 | hellofunk | Pupeno: Joy of Clojure is also a good book |
| 14:55 | Pupeno | hellofunk: that's what I read, I still have the first edition. I felt that some parts of the book were only clear to me because I been toying with Common Lisp and Scheme for years though. |
| 14:55 | dnolen | Bronsa: so it appears I can use cljs.tools.reader to read all of core.cljs, the main thing I had to change was that read-keyword just seems wrong on master (for the obvious reason that resolve-ns and *ns* are not yet a thing in a ClojureScript release. |
| 14:56 | dnolen | I fixed this by just copy-pastaing read-keyword from Clojure version into ClojureScript version |
| 14:56 | Pupeno | Anybody read Living Clojure? http://shop.oreilly.com/product/0636920034292.do |
| 15:01 | mmeix | it's a friendly book for beginners, I find |
| 15:02 | Pupeno | It covers ClojureScript, which we do want to use. |
| 15:03 | jonathanj | i don't suppose there is a (format) syntax for converting keywords into names? |
| 15:04 | mmeix | ,(name :foo) |
| 15:04 | clojurebot | "foo" |
| 15:04 | mmeix | https://clojuredocs.org/clojure.core/name |
| 15:05 | jonathanj | so not then |
| 15:07 | mmeix | (I misunderstood the question?) |
| 15:09 | kwladyka | to learn something more I repair bug in https://github.com/cryogen-project/cryogen but I am not sure how to do that in Clojure, because I want repair this in https://github.com/cryogen-project/cryogen-core which is dependency but I need whole project to test it is working. |
| 15:09 | kwladyka | How to tell Clojure to use version from my disk during development? |
| 15:12 | mmeix | trying |
| 15:12 | mmeix | ,(format "Hey, %s" (name :foo)) |
| 15:12 | clojurebot | "Hey, foo" |
| 15:24 | sdegutis | To compare two #inst's do you just use java.util.Date methods? |
| 15:32 | sdegutis | Yep. Thanks. |
| 15:36 | gfredericks | as long as #inst is a java.util.Date in your system |
| 15:55 | jonathanj | should i pass a reader to a function? should that function use (with-open) or should the outer function do that? |
| 15:56 | jonathanj | i guess if the outer function does that, then i can avoid closing the reader before the lazy seq is fully consumed |
| 16:09 | justin_smith | jonathanj: generally, if you are doing lazy processing of any sort on the input, the innermost stage that knows whether you are done or not should also be in charge of closing the input. |
| 16:09 | justin_smith | jonathanj: you also don't have to use with-open, you can explicitly call close, and sometimes that is called for |
| 16:09 | kwladyka | how to change in procjt.clj :dependencies [[cryogen-core "0.1.22"]] into version on my harddrive? |
| 16:10 | justin_smith | kwladyka: you may want a lein checkout (see "lein checkout dependencies") but it's more reliable to use lein install to update the lib, and then use the locally installed version |
| 16:11 | justin_smith | but a checkout might be called for if you are doing extensive work in both the lib and your app together |
| 16:11 | kwladyka | my goal is to fix a bug inside cryogen-core |
| 16:11 | justin_smith | kwladyka: https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md#checkout-dependencies |
| 16:12 | justin_smith | but it might be easier to fix cryogen-core within that project using unit tests |
| 16:12 | kwladyka | maybe but only one way to be sure it works is test it in real situation |
| 16:12 | justin_smith | kwladyka: either way, if you change the version string in the cryogen-core project.clj then use lein install, you can then use that version in your app locally |
| 16:13 | kwladyka | yes, it can be one of option, but it can make some conflicts later |
| 16:14 | kwladyka | i guess |
| 16:14 | justin_smith | kwladyka: to use it locally, lein install is the easiest option. You can use a checkout, but lein install is the first step of using a checkout, so... |
| 16:15 | kwladyka | hmm i am working on windows and i don't have symlinks :P |
| 16:15 | justin_smith | oh man, that sucks |
| 16:15 | kwladyka | yes i know |
| 16:15 | kwladyka | many things on windows sucks... next time i will buy mac |
| 16:16 | justin_smith | have you considered using an ubuntu vm to develop in? even on a mac the folks on my team like to use ubuntu under vagrant for some stuff |
| 16:16 | kwladyka | in my country macs are more expensive then everywhere.... it is consequence of history and war, they just didn't change it after war |
| 16:17 | kwladyka | it is a little complicated |
| 16:17 | justin_smith | that sounds very frustrating. Maybe you should save up for a trip to the clojure conj and buy a mac while you are here in the US |
| 16:17 | kwladyka | but it was the reason why I didn't buy mac as a protest of this absurd |
| 16:18 | justin_smith | yeah, makes sense. I use linux instead, unless I need a mac for work (and work pays for it) |
| 16:18 | kwladyka | justin_smith, i were using vagrant a few years ago for a while and instead of coding i was loosing time on manage vagrant and system... |
| 16:19 | justin_smith | oh, I never had to spend much time managing it. Probably because I forget how hard linux was at first. |
| 16:19 | kwladyka | maybe something changed, but few years ago it has too many complication |
| 16:19 | kwladyka | i had many problems with things which weren't work on linux if i used vagrant, on clear linux works |
| 16:19 | kwladyka | but it was a few years ago |
| 16:20 | kwladyka | and even i don't remember what it was |
| 16:20 | kwladyka | ofcourse for everything i could find a solution |
| 16:20 | kwladyka | but still i loosing time |
| 16:20 | kwladyka | i spent aobut 7 years on linux in the past |
| 16:21 | kwladyka | but one day a decided back to windows, because linux always sucks with drivers and conflicts |
| 16:21 | kwladyka | for desktop |
| 16:21 | kwladyka | but windows is terrible for coding... |
| 16:22 | TimMc | I've been on Linux for the past 10 years. For the past 6 I haven't had serious driver issues. |
| 16:23 | kwladyka | but for desktop? i don't believe, i guess even now if you buy newest hardware linux wouldn't work with that |
| 16:24 | TimMc | Laptop. |
| 16:24 | justin_smith | kwladyka: I have had very few conflict or driver issues with linux - the exceptions being new hardware and unstable software |
| 16:24 | kwladyka | for my experience linux never works with new hardware |
| 16:24 | justin_smith | my solution was to buy a laptop with linux pre-installed, set up explicitly to run linux |
| 16:24 | TimMc | Thinkpads tend to work very well with Linux. |
| 16:25 | kwladyka | i have my own PC, i made it myself with hardware which i choose |
| 16:25 | TMA | kwladyka: the steps for flawless experience are: be friends with Linux kernel developers. ask them what laptop they have. buy the exact same one |
| 16:25 | kwladyka | and linux totally didn't have drivers for that hardware |
| 16:26 | TimMc | Or dual-boot. :-P |
| 16:26 | kwladyka | heh, i will just buy a mac next time :) |
| 16:26 | justin_smith | kwladyka: I think it's a little rough to blame linux for not supporting random hardware. I mean, it's not like the hardware vendors put any effort into making their shit work with linux. |
| 16:26 | kwladyka | i am a little sceptic about changes in linux |
| 16:26 | TimMc | TMA: Alternative plan: Give your favorite Linux kernel developer a "gift" of some hardware. ;-) |
| 16:26 | justin_smith | (inc TimMc) |
| 16:27 | kwladyka | justin_smith, of course but windows have drivers |
| 16:27 | TMA | TimMc: that's twice as expensive and not at all guaranteed to work |
| 16:27 | justin_smith | kwladyka: because the hardware vendor wrote those drivers |
| 16:27 | kwladyka | justin_smith, yes - that is the point |
| 16:27 | kwladyka | justin_smith, everything support windows, not linux |
| 16:29 | kwladyka | but last time when i used linux was... mmmm... 5-7 years ago |
| 16:29 | justin_smith | kwladyka: I have a laptop at home that has 32 gigs of ram, supports 5 external monitors, up to 4k resolution, has high quality built in audio, wifi, bluetooth, etc. etc. and it all worked with linux with 0 setup on my part, because I bought from a company that specilizes in making machines to run linux on. It's a couple years old now and the specs are still good. |
| 16:30 | justin_smith | kwladyka: still cheaper than a mac with worse specs |
| 16:30 | kwladyka | maybe things changed, when i was using linux in my country it was almost impossible to buy good laptop with linux. |
| 16:30 | katratxo | justin_smith: which company is that? |
| 16:31 | kwladyka | justin_smith, so don't you have MAC? |
| 16:31 | csd_ | Is there a function that will return the methods of an instantiated java object in clojure? |
| 16:31 | kwladyka | in USA you have always things faster, because you produce most of them :P |
| 16:32 | TimMc | kwladyka: Which is funny, because they're not even made here. |
| 16:32 | justin_smith | kwladyka: I use a mac at work, because they expect me to use one (and gave me one to use), I just leave it on the desk in my office |
| 16:32 | kwladyka | TimMc, yes, exactly |
| 16:33 | justin_smith | csd_: bean works for some stuff, otherwise there is clojure.reflect |
| 16:33 | justin_smith | ,(bean (java.util.Date.)) |
| 16:33 | kwladyka | justin_smith, why? i don't have too much experience with mac. Only basic. |
| 16:33 | clojurebot | #error {\n :cause "denied"\n :via\n [{:type java.lang.ExceptionInInitializerError\n :message nil\n :at [java.lang.reflect.Proxy$ProxyClassFactory apply "Proxy.java" 672]}\n {:type java.lang.SecurityException\n :message "denied"\n :at [clojurebot.sandbox$enable_security_manager$fn__835 invoke "sandbox.clj" 69]}]\n :trace\n [[clojurebot.sandbox$enable_security_manager$fn__835 invoke "sandbo... |
| 16:33 | justin_smith | it won't let me make a bean :( |
| 16:34 | blkcat | macs are pretty great when you're not the one paying for it ;p |
| 16:34 | TimMc | justin_smith: Error: Dates are not a type of bean, they're an entirely different family. |
| 16:34 | justin_smith | TimMc: it works locally, it's a clojurebot thing |
| 16:34 | csd_ | justin_smith: for the class i used it on. it just returns {:class <classname>} |
| 16:34 | justin_smith | oh, sorry, vegetable joke, of course |
| 16:34 | justin_smith | csd_: yeah, there is clojure.reflect for the rest |
| 16:35 | TimMc | csd_: org.timmc/handy has some reflection stuff |
| 16:35 | csd_ | ok-- id been looking at the java reflection libs and doesnt seem like it has anything |
| 16:35 | justin_smith | csd_: but java.util.Date is a good demo of what bean can do in the best case |
| 16:35 | TimMc | Do you just want it for development/debugging? |
| 16:35 | csd_ | debugging |
| 16:35 | csd_ | having trouble instantiating something |
| 16:35 | justin_smith | csd_: oh, it has *EVERYTHING*, and none of it is easy to use (but the TimMc stuff helps) |
| 16:35 | TimMc | org.timmc.handy.repl/show |
| 16:35 | kwladyka | do you thing lein checkout can work with direcotry with project instead of symlink ? ;) |
| 16:35 | kwladyka | *think |
| 16:36 | justin_smith | kwladyka: couldn't hurt to try |
| 16:36 | kwladyka | justin_smith, yes, i am trying to do that :) |
| 16:36 | TimMc | https://gist.github.com/timmc/1cd194b6ac5980a8c548 |
| 16:36 | justin_smith | kwladyka: but as I said, lein install works too (as does loading the edited source code in your repl, even from inside a different project) |
| 16:36 | csd_ | TimMc: sounds like what i need |
| 16:36 | csd_ | thanks |
| 16:36 | justin_smith | kwladyka: you don't need symlinks or subdirs for lein install to work |
| 16:37 | kwladyka | justin_smith, i will try this if checkout fails |
| 16:37 | TimMc | I use this thing constantly. One of tehbetter things I've hacked together. :-P |
| 16:37 | justin_smith | kwladyka: remember checkout won't work unless you run lein install with your modified project.clj version string |
| 16:38 | csd_ | TimMc: Can I just make it a dep in my profile? |
| 16:38 | TimMc | csd_: Yeah, in profiles.clj :user :dependencies I have [org.timmc/handy "1.7.0"] |
| 16:39 | csd_ | cool |
| 16:39 | TimMc | so it's available in all my REPLs |
| 16:39 | TimMc | that and criterium and tools.trace :-P |
| 16:41 | kwladyka | justin_smith, i am not sure how is it working or it doesn't work without symlink... |
| 16:41 | kwladyka | i created checkouts, put there crygoen-core |
| 16:42 | kwladyka | changed there version number and changed in :dependencies in main project.clj |
| 16:42 | justin_smith | kwladyka: first step is to modify the version string. Next, run lein install so that version is available in the local repo. Then put the symlink (or repo?) into your checkouts subdir |
| 16:42 | kwladyka | lein install from subproject or project? |
| 16:42 | justin_smith | subproject |
| 16:42 | kwladyka | so what checkouts gives? |
| 16:43 | kwladyka | it is the same like run that separate? |
| 16:43 | justin_smith | kwladyka: when you edit the code, the edited code is visible to your repl for reload |
| 16:43 | justin_smith | without having to restart the repl, or manually load the code |
| 16:43 | kwladyka | but after each change i have to do lein install? |
| 16:43 | kwladyka | is it work with lein ring server? |
| 16:43 | justin_smith | no, the point of checkouts is that you don't have to install |
| 16:44 | kwladyka | so why do i need this first time? how is it working? |
| 16:44 | justin_smith | it can't fulfill the checkout dep unless you run lein install so that it can find the pom |
| 16:44 | justin_smith | that's because checkouts are fundamentally a hack |
| 16:45 | justin_smith | but after that it should just work (until you change the version) |
| 16:45 | kwladyka | justin_smith, oh, now i think i understand |
| 16:45 | kwladyka | justin_smith, if it is a hack |
| 16:51 | csd_ | TimMc: why do you think i might be getting told no method found for <x> when i've confirmed that the method i'm trying to use does exist, is public, and that i'm using the correct function signature |
| 16:51 | csd_ | i don |
| 16:51 | csd_ | err |
| 16:51 | kwladyka | mmm how can i debug project with lein ring server. I want just see what is under variables, unfortunetly (ptrinln foo) doesn't show anything in console, i am not sure why |
| 16:52 | TimMc | csd_: Any primitives involved? Varargs? static/instance? |
| 16:52 | TimMc | Maybe post the method signature and the call you're trying to make. |
| 16:53 | csd_ | public CompiledScript compile(String js, boolean debug) throws InvalidJsException |
| 16:53 | csd_ | just trying to call (.compile obj "foo" true) , basically |
| 16:56 | TimMc | Looks fine, yeah. |
| 16:57 | csd_ | meanwhile I'm told IllegalArgumentException No matching method found for class, and yet i can look it up just fine with your code and see that that method does in fact exist |
| 16:57 | justin_smith | csd_: is it varargs? |
| 16:58 | csd_ | no |
| 16:58 | justin_smith | does it take an int? |
| 16:58 | csd_ | a string and a bool |
| 16:58 | justin_smith | what's the class? |
| 16:58 | csd_ | its just a business object |
| 17:00 | csd_ | there's this guice code scattered through the codebase, making it difficult to know what's going on, but i don't think it's affecting this particular code |
| 17:00 | TimMc | csd_: Freaky. Does the exception tell you what types it thought you were trying to use in the call? |
| 17:01 | justin_smith | TimMc: matching method not found never does that |
| 17:01 | justin_smith | because methods are dispatched by arg types |
| 17:01 | TimMc | aw |
| 17:01 | csd_ | http://pastebin.com/aaVxCVR6 |
| 17:01 | TimMc | ,(.flurb "" 5) |
| 17:01 | clojurebot | #error {\n :cause "No matching method found: flurb for class java.lang.String"\n :via\n [{:type java.lang.IllegalArgumentException\n :message "No matching method found: flurb for class java.lang.String"\n :at [clojure.lang.Reflector invokeMatchingMethod "Reflector.java" 53]}]\n :trace\n [[clojure.lang.Reflector invokeMatchingMethod "Reflector.java" 53]\n [clojure.lang.Reflector invokeInstance... |
| 17:01 | csd_ | that's the error |
| 17:02 | TimMc | Ghosts. |
| 17:02 | justin_smith | same error with real method but wrong types |
| 17:02 | justin_smith | ,(.getTime (java.util.Date.) "foo") |
| 17:02 | clojurebot | #error {\n :cause "No matching method found: getTime for class java.util.Date"\n :via\n [{:type java.lang.IllegalArgumentException\n :message "No matching method found: getTime for class java.util.Date"\n :at [clojure.lang.Reflector invokeMatchingMethod "Reflector.java" 53]}]\n :trace\n [[clojure.lang.Reflector invokeMatchingMethod "Reflector.java" 53]\n [clojure.lang.Reflector invokeInstance... |
| 17:03 | TimMc | justin_smith: Right, I guess it can't decide what the relevant ancestor of each argument's class is. |
| 17:03 | TimMc | (Is 5 an int, an Integer, or an Object?) |
| 17:05 | csd_ | yes |
| 17:07 | TimMc | csd_: Can you try invoking the method via reflection? Here's an example with String.indexOf: (.invoke (.getMethod String "indexOf" (into-array Class [String])) "foo" (into-array Object ["o"])) |
| 17:08 | TimMc | Use Boolean/TYPE for the boolean class. |
| 17:08 | csd_ | ok one sec |
| 17:09 | TimMc | csd_: (.invoke (.getMethod YourClass "compile" (into-array Class [String Boolean/TYPE])) obj (into-array Object ["foo" true])) |
| 17:09 | TimMc | sub in YourClass and obj |
| 17:10 | csd_ | (.invoke (.getMethod ApiJsCompiler "compile" (into-array Class [String Boolean/TYPE]) c (into-array Object ["foo" true]))) ? |
| 17:11 | TimMc | yeah |
| 17:11 | TimMc | You might try the getMethod separately at first, of course. |
| 17:12 | csd_ | says no such method |
| 17:12 | TimMc | And alternatively try replacing ApiJsCompiler with (class c) |
| 17:12 | TimMc | (just in case there are two versions of the class in play) |
| 17:13 | csd_ | same error |
| 17:13 | TimMc | Fascinating. |
| 17:13 | csd_ | words you dont want to hear :-P |
| 17:14 | TimMc | This is using *almost* the same code as produced that printout for you from handy/show. |
| 17:15 | justin_smith | csd_: do you find anything at all similar if you just use reflection to look at all the methods of the object? |
| 17:16 | csd_ | I think I just figured it out |
| 17:16 | csd_ | (show ApiJsCompiler) says for this method pub compile : String -> CompiledScript |
| 17:17 | justin_smith | no boolean arg? |
| 17:17 | csd_ | so then i tried not including the boolean and it its still throwing an exception but it's an exception thrown by the function |
| 17:17 | csd_ | so its ignoring the boolean arg i guess |
| 17:17 | TimMc | Where did the boolean come from? |
| 17:17 | justin_smith | sounds like there is no public method that takes the boolean |
| 17:18 | csd_ | TimMc: it's called 'debug' and this is legacy code i just started working on |
| 17:18 | TimMc | csd_: Oh... I thought the method signature you gave previously was the output of show. |
| 17:18 | csd_ | no that was copied from the java code |
| 17:18 | TimMc | Ah. |
| 17:18 | TimMc | So you're probably not working with the same version of the codebase or something like that. |
| 17:19 | csd_ | that could be potentially |
| 17:19 | csd_ | i'm working off jars that someone else put together |
| 17:20 | csd_ | thank you TimMc, justin_smith. good lessons for the future |
| 17:20 | TimMc | Such as not trusting the source? :-P |
| 17:20 | csd_ | trust nothing |
| 17:20 | TimMc | (Don't trust the REPL either. Don't trust anything.) |
| 17:20 | TimMc | (inc csd_) |
| 17:20 | justin_smith | (dec lazybot) |
| 17:21 | TimMc | (dec lazybot) ;; amalloy_ it done broke |
| 17:21 | TimMc | Especially don't trust bots. |
| 17:25 | lodin_ | Some years ago multimethods were (claimed) to be slow. Is that still true, if it ever was? My Java benchmarking skills are rather poor, so I don't trust my own observations, but it doesn't seem like the performance is that bad. |
| 17:27 | justin_smith | lodin_: bad is always relative to some need, go ahead and use multimethods, and if you have a performance problem just remember they are one thing you could look out for. They are slower than a regular function call (slightly), or a protocol invocation (by a bit more), but they are likely just fine for a typical use case |
| 17:32 | lodin_ | justin_smith: I know this question is flawed, but would you dare to guestimate in what range the increase in execution time would lie if all functions were turned into multimethods with only one implementation (:default), in a (pure) non-trivial data transformation application? |
| 17:33 | lodin_ | justin_smith: 1%? 10%? 100%? |
| 17:33 | TimMc | lodin_: I think that would be a fun exercise with a shell script. |
| 17:34 | TimMc | You could take an existing codebase and transform it to that. |
| 17:34 | justin_smith | lodin_: the flaw is that it's a change in the time it takes the thing to dispatch - normally that is only a small percentage of your execution time, but that totally depends on your method and what all it is trying to do |
| 17:35 | justin_smith | so the bigger your methods are / the more intense the calculations they must do, the less expensive (relatively) the dispatch is as a percentage of your runtime |
| 17:35 | lodin_ | TimMc: Maybe even just refer my own defn after the ns form. |
| 17:35 | justin_smith | lodin_: check out criterium, it really helps for this kind of micro-benchmarking stuff |
| 17:36 | justin_smith | eg. compare calling a function vs. using a multimethod, where both have the same body and do some configurable amount of work |
| 17:38 | lodin_ | justin_smith: OK, thanks. I'll check it out. |
| 18:13 | cfleming | Can anyone recommend a good IRC channel for diagnosing Java certificate issues? I have a new cert which the JVM isn't trusting, and it's not apparent why. |
| 18:14 | justin_smith | cfleming: sounds like something someone on ##java would know the answer to |
| 18:14 | cfleming | justin_smith: Thanks, I'll try that |
| 18:14 | xemdetia | cfleming, did you put all the roots and intermediates? |
| 18:15 | xemdetia | is it signed by Verisign group ca 2 and did you not get rid of the md2 duplicate |
| 18:15 | cfleming | xemdetia: Yeah - I'm on a chat with Digicert, we can't work out why it's failing. SSLLabs says everything is hunky dory, and Firefox likes it too. |
| 18:16 | cfleming | But JDK 1.6 on OSX doesn't for some reason, even though the CA root cert is in cacerts |
| 18:16 | xemdetia | what is the CA |
| 18:16 | cfleming | DigiCert |
| 18:16 | xemdetia | yeah welcome to the md2 problem |
| 18:16 | cfleming | What's the md2 problem? |
| 18:16 | xemdetia | what is the full CN of the root you had it signed by |
| 18:16 | xemdetia | verisign had an old certificate that they had to reissue because it was signed by md12 |
| 18:17 | xemdetia | but some javas have it lying around in a keystore |
| 18:17 | xemdetia | or worse have both entries |
| 18:17 | TimMc | ##java? Good luck; don't die. |
| 18:17 | xemdetia | but give me the full CN and I can tell if it is the same one |
| 18:17 | xemdetia | or dpaste a full cert verify |
| 18:17 | cfleming | How do I get a cert verify? |
| 18:18 | xemdetia | is it publically accessible? |
| 18:18 | cfleming | Yeah, it's on https://cursiveclojure.com |
| 18:19 | cfleming | It's an EV cert, according to DigiCert it seems to be set up correctly. |
| 18:19 | xemdetia | okay so it is not the md2 |
| 18:19 | xemdetia | there is another digicert that goes through verisign for some reason |
| 18:20 | xemdetia | did you store the leaf, intermediate and root to be served by your https server in the keystore |
| 18:21 | cfleming | In which keystore? This should be trusted by the JDK |
| 18:21 | xemdetia | Both the root and the intermediate are really new, it's possible jdk 1.6 on osx just doesn't know it exists |
| 18:22 | cfleming | It does have the DigiCert High Assurance EV Root CA |
| 18:22 | xemdetia | but does it have the intermediate |
| 18:23 | cfleming | That's a good question |
| 18:23 | cfleming | Does it need it? Surely it only needs to know the root and then it can follow the chain? |
| 18:24 | xemdetia | cfleming, validation of certificates is a client side act |
| 18:24 | xemdetia | if it doesn't have the intermediate, or the server does not send it |
| 18:24 | xemdetia | it can't complete the chain of trust/integrity |
| 18:24 | cfleming | The server should be sending it |
| 18:24 | TimMc | cfleming: It needs everything but the root. (And the root needs to already be in your truststore.) |
| 18:25 | cfleming | I'm pretty sure the server is sending the intermediate, how can I check that? |
| 18:25 | xemdetia | it's often easier on the server side to just make your own keystore that is only the certificates that actually matter |
| 18:25 | xemdetia | and just tell java to use that |
| 18:26 | cfleming | Unfortunately I'm not using Java on the server, it's nginx |
| 18:27 | xemdetia | same difference |
| 18:27 | xemdetia | cat a bunch of pem's together |
| 18:27 | xemdetia | same as a keystore |
| 18:27 | cfleming | I've done that. |
| 18:27 | xemdetia | does java osx know how to do sha256 |
| 18:28 | xemdetia | during verify for that version |
| 18:28 | xemdetia | I don't know how old is old |
| 18:29 | xemdetia | yeah it is not sending the intermediate |
| 18:30 | cfleming | How can I see that? |
| 18:30 | xemdetia | openssl s_client -connect www.cursiveclojure.com:443 -showcerts |
| 18:31 | xemdetia | It's only sending me the first certificate- compare that output to just good ol' openssl s_client -connect www.google.com:443 -showcerts |
| 18:31 | TimMc | I'm a little alarmed that Digicert's support didn't point this out. |
| 18:32 | xemdetia | be warned s_client will return bad verifications in nearly every setup even if it is working |
| 18:32 | cfleming | TimMc: When I started chatting to them an hour ago, he said the intermediate was being sent |
| 18:35 | xemdetia | cfleming, it's entirely possible something got touched but I certainly am not seeing it |
| 18:35 | xemdetia | openssl s_client -connect -showcerts is the command of the hour |
| 18:36 | cfleming | DigiCert have an SSL checker which claims it's being sent: https://www.digicert.com/help/index.htm?host=cursiveclojure.com |
| 18:36 | cfleming | Although I tend to believe openssl |
| 18:37 | xemdetia | I'm confused, there's nothing on that page that indicates to me that it is being sent |
| 18:37 | xemdetia | I think this is one of those cases where the DigiCert SHA2 Extended Validation Server CA is now commonly accepted to be in trusted keystores and just isn't for OS X java 7 |
| 18:38 | xemdetia | java 6* |
| 18:38 | xemdetia | I mean it is in my firefox ETS |
| 18:38 | xemdetia | *ESR |
| 18:40 | cfleming | That sounds like the problem. So instead of sending my public crt, I should be sending a PEM consisting of that and the intermediate? |
| 18:40 | xemdetia | cfleming, yes- http://nginx.org/en/docs/http/configuring_https_servers.html it looks like there is a part just for you under the heading SSL certificate chains |
| 18:41 | xemdetia | I apologize for getting my ##openssl in your #clojure :) |
| 18:42 | cfleming | I should be apologising, it's all my fault :-) |
| 18:42 | cfleming | Thanks xemdetia, that was amazingly helpful. |
| 18:42 | xemdetia | for further certificate issues ##openssl isn't a bad place for me to accidentally help |
| 18:43 | xemdetia | :) |
| 18:44 | cfleming | I'll be sure to ask there next time :-) |
| 18:58 | cfleming | xemdetia: That's fixed the problem - thanks! It's much appreciated. |
| 18:58 | xemdetia | anytime |
| 20:24 | thearthur | is there a type specific java array producing convenience for strings ala int-array or byte-array? |
| 21:26 | cryptack | hey, I tried this question in the past, but was unable to get much help…I have an odd issue on my Mac where tab completion isn’t working in the repl (using Leiningen 2.5.1 on Java 1.8)…anyone else experience this issue? |
| 21:29 | andyf_ | thearthur: make-array can create an array of any desired Java object type |
| 22:24 | tmtwd | in clojure, how would we call the function artist.draw();? |
| 22:24 | tmtwd | (draw artist) would be the equivalent of draw(artist); |
| 22:36 | gfredericks | tmtwd: that's a lot of the difference between OOP and FP; you write a function instead of a method on a class |
| 22:36 | tmtwd | i see |
| 22:37 | tmtwd | but what if you are interoperating with javacode? |
| 22:37 | gfredericks | oh well then |
| 22:37 | gfredericks | (.draw artist) |
| 22:37 | gfredericks | :) |
| 22:37 | gfredericks | "java interop" is special in a few different ways in clojure |
| 23:04 | mindbender1 | I'm having difficulty importing goog.History. How can I achieve this. (ns foo.baz (:import [goog History])) does not achieve this. |
| 23:31 | justin_smith | mindbender1: in cljs you can actually require js libs |
| 23:33 | mindbender1 | justin_smith: I want to be able to use it like (History.) but I was not able to achieve this. |
| 23:34 | mindbender1 | I had to do (:import goog.History) before it could even pull it from the jar. |
| 23:35 | justin_smith | if (:import goog.History) worked, I am surprised that (:import [goog History]) did not |
| 23:35 | mindbender1 | I'm even more so. |
| 23:36 | mindbender1 | Unless it's working right now at your end? |
| 23:36 | justin_smith | I have a project where I use the (:import goog.History) version, I am going to try it with the other right now |
| 23:37 | mindbender1 | Cool. I'll be pleased to here your situation. |
| 23:37 | mindbender1 | *hear |
| 23:37 | justin_smith | does it fail on cljsbuild, or on page load? |
| 23:38 | justin_smith | because cljsbuild is not showing me any error |
| 23:39 | justin_smith | ugh, this project won't start up normal because I can't access the db, maybe I'll get back to you about it tomorrow |
| 23:39 | justin_smith | sorry |
| 23:40 | justin_smith | don't feel like setting up a tunnel through work atm |
| 23:46 | mindbender1 | justin_smith: okay. No p. I also just observed from the cljs-http project that doing just (:import goog.Uri) is enough to use like (Uri.) right from inside the file but not from the repl. |
| 23:47 | justin_smith | mindbender1: well, it would only work if your repl was in the importing namespace |
| 23:47 | justin_smith | import is specific to a namespace (maybe you realize this already) |
| 23:48 | justin_smith | mindbender1: also the (:import whatever.what) form only works inside an ns form |
| 23:48 | mindbender1 | justin_smith: it doesn't work for me when my repl is in the importing ns. |
| 23:48 | justin_smith | it silently does nothing outside the ns form |
| 23:48 | justin_smith | ,(:import 'this-doesnt.exist) |
| 23:48 | clojurebot | nil |
| 23:49 | justin_smith | ,(import 'this-doesnt.exist) |
| 23:49 | clojurebot | #error {\n :cause "this-doesnt.exist"\n :via\n [{:type java.lang.ClassNotFoundException\n :message "this-doesnt.exist"\n :at [java.net.URLClassLoader$1 run "URLClassLoader.java" 366]}]\n :trace\n [[java.net.URLClassLoader$1 run "URLClassLoader.java" 366]\n [java.net.URLClassLoader$1 run "URLClassLoader.java" 355]\n [java.security.AccessController doPrivileged "AccessController.java" -2]\n [... |
| 23:50 | mindbender1 | I have been trying it out now for several minutes now I guess I'll just use the FQN version. |
| 23:50 | justin_smith | ,(import '(java.util Date)) |
| 23:50 | clojurebot | java.util.Date |
| 23:50 | justin_smith | that's the repl version |
| 23:52 | mindbender1 | justin_smith: I suspect it's because the location of that file does not match the segments in the provide symbol. |
| 23:52 | justin_smith | interesting... |
| 23:52 | mindbender1 | whereas a symbol like goog.net.XhrIo does |