This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-09-07
Channels
- # beginners (7)
- # boot (25)
- # clojure (66)
- # clojure-australia (10)
- # clojure-berlin (1)
- # clojure-czech (1)
- # clojure-denmark (2)
- # clojure-france (27)
- # clojure-italy (6)
- # clojure-japan (1)
- # clojure-nl (5)
- # clojure-norway (1)
- # clojure-russia (25)
- # clojurescript (55)
- # cursive (27)
- # datascript (2)
- # datomic (5)
- # editors (4)
- # emacs (2)
- # hoplon (183)
- # ldnclj (45)
- # off-topic (4)
- # om (2)
- # rdf (5)
- # re-frame (11)
- # reagent (5)
- # ring (3)
When making Ruby on Rails applications I generally just throw active_admin into my projects to be able to edit records. My searches for something like this for Clojure turned up nothing (not unexpected). What tools do you use for CRUDing records?
is there any way to pr-str using the DEFAULT printers only?
@pupeno: I remember caribou framework having some admin functionality, but I think it only works with their models.
I’m doing some performance testing of my Clojure app, and it seems the bare minimum will happily eat 350MB of RAM (Jetty with 6 threads, the minimum). As soon as I add Nashorn, it jumps to >512MB. Is this common or am I experience a problem here? Clojure/Java being memory hungry might have an effect on whether I use Heroku or not.
is there any way of trying external libraries from lein repl without creating a new project?
I found https://github.com/rkneufeld/lein-try and https://github.com/cemerick/pomegranate but both seem unmaintained
ergl: lein-try is what you want, it was developed by the guys who wrote the Clojure Cookbook. I never tried it though, does it not work?
I would consider it a "done" project; there's nothing more to add or remove, hence no recent commits.
...well, i guess there are a few issues (https://github.com/rkneufeld/lein-try/issues) but i have not run into them.
prismatic/schema question: Is it possible to make the validation default to treating the keys as optional? By default it treats the keys as required, but alot of times we want to use the schema to outline the data structure, but most keys are actually optional.
So if this is my scheme: (def FooBar {:foo s/Str :bar s/Keyword}) i want (s/validate FooBar {:foo "f”}) to pass validation.
I don't think you can, at least in an obvious way. I just mapped the schema to wrap keywords in optional-key
.
That’s what we are doing as well, but it does look quite ugly to basically do that to the entire map
I do quite agree, but if there's an option for that it's not easily discoverable, to me at least
It just looks hardcoded unfortunately - https://github.com/Prismatic/schema/blob/master/src/cljx/schema/core.cljx#L656-L658
@casperc: tangential, but when you mean optional keys, do you mean missing keys will be given a default value? or are they mutually exclusive? If the former, then why not validate after the missing values are filled in?
@amithgeorge: I don’t mean to give the missing values a default value. The specific case I keep running into is that I want to define a schema for a large(ish) data structure, but most of the keys are optional and not present in the normal case. I want the validation to pass if given a subset of what the schema defines. I want to the validation to fail if given a map containing keys not in the schema (or of the wrong types).
If the keys are optional and they won't get populated with default values, then can it be assumed that provided and missing keys won't be used by your code at the same time. In which case you could split each group of keys into separate schemas and create a top level schema whose each key is optional and value maps to corresponding group schema.
is there any way to define a default handler for fressian, one that is used when no other handler is matched
Is there an easier way to use an unreleased branch of code than releasing it as a jar?
Like, can I point to a repository/branch instead of a jar in my project.clj (a-la Ruby/gem/bundle/Gemfile)?
There's checkout dependencies in lein and recently I've stumbled upon this - https://github.com/tobyhede/lein-git-deps. Not sure how well does it work though.
I’d like to check in some test data files somewhere in my project that I can access from clojure.test tests
What’s the best way of passing their location to the tests? I need them to be files so resources are probably not useful here.
if you can load them with relative path, the "current directory" will be the root of the project when you run
What Alex said, but also, what's the issue with resources? You could even add a separate dev-resources
to :resource-paths
in the :dev profile... while in dev (I mean, not in the jar), (io-resource ...)
will return a "file location" (not a url as when in the jar). The advantage of using resources instead of just files relative to the current directory is that you could move the resources dir to a new location without the need of changing the tests. But of course you could use a helper fn to abstract that location too
Sorry, it will return a url, but one that will plays well with (io/file (io/resource ...))
@nberger: Interesting, thanks - I didn’t know that. That does sound like the best solution.
This is for testing the new lein integration I’m working on - it looks like lein itself just uses CWD as suggested by alexmiller to get to its test projects
What do you use to deploy Clojure web apps to your own servers?
@tcrayford: I assume that haskell app runs on a separate instance?
not asking from a perf perspective but rather stability or so, so the haskell thingies run on each instance that also runs the fat jar?
well, one haskell thingy deploys to all servers. I just keep one on each instance so that if an instance is down I can deploy still
I see. Cool. I remember reading that article before but somehow missed the haskell app which is a nice idea. (Or at least seems like one.)
just easier for me to write than a server in most other languages that talks over json/http to circle
With clojure.test, is there a way of defining some setup that runs before any test namespace? Luminus provides a sample test namespace with this:
(use-fixtures
:once
(fn [f]
(db/connect!)
(migrations/migrate ["migrate"])
(f)))
This is great and all, but I don't need to connect and bring migrations up to date before every test namespace. (I'm treating test namespaces kind of like suites, which seems reasonable enough, so I have a fair number of them.)It's not hurting anything, but offends my sense of tidiness.
@amacdougall: how about just calling a function before you call run-tests
Sounds reasonable! I'm using https://github.com/jakepearson/quickie for autotest (which is really handy in combination with a toast notification on failures), but I bet I could add the ability for it to run a little custom code before each execution.
@amacdougall: responding to this a bit late, but both lein-test-refresh and quickie reload namespaces and rerun tests. They both add a couple features on top of the “use tools.namespace to refresh namespaces and rerun tests main feature”. It sounds like you already found a solution for notifications with quickie, but if you find lein-test-refresh’s success notifications annoying you can turn them off (https://github.com/jakemcc/lein-test-refresh/blob/master/sample.project.clj#L18).
Oh, if lein-test-refresh does the namespace reloading thing, that could be just the ticket! I was using multitail
to grep the Quickie output and fire notifications on failures/errors, which is kind of a Frankenstein solution. I'll try out lein-test-refresh and see if I like it better. Thanks!