This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-01-02
Channels
- # admin-announcements (1)
- # alda (1)
- # aws (4)
- # boot (276)
- # cljs-dev (3)
- # cljsjs (1)
- # cljsrn (3)
- # clojars (22)
- # clojure (174)
- # clojure-austin (1)
- # clojure-italy (2)
- # clojure-russia (20)
- # clojurecup (1)
- # clojurescript (233)
- # cursive (4)
- # datavis (97)
- # datomic (122)
- # hoplon (80)
- # ldnclj (8)
- # leiningen (6)
- # om (82)
- # reagent (10)
- # spacemacs (8)
- # specter (5)
Do you have a lein checkouts
directory? lein -o
didn’t work for me for that reason. It worked after I temporarily disabled it
@nooga: I don't know. It might be a bug? Anyway, all I know is that when I temporarily renamed my checkouts
directory (effectively disabling that feature), it started working for me.
Then it probably doesn't apply to you. You have to create a checkouts
folder to use that feature.
@aaronk ya it’s me
@leolaporte: wow… so what are you doing in a Clojure channel?
@aaronk - @leolaporte is checking out where all the real action is happening
I like Lisp a lot and I’ve been reading Clojure for the Brave and True. I kind of collect languages. Just for fun. I don’t do anything serious with them.
So like... is this clojars route working for others? http://clojars.org/search?q=hiccup&format=json
or this one: http://clojars.org/
Oh my god @leolaporte is here?!?? I was a huge fan of his radio show on what... KFI 640? like 15 years ago
and then watched screensavers, but that radio show was a reason I later got into programming, thanks @leolaporte 🍻
Clojars donations all round for the new year I think
+1 Donating now...
Any word why Linode is being attacked?
Is anyone here from Clojars? I have some spare capacity my end which I could mirror the site and host until such time as the DDoS dies down...
I’m trying to serve a static index.html file (GET "/" [] (resp/resource-response "index.html" {:root "public"}))
but Chrome, FireFox etc download it rather than display it.
Here’s my route definitions etc.
defroutes app-routes
(GET "/" [] (resp/resource-response "index.html" {:root "public"}))
(GET "/fake" [] (str "<h1>" "Meaningless URL just to test we get a response" "</h1>"))
(context "/api" []
(GET "/auth-token" [] (build-auth-token))
(ANY "/departments" [] (departments))
(ANY "/departments/:id" [id] (department id))
(ANY "/department/:id" [id] (department id))
(ANY "/employees" [] (employees))
(ANY "/employee/:id" [id] (employee id))
(ANY "/holidays" [] (holidays))
;(ANY "/holidays/:id" [id] (holiday id))
(route/not-found "Not Found"))
;; All other routes failed. Just serve the app again
;; and let the client take over.
(ANY "*" [] root-handler))
(def app
(->
app-routes
(wrap-reload)
(wrap-authentication auth-backend)
(prone/wrap-exceptions)
; wrap-defaults adds lots of standard middleware such as wrap_params, wrap_cookies etc
(wrap-defaults site-defaults)
(wrap-cors
:access-control-allow-credentials "true"
:access-control-allow-origin [#".*"]
:access-control-allow-methods [:get :put :post :delete])
#_(liberator.dev/wrap-trace :header :ui)
))
What am I doing wrong?simax99: Its usually a mine-type issue. What does curl -I
return?
Oh, I think it’s seeing it as text/plain. This works (resp/content-type (resp/resource-response "index.html" {:root "public"}) "text/html”)
@crankyadmin: Yeh, its certainly mime type issue. Curl returns: HTTP/1.1 200 OK Date: Sat, 02 Jan 2016 11:27:28 GMT Last-Modified: Thu, 31 Dec 2015 15:32:41 GMT Set-Cookie: ring-session=549236ac-507b-42a9-b8dd-7d3563fae6c2;Path=/;HttpOnly Content-Type: application/octet-stream X-XSS-Protection: 1; mode=block X-Frame-Options: SAMEORIGIN X-Content-Type-Options: nosniff Content-Length: 6401 Server: Jetty(9.2.10.v20150310)
@crankyadmin: Its strange. My code now looks like this
(defn root-handler [_]
(resp/resource-response "index.html" {:root "public"}))
(defroutes app-routes
(GET "/" [] root-handler)
(GET "/fake" [] (str "<h1>" "Meaningless URL just to test we get a response" "</h1>"))
(context "/api" []
(GET "/auth-token" [] (build-auth-token))
(ANY "/departments" [] (departments))
(ANY "/departments/:id" [id] (department id))
(ANY "/department/:id" [id] (department id))
(ANY "/employees" [] (employees))
(ANY "/employee/:id" [id] (employee id))
(ANY "/holidays" [] (holidays))
;(ANY "/holidays/:id" [id] (holiday id))
(route/not-found "Not Found"))
;; All other routes failed. Just serve the app again
;; and let the client take over.
(ANY "*" [] root-handler))
(def app
(->
app-routes
(wrap-reload)
(wrap-authentication auth-backend)
(prone/wrap-exceptions)
; wrap-defaults adds lots of standard middleware such as wrap_params, wrap_cookies etc
(wrap-defaults site-defaults)
(wrap-cors
:access-control-allow-credentials "true"
:access-control-allow-origin [#".*"]
:access-control-allow-methods [:get :put :post :delete])
#_(liberator.dev/wrap-trace :header :ui)
))
Now navigating to localhost:3000/ serves the index file correctly. What I’m actually trying to achieve is whenever I navigate to a URI the server doesn’t understand, then just serve the index.html again and let the client take over. Everything’s fine but when I navigate to localhost:3000/employees/19 it starts to download the file again. Any ideas? (I have rebuilt)^--- that should work.
Can you clean and rebuild your project?
@crankyadmin: I should have said I’m using the pushy library for HTML5 push state so I don’t need URI’s with the # in them. Everything is working fine apart from navigating to some of the URI’s I described above.
What interesting there is wrap-content-type. "If no content-type can be found, it defaults to 'application/octet-stream'."
You do have the middleware enabled don't you?
As I said its doing very nearly what I want. Just that final hurdle (isn’t that always the case)
Ha! yeah its normally the way... I'm stumped. Hopefully someone will wade in with a bit more knowledge than myself.
But if its any help. Its should work.
@crankyadmin: np, thanks anyway.
Clojars is back.
yes, strangely localhost:3000/ does work which is getting to here (GET "/" [] root-handler) in my routes. but when it gets to here (ANY "*" [] root-handler) the browser starts to think it should download again.
is it possible to overwrite the hashCode of a record?
(e.g. defrecord, java.lang.Object hashCode?)
guess you can’t, need to make a deftype instead
or for this particular use case, maybe a memoize that takes a hashfunction 😛
@tcrawley: I think I’ve followed the instructions for your mirror, but lein is still trying the official clojars, it doesn’t look like it’s failing over
@arohner: I'm using a letsencrypt free cert, but that only works with openjdk 8, apparently. are you seeing "sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target"?
@tcrawley: no, I’m just seeing 'INFO: I/O exception (java.net.NoRouteToHostException) caught when processing request to {s}->https://clojars.org:443: No route to host’, with no attempt to try the mirror
you should see "Retrieving cheshire/cheshire/5.4.0/cheshire-5.4.0.jar from clojars mirror" when it works. can you gist ~/.lein/profiles.clj
(assuming that's where you put the mirror info)?
annoyingly, LEIN_OFFLINE=true seems to report many plugins (non snapshot) as not available, even though I haven’t changed any deps, and this project booted 2 days ago
yeah, that should work. I wonder if the mirrors aren't being honored for some part of the plugin init process? that would be odd though
yeah, I commented out my top-level :plugins in project.clj and now see: ould not transfer artifact lein-figwheel:lein-figwheel:pom:0.2.9 from/to tcrawley (https://clojars-mirror.tcrawley.org/repo/): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
that PKIX error is caused by the java you are using not liking the letsencrypt cert - I'm fixing that now.
Hey everyone!… has anyone extended the IResultSetReadColumn protocol in order to read JSON objects directly from a PostgreSQL database?. I extended the protocol to the PGobject class to transform any JSON to a Clojure map without success. This is my code:
However, for some reason, the code never gets executed (I am pretty sure about that).
You can see here the result from a SQL that returns a JSON field, which I want to transform to a map.
@tcrawley: SSL cert seems to be fixed: `Retrieving org/thnetos/cd-client/0.3.6/cd-client-0.3.6.pom from tcrawley Retrieving clj-http-lite/clj-http-lite/0.2.0/clj-http-lite-0.2.0.pom from tcrawley `
@rcanepa: is your postgres column actually jsonb
by any chance?
I had to deal with a very similar problem recently: https://github.com/BedquiltDB/clj-bedquilt/blob/master/src/bedquilt/utils.clj
you may need to add a ”jsonb”
case to the protocol extension
tcrawley: lein and boot both seem to still have issues that they try to contact clojars even though I have :mirrors
set up
Retrieving clj-jgit/clj-jgit/0.8.0/clj-jgit-0.8.0.jar from tcrawley
Retrieving fs/fs/1.3.2/fs-1.3.2.jar from tcrawley
Retrieving alandipert/desiderata/1.0.2/desiderata-1.0.2.jar from tcrawley
Retrieving clj-yaml/clj-yaml/0.4.0/clj-yaml-0.4.0.jar from tcrawley
Jan 02, 2016 1:27:45 PM org.apache.http.impl.execchain.RetryExec execute
INFO: I/O exception (java.net.NoRouteToHostException) caught when processing request to {s}->https://clojars.org:443: No route to host
Jan 02, 2016 1:27:45 PM org.apache.http.impl.execchain.RetryExec execute
@shanekilkelly: it is not. The JSON comes from the execution of a json_build_object statement.
I see you’ve got a println in there printing the type, what type is it printing?
could try casting the result of array_agg to json, to ensure that the sql engine definitely sees it as json
array_agg(…)::json
either way, I’m pretty sure the value is coming out as a type that’s not being caught in the case expression in extend-protocol
@rcanepa: I’d recommend casting the result of array_agg to json (`array_agg(…)::json`), if you’re still having trouble with this in about a half hour, ping me a direct message
@joelpedraza: not sure if this would work or not but I recently used reify
to override the toString
on an object.
lots of good examples here: https://clojuredocs.org/clojure.core/reify
oops, that was for @joelkuiper not @joelpedraza
@meow: hmm not sure, ended up writing this https://gist.github.com/joelkuiper/a96994dcc0ae0b2f843b I needed a custom key/hash for the memoize of a function
@joelkuiper: Whatever works. I just saw a different way to shave that yak. 😉
fair enough 😄
I can confirm that even with :mirrors
set lein is still trying the main repo and failing
@akhudek: Have you figured out how to get mirrors working? I added :mirrors
to my profile and was able to get some stuff going but it seems inconsistent as to which "clojars" is being used - main or mirror.
I must be the lucky one; I haven’t had to use -o
or :offline? true
and I’ve been coding on and off all day.
Came here to ask the same thing. My ~/.lein/profiles.clj
is empty, so I set it to
{:user {:mirrors {#"clojars" {:name "clojars mirror" :url " "}}}}
based on the help I found online. Note the outermost :user
. Doesn't seem to work thoughI left cljbuild running for 30 min and it eventually started after a bunch of clojars errors
I wonder if it was really just intermittent access to http://clojars.org when I thought the mirror was working
when the mirror is being used, you should see messages like: Retrieving clj-yaml/clj-yaml/0.4.0/clj-yaml-0.4.0.jar from whatever-you-named-the-mirror
One thing I have just noticed - lein <anything>
stalls when I have lein-immutant
as a plugin unless I have :mirrors
in my profile. So, that seems to be pinging the mirror as expected. However, when I run lein immutant war
(which does its own dependency checking), I eventually get errors indicating that it's trying to retrieve dependencies from main
@tcrawley: I started digging through the code and it looked like it was just using fns from leiningen so I was hoping it would just use the same resolution mechanism
Good to know though!
well, I'm assuming it doesn't honor mirrors, because I don't recall passing :mirrors
around
@tcrawley: Just dug through it a little deeper given that you didn't think mirrors is passed around. You essentially create a new project map in immutant.deploy-tools.war
. Going to work on a quick fix so I can proceed and will submit a PR if you'd like.
@andrew-nguyen: that would be swell, thanks!
@akhudek: I just ran a lein-modules project, and it built even after I removed some of the deps from ~/.m2
@tcrawley: I think you're right. I have a normal compojure project and I can't even get as far as lein help
without it trying to download the lein-ring
plugin
if I remove :plugins [[lein-ring "0.9.7"]]
from my project.clj I can do a lein deps
with no problems
I don't understand the interconnections well enough so just reporting observations... I cloned lein-immutant
and tried lein install
so that I could reference it via checkouts and even lein install
stalls out trying to get to the main clojars (and I have :mirrors
defined in my profiles.clj)
I did the same thing for immutant/deploy-tools and lein install
worked fine
I added a plugin repo to my profiles.clj as a workaround for now and can carry on as normal
{:user {:mirrors {#"clojars" {:name "tcrawley clojars mirror"
:url " "}}}
:plugin-repositories [["tcrawley-clojars-mirror" ""]]}
(Edit: This didn't work. Clojars came back up.)@tcrawley: Thanks for all your hard work. When you have a chance, I'd like to hear what we could do to help to prevent this in the future.
Still a bit rough but they’re getting there: https://linode.statuspage.io
@jwhitlark: thanks! and yeah, I'd like to hear how we could prevent it as well :)
I saw the new issues filed on lein, that's a good start. Mirroring should help too. Does is seem like some work needs to be done on plugins? Maybe just an audit and a few repairs? I'm not up enough on the internals to know for sure.
I don't know either, and am a little brain-fried at this point, so I don't really know what the next step is. Once I've had some rest, I'll probably start a thread on the clojars-maintainers email list to discuss what happened, including tooling failures
@tcrawley: FYI - I think I had a typo when working with lein-immutant and deploy-tools. I have something and will be sending over PR shortly. Thank you again for all of your help these past few days.
found a simple way to simulate http://clojars.org being down
echo '127.0.0.1 ' >> /etc/hosts
@andrew-nguyen: thanks!
@tcrawley: thanks for looking at this. am a bit of a noob, but will see if I can find a workaround for plugins for now
Does anyone know when the survey results are going to be released?
Everyone is just on vacation right now - it's high on the list for next week!