Fork me on GitHub
#clojure
<
2016-01-02
>
solicode00:01:06

Do you have a lein checkouts directory? lein -o didn’t work for me for that reason. It worked after I temporarily disabled it

akhudek00:01:56

lein -o doesn't seem to work for cljsbuild

nooga00:01:56

@akiva: any command, even if I do just lein -o I get the exception

akiva00:01:35

I wonder if it’s something unique to figwheel.

nooga00:01:57

even if I run plain lein -o outside of any project

akiva00:01:10

Oh. Hunh.

akhudek00:01:55

My project is not using figwheel

akhudek00:01:12

lein -o seems to work for most commands for me, just oddly not cljsbuild

akiva00:01:47

Wish I could help further but I can’t replicate the behavior here.

nooga00:01:40

thanks anyway - I’ll try to investigate

nooga00:01:01

@solicode: where should it be?

solicode00:01:29

@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.

solicode00:01:36

Do you also have a checkouts directory?

akhudek00:01:57

I tried both with and without checkouts

akhudek00:01:07

lein run seems to work with checkouts

solicode00:01:29

Strange. Even lein run didn’t work for me until I renamed it.

nooga00:01:14

@solicode: I don’t know where to look for checkouts folder

solicode00:01:44

Then it probably doesn't apply to you. You have to create a checkouts folder to use that feature.

solicode00:01:08

It would be in the project root directory if you had one.

akhudek01:01:48

dang, even LEIN_OFFLINE=true lein … doesn't work for cljsbuild

akhudek01:01:52

so close, yet so far

tcrawley03:01:20

clojars is up at the moment. get your deps while they are hot

aaronk04:01:16

@leolaporte: wow… so what are you doing in a Clojure channel? simple_smile

kahunamoore05:01:38

@aaronk - @leolaporte is checking out where all the real action is happening simple_smile

leolaporte05:01:19

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.

aaronk06:01:40

Saw the reply in the Clojurescript channel, nice. I’ve been reading the same book.

escherize09:01:44

So like... is this clojars route working for others? http://clojars.org/search?q=hiccup&amp;format=json

solicode09:01:51

Unfortunately, no

escherize09:01:07

Hmmm, anything I could do?

escherize09:01:28

Pretty bad if the clojars site goes down T_T;

solicode09:01:20

Yeah, we’re all feeling it 😞

escherize09:01:41

Oh my god @leolaporte is here?!?? I was a huge fan of his radio show on what... KFI 640? like 15 years ago

escherize09:01:22

and then watched screensavers, but that radio show was a reason I later got into programming, thanks @leolaporte 🍻

escherize09:01:09

Re: Clojars, sorry for causing some spam shoulda backread or searched a bit

zharinov09:01:17

get your deps while available!

zharinov09:01:32

Definitely I will donate clojars from this new year

agile_geek10:01:53

Clojars donations all round for the new year I think

crankyadmin10:01:50

+1 Donating now...

crankyadmin10:01:09

Any word why Linode is being attacked?

crankyadmin10:01:16

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...

simax9911:01:44

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?

crankyadmin11:01:56

simax99: Its usually a mine-type issue. What does curl -I return?

simax9911:01:29

Oh, I think it’s seeing it as text/plain. This works (resp/content-type (resp/resource-response "index.html" {:root "public"}) "text/html”)

simax9911:01:02

@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)

simax9911:01:40

@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)

crankyadmin11:01:44

^--- that should work.

crankyadmin11:01:02

Can you clean and rebuild your project?

simax9911:01:19

@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.

crankyadmin11:01:44

What interesting there is wrap-content-type. "If no content-type can be found, it defaults to 'application/octet-stream'."

simax9911:01:46

Yeh, been there and to lots of other things like that.

crankyadmin11:01:45

You do have the middleware enabled don't you?

simax9911:01:06

As I said its doing very nearly what I want. Just that final hurdle (isn’t that always the case)simple_smile

simax9911:01:11

yes lots of middleware (wrap-defaults site-defaults)

crankyadmin11:01:04

Ha! yeah its normally the way... I'm stumped. Hopefully someone will wade in with a bit more knowledge than myself.

crankyadmin11:01:26

But if its any help. Its should work.

simax9911:01:36

@crankyadmin: np, thanks anyway.

crankyadmin11:01:47

Clojars is back.

simax9911:01:48

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.

joelkuiper12:01:55

is it possible to overwrite the hashCode of a record?

joelkuiper12:01:30

(e.g. defrecord, java.lang.Object hashCode?)

joelkuiper13:01:16

guess you can’t, need to make a deftype instead

joelkuiper13:01:30

or for this particular use case, maybe a memoize that takes a hashfunction 😛

tcrawley17:01:20

anyone want to help test a clojars mirror?

arohner18:01:44

@tcrawley: re: test a mirror: yes

arohner18:01:15

@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

tcrawley18:01:41

@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"?

tcrawley18:01:05

I'm working on getting a better cert now

arohner18:01:13

@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

tcrawley18:01:31

is this lein?

arohner18:01:36

yes, lein 2.5.3

tcrawley18:01:13

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)?

arohner19:01:25

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

tcrawley19:01:38

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

arohner19:01:41

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

arohner19:01:05

I have some extra plugins in :profiles {:dev {:plugins []}}

tcrawley19:01:38

that PKIX error is caused by the java you are using not liking the letsencrypt cert - I'm fixing that now.

arohner19:01:05

yeah, I saw that on twitter

rcanepa19:01:57

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:

rcanepa19:01:30

However, for some reason, the code never gets executed (I am pretty sure about that).

rcanepa19:01:43

You can see here the result from a SQL that returns a JSON field, which I want to transform to a map.

tcrawley19:01:55

@arohner: I just replaced the ssl cert - can you try again?

rcanepa19:01:06

You can see there, that the PGobject was not transformed as I was expecting to

arohner19:01:02

@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 `

shanekilkelly19:01:19

@rcanepa: is your postgres column actually jsonb by any chance?

shanekilkelly19:01:32

you may need to add a ”jsonb” case to the protocol extension

arohner19:01:41

tcrawley: lein and boot both seem to still have issues that they try to contact clojars even though I have :mirrors set up

arohner19:01:55

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

tcrawley19:01:09

is that boot or lein?

arohner19:01:19

that’s boot, but I’m seeing similar in lein

arohner19:01:36

it’s clearly hitting your mirror for some things, but not others

rcanepa19:01:36

@shanekilkelly: it is not. The JSON comes from the execution of a json_build_object statement.

rcanepa19:01:33

Mmmm… could be array_agg the source of the problem ?

shanekilkelly19:01:43

I see you’ve got a println in there printing the type, what type is it printing?

shanekilkelly19:01:11

could try casting the result of array_agg to json, to ensure that the sql engine definitely sees it as json

shanekilkelly19:01:21

array_agg(…)::json

shanekilkelly19:01:10

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

rcanepa19:01:06

Yeah, it is coming out as an Jdbc4Array

rcanepa19:01:19

Inside of it I can see the PGobjects

rcanepa19:01:28

That is the problem

shanekilkelly19:01:46

@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

meow19:01:01

@joelpedraza: not sure if this would work or not but I recently used reify to override the toStringon an object.

meow19:01:01

makes me want to use reify more often - got a hammer, lookin' for some nails

meow19:01:27

looks to me like you should be able to override the hashCode on a record using reify

meow19:01:25

oops, that was for @joelkuiper not @joelpedraza

joelkuiper19:01:33

@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

meow20:01:50

@joelkuiper: Whatever works. I just saw a different way to shave that yak. 😉

joelkuiper20:01:02

fair enough 😄

meow20:01:16

semi burned out from working on this polygon mesh processing library

akhudek21:01:19

I can confirm that even with :mirrors set lein is still trying the main repo and failing

akiva21:01:15

@akhudek, Can you put up a snippet on how you have your :mirrors configured?

akhudek21:01:00

:mirrors {#"clojars" {:name "tcrawly" :url ""}}}

akhudek21:01:11

under :user

akiva21:01:58

Hm. That looks right to me.

andrew-nguyen21:01:47

@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.

akiva21:01:28

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.

chetbox21:01:54

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 though

akhudek21:01:00

I left cljbuild running for 30 min and it eventually started after a bunch of clojars errors

andrew-nguyen21:01:41

I wonder if it was really just intermittent access to http://clojars.org when I thought the mirror was working

tcrawley21:01:30

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

tcrawley21:01:56

there may be an issue with plugins and mirrors in lein

tcrawley21:01:13

are any if the failing projects public?

tcrawley21:01:29

and can you share your profiles.clj?

andrew-nguyen21:01:02

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

tcrawley21:01:45

yeah, the lein-immutant plugin doesn't honor mirrors

tcrawley21:01:49

that's my fault

akhudek22:01:06

I'm using lein-modules

akhudek22:01:15

could that also be an issue?

andrew-nguyen22:01:31

@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

andrew-nguyen22:01:37

Good to know though!

tcrawley22:01:09

well, I'm assuming it doesn't honor mirrors, because I don't recall passing :mirrors around

tcrawley22:01:31

@akhudek: possibly? I have a lein-modules project here, let me try to run it

andrew-nguyen22:01:26

@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.

tcrawley22:01:40

I think lein isn't honoring mirrors when resolving plugins

tcrawley22:01:58

@andrew-nguyen: that would be swell, thanks!

tcrawley22:01:51

@akhudek: I just ran a lein-modules project, and it built even after I removed some of the deps from ~/.m2

tcrawley22:01:03

do you have any plugins that are snapshots?

chetbox22:01:07

@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

chetbox22:01:26

and it's not using the mirror to fetch it

chetbox22:01:56

if I remove :plugins [[lein-ring "0.9.7"]] from my project.clj I can do a lein deps with no problems

tcrawley22:01:05

I'm digging in to the lein code now

andrew-nguyen22:01:59

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)

andrew-nguyen22:01:33

I did the same thing for immutant/deploy-tools and lein install worked fine

tcrawley22:01:12

hmm, and it has no plugin deps. let me see what happens for me

chetbox22:01:57

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.)

tcrawley22:01:53

clojars is back up, at least for the moment

chetbox22:01:08

oh, that might be why...

jwhitlark22:01:45

@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.

akiva22:01:55

Still a bit rough but they’re getting there: https://linode.statuspage.io

tcrawley22:01:39

@jwhitlark: thanks! and yeah, I'd like to hear how we could prevent it as well :)

jwhitlark22:01:10

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.

tcrawley22:01:05

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

andrew-nguyen22:01:07

@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.

chetbox22:01:36

found a simple way to simulate http://clojars.org being down

echo '127.0.0.1 ' >> /etc/hosts

chetbox22:01:44

@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

Oliver George23:01:36

Does anyone know when the survey results are going to be released?

jaen23:01:15

I've seen it mentioned somewhere around here it should be in this week-ish.

Alex Miller (Clojure team)23:01:08

Everyone is just on vacation right now - it's high on the list for next week!