Thursday, November 8, 2012

Eclipse Refactoring: Delete getters and setters

Delete getters and setters
Deleting getters and setters isn’t as straightforward as just deleting the field in the editor. However, you can delete a field and its getters/setters from the Outline view.
Open the Outline view (Alt+Shift+Q, O), select the field you want to delete and pressDelete (or right-click, Delete). Eclipse will ask you whether you want to delete the getters/setters as well. Just choose Yes To All and they will be removed.
You need to have fields visible in the Outline view to use this feature (ie. untoggle the Hide Fields button ).
You can select multiple fields simultaneously. And you can delete individual getters/setters (excluding the field) by just selecting the getter/setter and pressing Delete.

Tuesday, November 6, 2012

Windows: find and kill process with a particular port


netstat -ano displays all the tcp and udp process with assinged process id's.
To get a process with a particular port (say 8080) use
netstat -ano | findstr 8080
This would display something like

here 82360 is the PID. Now to kill this process use
kill -f 82360
You can verify if the process has indeed been killed by executing netstat -ano | findstr 8080 again