#clojure logs

2017-02-23

04:31RovanionWhy do we call them symbols instead of names?
04:31dysfunsymbol is accepted terminology. also name is taken for the part that isn't the namespace
04:36osfabibisiis there already something like: (defn and->> [f value] (doto value f))
04:37osfabibisie.g. to run something parenthetically, returning the original value unchanged.
04:38osfabibisie.g. https://gist.github.com/HakimCassimallyBBC/10fdaec1d1907e758e92403933ada0c8
04:41RovanionI tend to define a transparent print which returns the printed value in the case of println. But to answer your question: No idea.
04:42osfabibisiyeah, we're doing a fair bit of (defn some-side-effecting-thing [side-effect-input passthrough] (do-something-to side-effect-input) passthrough)
04:42osfabibisibut you can rework that into a function that takes the passthrough and does something with it (or ignores it, doing something else ;-)
04:43RovanionOh yeah absolutely.
04:44dysfunosfabibisi: doto ?
04:44dysfun,(doto 123 prn)
04:44clojurebot123\n123
04:44osfabibisidysfun: yeah, essentially the function in my gist does a doto
04:45dysfunoh i missed that, haven't woken up properly
04:45osfabibisiit'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:49dysfun(defmacro &-> [value & fs] `(let [v# ~value] (doto v# (some-> v# ~@fs))))
04:50osfabibisiwhat's the advantage of wrapping in a macro here?
04:50osfabibisiand why some-> ?
04:50osfabibisiI like the &-> name, ta
04:50osfabibisiah, you're chaining multiple functions
04:50dysfunwell i'm expanding to some-> which is a macro, so it has to be a macro
04:51dysfunand i choose that because i'm guessing at your desired underspecced behaviour :p
04:51osfabibisihehe
04:51osfabibisiI'm not certain we need that, but I'll make a note for when we do :D
04:52dysfunwell my gut tells me you only want it for println
04:52dysfunin which case copy `?` out of useful
04:52osfabibisinope, commit'ing sync-point in kafka queues too
04:52dysfunoh, cool
05:14Hanonimdo you always gpg sign your stuff when publishing to clojars ?
05:15dysfunclojars won't accept it if you don't
05:19Hanonimoh
05:19Hanonimi supposed it's best to use a key that never expire ?
05:19dysfunperhaps better to have proper key rotation procedures
05:20osfabibi_do old dists stop being installable if you change your key?
05:21dysfunno
05:21dysfunonce you have pushed them to clojars with a valid gpg signature, they are there til you delete them
05:22dysfuni suspect it just needs a nice gui
05:22osfabibisiso all it proves is that someone once had a gpg-key?
05:22osfabibisiwell, the command-line part of `pass` is fine
05:22dysfunit proves that it has not been tampered with since upload
05:23osfabibisiit'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:23dysfunhah. so i have a project that solves this one
05:23dysfunbut it's not finished yet
05:24Hanonimwhat do you mean by key rotation in this context ?
05:24Hanonimif my current key expires, what happens ?
05:24dysfunyou rotate to a new key
05:25Hanonimyes but is the work signed with the old key still accessible ?
05:25dysfunat 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:25dysfunyes, it will remain accessible
05:25dysfunthe user will get a warning the key is expired
05:25dysfunbut it's not
05:26dysfunonly writing it is hard
05:26osfabibisievery time our secure certs run out at work, it takes about a month to get everything working
05:26Hanonimso i could, let's say every year, complete delete my old key and simply gen a new one ?
05:26dysfunyes. many people do
05:26osfabibisie.g. converting things from pem to p12 or vice-versa, figuring out how to extract them without passwords for svn etc.
05:26dysfunah yes. that's all fun
05:26dysfunat some point i should write something to de-tedium this
05:27osfabibisithere are a million instructions on how to openssl convert things on our internal wiki
05:27osfabibisisome of which work for the particular circumstance you're trying to convert...
05:27osfabibisi(of course actually *understanding* what you're doing would make it easier...)
05:27dysfunthey need to hear about how wonderful ACME is
05:27osfabibisiacme?
05:27dysfunthe protocol letsencrypt uses
05:28dysfunyour employer should install an acme server
05:28osfabibisiI thought that was a free https cert provider?
05:28dysfunthey are, yes
05:28dysfunbut acme is the protocol your client speaks to the server
05:29dysfunyou just run a little command on the server and boom, new updates
05:29dysfunrestart apache, done
05:29osfabibisidon't you need to e.g. update httpd.conf and such?
05:29dysfunif the filenames are the same and the keys haven't changed types, why?
05:30osfabibisiah you mean you only have to do that *once*?
05:30dysfunyes
05:30dysfungreat isn't it?
05:38redpoppieshello, everyone
05:38dysfunhello
05:39redpoppiescan anyone help with converting the following to clojure? : https://gist.github.com/rredpoppy/c453400fbf4b9a15ca6fe4ad18f28f42
05:39redpoppieshello @dysfun
05:39dysfunyou don't need to use an @ here :)
05:39redpoppieswe meet again:)
05:39redpoppiesok
05:39dysfunokay, what have you written so far?
05:40redpoppiesI am at loss about typecasting
05:40dysfunwell for the most part you don't need to. it's all Object to clojure
05:41redpoppiesdoing (.. ^WSBindingProvider pt (setOutboundHeaders some-headres))
05:41dysfunyou can use type hints to avoid reflection (which slows things down)
05:41redpoppiesdoesn't work, it says no such method
05:41redpoppiesas the pt binding is not typecast
05:42redpoppiesyeah, I am guessing the "for the most part" doesn't work
05:43dysfuni don't really use .. tbh
05:43dysfunnot sure i can help
05:43redpoppiesI am not sure I get this "it's all object to Clojure" part
05:45dysfunthere's type erasure. a lot of the checking of java is done by the java compiler. clojure either sees a primitive or Object
05:45dysfunand java generics are a complete compiler fiction, because their contents are all Object
05:46Para^-^Fiction written by Martin Odersky, of all people even.
05:46dysfunclojure just bypasses the java compiler and generates jvm bytecode so it doesn't care
05:46lumawell, in a perfect type system, all types could be erased at runtime...
05:46luma(static type system)
05:46dysfunsure, if you want to lose replabiilty
05:47dysfunthat was one of the tradeoffs i didn't like about pony
05:53redpoppiesso, any idea for my concrete example?