Fork me on GitHub

@bjarnagin: with the caveat that you won’t be protected from SQL injection if you do that


@danielcompton: Good call out. I use replace for things like replacing the table name or an alias but I still use the parameter list for user injected variables. Yeah, I would never inject user-provided strings into sql.


@danielcompton: fortunately i won’t be accepting user inputs here. i am just making a quick ETL job to process data from multiple client databases and wanted a convenient way to query each db in turn without opening a new connection or going to the effort of sending a USE DATABASE query.


Hi! Someone mentioned me a clojure lib to request datastructures (ala get-in but much more sophisticated) and I can't find the name again. Do you know it ?


There are several of them, is on top of my mind.


hi! I have a question… if I have a vector [1 2 3] and I want [2 3 1], something like (-> v cycle (drop 1) (take 3)) but without having to know the length… any ideas?


shifting all the elements to the left in a way


@txus (let [[f & r] [1 2 3]] (conj (vec r) f))


@txus - it seems a strange request though; maybe I have misunderstood?


no, that’s it simple_smile it just doesn’t work with empty vectors, but it’s okay @colin.yates. thank you a lot


I'm literally asking for a friend


so I’m not sure what he’s up to


np - glad to help


Am I correct in thinking that in a multi-module project, lein test will run tests from all sub-projects, not just the top-level one?


@ul: thanks ! specter was the one I had in mind


@cfleming: Leiningen has no built-in support for multi-module projects. Modules are handled by plugins such as lein-sub or lein-modules, and they determine the behavior.


Anyone used Gloss in anger in here?


@jonpither: I tried. I implemented the redis protocol using gloss and aleph (largely based on code I fished out of old versions of aleph; it used to have a redis protocol implementation). It ended up being very slow.


@stuartsierra: Right, but from what I can tell, lein test finds all namespaces on the classpath using bultitude - I don’t know whether that includes tests from dependencies or not. Thinking about it, I guess not, since at that point your sub-module deps are just like any other lib.


And probably don’t include test nses in their jars.


@ljosa: due to gloss producing inefficient (de)serialization logic? Or something else?


@ds300: as far as I could tell, yes. (but I could be wrong.) It got very noticeable in requests that were doing hundred of pipelined HGETALLs, each with a dozen fields. (Carmine was much faster but still too slow for my need; I ended up using Jedis, which was still slower than the python redis library that we’ve been using.)


So I feel like I should know this, but I don’t. Is there a way to test if something is sequable?


seq will perform various conversions but fails if it can’t produce one, so it’s not so good as an idiomatic check.


seq? only checks if something actually is an ISeq


perhaps consider if a protocol can get you out of the game of type-testing?


("just write a distributed map-reduce function" ... )


Well, in this case there are various other tests I could use since I’m only working on a known subset of classes, and I think the sequable ones all implement ISeqable, but it seems like something there ought to be a generic check for.


And in a way, a test like “can this thing be converted into a seq of some kind” really does get out of the type testing to a much greater extent than what seem to be the current options.


there is a seqable? in core.incubator


@chris: Interesting, thanks


I'm debugging a hairy SSL problem. How can I get cider to take me to Java sources?


As in some class in


how can I do a nil or empty / seq condition in a sql korma query?


Hey everyone - I seem to be getting an error when trying to run “lein repl”

Caused by: java.lang.RuntimeException: Unable to resolve symbol: create in this context
I wondered if there was any common solutions to this? (and I hope this is the right place to ask!)


What do you mean @denik? What's the query you'd like to write?


@cddr: I got it, was an issue w/ a wrapper I wrote around korma and macros


@jamesmintram: That kind of error is caused by a use of a symbol (`create` in this case) before it has been defined. It is happening when you run lein repl because something else is trying to load the Clojure source file containing that bad code, perhaps from a user.clj file. The solution is to search your code for instances of create that are not defined.


Thanks stuart - this error only occurs when I add a dependency (amazonica) - I think I have just found a work around (exclude com.fasterxml.jackson.core/jackson-databind) - doesn’t seem a great solution though..


I see [project-name :scope "test"] in Clojure dependencies a lot, but I can't find it documented anywhere (the :scope keyword). Is this a feature specific to boot (I see it in boot projects primarily)? What does it do?


@jamesmintram: I admit, I'm not sure how adding a dependency would cause that problem, but it might have something to do with dependency conflicts or a bug in that library.


@aengelberg: It's part of maven.


probably-stupid liberator question... I'm sending a map in the body of a POST request... how do I get it back to a map in my handler?


(I figure there are more likely liberator folks here than in #C053AK3F9 ...)


@mahinshaw Thanks, I wasn't sure because it's not documented in sample.project.clj.


@aengelberg: I hear ya, it took some digging for me to figure that out as well. Looks like @martinklepsch was better about giving you useful feedback though.


@mahinshaw: @aengelberg I think in Leiningen people usually use :dev :dependencies.


@martinklepsch: I think so too. I picked up boot a few months ago, and ran into this. I actually prefer the boot way, although I don't see why you couldn't use the same notation in lein, since it is using maven as well


So it's usually used in boot because boot doesn't have a convenient notion of profiles as lein does?


You can totally use it (I believe) it’s just less common


@aengelberg: Nice thing about boot is, you don't really need the dev profile. The tasks take care of that.


That satisfies my curiosity. Thanks guys.


I have a query template stored in a file with format specifiers for variables i need to pass in. i’m slurping that file into my program, but when i call format on it, i get a java.util.MissingFormatArgumentException, even though the format arguments are in the file. Am I doing something wrong here?


any postgresql + yesql wizards around?


Not a wizard but I might be able to help you @curtosis


I think I found what was going wrong... kept getting a "no operator found for text = jsonb" error.


in the middle of a SELECT WHERE IN query


You can cast using the ::some_type syntax in yesql


turned out I was passing in a list of maps where I thought it was a list facepalm


blah blah static typing.... 😉