Idea

An idea is like an itch: you need to scratch it, and when you do it feels better. As software developers, we spend a lot of time thinking up ideas for different kinds of applications. That's fun, right? What's challenging is figuring out how to bring a software product to fruition. It's satisfying to imagine something and then create it. The alternative (an unscratched itch) is just frustrating.

Just went through some good ideas thinking how to make them come true into the reality. Hope this time it happens! ll Keep scratching!!!

How to clear textarea's default text

Often there may be requirements that a html form with a textarea containing a default text clears automatically when someone selects/clicks on the textarea.
This is achieved as below.




How to convert Byte[] array to String in Java

In some cases, we have to convert String variable into a Byte array format, for example, JCE encryption. However how do we convert a Byte[] array to String afterward?

Simple toString() function like following code is not working property. It will not display the original text but byte value.

String s = bytes.toString();

In order to convert Byte array into String format correctly, we have to explicitly create a String object and assign the Byte array to it.

public class TestByte
{
public static void main(String[] argv) {

String example = "This is an example";
byte[] bytes = example.getBytes();

System.out.println("Text : " + example);
System.out.println("Text [Byte Format] : " + bytes);
System.out.println("Text [Byte Format] : " + bytes.toString());

String s = new String(bytes);
System.out.println("Text Decryted : " + s);
}
}