Fork me on GitHub
#hoplon
<
2017-03-09
>
thedavidmeister05:03:21

@micha have you had any experience getting hoplon prerender working on heroku?

thedavidmeister07:03:48

nm, i just had to hardcode the path to phantomjs

thedavidmeister12:03:03

@mynomoto got another snippet if you're interested

thedavidmeister12:03:50

adding a data attribute to something if it or its descendants are currently in focus, so you can style it

thedavidmeister12:03:11

(let [target (j/cell nil)
      current-els (j/cell #{})]
 (defmethod hoplon.core/do! :current-el
  [el k v]
  (hoplon.core/do-watch
   (j/cell= (when (get current-els el) v))
   #(hoplon.core/do! el :attr {:data-current %2}))
  (.on
   (js/jQuery el)
   ; click is an obvious candidate for "current" el.
   ; focusin covers keyboard navigation.
   ; input covers deletion of an element and reselection of a new one.
   "click focusin input"
   (fn [e]
    (j/dosync
     (when-not (identical? (.-target e) @target)
      (reset! target (.-target e))
      (reset! current-els #{}))
     (swap! current-els conj el))))))

chromalchemy16:03:44

This conversation about core.async use-cases on Reddit supports Hoplon's position that Javelin dataflow is more useful for UI's than core.async. https://www.reddit.com/r/Clojure/comments/5y9ln1/what_are_use_cases_for_coreasysnc/

jjttjj16:03:18

what i've always liked about the hoplon community's school of thought is that it seems to manage to be simple AND easy according to Rich Hickey's definitions. I'm sure core async is simple but it's definitely a lot to learn and practice. And with the cljs react libraries (though I haven't looked at them in a while) there's extra layers of stuff you have to learn. With hoplon you pretty much need to know html and spreadsheets and you can start typing and seeing results

alandipert17:03:18

interesting that even the creators have come around

alandipert17:03:33

when rich first unveiled core.async he was enthusiastic that it "solved" callback hell

alandipert17:03:42

which it does in a way

alandipert17:03:30

you get to trade callbacks for infinite loops lol

alandipert17:03:10

and there isn't a catchy pejorative for the hand wringing associtaed with infinite loops yet, so it's an improvement 😉

chromalchemy17:03:41

@alandipert I'm trying to deploy the castra template (made a new project with the included boot-new command). Total Heroku noob here. I successfully build and uploaded the war, and got a confirmation message and url on the command line. But when I load the url I get this:

HTTP Status 500 - Servlet.init() for servlet boot-webapp threw exception

type Exception report

message Servlet.init() for servlet boot-webapp threw exception

description The server encountered an internal error that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Servlet.init() for servlet boot-webapp threw exception 
.......

root cause

java.io.FileNotFoundException: Could not locate my_app/handler__init.class or my_app/handler.clj on classpath. Please check that namespaces with dashes use underscores in the Clojure file name.
......
Any suggestions?

chromalchemy17:03:42

The castra demo seems to run in (boot-dev) mode on localhost

alandipert17:03:38

hm looks like clj didn't make it into the war

alandipert17:03:46

i'm gonna see if i can reproduce locally using the jetty runner

chromalchemy17:03:50

In my target there is <project-name>/handler.clj

chromalchemy17:03:14

I am on windows, btw (maybe some backslash thing?)

chromalchemy17:03:40

I dont need to use the heroku.git stuff right?

alandipert17:03:42

did you do boot make-war

alandipert17:03:37

ok: repro'd locally

alandipert17:03:43

this has to be something small, 1 sec

alandipert17:03:59

i see the problem

chromalchemy17:03:15

.. or any local git stuff for the war deploy?

alandipert17:03:17

it's a bug in the template

alandipert17:03:35

my_app/handler.clj should be <app-name-you-picked>/handler.clj

chromalchemy17:03:39

I ran into a similar error last time I took a stab at Heroku deployment.

alandipert17:03:15

if you change line 53 to the from my-app to the name of your app you picked, it should work if you boot make-war and redeploy

chromalchemy17:03:52

Ok. Thanks! Trying it now, will report back.

alandipert17:03:53

template is fixed now too

alandipert17:03:00

thanks for the report @chromalchemy

chromalchemy18:03:56

@alandipert It worked!!! Thanks for the quick fix. I live clojurescript, but now I don't feel so cut off from the rest of clj libs, having little devops or java experience.

alandipert18:03:39

awesome, glad it works