Friday, 25 September 2015

How to get client ip address in java servlet

HTTPServletRequest Object has a method called servletRequest.getRemoteAddr(). This method can be used to get the ip address of the client.
    String ipAddress = request.getRemoteAddr();  
    System.out.print(ipAddress);

Thursday, 9 October 2014

Java program to execute shell scripts on remote server

If you want to execute shell scripts on remote server and get output with the help of your java program then you are at right place. In this tutorial we will be using Java secure channel ( Jsch ) to log on to remote server, execute the shell script and capture the output. JSch is a pure Java implementation of SSH2. ( download jSch ).

Tuesday, 8 July 2014

Mysql connection very slow

There can be many reasons that cause slow execution of mysql command, possibly amount of memory, cpu, database size, database engine and many more. In this tutorial we are going to talk about the connection being slow for mysql, your queries are running faster from command line but your web page scripts are not able to make connection faster. Response time from mysql  is taking longer than usual. The major cause can be the DNS lookup. So how to fix this ?

Monday, 7 July 2014

Enable gzip compression in apache

When a user types your website url in browser and hits enter, browser sends request to server. Server responds to that request in the form of reply by giving back the requested document. That document can be of any size, typically if we take javascript files, it can be between 100 to 200 KB. Is there is any way to reduce this size so that the downloading can be faster ? Answer is "yes", that's what gzip compression does. It compresses the document size to almost 70% of the original. The major benefit of gzip compression is that it reduces bandwith by reducing the size of the response from the server.

Tuesday, 1 July 2014

How to speed up your website

One of the major concern of today's web developers is how to speed up their website. No one wants to wait for page download neither your user's too. Having fast website is very crucial in today's world, their is no place for slower websites. Below are some tips that you can follow to make your website blazing fast with minimal network load and fast rendering.