This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-06-16
Channels
- # admin-announcements (72)
- # beginners (41)
- # boot (93)
- # cider (50)
- # clojure (173)
- # clojure-berlin (19)
- # clojure-dev (2)
- # clojure-greece (3)
- # clojure-israel (2)
- # clojure-italy (32)
- # clojure-japan (33)
- # clojure-nl (8)
- # clojure-russia (3)
- # clojure-seattle (1)
- # clojure-sg (1)
- # clojure-spain (16)
- # clojure-uk (4)
- # clojure-ukraine (1)
- # clojurescript (170)
- # code-reviews (20)
- # core-async (3)
- # datomic (5)
- # docs (28)
- # editors (17)
- # euroclojure (2)
- # events (7)
- # instaparse (18)
- # jobs (25)
- # ldnclj (11)
- # om (26)
- # overtone (3)
- # remote-jobs (3)
- # sneer (1)
@seancorfield: Thanks, a standalone app sounds like a good idea - it always annoys me to have once-off patch code committed to a codebase
@arohner: I know exactly what you mean by the brittle thing - we currently use that in our php system and when a patch doesn’t work, have to tweak the live value and try run again after updating the code.. very touch and go. I like the idea of idempotent patch functions - I’d like to not have to rely on repl access though.
@meow: Ye, I could write a boot task, but I prefer not to run build tools like boot or leiningen on our production environments
@seancorfield, @arohner, @meow - thanks for the feedback! really appreciated.
@borkdude: not sure if an uberjar is packaged similar enough to a maven-shade-plugin jar, which they recommend
would be great if someone could get clojure working on lambda using maven-shade-plugin, and then we could compare uberjars
@ulsa: "shade - i.e. rename - the packages of some of the dependencies"... I never came across anything like that in uberjar
How can I get maven-shade-plugin to understand that Leiningen has placed class files under target/base+system+user+dev/classes
? Or better yet, how can I get Maven to compile them and place them somewhere that it actually knows?
anyone using lein-cloverage here? https://github.com/lshift/cloverage
I tried using it a couple of times but always got stuck with this error message:
java.io.FileNotFoundException: target/coverage/coverage.css
I created the file manually but no dice.OK, I seem to get the same error in lambda when running a maven-shade-plugin jar as with a lein uberjar, so perhaps there's some intrinsic Clojure/Lambda class-loading issue?
Caused by: java.io.FileNotFoundException: Could not locate clojure/core__init.class or clojure/core.clj on classpath:
at clojure.lang.RT.load(RT.java:443)
$ jar tf target/lambdaclj-0.1.0-SNAPSHOT.jar |grep clojure/core__init
clojure/core__init.class
Is there a better way to parse a String into a number than (Integer/parseInt “1”)
?
Ok, read-string
does the job
mdallastella: you probably want (Integer/parseInt “1”)
, read-string
is really for source so not safe. There’s also the clojure.edn
ns, but honestly I would prefer Integer/parseInt
in the case I know I’m just reading numbers.
@dnolen, @niwinz: I see, thanks. read-string
is probably “too much” for the task.
but you can just create the überjar and upload this to lambda as is? I haven’t looked at the tech details of the java support for lambda yet
if you could tell the shim which clojure var to invoke (through some kind of env variable for example), it would be reusable
Is there a way to call a function when using deconstruction. I'm using something like (defn route-erp-customer [{{id :id} :params :as req}] , but id i a string and i would like to convert it to an int...
Someone working with genetic algoritms in Clojure?
@ulsa: maybe it's a good idea to stalk https://twitter.com/jeffbarr about it (author of the blog)
@martinskou: functions are not allowed in map destructuring
@ulsa @borkdude Updated spike to allow specifying the var to invoke, updated readme to show sample invocation: https://github.com/uswitch/lambada#usage
CIDER 0.9 is out http://batsov.com/articles/2015/06/16/cider-0-dot-9/
awesome @bozhidar ! thank you!
Congrats
@bozhidar: kudos!
I currently work on a project that already has a PHP+MySQL site and I'm building a web app on the side using Clojure/ClojureScript using the same database. I haven't used lobos for ddls, so I had to do some string manipulation to re-use the same ddls in the in memory database which was hsqldb. Also I bumped into some 'locking' problem that hsqldb has turned on by default. I wonder if H2 is a better starting point for next projects.
@borkdude: I would go with the same db in dev that I want to use in production, just to make sure I hit problems early
@borkdude: as mysql does not have a in memory version, IIRC, I'd maybe go with a docker env setup or something like that
@sveri: run against a mysql test db? could do that. I'd have to set it up in CI too then.
for what it's worth, there is a MEMORY storage engine in MySQL: https://dev.mysql.com/doc/refman/5.7/en/memory-storage-engine.html
@borkdude: it's tradeoffs imo. communicating with in memory stuff is often much faster than talking to a server. If you estimate you have 10 devs, each running tests once a minute, and the mysql build takes 15s, and the h2 build takes 1s, and the cost of shipping a bug to production is X, and the average dev salary is Y etc. You can run calculations based on that and see if it's worth it
When I think about a sql database, mysql is not exactly the first thing that comes in my mind 😏
@mdallastella: I know right, it's a legacy decision.
@mdallastella: I'm extending a PHP/MySQL site with Clojure and ClojureScript
@borkdude: sorry for the digression, no flame intended 😃
@borkdude: @tcrayford I agree with the
for now I'll stay with HSQLDB. I didn't write all those string/replaces in vain today. I could of course have used InstaParse 😛.
* what @tcrayford said. Maybe it is also worth to have multiple layers, having a second layer with a mysql db for cont. tests running every hour and a "first" layer using an in memory db
hey @juhoteperi 😄 ping
@txus: pong
I was wondering if you could release a snapshot of https://github.com/metosin/ring-middleware-format ?
Interestring. I wonder why I haven't noticed the problem.
it’s better described in https://github.com/metosin/ring-middleware-format/issues/11 but yeah...
@txus: Thanks.
@txus: I'm not sure if that error would be fixed by that r-m-f change. It looks more like mismatched kwargs somewhere.
And at least Compjure-api example is working for me.
@txus: Are you setting the options in defapi (or api)?
strange. I realized that wrap-restful-params and wrap-restful-response have different signatures (-params takes kwargs while -response takes a hash), and they used to have the same signature
@juhoteperi: tried setting them and letting it run with defaults
Yes, I changed it in the fork. Might have been a bad idea 😞
Ah, in the fork both should take maps.
this one uses kwargs: https://github.com/metosin/ring-middleware-format/blob/master/src/ring/middleware/format_params.clj#L256
Nope, thats a map.
R-m-f is unfortunately a bit of a mess currently, I've been trying to get ngrunwald to merge our (non-breaking) changes to upstream.
that “No value supplied for key” I’ve gotten even going deep in the code and calling the functions manually with a map instead of kwargs :S
Do you happen to have both versions of r-m-f in classpath? Check lein deps tree or something.
@txus: Try https://github.com/metosin/compojure-api-examples and if that works, try to see whats different with your project or create an example which I can use to reproduce the error
is there a lib out there that does a good job of surfacing actual JDBC errors? I'm on postgres and half the time the error is inside nextException
and the other half the time it just plainly complains about the transaction being aborted with no details. I, of course, can figure out what the issue is, but it makes it hard to surface that for UIs without writing a ton of special checking code around every insert/update.
can you say more voxdolo? clojure.java.jdbc just unwraps RuntimeExceptions if they're there
So in the case of a conflict on a unique column, when run using the postgres adapter, I'm currently just getting a "transaction aborted" error which says nothing of the nature of the error. Other times when the transaction fails, I get an error message telling me to "getNextException" to see the actual error [which tends to be more descriptive ("such and such has violated a foreign key constraint")]
I'd love it if the error messages were better and more uniformly presented… I don't ever want to have to write special handling logic to see if there's an error in nextException.
just wondering if someone has done the work to try to surface the actual error messages rather than the sad state of affairs that currently is presented
Perhaps a meta-issue is that I'd really rather not have to check that something like a uniqueness constraint hasn't been violated before hand by querying before inserting/updating. I'd rather fire off an insert, catch an exception with a sensible message and show an error to a user as derived from that.
yep I wish things were a bit more easy to interrogate for useful information and in a standard manner.
So, a couple things. In our code base (mysql) we catch a DuplicateKeyException explicitly. You could do that, but it may be hidden in nested exception causes
The insert/update could handle it directly too, similar to mysql's ON DUPLICATE KEY clause
voxdolo something like
(->> (iterate #(.getNext %) throwable)
(remove (comp #{RuntimeException TransactionException} class))
first)
I was pinging folks in the clojure IRC channel, but it's beginning to look like Slack has captured the hearts and minds of many.
devn: are you defn on clojuredocs? I'm guessing so and have been meaning to ask (and subsequently thank you for all your examples over there)
i found a lot of them by spelunking through my http://getclojure.org thingy
we've all pretty much got you to thank for http://clojars.org too. so thanks again
what would be another way to accomplish this?
(def sample {:x 10 :y (+ 2 (:x sample))})
I just want a map with values that depend on each other somehow
I guess maybe a let is the only way
but then I can't produce a single map
yeah I can do that true, I just thought I could access the map that is not created yet
but it makes sense that I don't
also @andrea.crotti -- #C053AK3F9 might be a better place to take this conversation
devn: All the time.
i'm considering writing a "web service" that continuously queries the twitter API and stores results in a db. i'd then like to display those results on web pages. can a single leiningen/compojure web app do both those things simultaneously?
yeah, you’ll probably want to kick off some working process / thread / agent on application start
@stuartsierra: @moocar either of you have any experience pushing logs to logstash?
reason i ask is because there seems to be a fair amount of garbage required to get the data it's using somewhere closer to correct
for instance, when an exception is logged from my.namespace, the encoder and layout say it's from logging.clj