dirac

Dirac v1.7.2 is out: https://github.com/binaryage/dirac/releases/tag/v1.7.2
qqq 2017-03-03T02:30:38.002890Z

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

qqq 2017-03-03T02:34:46.002891Z

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

2017-03-03T02:36:04.002893Z

@qqq I’m afraid nothing like that is supported

2017-03-03T02:36:24.002894Z

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

2017-03-03T02:36:27.002895Z

nothing special

2017-03-03T02:37:56.002896Z

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

qqq 2017-03-03T02:38:50.002897Z

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

qqq 2017-03-03T02:39:08.002898Z

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

qqq 2017-03-03T02:39:13.002899Z

if I could do that, it'd suffice

2017-03-03T02:39:34.002900Z

what is cljs-devtools-browser-ui?

qqq 2017-03-03T02:39:57.002901Z

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"

qqq 2017-03-03T02:40:05.002902Z

What should I call it ?

2017-03-03T02:40:35.002903Z

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

2017-03-03T02:40:49.002904Z

cljs-devtools is completely independent and technically unrelated project

qqq 2017-03-03T02:40:58.002905Z

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

qqq 2017-03-03T02:41:05.002906Z

shoudl I call the ui part "dirac devtools" ?

2017-03-03T02:41:08.002907Z

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

2017-03-03T02:41:15.002908Z

it does not require dirac to work

qqq 2017-03-03T02:41:37.002909Z

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

2017-03-03T02:41:46.002910Z

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

2017-03-03T02:41:55.002911Z

whole set of tools just “dirac"

2017-03-03T02:42:21.002912Z

so back to your breakpoints

qqq 2017-03-03T02:42:43.002913Z

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

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

2017-03-03T02:42:43.002914Z

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

2017-03-03T02:42:47.002915Z

dirac does nothing special here

2017-03-03T02:43:11.002916Z

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

qqq 2017-03-03T02:44:01.002917Z

great; thanks for clarifying 🙂

2017-03-03T02:44:17.002918Z

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

2017-03-03T02:44:33.002919Z

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

2017-03-03T02:47:34.002922Z

going off, good luck!

qqq 2017-03-03T02:47:46.002923Z

thanks again!

qqq 2017-03-03T04:47:04.002924Z

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?

qqq 2017-03-03T10:39:14.002926Z

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

qqq 2017-03-03T10:47:08.002927Z

@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

2017-03-03T13:39:53.002928Z

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

2017-03-03T13:41:36.002930Z

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

2017-03-03T13:42:13.002931Z

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

2017-03-03T13:49:16.002935Z

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

2017-03-03T13:52:31.002937Z

^ this will work when using preloads

qqq 2017-03-03T14:06:57.002938Z

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

qqq 2017-03-03T14:07:14.002939Z

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

2017-03-03T14:07:52.002940Z

:dirac-opts where did you see that?

qqq 2017-03-03T14:08:45.002941Z

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

2017-03-03T14:09:26.002942Z

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

2017-03-03T14:09:54.002943Z

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

2017-03-03T14:10:32.002944Z

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

2017-03-03T14:10:54.002945Z

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

qqq 2017-03-03T14:10:59.002946Z

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

qqq 2017-03-03T14:11:08.002947Z

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

qqq 2017-03-03T14:11:24.002948Z

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

2017-03-03T14:12:24.002949Z

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

qqq 2017-03-03T14:14:53.002950Z

@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

qqq 2017-03-03T14:15:02.002951Z

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

2017-03-03T14:16:08.002952Z

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

qqq 2017-03-03T14:16:28.002953Z

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

qqq 2017-03-03T14:16:37.002954Z

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

qqq 2017-03-03T14:16:55.002955Z

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

qqq 2017-03-03T14:17:17.002956Z

it's 100% first world problem

qqq 2017-03-03T14:17:37.002957Z

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

2017-03-03T14:19:03.002958Z

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

qqq 2017-03-03T14:19:36.002959Z

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

2017-03-03T14:19:44.002960Z

yes

qqq 2017-03-03T14:20:16.002962Z

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

2017-03-03T14:20:25.002963Z

🙂

2017-03-03T14:20:46.002964Z

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

2017-03-03T14:21:28.002965Z

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

qqq 2017-03-03T14:22:06.002966Z

wait, is binarage a 1 person llc ?

2017-03-03T14:22:08.002967Z

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

2017-03-03T14:22:15.002968Z

🙂

2017-03-03T14:23:08.002969Z

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

qqq 2017-03-03T14:23:42.002970Z

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

2017-03-03T14:24:20.002971Z

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

👍 1
2017-03-03T14:24:22.002972Z

we will see

qqq 2017-03-03T14:24:41.002973Z

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

qqq 2017-03-03T14:25:02.002974Z

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

2017-03-03T14:25:55.002975Z

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

2017-03-03T14:26:37.002976Z

I can sponsor it from binaryage’s earnings for now

2017-03-03T14:26:57.002977Z

what is your startup thing, btw?

qqq 2017-03-03T14:28:15.002978Z

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

2017-03-03T14:28:34.002979Z

ok 🙂

qqq 2017-03-03T14:29:05.002980Z

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 🙂

qqq 2017-03-03T14:29:26.002981Z

dirac has doubled y cljs productivity

qqq 2017-03-03T14:29:42.002982Z

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

2017-03-03T14:31:41.002983Z

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.

2017-03-03T14:32:38.002984Z

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

2017-03-03T14:33:41.002985Z

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

2017-03-03T14:34:06.002986Z

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

qqq 2017-03-03T14:56:53.002987Z

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

2017-03-03T15:13:32.002988Z

great!

qqq 2017-03-03T20:42:35.002989Z

@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

qqq 2017-03-03T20:42:58.002990Z

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?

qqq 2017-03-03T20:45:11.002991Z

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

2017-03-03T20:45:12.002992Z

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

2017-03-03T20:45:39.002993Z

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

2017-03-03T20:46:44.002994Z

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

2017-03-03T20:48:27.002995Z

it already got enough thumbs up: https://github.com/binaryage/dirac/issues/56

2017-03-03T20:49:16.002996Z

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

qqq 2017-03-03T20:51:59.002998Z

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

2017-03-03T20:53:29.002999Z

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)

qqq 2017-03-03T20:54:14.003Z

documented it in the same manner as https://github.com/binaryage/dirac/blob/master/docs/about-repls.md 🙂

2017-03-03T20:54:37.003001Z

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

qqq 2017-03-03T20:55:58.003002Z

[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

qqq 2017-03-03T20:56:14.003003Z

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

2017-03-03T20:57:25.003004Z

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

2017-03-03T20:57:32.003005Z

😉

qqq 2017-03-03T20:57:53.003006Z

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

qqq 2017-03-03T20:58:07.003007Z

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

qqq 2017-03-03T20:58:14.003008Z

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

2017-03-03T21:03:07.003009Z

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

2017-03-03T21:03:31.003010Z

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

2017-03-03T21:03:34.003011Z

IMO

2017-03-03T21:04:28.003012Z

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

qqq 2017-03-03T21:05:23.003013Z

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"

2017-03-03T21:06:13.003014Z

ok, fair enough