Fork me on GitHub
#dirac
<
2017-03-03
>
qqq02:03:38

@darwin: I am using some library which catches (assert false) which is bad; because I like getting exceptions + debugging stack frames in dirac/cljs-devtools. Rethrowing is not getting the stack frames I want. My question now: instead of (assert false), can I do something like (call-dirac-break-point) where my code, instead of throwing an exception, directly interacts with dirac to cause dirac to have a break point there? [I realize this would only work in dev mode, and that is fine.] Basically, instead of jumping into dira/cljsdevtools via (assert false) [which other code can catch / screw up], I'd directly like to make a call into dirac-break-here.

qqq02:03:46

can I do something involving https://github.com/binaryage/dirac/search?utf8=%E2%9C%93&amp;q=js-debugger that triggers the debugger ?

darwin02:03:04

@qqq I’m afraid nothing like that is supported

darwin02:03:24

js-debugger is just clojurescript version of “debugger;” statement in javascript

darwin02:03:27

nothing special

darwin02:03:56

I think nothing is stopping you to do that instead of assert, so you get a conditional breakpoint

qqq02:03:50

sorry, I don't understand the alternative you are proposing

qqq02:03:08

can I set dirac breakpoints in my cljs files directly, without using the cljs-devtools-browser-ui ?

qqq02:03:13

if I could do that, it'd suffice

darwin02:03:34

what is cljs-devtools-browser-ui?

qqq02:03:57

I don't know the proper name of the gui window that pops up when I click on the "dirac extension" inside of "chrome canary"

qqq02:03:05

What should I call it ?

darwin02:03:35

that is Dirac DevTools, which is a fork of Chrome DevTools

darwin02:03:49

cljs-devtools is completely independent and technically unrelated project

qqq02:03:58

yes, but "dirac devtools" consists of that ui + parts in nrepl + parts in cljs code + dirac agent

qqq02:03:05

shoudl I call the ui part "dirac devtools" ?

darwin02:03:08

cljs-devtools provides bunch of custom formatters to present cljs data structure in chrome console

darwin02:03:15

it does not require dirac to work

qqq02:03:37

I see, my mistake is confusing cljs-devtools (which provides pretty printing in clj format) with dirac-devtools

darwin02:03:46

yes, the ui part should be callled “dirac devtools"

darwin02:03:55

whole set of tools just “dirac"

darwin02:03:21

so back to your breakpoints

qqq02:03:43

oh wow, changing (assert (...)) to

(if-not (...)
  (js-debugger))
appears to ahve worked

darwin02:03:43

debugger; statement is normal javascript feature supported by stock chrome devtools

darwin02:03:47

dirac does nothing special here

darwin02:03:11

yes, you should replace assert with something like the code above

qqq02:03:01

great; thanks for clarifying 🙂

darwin02:03:17

there are other tricks you could do, but I’m not sure if you should go that route, you could schedule an async call and throw assert exception there

darwin02:03:33

this way you would work-around that om-catch which is eating your exceptions

darwin02:03:34

going off, good luck!

qqq02:03:46

thanks again!

qqq04:03:04

I have a data structure which is a LIST of VECTORS. When I view the local in the "local scope vars" or in (. js/console log), I do NOT want to see

( [:foo 1] [:bar 2] [:cat 3] [:dog 444])
instead, I would prefer to see
([:foo 1]
[:bar 2]
[:cat 3]
[:dog 444])
is there anyway I can specify horiz vs vert rendering via meta -- or if not, add extra junk elements to change the way whether dirac choose horiz vs vertical?

qqq10:03:14

is there a way to tell dirac that instead of localhost:8230, it should look for this-ip:8230 ?

qqq10:03:08

@giles @richiardiandrea @darwin : did this ever got resolved? https://clojurians-log.clojureverse.org/dirac/2016-08-23.html I'm basically running into the ezact issue

darwin13:03:53

@qqq you could try to tweak cljs-devtools prefs, for example this one controls how many items you need to render “expanson disclosure triangle button"

darwin13:03:36

as of the second issue, you probably need to tweak nrepl config, which controls weasel configuration: https://github.com/binaryage/dirac/blob/master/src/nrepl/dirac/nrepl/config.clj#L19

darwin13:03:13

you want to replace “localhost” with the IP where your Dirac agent is running

darwin13:03:16

btw. nrepl-config override can be specified in runtime config, it gets constructed here and sent via bootstrap message: https://github.com/binaryage/dirac/blob/master/src/implant/dirac/implant/intercom.cljs#L328-L334

darwin13:03:31

^ this will work when using preloads

qqq14:03:57

@darwin: thanks for the resources! looking into it now

qqq14:03:14

what I'm curently trhing is: :dirac-opts {:nrepl-tunnel {:host .. ip ..}}} but clearly this is wrong

darwin14:03:52

:dirac-opts where did you see that?

qqq14:03:45

probaly because I'm doing this wrong; in that "preloads" = stuff injected into cljs land right? :dirac-opts comes from (doc dirac) // in boot which comes from powerlaces.boot-cljs-devtools

darwin14:03:26

aha, that’s a boot thing and means “dirac agent options"

darwin14:03:54

dirac agent is not the place where to configure runtime or nrepl

darwin14:03:32

actually it is pretty tricky to configure nrepl middleware, because there is no mechanism supporting it in nrepl system (AFAIK)

darwin14:03:54

so I configure it at runtime by sending a config during bootstrap phase

qqq14:03:59

actually, I think I have the pices, let met struggle with this for a bit, 30min - 1 hr

qqq14:03:08

I'll gain intuition / familiar with the error msgs, then I'll bug you again 🙂

qqq14:03:24

[my cljs is also broken at the moment, so I need to fiz that before testing this out]

darwin14:03:24

a tip: if you open internal devtools console on "dirac devtools” page, you should see runtime config and messages about weasel connection attempts, you should see there if your setting got reflected there

qqq14:03:53

@darwin: noted: the problem is -- during moving boot to a remote machine, I somehow broke my *.clj scode, which means I can't compile new cljs code / test out what you've already suggested

qqq14:03:02

the moment I get *.cljs compiling gain, I'll test all of this out

darwin14:03:08

may I ask, why you're doing this remote setup?

qqq14:03:28

my mbp is fairly weak, and the fans spins up when I have multipel compilations going on

qqq14:03:37

I also have a beefy 8 core i7 with 24GB of RAM

qqq14:03:55

so mbp is powering emacs; while 8 core i7 24GB RAM is powering boot

qqq14:03:17

it's 100% first world problem

qqq14:03:37

if I may ask -- how are you so responsive? what's your day job?

darwin14:03:03

I would try just emacs to have a remote nrepl connection, but all dirac stuff sitting on single machine and use remote desktop or something to see the browser

qqq14:03:36

so emacs = runniing on local MBP boot + dirac = running on remote beefy machine then VNC into remote machine to show browser + dirac ?

qqq14:03:16

I have no doubt that's the right solution, but I now I think this is a matter of pride where if I can't get it working, I'll bother me for the rest of the week

darwin14:03:46

you will be probably the second one trying this, so expect sharp edges

darwin14:03:28

and back to your question, I don’t have a day job, that is why I can be so responsive 🙂

qqq14:03:06

wait, is binarage a 1 person llc ?

darwin14:03:08

actually I make money here: https://www.binaryage.com, but that is a dead business already, so I just play with cljs

darwin14:03:08

actually it is two devs, me (TotalFinder) and Stephen (TotalSpaces)

qqq14:03:42

okay, I have gottten error from: dirac failed to conenct on <ws://locaolhost:8231> to dirac agent is not listening at <ws://192.168.0.113:8231> I think I know what's going on, in my boot config for whatever's litening on 8231, it's doing it on localhost, not on 0.0.0.0

darwin14:03:20

I want to build my next biz idea with cljs+clojure, but before that I had to make some better tools/libs to hopefully get there

darwin14:03:22

we will see

qqq14:03:41

yeah, in boot it says: Agent is accepting connections at <ws://127.0.1.1:8231> whoa, the 1.1 is NOT a typo, this is weird

qqq14:03:02

if/when my startup becomes profitable, I'll be happy to pay subscription fee your way if you build tools

darwin14:03:55

thanks, but this is not going to make enough to support this development, cljs community is tiny, at least not in short term

darwin14:03:37

I can sponsor it from binaryage’s earnings for now

darwin14:03:57

what is your startup thing, btw?

qqq14:03:15

err, I think this channel is publicly logged; I'll send a beta invite you way when it's ready

qqq14:03:05

it's actually not the idea that's private; it's that I don't want competitors to know I'm debugging my cljs with dirac 🙂

qqq14:03:26

dirac has doubled y cljs productivity

qqq14:03:42

it's too bad that you can build somethign that 2xs productivity of 100 ppl, yet not be able to make a living off of it

darwin14:03:41

I didn’t want to claim it is not possible, I haven’t tried, actually Colin made a living from Cursive, Clojure + ClojureScript ecosystem is much bigger that and code editor is something everyone needs. With dirac the target audience is much smaller and it is not that essential.

darwin14:03:38

anyways, Dirac is now in mainenance mode, I have all features I wanted in place, now I will “just" keep maintaining it, there won’t be much my effort going into new development there

darwin14:03:41

let me know if/when you get your remote setup working, I’m curious, but be aware that there might be some blocker, never tried it myself

darwin14:03:06

would help you fix it if that would be the case, of course

qqq14:03:53

okay, so I got it working, but not via dirac connecting remote (on second thought, the idea of opening up nrepls on 0.0.0.0 did not sit well with me) whatI did do ... was just port forward (over ssh) 7000 [http port], and 8230-8242

qqq20:03:35

@darwin: one nice thing about being a founder/unemployed is large blocks of time to learn whatever I want I'm not asking you to do this for me -- I'm asking you to point me to the right direction so I can do this myself -- I think it's high tie I learn how to deal with either (1) chrome extensions or (2) chrome devtools extensions alright, so right now, in dirac devtools, when I get an exception printed in teh console, and it shows me something like: (window.cljs:50) when I click on that, it jumps me to window.cljs ,line 50

qqq20:03:58

instead, I want to modify it so that when I click on it, it sends a REST request to some webserver somewhere (i.e. run by emacs) -- what is the minimal amount of tech I need to learn in order to do this?

qqq20:03:11

given how basic the op is, I'm willing to do this in pure-js, it doesn't have to be a cljs setup

darwin20:03:12

I wanted to implement it myself I will teach nrepl middleware to be configured to execute a shell command on such clicks

darwin20:03:39

I want to do this right, I think this could be used by many people

darwin20:03:44

or more specifically it will execute a user-specified function, the default implementation will be a shell script execution (if the script exists)

darwin20:03:16

so your emacs does not run on the same machine as your nrepl server, right?

qqq20:03:59

emacs / nrepl-server not on same machine, but not a problem; if I can setup clj callbacks for each "dirac devtools ui event", hooking up eamcs <-> remote nrepl is not going to be ahrd

darwin20:03:29

I will introduce a new nrepl op, something like :dirac-devtools-request, dirac nREPL middleware will handle it and launch a pre-defined function (in the context of nREPL server)

darwin20:03:37

you will be either able to specify that function via config, or write a shell script to do whatever you want, for example do http post somewhere

qqq20:03:58

[unrelated to solving this for dirac] as an aisde, it's kinda of annoying how shitty modern dev cycles are; I should be able to right click an element, and say "for each element of this, type overwrite the :onClick handler to execute THIS CODE INSTEAD" instead, we have to jump through all these hoops to do otherwise such a conceptually simple task

qqq20:03:14

maybe if chrome was written in smalltalk, this'd be easier

darwin20:03:25

did you program for web before firebug was introduced back in 2006 or so? that is what I would call a shitty dev cycle

qqq20:03:53

no, I refused to learn web dev technologies for the longest time because javascript fucking hcanges all the time

qqq20:03:07

then I wathced a bunch of college friends become millionaires over dumbass facebook apps

qqq20:03:14

and I realized -- hmm, maybe I should learn web tech

darwin21:03:07

I think javascript started changing with ES6, but before that it was pretty stable

darwin21:03:31

and you can still use "the good parts”, you are not forced to learn new stuff

darwin21:03:28

anyways cljs is much superior and it is guaranteed to remove you from js spec churn

qqq21:03:23

hmm, what I meant to say (but not what I wrote is): if you learn an algorithm, like binary search or heap sort, that knowoedge will stay the same and likely not change for the rest of your life if you learn some javascript trick that works in Netscape 3.0, no one knows how useful that knowledge will be 5 years from now; in that sense, js knowledge "changes all the time" and is not that worth learning so instead of "js", I should have said "latest tricks to do cool things by exploiting new browser quirks"

darwin21:03:13

ok, fair enough