This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-06-12
Channels
- # admin-announcements (35)
- # beginners (18)
- # boot (257)
- # cider (14)
- # clojure (226)
- # clojure-china (1)
- # clojure-germany (2)
- # clojure-japan (91)
- # clojure-korea (3)
- # clojure-poland (11)
- # clojure-spain (37)
- # clojure-ukraine (1)
- # clojurescript (165)
- # code-reviews (33)
- # datomic (8)
- # editors (42)
- # euroclojure (2)
- # jobs (30)
- # ldnclj (72)
- # reading-clojure (5)
- # slack-help (5)
(let [y 2] (for [x [0 1 2] :let [z (* x 3)] (+ x y z))) would return (2 6 10), y is constant while z in this case isn't
i was thinking more like `(for [x (range 1 6)] (let [y ( x x) z ( x x x)] [x y z]))` vs `(for [x (range 1 6) y (* x x) z (* x x x)] [x y z])`
i think i got a better understanding looking at clojuredocs a bit more closely, though
@jonpither: i made a copy function for use in a boot task recently, https://github.com/adzerk-oss/boot-beanstalk/blob/master/src/adzerk/boot_beanstalk.clj#L94-L97
nside: Lein has real issues in terms of composing tasks, and in terms of scripting custom tasks. It also doesn't help that the primary maintainer has largely withdrawn from the community of late. Boot has active maintainers/promoters and solves the task authorship issues which plagued leiningen.
@borkdude: I just remember that when Phil did his big move he scaled back his channel involvements and the leiningen stuff went quiet (which is a totally reasonable reflection of his real world priorities, just opens the door wider to boot)
@arrdem: I am reading his latest blog. I was vaguely aware of it, but that explains it. http://technomancy.us/
Howdy folks! Does someone know how can I setup lein repl, so I have syntax highliting and/or (at least) have indentation support ?
Actually I am using fireplace in vim, but usually that means i have to run lein repl in another console tab, then connect to it manually from vim, specifying port ... or create a new clojure project via leiningen and open it with vim, but sometimes i just need to quickly try something..
smnplk: ultra? https://github.com/venantius/ultra
@smnplk: for quick snippets spinning up a REPL and connecting to it from your favorite editor is still the best option
Also I am trying to migrate to spacemacs..but I have no emacs knowledge, I would really like to try cider, b
I am looking for a scheduler in Clojure any personal preferences or tips here?
http://clojurequartz.info perhaps? never used it but you can’t go wrong with ClojureWerkz
Yeah that's true that is also the one I found first
Let's just try this
And the clojurewerkz guys always have top notch documentation ^^
mitchelkuijpers: I’ve used quartzite for a long time in production, works well. I vaguely remember that the DSL for recurring jobs wasn’t working exactly as I expected, we used Cron strings instead.
@mitchelkuijpers: you can always go with Java ScheduledThreadExecutors if its simple
@danielcompton: I will need more scheduling in the app so I don't mind the extra options for later
@pastafari: Hmm let's see if i get bitten by that
Hey folks I'm thinking about a UI redesign for Grimoire (http://conj.io) and would appreciate any criticism of the live site you care to offer.
@seancorfield: using the bare x
inside the implementation is likely a bit faster (until the JIT wakes up anyway). That and field access style are definitely faster than keyword access, even with the JIT fully warmed up.
@mitchelkuijpers: I’ve used quartzite, no problem at all
@txus: Yeah using it right now, really like it! First time quarts does not make me cry
The last time I tried to use quartzite, the docs were not up to date with the library, which was a pity, as the api seem to have changed, is that fixed?
@sveri: Seems fixed to me 😄
@mitchelkuijpers great, I will give it another try then
I need to start a greenfield om SPA with a bit of dumb backend code (it’s basically an admin section interacting with postgres, needs authentication as well) I’ve considered Pedestal, haven’t used it, but what are your thoughts?
I’ve been trying buddy for auth recently. Seems good but haven’t used it in production
so I guess compojure/ring and something like buddy or friend? I don’t mind too much but i was wondering if there is something a bit less hand-crafted these days, Luminus is a bit old but Pedestal looked nice
@txus I use Pedestal it is pretty nice, but the docs are very outdated
@txus: But he interceptor API is pretty powerfull
@txus disclaimer i am the author. This is what I built closp for. Having authentication and some user admin on the backend side, with server side template generation + the ability to have semi SPA. I built that on top of luminus and reagent, but switching to on is pretty easy.
is it me, or is it a bug in http://tryclj.com at the moment
> (defn foo [x] (* x x))
#'sandbox7490/foo
> (foo 10)
java.lang.IllegalStateException: Attempting to call unbound fn: #'sandbox7490/foo
>
@txus great to hear that, I am always eager for any kind of feedback, also pull requests and things, good luck
FYI channel notifications can be disable on a per-channel basis, if hearing the ping in clojurians rooms is bothersome
Is it possible to create a defmethod in Java of a multimethod defined in Clojure?
@michaeldrogalis: by definition, yes, right? Clojure is just a java program
@tcrayford: Yeah, I figured 😞
Probably an @alexmiller question
Thanks @dnolen!
@michaeldrogalis: making a java api for onix?
Yee-up. Actually someone else is, happy that I don't have to. 😛
0.6 seems to have pushed a lot of people over the edge from "interested" to "dabbling". Nice to have more hands
I read through the kafka adapter somewhat recently. Does onyx have anything like storm's transactional spouts?
@tcrayford: Like Trident? Not yet, but now I want one haha
@michaeldrogalis: yeah. It's a pain in the butt to do properly 😞
(Yeller has handrolled stuff that does that on top of kafka's simpleconsumer. So much painful)
@tcrayford: I want to see Yeller's source so bad
Are you doing Yeller full time now, btw?
You're really cranking along for those circumstances
Hey everyone. I've got to turn a bunch of java objects into maps based on their getters. I can just write a macro for that, but I'm wondering if there's already a library?
@malabarba: I also wrote unbean, if you need the inverse: https://github.com/arohner/unbean
@malabarba: if they have getters and setters that follow the convention, I think it just works
Thanks @tcrayford — I suspected that might be the case (and in fact had a noticeable slowdown when I used :x
access inside a record that was accessed a lot in our app).
@seancorfield: as always with the JVM though, the JIT makes benchmarking hella awful 😕
Yeah, I gave up on micro-benchmarking a long time ago
In general, if something affects the time our full test suite runs, we know to dig more (normal time is ~11 minutes right now).
Our full test suite exercises our two main apps at pretty much every level: from the lowest unit test up to full end-to-end WebDriver and Selenium suites.
We have about 25K lines of production Clojure and nearly 7K lines of test code (although that includes a fairly extensive suite of HTTP API tests) and nearly 2K lines of WebDriver test code. Plus we have unit tests and integration tests at our CFML layer (which also exercises a lot of Clojure code) and we have Selenium HTML tests too (from the "good ol’ days").
I always wonder, when I hear people say "Oh, those Clojure folks don’t really do any (unit) testing…"
I hear that a lot, It’s nonsense @seancorfield I think we just do it at a different time.
@seancorfield: for the record, Yeller has ~1k or so automated tests, with maybe 50 of those being end to end ones (no selenium here though). 10k lines of production code, 3k lines of test. Bugs that made it to prod since launch last year: 8
We still have too many bugs getting through to production but it’s a vast dating platform and we expose similar functionality in a lot of different places in the UI so getting full test coverage of a feature at the end user level is a huge amount of work.
@seancorfield: yeah. Comparing apples and oranges here I think, Yeller is greenfield as of last year, and has one dev. Super different environment 😄
For example, we let members add someone as a favorite in maybe a dozen places — and one of those broke due to an unrelated change (a data type changed in an unrelated table and that caused a small piece of JavaScript to break in one file used to construct ajax links for favoriting a member on one particular page).
@tcrayford: what sort of end-to-end testing are you doing?
So now we’re going to write a WebDriver test that makes sure you can favorite / unfavorite a member from every single possible location in the app. Sigh.
Right now the closest I'm getting to end-to-end are some ring-mock tests and I have far too few 😕
@seancorfield: you work at World Singles, I take it?
Yup. That’s me.
We’re the crazy "Clojure embedded in CFML" folks
Holy what? CFML like ColdFusion?
That’s kind of awesome.
@voxdolo: think it's "the number of bugs that make it to prod" that is the important number, and the feeling of confidence programmers have whilst changing existing code. Both of those can be improved with better testing, but don't think coverage or a feeling of "I should write more tests" are good reasons for writing tests
We recently passed the point where we have more lines of Clojure in our Model than CFML, but we still have a lot of CFML in our Controllers (and don’t get me started on the Views!).
Yeah, I did a short talk at Clojure/West a few years back about it, and a longer one at a few user groups around the world.
@tcrayford: yeah, agreed. I was mostly just curious how you were going about your end-to-end. Still looking for something I feel like is a better way… I've been struggling against ring-mock pretty hard.
Slides from the longer talk: http://corfield.org/articles/WorldSinglesWeb.pdf
CFML is not like it used to be. And we use a modern FOSS engine for it.
@voxdolo: I use https://github.com/xeqi/kerodon for now. I don't have much javascript, or even very many end to end tests that hit the web ui at all
@voxdolo: here’s one of our CFML functions calling into Clojure https://www.refheap.com/102130
@tcrayford: nice! thank you.
@seancorfield: I actually had no idea CF ran on the JVM, so it's just standard interop then, eh?
@voxdolo: Yeah, most folks who’ve even heard of CFML still think it’s a proprietary interpreter written in C++ It’s been running on the JVM as a compile-on-demand to bytecode system for nearly 15 years now.
It’s had closures for years now, and arrays and structs have map/filter/reduce member functions etc
I worked at Macromedia when they bought Allaire — CF5 was the last C++ interpreter version and the first released under the Macromedia brand. The next release was compile-to-Java, followed by a compile-to-bytecode release.
That’s how I came to be doing CFML in the first place — management made my team (of C++ and Java developers) use CF for a big new web project on http://macromedia.com!
hah nice. I was working at http://homes.com in the early 2000s and significant bits of the front end were written in CFML. Backend in Pro-C 😢 and a little Java (struts/tiles).
And, to bring this back on topic, that’s why I’ve always been so interested in the ability to "host" Clojure code inside other JVM languages and why I was particularly concerned about a stable API to do so (which we got in Clojure 1.6).
Ah, the good ol’ dot-com boom days…
I haven't been doing it, but is there any drawback to running 'lein run' in production from a source project, instead of packaging as uberjar + java -jar ...?
longer startup time, more ram usage, less runtime optimization (by default hotspot is turned off)
also more to install on each server instance, and more elaborate setup for each server
I was thinking about this, because it seemed to be suggested as ok from the Pedestal docs: (defn -main "The entry-point for 'lein run'" https://github.com/pedestal/pedestal/blob/master/guides/documentation/hello-world-service.md
@noisesmith: I see those drawbacks, but what about installation? can you explain why uberjar is better in those terms? git push deployment is pretty easy too
@borkdude: lein, git, all your maven artifacts
it's not a big difference, but it's a lot more that ends up being installed
(and statefully ends up needing to be on disk before you can run)
as opposed to java, plus a single jar
lein, git, your repo, your deps
(plus java of course)
just in terms of what needs to be downloaded before the thing can run on a fresh server
think of it as lein run
being like hitting ‘run’ in an IDE, and the uberjar as your nice, packaged, optimized release build
Did someone ever try clicking on an element inside an iframe with clj-webdriver? (is (exists? “#foo”))
passes but (click “#foo”)
complains
I’ve tried switching to frame with no success...
lein run
resolves deps at startup time, so depending on your deps, you could get different versions at runtime
@borkdude: lein run is also slower to startup, because of second JVM process + more compile time
I used to run lein run in production, and now I’m firmly in the ‘single release artifact’ camp
@arohner: all good reasons for uberjar then, I've been using uberjar as long as I can remember. Just wondered about this
@charlespwd: i never had to deal with iframe, but clj-webdriver in general, yes
@fhanreich: I’m playing inside shopify’s iframe so I’m kind of forced to. But while I’m saying this I’m probably not forced to.
I’ll test the login/iframe business once and everything else outside the context
Alright thanks!
@charlespwd: what does it return when you do (first (filter visible? (elements "#foo"))) ?
=> nil
@charlespwd: oh? (first is not really necessary because #foo is an id)
@charlespwd: what does it show when you inspect element?
AH! It’s because it’s an overlay button/link I’m guessing.
http://stackoverflow.com/questions/12040615/selenium-webdriver-clicking-on-hidden-element
Much thanks!
@charlespwd: I learned something new Thanks!
clojure
(ƒ click-hidden [q]
(execute-script
(str "document.querySelector('" q "').click();")))
Had nothing to do about the iframe
@charlespwd: second thought, maybe that should be added to clj-webdriver?
That’s a good question. Should it?
I’ll open an issue
@fhanreich: Same username on GH?
what would be the cheapest option if I would host a small simple clojure app + small postgres db. I guess Heroku with 1 dyno and free Postgres? or maybe DigitalOcean.
it's for some people I know, they want to host a simple webapp. DigitalOcean starts at 5 and that seems nice for them
@markstang: what domain? .be?
I am using chromedriver and want to tinker with the driver. Does anyone have a code sample or anything ?
But Webline’s prices look more attractive. I’d like to drop Dreamhost entirely. These days, I just use them for domain registration but I’m still paying for the full boat.
@shriphani: what are you looking to do?
@seancorfield: i want to load a plugin (a .crx file)
Hmm, that I can’t help with.
The most we’ve done is set the window size and stuff.