This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-01-14
Channels
- # announcements (6)
- # architecture (5)
- # aws (4)
- # beginners (79)
- # boot (3)
- # boot-dev (7)
- # calva (21)
- # cider (17)
- # cljdoc (12)
- # clojure (83)
- # clojure-art (2)
- # clojure-belgium (2)
- # clojure-brasil (1)
- # clojure-estonia (2)
- # clojure-europe (3)
- # clojure-finland (5)
- # clojure-india (2)
- # clojure-italy (49)
- # clojure-losangeles (1)
- # clojure-nl (12)
- # clojure-spec (120)
- # clojure-sweden (2)
- # clojure-switzerland (4)
- # clojure-uk (31)
- # clojurescript (80)
- # data-science (17)
- # datavis (2)
- # datomic (31)
- # emacs (31)
- # figwheel-main (28)
- # fulcro (6)
- # jobs (2)
- # liberator (7)
- # luminus (1)
- # nrepl (2)
- # off-topic (51)
- # overtone (2)
- # pathom (4)
- # re-frame (28)
- # reitit (1)
- # rum (6)
- # shadow-cljs (26)
- # specter (2)
- # tools-deps (33)
- # yada (3)
Classes are not constants
condp with = is a good match for this though
I'm getting this when I run 'clj' on a fresh linux install.
cp: cannot stat 'PREFIX/example-deps.edn': No such file or directory
ok so I found in old slack logs its to do with a botched clojure install
I can't get it installed though. If I remove the install from linuxbrew then it gives me. bash: /home/linuxbrew/.linuxbrew/bin/clj: No such file or directory
but if I use brew I get the other error.
Is there not a clojure package in your distro's package manger?
I managed to fix it. I completely removed linuxbrew and followed instructions on Linux install on Clojure website
Glad to hear, but that may not be necessary if your distro has a package for it. The method on the website is manual updating
are there core functions/macros that do something similar to this ones I've made
(defmacro anon-proxy
[draw-fn]
`(fn [& ~'args]
(apply ~draw-fn ~'args)))
(defmacro map-keyed
{:style/indent :defn}
[& args]
`(->> (list ~@args)
(interleave (map keyword '(~@args)))
(apply hash-map)))
the first is for live coding with some libraries since you have to have function that calls the one you'll be re-deffing
vars can be invoked and when done, will invoke the function they hold. so I think they already serve this purpose and on the caller side if you just invoked the var, you could change the var binding as much as you want.
the second is to just get a key/value from a collection of symbols that are in scope.
Is there a generic-ish way to transform stateful systems in functional ones? Namely, I have a server serving a complicated stateful protocol (Wayland to be precise), and would like to read some guide or a war story of turning these webs-of-mutating-objects into something more manageable.
I’m having some fun with the cognitect AWS library, specifically with the KMS functions.. is there a good place to ask questions around this..?
{"__type" "InvalidCiphertextException", :cognitect.anomalies/category :cognitect.anomalies/incorrect}
< trying to find out what this means
this info gave me enough to check the Java SDK API docs:
https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/kms/model/DecryptRequest.html#setCiphertextBlob-java.nio.ByteBuffer-
and it looks like it takes a java.nio.ByteBuffer
is there ways people work around the fact that strings and other primitives don’t implement IMeta? For a similar use case as REBL I’d like to allow different viewers for data and I’d like this to work for strings and numbers as well…
{:status 200,
:headers {"Content-Type" "application/json; charset=utf-8", "Vary" "Accept", "Content-Length" "44"},
:body #object[java.io.BufferedInputStream 0x109943d3 "java.io.BufferedInputStream@109943d3"]}
How do you show maps with objects like in this example, but converted to the value (string) I need it for developing purposeBut I don’t want to do it on :body
. I would like to have fn
like (show-me-values m)
. Perhaps such function doesn’t exist 🙂
What buddy
exactly add on top of ring
sessions
? http://funcool.github.io/buddy-auth/latest/#session ? It doesn’t look like it is adding something special, but maybe I miss something.
Asking in different way: I need to make sessions based on DB, I am thinking about https://github.com/clojusc/ring-redis-session . Does it make sense to glue it in some way with buddy
?
@kwladyka aren't ring sessions
just for authentication? Buddy seems to give you authorization too
I am trying to figure out if buddy
is something for me or not. What I can use from there.
I don’t see too much benefits while I am using liberator
, but maybe I miss something. Am I miss something?
any advice on how to parse this string (read-string "09")... It's an invalid number, was gonna maybe strip zero's but if there's anything less complicated, i'd love to know 🙂
java.lang.NumberFormatException: Invalid number: 09
read-string
is not safe
(read-string "#=(prn :code-injection)")
Prefer edn/read-string
But sure, to parse a number, you can use Long
or (bigdec "09")
read-string cannot recognize a decimal number headed with 0, but it recognizes "00" - "07", why? they're considered as octal ones
(read-string "#=(slurp \"/etc/passwd\")")
What do you use for sessions in clouds with solution like kubernetes? redis
to store sessions? sessionAffinity
? I think the best solution is redis
, but maybe I am in mistake 🙂 What do you use to store sessions and why?
I've used Redis for session stores all the way back to my Ruby on Rails days, so I just use the same thing in clojure apps.
But... my new app uses a datomic db. So I could probably just use that. But I'm also using redis for a message queue, so, why not... If it ain't broke.
yeah... i presume redis is faster. But then again, I'm storing a session key and a user id value, and then looking the user up in datomic anyways.
@jdkealy for temporary session-state type things, redis would be a better fit than datomic
datomic is best used as a system of record. for sessions that you want to throw away after 30 mins or whatever, you're going to end up growing your database very quickly and probably don't need a lot of what datomic brings to the table (at the cost of increased overhead)
Best way to implement first-and-only
, which checks that there is only one item in coll, and throws otherwise?
(first-and-only [1]) => 1
(first-and-only []) => Exception
(first-and-only [1 2 3]) => Exception
(first-and-only nil) => Exception
(first-and-only 1) => Exception
(first-and-only [nil]) => nil
(first-and-only [nil nil]) => Exception
(defn first-and-only [x]
(if (coll? x)
(if (and (seq x)
(next x)
(first x))
(throw (Exception. "too many"))
(first x))
(throw (Exception. "not a coll"))))
is close, but for instance, wouldn't catch the scenario where the next
element is nil
Can’t you just count and see if it has 1 item in it?
why not?
ah that’s fair
There’s bounded-count
(defn first-and-only [x]
(if (coll? x)
(let [bc (bounded-count 1 x)]
(condp = bc
0 (throw (Exception. "not enough"))
1 (first x)
(throw (Exception. "too many")) ))
(throw (Exception. "not a collection"))))
bleep bloop