Fork me on GitHub
Pablo Fernandez08:09:09

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.


is there anything similiar to map-indexed for reduce?


or should I do (reduce f val (map-indexed vector coll))?

Pablo Fernandez09:09:53

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?

Pablo Fernandez10:09:58

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?


haven't tried it yet, just asking because I saw that the last commit was a year ago


lein-try works well.


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 ( but i have not run into them.


you're right, it works pretty well


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.


If you have nested maps in schema then you'd have to use clojure.walk or something


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


yeah me neither.


I might try writing a validate-optional function


I think you can use s/Any for that specific case


but you'd have to use a different schema


so (def FooBar {:foo s/Str s/Any s/Any}) would make (s/validate FooBar {:foo "f}) pass


@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

Pablo Fernandez14:09:36

Is there an easier way to use an unreleased branch of code than releasing it as a jar?

Pablo Fernandez14:09:22

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 - Not sure how well does it work though.


i have never used it tho...


haha, i should read first before posting, sry


oh my god, I've never used clj-webdriver before. It is sooo awesome


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.


I can use a system property obviously, is there a better way?

Alex Miller (Clojure team)17:09:22

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


But I think I like nberger’s solution better

Pablo Fernandez19:09:16

What do you use to deploy Clojure web apps to your own servers?


@tcrayford: I assume that haskell app runs on a separate instance?


I run one of them for each yeller server and front it with haproxy


it doesn't do very much at all as far as modern computers are concerned


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:

  (fn [f]
    (migrations/migrate ["migrate"])
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 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 (


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!