Wednesday, August 28, 2013

find out the stack trace at any point

sometimes,code call embeded too complex,we want know what is the call stack from a point of code.
we can do it like this

logger.debug(stackTraceToString(Thread.currentThread().getStackTrace()));

public String stackTraceToString(StackTraceElement[] ste){
   StringBuilder sb = new StringBuilder();
   for (StackTraceElement element : ste) {
       sb.append(element.toString());
       sb.append("\n");
   }
   return sb.toString();

}



Tuesday, August 27, 2013

find who is log in in linux server

1) pinky command will show ips that user lo in from(actually name already there)
Login    Name                 TTY      Idle   When             Where
sprathaban fisrname lastname    pts/1    17:34  2013-08-26 13:27 10.136.xx.xxx
2)windows
nbtstat -A 10.136.xxx.xxx


Local Area Connection:
Node IpAddress: [10.136.xxx.xxx] Scope Id: []

           NetBIOS Remote Machine Name Table

       Name               Type         Status
    ---------------------------------------------
    GCHELLIAH-DT   00  UNIQUE      Registered

    MAC Address = 00-1E-0B-xx-xx-xx