This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-12-10
Channels
- # 100-days-of-code (2)
- # adventofcode (188)
- # aleph (3)
- # announcements (2)
- # beginners (76)
- # boot (3)
- # braveandtrue (49)
- # cider (82)
- # clara (15)
- # clojure (101)
- # clojure-europe (4)
- # clojure-india (3)
- # clojure-italy (26)
- # clojure-kc (1)
- # clojure-nl (4)
- # clojure-norway (1)
- # clojure-russia (5)
- # clojure-uk (33)
- # clojurescript (32)
- # crypto (20)
- # cursive (34)
- # datomic (45)
- # emacs (3)
- # events (1)
- # figwheel (1)
- # figwheel-main (10)
- # fulcro (30)
- # graphql (14)
- # hoplon (12)
- # hyperfiddle (21)
- # jobs (11)
- # kaocha (7)
- # klipse (8)
- # leiningen (10)
- # luminus (3)
- # nrepl (18)
- # off-topic (232)
- # onyx (8)
- # pathom (6)
- # re-frame (30)
- # reagent (3)
- # reitit (6)
- # remote-jobs (3)
- # ring-swagger (4)
- # shadow-cljs (21)
- # spacemacs (5)
- # sql (18)
- # tools-deps (23)
- # yada (2)
Hi everyone. I have a ClojureScript (reagent) application and I would like to add some server side rendering to it for a better support for SEO and etc. Ideally, I’d like to create an isomorphic site. I was looking at http://blog.testdouble.com/posts/2016-01-21-isomorphic-clojurescript and most likely I’ll proceed with this. but just wanted to ask, perhaps there’s a framework already out there that solves this?
datafy question: If we datafy an object to produce a map, should the keys be symbols, keywords or namespaced keywords (or doesn't it matter?)
all of those are data so doesn’t matter to datafy
Is there a convention?
no, but I think a map with keyword keys is the most idiomatic way to represent information in Clojure
:thumbsup:
Thanks
followup question: in the metadata, is there any reason why datafy marks the source object with a keyword (:clojure.datafy/obj) but extending protocols needs a symbol ('clojure.core.protocols/nav)?
yes, and it’s a good question that Rich went back and forth for a while. :) Using the symbol key here is intentionally different than typical meta keys (which are keywords) and thus unlikely to collide. Also, symbols naturally refer to functions so there is sort of a semantic match here as well.
That makes sense, thanks.
@arohner I cut tools.analyzer 0.7.0 with support for injected locals for add-binding-atom
Does anyone know of something that is the inverse of bean
?
i.e. takes a beanified map and converts into a POJO?
the java.data library has some stuff like that https://github.com/clojure/java.data
thanks @alexmiller will take a look
I’ve hacked together macros to do stuff like that a few times but they were generally pretty customized to what I was doing
I only have one pretty small bean, so I might just hand roll a function to do it
unless there’s something generic though to-java
looks like it might do what I need
Is there a way I could access an atom’s previous state? I’m trying to build a simple time travelling debugger using the fact that the data structures are persistent
user=> (def my-atom (atom {}))
#'user/my-atom
user=> (def my-atom-history (atom [@my-atom]))
#'user/my-atom-history
user=> (add-watch my-atom :history (fn [_ _ _ new-state] (swap! my-atom-history conj new-state)))
#object[clojure.lang.Atom 0x292d1c71 {:status :ready, :val {}}]
user=> (swap! my-atom assoc :a 2)
{:a 2}
user=> (swap! my-atom assoc :b 2)
{:a 2, :b 2}
user=> (swap! my-atom dissoc :a)
{:b 2}
user=> @my-atom-history
[{} {:a 2} {:a 2, :b 2} {:b 2}]
to-java works a treat
@bronsa yeah this is waht I had in mind at the start, but then I remembered that the persistent data structures do indeed keep track of it’s history
"recording its history" would require keeping backreferences to old values, rendering GC impossible
persistent data structures simply share common paths with old values, but they don't record diffs or anything like that
Has anyone got a good solution on the JVM for this? Does deleting a namespace have the effect that the data held on by the vars in that namespace will be garbage collected? https://github.com/borkdude/advent-of-cljc/issues/85
surely that depends on whether anyone is carrying references to the vars?
also, you could ns-unmap the var, or intern it to nil - maybe it's better since it's more direct?
something like: (run! #(alter-var-root % (fn [_] nil)) (vals (ns-publics 'aoc.y2018.d01.borkdude)))
that seems about right, yeah
It seems tools.cli breaks native-image compilation. Has anyone else encountered this?
I was trying to get cljfmt to compile. And I had to remove tools.cli and roll my own args parsing instead for it to work.
I'm aware of that. But I feel if its worth working around these issues it would be in tools.cli
@didibus I've been able to compile native-image stuff with tools.cli as a dependency https://github.com/taylorwood/clj.native-cli/blob/master/deps.edn#L2
And at runtime, tools.cli does throw the same error anyways, rendering the CLI useless
I also found an online graalvm compiled version of cljfmt, but they also bypass tools.cli
weird, I made this example project and it uses tools.cli and compiles and works just fine with CLI args https://github.com/taylorwood/clojurl
also I think some other people have already compiled native images of different CLJ formatting tools
@didibus Feel free to create a JIRA issue for me to look at for tools.cli
-- but make sure you include complete instructions to repro your issue (I haven't even looked at GraalVM, so make sure your issue includes all the tool setup steps too!).
Is it worth looking into server side clojurescript through node if I want zero-downtime deploys?
If I have in-memory-only session information I want to persist through deploy, can a load balancer or blue-green strategy work?
Define "failing to install" -- what error do you get?
(the Clojars repo URL should probably be https://clojars.org/repo/ -- https rather than http?)
or https://repo.clojars.org to use the CDN-fronted repo
buildscript {
repositories {
jcenter()
maven { url = "" }
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
}
}
repositories {
maven { url = " " }
}
Like that?(caveat: I have never used Gradle)
(and, as Toby says, you should use
really)
It involves breaking a secret into a number of "shares", and using some subset of the shares to reconstruct the secret
there are some java libs out there, none of which I can vouch for: https://github.com/timtiemens/secretshare
oh, coda has one: https://github.com/codahale/shamir
Thanks! I had found secretshare yesterday but I haven't been able to get it to work the way I want, this looks promising
clojure hash-maps are java Map instances, if you need clojure's version explicitly (into {} m)
will do it
but of course it will still be a Map :D
for many things that conversion is never needed
user=> (get (System/getenv) "PWD")
"/Users/justin.smith/egret"
(ins)user=> (def hm (java.util.HashMap.))
#'user/hm
(ins)user=> (.put hm :a 0)
nil
(ins)user=> (:a hm)
0