Posts

How to convert InputStream to String in Java?

/**  *  */ package convert.stream.to.string; import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; /**  * @author abdul  *  */ public class StreamToString {     /**      * @param args      */     public static void main(String[] args) {         StreamToString streamToString = new StreamToString();               //intilize an InputStream         InputStream is = new ByteArrayInputStream("file content:\nData1\nData2".getBytes());               /*          * Call the method to convert the stream to string          */  ...

How to find exact version of Red Hat Linux

[root@localhost ]# cat /etc/redhat-release Red Hat Enterprise Linux Server release 5.2 (Tikanga) For others: Slackware: /etc/slackware-version Mandrake: /etc/mandrake-release Red Hat: /etc/redhat-release Fedora: /etc/fedora-release

How to configure session timeout for putty

Image
Click on the upper left hand corner of your putty screen, then click on 'Change Settings', then 'Connection'. I have my 'keepalive' set to 300. Now It will time out after 5 minutes.

How to create a ant log file

ant -logfile <filename>.log

Get Sub List of Java ArrayList Example

package com.subList.demo; import java.util.ArrayList; import java.util.List; /**  * This Java Example shows how to get sub list of java ArrayList using subList method.  *  * @author abdul  */ public class SubListDemo {     public static void main(String args[]) {         //create an ArrayList object         List<String> list = new ArrayList<String>();         int range = 4;         //Add elements to Arraylist         list.add("A");         list.add("B");         list.add("C");         list.add("D");         list.add("E");         list.add("F");         list.add(...

Debug Java applications remotely with Eclipse

Image
Remote debugging is a way of debugging any process running on some other location from your development machine. Local debugging is the best way in my opinion and should always be preferred over remote debugging but if local debugging is not possible and there is no way to debug your process then remote debugging is the solution. Many of us work on a project which runs on Linux operating system and we do development mostly on Windows. Eclipse provides us most useful feature called " Remote debugging " by using which you can debug your Linux running process from your windows machine. Now let's see how we can setup remote debugging in Eclipse: Just take a example of a simple program that we want to be debugged: package com.tutoial.debugger; /**  * @author abdul  *  */ public class Debug {     public static void main(String args[]) {         for(int i=1; i<=10;i++) {      ...

How to install springsource tool suite on linux

Download the STS self-extracting shell script (*.sh) that matches your OS and machine architecture from the following Url: http://www.springsource.org/eclipse-downloads Please make sure to download and install STS versions that match your JDK installation. Once downloaded, launch the installation by running the following command in a terminal session: $ sh springsource-tool-suite-2.9.0.RELEASE-e3.7.2-linux-gtk-installer.sh Follow the on-screen instructions to finish the installation. See “Running the STS Installer”.