Clojurians
#hoplon
<
2015-10-12
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

andrewboltachev16:10:53

Hi. Elements with :style (e.g. :style "postion: relative; ") are not affected by :toggle cell

roberto16:10:55

is there a way to hook hoplon into figwheel?

roberto16:10:09

I miss the fast feedback I get with figwheel.

raywillig16:10:21

@roberto i think the latest (possibly not yet in clojars) version of boot-reload has a figwheel style HUD in the browser

roberto16:10:53

oh, nice...

roberto16:10:22

I’ve just started playing with hoplon. I like it much more than the other options in the cljs space, but I was missing figwheel. It felt like a step backward in that regards. But I am still going to stick with hoplon for now. I’m having lots of fun with it so far.

raywillig16:10:47

i've had an extra large drink of the hoplon kool-aid. I hadn't used figwheel before no nothing really to miss. I find that most of the things that i'm trying to track down in my hoplon development have to do with cells and it's super easy to just log the value of a cell to the console to watch what's happening

alandipert17:10:06

@andrewboltachev: weird - i am able to produce in chrome, but not reliably

andrewboltachev17:10:35

yes, looks like race condition

alandipert17:10:47

@andrewboltachev: it looks like jquery toggle appends "display:none;" to the element's style attr... this version works more reliably for me

alandipert17:10:50

(defmethod do! :safe-toggle
  [elem _ v]
  (let [$ (js/jQuery elem)]
    (if v
      (.attr $ "style" (.data $ "saved-style"))
      (do (.data $ "saved-style" (.attr $ "style"))
          (.attr $ "style" "display:none;")))))

andrewboltachev17:10:53

Ok, good. But I solved with nested div's :simple_smile:

alandipert17:10:34

ah, easy fix

andrewboltachev17:10:22

btw, do you guys like TypedClojure?

alandipert17:10:11

as type systems go it looks like a good one, but i'm not a fan in general

andrewboltachev17:10:53

i.e., don't you think it would be possible to eliminate bugs?

andrewboltachev17:10:17

for me seemed more like multiplying my program to 2

alandipert17:10:47

just in general, in my experience, type systems are more trouble than they're worth

alandipert17:10:55

different kinds of isolation and virtualization are more productive i think... like instead of avoiding bugs by using type system, run your generative test suite in a very realistic environment

andrewboltachev17:10:27

thanks, that makes sense

andrewboltachev17:10:48

btw, is there a way for a cell to track value of input etc?

alandipert17:10:06

you can make a history cell by adding a watch to a cell

andrewboltachev17:10:11

unless having (input :change #(reset! ...)))

andrewboltachev17:10:28

I mean for a cell to be always value of input

alandipert17:10:12

(let [input-val (cell "")] (input :change #(reset! input-val @%) :value input-val))

alandipert17:10:46

the todo example on http://hoplon.io does this

andrewboltachev17:10:08

but, what @% is? :simple_smile:

alandipert17:10:34

% is a jQuery event object, that we have extended IDeref to

alandipert17:10:43

so that it returns the value of the element the event was fired on

andrewboltachev17:10:05

'cause I'm doing... (.val (js/$ "#input"))

andrewboltachev17:10:11

always have to have id

alandipert17:10:25

yeah, that's how we used to do it

alandipert17:10:38

the event deref way is preferred these days, because you dn't need to have IDs in your code

andrewboltachev17:10:14

btw, what :value input-val would do?

andrewboltachev17:10:19

isn't it redundant?

alandipert17:10:16

for the most part... but i wire it up because it makes it impossible for the input and cell values to diverge

alandipert17:10:26

for instance, if an event we're not handling happens on the object and changes the input value

andrewboltachev17:10:55

so would :change be fired?

alandipert17:10:52

hm, that's true

alandipert17:10:33

i was thinking about the situation where someone gets the element we made and does (.attr (js/jQuery our-input-elem) "value" "foo")

alandipert17:10:51

or even (set! (.-value our-input-elem) "foo")

alandipert17:10:23

in those cases :change would not be fired, but also the cell value wouldn't change, and the wiring wouldn't matter

alandipert17:10:05

so, i suppose it's more of a style thing than a defensive programming thing

flyboarder17:10:05

Is there a way to get better castra error messages back when doing an rpc call? I’m seeing a lot of {:message Server error., :data {:castra.core/exception true}} which isn’t that helpful

micha17:10:54

flyboarder: you should be able to see the stack trace

micha17:10:22

the "server error" you see there is what is sent when an unknown (non-castra) exception is thrown

micha17:10:51

it's wrapped in a castra exception with the message "server error", because the exception that comes over the wire to the client should have a message that you can show to the user

micha17:10:21

the error object on the clientside in cljs will have a (.-serverStack ex) property

micha17:10:24

which you can print

micha17:10:35

that will show you the full stack trace including the cause

micha17:10:40

which is what you're interested in

flyboarder17:10:27

ok it seems the stack trace is empty for uncaught language errors

andrewboltachev17:10:42

alandipert: but wouldn't :value be changed (.attr (js/jQuery our-input-elem) "value" "foo") from value-cell to that "foo"?

andrewboltachev17:10:41

and, in general, may be have two-way cell?

andrewboltachev18:10:38

(let [value-cell (cell "")] (input :bind-to-value value-cell))

andrewboltachev18:10:56

this would besides all set value to ""

andrewboltachev18:10:16

and then watch for changes

alandipert18:10:33

@andrewboltachev: no, there aren't 2-way cells in general... cells are unidirectional

alandipert18:10:48

but the unidirection can be sidestepped by linking cells with watches instead of formulas

andrewboltachev18:10:02

Yes, I know. But I think we might have them

andrewboltachev18:10:10

or isn't that good idea?

andrewboltachev18:10:17

for that use case, what way is better?

alandipert18:10:45

i am not sure about .attr... because that call happens thruogh jQuery, it might trigger the :change automatically

andrewboltachev18:10:27

and all this behaviour might change with jQuery version changes :smile:

alandipert18:10:45

true, fortunately jquery in general is extremely stable

alandipert18:10:25

might anyone be interested in hoplon contracting? we might need help with the new adzerk UI, which is all hoplon. remote/international totally cool

andrewboltachev18:10:44

alandipert: sounds quite interesting

andrewboltachev18:10:33

going to ask my boss if we can take this ('cause we're busy on projects)

alandipert18:10:54

i think we'd prefer to contract with individuals and not agencies, but we're open to either

raywillig18:10:31

@alandipert: I'm available if we can do <= 30 hrs/wk

alandipert18:10:19

@raywillig: awesome! and probably. i'll let you know when the idea moves ahead

roberto19:10:05

I have 0 hoplon experience. I’m still learning. But if there is some small task that a beginner can tackle, I would be game too.

alandipert20:10:33

@roberto: cool i'll let you know when i have more info :smile:

symbit20:10:46

@micha: I can try the method @kirked suggested. I'll put it after the hard-link call in copy-with-lastmod. Anyplace else?

micha20:10:54

you could try it in the loop body

micha20:10:05

@symbit: in your loop experiment

symbit21:10:15

@micha I put the call (System/runFinalization) after all the (copy-with-lastmod ...) calls. No Dice. Same behavior. Also the runFinalization method is also just a suggestion.

micha21:10:02

@symbit: :confused:

symbit21:10:24

@micha: What's interesting with or w/o the runFinalization method call inserted and changes to the source file are compiled as on unix.

symbit21:10:00

@micha: It's only after the page is loaded in the browser (hence all the dep files in question) does the issue occur. So you load then make a change. boom can't delete.

micha21:10:22

if you don't load the page in the browser it's ok?

symbit21:10:23

@micha Perhaps the webserver is holding on to the files?

micha21:10:44

how are you serving the files?

symbit21:10:16

I'm running the example with 'boot dev'

micha21:10:25

is that using boot-http?

micha21:10:56

you could try using the boot-jetty task instead

micha21:10:14

that one copies all the files over into a tempdir and serves from there

symbit21:10:36

Where is the boot-http, you're talking about build.boot?

micha21:10:22

it's probably the task you're using to start a webserver

symbit21:10:07

This is the barebones address-book example. The lein new hoplon template didn't put any http in the build.boot.

symbit21:10:36

oops. I see it now.

symbit21:10:46

boot-jetty is there already.

symbit21:10:08

[tailrecursion/boot-jetty "0.1.0"]

roberto21:10:15

it is working for me

symbit21:10:45

which version of windows?

roberto21:10:56

oh, I missed that part

roberto21:10:59

I’m not on windows

micha21:10:33

ah so maybe try [pandeiro/boot-http "0.6.3"] instead

micha21:10:55

then change the require accordingly

micha21:10:18

(require
  ...
  '[pandeiro.boot-http :refer [serve]]
  ...

symbit21:10:45

That http server worked!

symbit21:10:05

I'll revert all changes now...

micha21:10:48

i'll make a modification to the boot-jetty task

micha21:10:21

maybe you could test it to see if my change works?

symbit21:10:18

Took all finalization, etc out. Still works. The issue was the default http server used seems to be holding on to the file handles.

micha21:10:36

yep i think i know why

symbit21:10:50

@micha: Let me know if you'd like me to test it.

micha21:10:01

ok boot-jetty 0.1.1-SNAPSHOT

symbit21:10:23

Only 1 exception instead of 1 for every file in the FileSet.

symbit21:10:52

java.io.FileNotFoundException: C:\Users\me\.boot\cache\tmp\somedir\dev\clj\address-book\5ek\-w8szar\index.html.js ( The requested operation cannot be performed on a file with a user-mapped section open) ... http://clojure.java.io/fn io.clj: 345 ... http://clojure.java.io/copy io.clj: 396 ... clojure.core/partial/fn core.clj: 2493 boot.file/copy-with-lastmod file.clj: 175 boot.file/sync! file.clj: 221 ... clojure.core/apply core.clj: 634 boot.core/sync! core.clj: 498 ... clojure.core/apply core.clj: 632 tailrecursion.boot-jetty/eval735/fn/fn/fn/fn boot_jetty.clj: 29 tailrecursion.boot-jetty/eval735/fn/fn/fn boot_jetty.clj: 28

symbit22:10:08

@micha it seems the index.html.js file stands out in some way and remains open, while the other files are closed now.

symbit22:10:12

@micha: stock clojure 1.7.0 (without the patch) works with pandeiro http.