Remote Debugging in Intellij Idea IDE

Follow the below steps to perform the remote debugging in Intellji Idea IDE

1. Start the java application with the below Java options


-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9995

Ex:
java -jar -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9995 application.jar

Here “application.jar” is the actual jar file which we have

2. Open up the Intellji Idea IDE and click on Run ➝ Edit Configuration, then Select Remote and click on + sign on the menu bar. It will open up a Remote Debug config window. Just change the port number to 9995 and Host accordingly and click on “Apply” and “OK”

3. Open up the Run window, you will see the “Debug “Remote”” option. When you click on it, you will be going to remote debug mode.

4. Then Put up some break points in your code.
5. Access the application from the browser or by running any process
6. The remote process will get started and it will be stopped at the break point. You can continue with the debugging process from there with all the debug options

How to show XML in wordpress page

If we post the XML in a wordpress post, then it wont show properly. So we have to convert the <, > tags to HTML entities appropriately.  If its a small XML, then we can do it easily, but if its a big one, then its somewhat tedious.  I am using the below approach to handle this.

Access this online utility Free Formatter and convert the html tags with appropriate entities. Then add those snippet in the post surrounding with <pre><code> tags.

Please refer the below example,


<person>
<name>bala</name>
<age>90</age>
</person>

Extract haState from the ResourceManager REST API’s response

I have used jq[https://stedolan.github.io/jq/] command line JSON processor to process the clusterInfo JSON response and extract the haState value from it.

If the JSON is stored in a file, then you could use the below script. Make sure that you install jq package first.


jq '.clusterInfo.haState' clusterInfo.json

If you want to access the service and parse the response on the fly, then use the below CURL command


curl 'http:///ws/v1/cluster/info' | jq -r '.clusterInfo.haState'