Archive for 2016-03-29

grep list the whole line which matches

If we needs the whole line

grep -R -a 'XXX'

 

Java Calendar format eclipse-ben

The following effectively overwrites the toString() method for any class as seen using the Eclipse Debugger only, but I’ve found it very useful in decoding calendar objects while I debug.

Add a Debug Detail Formatter, using these steps:

  1. From the menu select Windows->Preferences
  2. In Preferences open Java->Debug and click on Detail Formatters
  3. Here you can add your desired formatter

As an example, for the calendar object:

  1. Click Add..
  2. Enter
    java.util.Calendar

    into the Qualified type name field

  3. Enter the following:
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z"); sdf.format(this.getTime());
  1. Ensure Enable this detail formatter is checked

Click OK.

 

src:

https://acoderslife.wordpress.com/2009/06/12/eclipse-java-debugging-showing-variable-type-values-calendar/