How to change tomcat port number from 8080

  • Goto tomcat>conf folder
  • Edit server.xml
  • Search "Connector port"
  • Replace "8080" (Default) by your new port number
  • Restart tomcat server.
Similarly you can also change port number for HTTPS as well.

Java FileOutputStream Create File or Parent Folders if not exists

FileUtils from apache commons is a pretty good way to achieve this in a single line.
FileOutputStream s = FileUtils.openOutputStream("/home/nikhil/somedir/file.txt")
This will create parent folders if do not exist and create a file if not exists and throw a exception if file object is a directory or cannot be written to. This is equivalent to:
File file = new File("/home/nikhil/somedir/file.txt");
file.getParentFile().mkdirs(); // Will create parent directories if not exists
file.createNewFile();
FileOutputStream s = new FileOutputStream(file,false);
All the above operations will throw an exception if the current user is not permitted to do the operation.

Eclipse Refresh projects taking lot of time ?

How to speed up the eclipse project 'refresh'


This automatically copies the changed files to the network share. Works fantastically. I can now do a complete update/switch/refresh from within Eclipse in a couple of seconds.

Installation
Please use Eclipse update manager to install this plugin.
Eclipse 3.3 - 3.4:
Go to "Help -> Software Updates -> Find and Install... -> Search for new features to install -> Next -> New Remote Site..."
Eclipse 3.5:
Go to "Help -> Install new Software... -> Work with:"
and use the http://andrei.gmxhome.de/eclipse/ as url.

Failed to create the part's controls Eclipse + Unable to debug JUnit

I had the same error. I fixed it by switching the eclipse workspace. Go to menu File->Switch Workspace->Other, and then select the same workspace you were working with. Eclipse will restart and you should not get the error.

Copy the Current Path from Terminal to the Clipboard in Mac OS X


Create a new tab next to current tab + chrome extension

chrome.tabs.query({
        active: !0,
        lastFocusedWindow: !0
    }, function(a) {
        chrome.tabs.create({
            url: gQuery,
            index: a[0].index + 1,
            selected: true
        })

    });

How to remove all docker images stored in a local repository

The following commands can be used to remove all Docker images stored in your local repository. Be aware that you would not be able to undo any of the removed docker images. First, list all your docker images to make sure that there is nothing you want to remove:
# docker images
Using the following command you can obtain image IDs of all your docker images:
# docker images -q
To remove a single docker image simply run docker rmi followed by the image ID. For example:
# docker rmi 9fa0e1f381ad
In order to remove all image at once with a single command we can combine two commands together:
# docker rmi `docker images -q`
The above command will not remove images which are currently being used by containers and the following error message will appear:
Error response from daemon: Conflict, cannot force delete 568f5ffe3905 
because the running container 9fa0e1f381ad is using it, stop it and retry
To remove docker images even if they are used by container use force switch:
# docker rmi -f `docker images -q`