This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-01-15
Channels
- # aws-lambda (3)
- # beginners (17)
- # boot (65)
- # cider (3)
- # cljs-dev (7)
- # cljsrn (82)
- # clojure (82)
- # clojure-italy (1)
- # clojure-russia (25)
- # clojure-spec (56)
- # clojure-uk (5)
- # clojurescript (52)
- # css (2)
- # datomic (6)
- # emacs (1)
- # hoplon (9)
- # jobs-discuss (5)
- # leiningen (8)
- # mount (2)
- # nginx (1)
- # off-topic (2)
- # om (1)
- # om-next (9)
- # perun (13)
- # portland-or (1)
- # re-frame (13)
- # reagent (20)
- # remote-jobs (2)
- # ring (5)
- # spacemacs (1)
- # specter (10)
- # untangled (5)
- # yada (6)
For danielsz/system users: Wondering if anyone know why (fn [req] (handler req))
wraps the handler in line: https://github.com/danielsz/system/blob/master/src/system/components/jetty.clj#L13
I'm wondering why not pass the handler directly to run-jetty
Has anybody got an experience in building nginx-clojure
i'm not happy with spec using qualified keywords and defreord using unqualified keywords; is there a way to tell defrecord ot use qualified keywords as selectors ?
Does "java.lang.NoClassDefFoundError: clojure/lang/RT” usually mean I dont have the clojure.jar in my classpath?
@underplank I’ve seen a similar error happen when I “lein uberjar” package the project while I have “lein repl" running but never fully investigated - not sure if that’s your case though
who's in the mood for a dumb bug in using spec? here is my entire afternoon in trying to learn how to use spec: (s/def ::foo some-func) (defn some-func [x] (assert ...) (assert ..>) (assert ...)) now, guess what? assert returns nil on success? so what's happening? I'm running this x, it's failing the spec, then I manulaly through the assertions -- each works -- but the spec is still failing? --- wtf --- repeat for entier afternoon , before realizing the some-func needs to return boolean and assert always returns nil face-palm
it's been a while since i've used core.async and i'm trying to figure out how to go about mapping a function to multiple channels. i'm not sure if map
or tap
will accomplish what i need: i have a function that takes a coll and returns a new coll and want to have it fan out separately onto multiple channels with each passing it an incremented index. so pmap
or a concurrent for
except returning separate instances when the channels close (so i can store them in a hash-map as well as feed the new colls back into the function. any pointers on what i should use for this?
Hmm. I’m trying to build an uberjar that will run a standalone jetty server. I have my main hooked up in my leiningen profile but everytime I do lein uberjar
it tries to execute the main function as well, which starts the Jetty server and fails the uberjar build.
Any ideas?
I'm using uberwar, not uberjar, and my solution is: 1) no main, 2) fire up repl, 3) manually call whatever jetty/ring would ahve called; then develop
No its not that. Its more I want to run the uberjar in a container to test some stuff. and it seems easier to run it as a standalone executable uberjar.
Oh nvm. looks like its working now.
they're names that I once had checekd into git, but certainly do not exist in current src directory
(defrecord foo [foo]) ^^ is this code that works in clojure but not cljs? if so, why? [this is what appears my bug to be]
I'm now curious why this code appears to behave differently in clj vs cljs and whether it's intentional.
it's a circular definition. also class names should begin with a capital...i've never used a record in any other way so am not sure what that even does. seems you would just use deftype
instead
i'm far from certain on any of this, but i'd guess it's not really working in clj as intended
i may be confused about it being circular (it's quite late here). just that the argument name is the same as the class name...
My guess on the cljs side is that the generated javascript has some kind of naming conflict that doesn't happen on the jvm side.
I'm not claiming that
(defrecord foo [foo])
is a good idea; I'm hoping someone who actually understands the compiler internals here can explain what's going on.(defrecord foo [foo])
ReferenceError: self__ is not defined
at repl:27:1
at repl:193:3
at repl:201:3
at repl:206:4
at ContextifyScript.Script.runInThisContext (vm.js:25:33)
at Object.exports.runInThisContext (vm.js:77:17)
at Domain.<anonymous> ([stdin]:41:34)
at Domain.run (domain.js:221:14)
at Socket.<anonymous> ([stdin]:40:25)
at emitOne (events.js:96:13)
In fact, it confused me for a good 5 minutes before I realized I had a line that said (defrecord bidi-table [bidi-table])
google is your friend: https://groups.google.com/forum/#!topic/clojurescript/jgpnFR_pUp8
the cljs compiler is mostly protocols. that error is about the spread operator, but it's likely the same issue occurring with protocol dispatch
@sophiago , @beppu: I've re-posted this over a #clojurescript -- thanks for attempts at helping 🙂
np. i ask for help enough on here i figured i'd try. if it were me i'd first see if it replicates when you properly capitalize the class name and then check the cljs source on github. it's all written in clojure with extensive comments so quite accessible
for example here: https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/core.cljc#L1819
Meet a problem when deploying with jenkins
, leiningen plugin.
installs/leiningen-2.7.1-standalone.jar -Dfile.encoding=UTF-8 -Dmaven.wagon.http.ssl.easy=false -Dleiningen.original.pwd=/var/lib/jenkins/workspace/caiba-data -cp /root/.lein/self-installs/leiningen-2.7.1-standalone.jar clojure.main -m leiningen.core.main run
Error: Could not find or load main class clojure.main
Build step 'Build project using leiningen' marked build as failure
However if I cd into that directory, run lein run
, everything works fine.suppose I want to create a map like (silly example)
{1: 1, 2: 2}
one way is to do something like
(into {} (for [x (range 2)] {x: x})))
is there an easier way to do that though?
ah great thanks
definitively better
@tbaldridge I am doing a spike with fn-fx now. when running the app from an uberjar, the app closes immediately after rendering the UI. It works flawlessly from the REPL though. Something might be off with the JavaFX lifecycle management when running from a jar. Are you aware of anything I would need to take care of to make it work from an uberjar?
figured it out, one needs to extend the superclass javafx.application.Application
from :gen-class
(ns fn-fx-ui.core
(:require
[fn-fx.fx-dom :as fx-dom]
[fn-fx.controls :as controls]
[fn-fx.diff :refer [component defui render should-update?]])
(:import (javafx.application Application))
(:gen-class :extends javafx.application.Application))
@nblumoe yeah, I imagine that's because everything runs on background threads, and they're probably all set to close down once the main thread exits.
Yep. But now not all threads get stopped when I close the (last) window. Like described here: https://github.com/friemen/async-ui#standalone
@tbaldridge I am trying to figure out how to invoke a dialog (FileChooser) from fn-fx. Did you think about those in the lib design? Should that be done via the diff-mechanisms?
@schmee That's cool, but why does the second (range) work? I would have written (zipmap (range 3) (range 3))
the second argument is only realized as many times as the first argument. So, while (range)
is an infinite lazy sequence, only 3 elements are realized since (range 3)
realizes 3 elements
the way it's written, you can change one value (the "3"), instead of having to change two values as you would have written @genec
@joshjones So, zipmap is calling the second range 3 times (lazily) because of the first (range 3) call. Thanks, that's cool.
also I noticed earlier when I read this that you wrote {1: 1 ...}
be careful and don't confuse maps with javascript objects .. there is no 1:
... there is :1
which is a keyword
though
@joshjones How would you write it to have the keys be :1, :2, :3 ...?
@joshjones Thanks, that's excellent. Very helpful.
unless I'm using protocols / polymorphism; is there ever a reason to use records over maps? I thought records would provide some additional abstraciton; but in practice, it's just been a mess of extra layers of abstraction
but unless you have measured that regular map performance is your bottleneck I’d stick to maps
And even when you need polymorphism, you still have multimethods
so if the main advantage of records is java interop, and I'm doing cljs, is there no reason to use records?
What is the best way get a section of a string and move it. I want to get this media query and all future media queries. Then place them at the end of the string in the order they're are supposed to be in.
.Sm{flex-wrap:wrap}@media(min-width:30rem){.Sg{flex-direction:row}.Si{padding-right:0}.Sh{padding-left:0}}.Sk{width:2em}.Se{padding-left:1.5em}.Sj{margin-right:3em}.Sb{display:flex}.Sc{flex-direction:column}.Sl{flex-direction:row}.Sd{align-items:baseline}.Sf{padding-right:1.5em}