Tag Archives: debugging

Javascript Debugging

This is gonna be a quicky on how to debug your standalone javascript. I assume you already know how to debug javascript using the browser’s inspector and are familiar with break points, scope vars, control flow, and everything else you can do in that inspector debugger.

The task here is to debug a standalone javascript program (not running in a browser).

Say you have a helloworld.js

You can run it like so

node helloworld.js

You can also debug it with like so

node --inspect-brk helloworld.js

The –inspect-brk option will set a breakpoint on the 1st line and wait for you to attach the debugger. Otherwise your program may run through thousands of lines of code before you’re quick enough to attach the debugger and stop it. This option is available in node version 7.x+. I didn’t have it in 7.2 though, so I upgraded to 8.9.4 which had it.

Then, open your chrome browser to about:inspect. You should see something like this

Screen Shot 2018-01-11 at 1.54.11 PM

Click on “Open dedicated DevTools for Node” and this will open the inspector debugger that you’re used to

Advertisements
Tagged ,

Setting up Tomcat for debugging

Short PSA. If you want to set up Tomcat for debugging, set up JPDA.

To do so, simply open the startup.sh file, which is somewhere in TOMCAT/bin folder.

Add these two lines near the top

export JPDA_ADDRESS=7000
export JPDA_TRANSPORT=dt_socket

Then modify the exec line (usually the last line in the file) from this:

exec "$PRGDIR"/"$EXECUTABLE" start "$@"

to this

exec "$PRGDIR"/"$EXECUTABLE" jpda start "$@"
Tagged ,

Adobe BrowserLab

How many times have you written some javascript code or css stylesheets, and it looks and works great in your browser but sucks ass in another?

Adobe BrowserLab promises that to help you by “Accurately preview web pages across multiple browsers and operating systems, navigate links, and use diagnostic tools to optimize websites efficiently.”

I’ve been meaning to try it out. I’ll come back with more interesting things to say when I do, or maybe you’ll get a chance to use it first and tell me about it…

Tagged ,