2017-02-23
| 04:31 | Rovanion | Why do we call them symbols instead of names? |
| 04:31 | dysfun | symbol is accepted terminology. also name is taken for the part that isn't the namespace |
| 04:36 | osfabibisi | is there already something like: (defn and->> [f value] (doto value f)) |
| 04:37 | osfabibisi | e.g. to run something parenthetically, returning the original value unchanged. |
| 04:38 | osfabibisi | e.g. https://gist.github.com/HakimCassimallyBBC/10fdaec1d1907e758e92403933ada0c8 |
| 04:41 | Rovanion | I tend to define a transparent print which returns the printed value in the case of println. But to answer your question: No idea. |
| 04:42 | osfabibisi | yeah, we're doing a fair bit of (defn some-side-effecting-thing [side-effect-input passthrough] (do-something-to side-effect-input) passthrough) |
| 04:42 | osfabibisi | but you can rework that into a function that takes the passthrough and does something with it (or ignores it, doing something else ;-) |
| 04:43 | Rovanion | Oh yeah absolutely. |
| 04:44 | dysfun | osfabibisi: doto ? |
| 04:44 | dysfun | ,(doto 123 prn) |
| 04:44 | clojurebot | 123\n123 |
| 04:44 | osfabibisi | dysfun: yeah, essentially the function in my gist does a doto |
| 04:45 | dysfun | oh i missed that, haven't woken up properly |
| 04:45 | osfabibisi | it's just slightly wrapping it to avoid a layer or so of parentheses in the caller (and making it easier to remember which way round to put the function depending on whether you're in a -> or a ->>) |
| 04:49 | dysfun | (defmacro &-> [value & fs] `(let [v# ~value] (doto v# (some-> v# ~@fs)))) |
| 04:50 | osfabibisi | what's the advantage of wrapping in a macro here? |
| 04:50 | osfabibisi | and why some-> ? |
| 04:50 | osfabibisi | I like the &-> name, ta |
| 04:50 | osfabibisi | ah, you're chaining multiple functions |
| 04:50 | dysfun | well i'm expanding to some-> which is a macro, so it has to be a macro |
| 04:51 | dysfun | and i choose that because i'm guessing at your desired underspecced behaviour :p |
| 04:51 | osfabibisi | hehe |
| 04:51 | osfabibisi | I'm not certain we need that, but I'll make a note for when we do :D |
| 04:52 | dysfun | well my gut tells me you only want it for println |
| 04:52 | dysfun | in which case copy `?` out of useful |
| 04:52 | osfabibisi | nope, commit'ing sync-point in kafka queues too |
| 04:52 | dysfun | oh, cool |
| 05:14 | Hanonim | do you always gpg sign your stuff when publishing to clojars ? |
| 05:15 | dysfun | clojars won't accept it if you don't |
| 05:19 | Hanonim | oh |
| 05:19 | Hanonim | i supposed it's best to use a key that never expire ? |
| 05:19 | dysfun | perhaps better to have proper key rotation procedures |
| 05:20 | osfabibi_ | do old dists stop being installable if you change your key? |
| 05:21 | dysfun | no |
| 05:21 | dysfun | once you have pushed them to clojars with a valid gpg signature, they are there til you delete them |
| 05:22 | dysfun | i suspect it just needs a nice gui |
| 05:22 | osfabibisi | so all it proves is that someone once had a gpg-key? |
| 05:22 | osfabibisi | well, the command-line part of `pass` is fine |
| 05:22 | dysfun | it proves that it has not been tampered with since upload |
| 05:23 | osfabibisi | it's just that everyone has to update their keys every time we get a new starter, which I suspect isn't the best way but haven't cared enough to understand how to do it better |
| 05:23 | dysfun | hah. so i have a project that solves this one |
| 05:23 | dysfun | but it's not finished yet |
| 05:24 | Hanonim | what do you mean by key rotation in this context ? |
| 05:24 | Hanonim | if my current key expires, what happens ? |
| 05:24 | dysfun | you rotate to a new key |
| 05:25 | Hanonim | yes but is the work signed with the old key still accessible ? |
| 05:25 | dysfun | at which point you will experience nothing probably. if your org has security turned up, they'll be checking the artifact signatures and reject an unknown key |
| 05:25 | dysfun | yes, it will remain accessible |
| 05:25 | dysfun | the user will get a warning the key is expired |
| 05:25 | dysfun | but it's not |
| 05:26 | dysfun | only writing it is hard |
| 05:26 | osfabibisi | every time our secure certs run out at work, it takes about a month to get everything working |
| 05:26 | Hanonim | so i could, let's say every year, complete delete my old key and simply gen a new one ? |
| 05:26 | dysfun | yes. many people do |
| 05:26 | osfabibisi | e.g. converting things from pem to p12 or vice-versa, figuring out how to extract them without passwords for svn etc. |
| 05:26 | dysfun | ah yes. that's all fun |
| 05:26 | dysfun | at some point i should write something to de-tedium this |
| 05:27 | osfabibisi | there are a million instructions on how to openssl convert things on our internal wiki |
| 05:27 | osfabibisi | some of which work for the particular circumstance you're trying to convert... |
| 05:27 | osfabibisi | (of course actually *understanding* what you're doing would make it easier...) |
| 05:27 | dysfun | they need to hear about how wonderful ACME is |
| 05:27 | osfabibisi | acme? |
| 05:27 | dysfun | the protocol letsencrypt uses |
| 05:28 | dysfun | your employer should install an acme server |
| 05:28 | osfabibisi | I thought that was a free https cert provider? |
| 05:28 | dysfun | they are, yes |
| 05:28 | dysfun | but acme is the protocol your client speaks to the server |
| 05:29 | dysfun | you just run a little command on the server and boom, new updates |
| 05:29 | dysfun | restart apache, done |
| 05:29 | osfabibisi | don't you need to e.g. update httpd.conf and such? |
| 05:29 | dysfun | if the filenames are the same and the keys haven't changed types, why? |
| 05:30 | osfabibisi | ah you mean you only have to do that *once*? |
| 05:30 | dysfun | yes |
| 05:30 | dysfun | great isn't it? |
| 05:38 | redpoppies | hello, everyone |
| 05:38 | dysfun | hello |
| 05:39 | redpoppies | can anyone help with converting the following to clojure? : https://gist.github.com/rredpoppy/c453400fbf4b9a15ca6fe4ad18f28f42 |
| 05:39 | redpoppies | hello @dysfun |
| 05:39 | dysfun | you don't need to use an @ here :) |
| 05:39 | redpoppies | we meet again:) |
| 05:39 | redpoppies | ok |
| 05:39 | dysfun | okay, what have you written so far? |
| 05:40 | redpoppies | I am at loss about typecasting |
| 05:40 | dysfun | well for the most part you don't need to. it's all Object to clojure |
| 05:41 | redpoppies | doing (.. ^WSBindingProvider pt (setOutboundHeaders some-headres)) |
| 05:41 | dysfun | you can use type hints to avoid reflection (which slows things down) |
| 05:41 | redpoppies | doesn't work, it says no such method |
| 05:41 | redpoppies | as the pt binding is not typecast |
| 05:42 | redpoppies | yeah, I am guessing the "for the most part" doesn't work |
| 05:43 | dysfun | i don't really use .. tbh |
| 05:43 | dysfun | not sure i can help |
| 05:43 | redpoppies | I am not sure I get this "it's all object to Clojure" part |
| 05:45 | dysfun | there's type erasure. a lot of the checking of java is done by the java compiler. clojure either sees a primitive or Object |
| 05:45 | dysfun | and java generics are a complete compiler fiction, because their contents are all Object |
| 05:46 | Para^-^ | Fiction written by Martin Odersky, of all people even. |
| 05:46 | dysfun | clojure just bypasses the java compiler and generates jvm bytecode so it doesn't care |
| 05:46 | luma | well, in a perfect type system, all types could be erased at runtime... |
| 05:46 | luma | (static type system) |
| 05:46 | dysfun | sure, if you want to lose replabiilty |
| 05:47 | dysfun | that was one of the tradeoffs i didn't like about pony |
| 05:53 | redpoppies | so, any idea for my concrete example? |