Simple, basic but much needed things in java

It is often needed to convert one type of objects into another type in java. Below I have mentioned about these common types as they form basic foundation in java.

* How to convert String to boolean?

String listing = "true";
boolean theValue = Boolean.parseBoolean(listing);

* How to convert boolean to string?

public class BooleanToString {
public static void main(String[] args){
boolean b = true;
String s = new Boolean(b).toString();
System.out.println("String is:"+ s);
}
}

* How to converting string to date?

public class StringToDate {
public static void main(String[] args) {
try {
String str_date="11-June-07";
SimpleDateFormat formatter ;
Date date ;
formatter = new SimpleDateFormat("dd-MMM-yy");
date = (Date)formatter.parse(str_date);
System.out.println("Today is " +date );
}
catch (ParseException e)
{
System.out.println("Exception :"+e);
}
}
}

* How to convert date to string?

import java.util.*;
import java.text.*;
public class DateToString {
public static void main(String[] args) {
try {
DateFormat formatter ;
Date date ;
formatter = new SimpleDateFormat("dd-MMM-yy");
date = (Date)formatter.parse("11-June-07");
String s = formatter.format(date);
System.out.println("Today is " + s);
} catch (ParseException e)
{System.out.println("Exception :"+e); }

}
}

Clipboard Hack Problem - News about CTRL+C

Ctrl+C may be one of the most frequently used keyboard shortcuts we use every day. But it's not a very safe thing to do while you are surfing the internet.
Read on to know why.



What happens when you press Ctrl+C while you are online? We do copy various data by Ctrl + C for pasting elsewhere. This copied data is stored in clipboard and is accessible from the net by a combination of Java scripts and ASP. This is called clipboard hack problem.

Just try this:

1. Copy any text by Ctrl + C
2. Click the Link: http://www.sourcecodesworld.com/special/clipboard.asp
3. You will see the text you copied was accessed by this web page.

Surprised!. Do not keep sensitive data (like passwords, credit card numbers, PIN etc.) in the clipboard while surfing the web. It is extremely easy to extract the text stored in the clipboard to steal your sensitive information. It is true, text you last copied for pasting (copy & paste) can be stolen when you visit web sites using a combination of JavaScript and ASP (or PHP, or CGI) to write your possible passwords/credit card no./sensitive data to a database on another server.

How Clipboard Hack is done?
The Clipboard hack is done by the following Source Code:


How to safeguard yourself from Clipboard Hack Problem?
To avoid clipboard hack problem, do the following:

1. Go to internet options->security.
2. Press custom level.
3. In the security settings, select disable under Allow paste operations via script.

Now the contents of your clipboard are safe.

Interestingly, this hack works only on internet explorer, and not on Mozilla Firefox browser.

Please spread awareness of this issue with CTRL+C & help in preventing online-frauds…

Tears of Loss

When faced with the loss of someone or something special, we are overwhelmed with extreme sadness. As a natural outlet, we break down into tears as we mourn over our loss. Yes, even the strongest of men can go through these moments.

Tears of Loss

To cry out these tears, is very healthy and therapeutic while we grieve over the loss and recover from it. To survive and move forward with our lives. Never forgetting, but rather growing from the experience.

With every tear drop, life memories fall from our head. The best of times, the worst of times, and even the possibilities of life after the loss. Life is present in every tear. In our mourning, we honor the relationship that once was.

As we recover, we turn to hope. Not in hope of filling the new emptiness, but in hope for new relationships and new memories. Learning from our past mistakes and successes to establish even greater connections with our current and future relationships.

The next time you find yourself shedding tears, remember the life in each drop. Life in yesterdays and hope for tomorrow.

How to find your Servlet, JSP and Server version?

Today when I was doing something my colleague asked me about what version of JSP and Servlet are you using. Untill now I never bothered about this, but later found a way for this. below are the lines of code to know what version of servlet you are running, version of JSP and application server you are running.

Servlet Version :
<%= session.getServletContext().getMajorVersion() %>.
<%= session.getServletContext().getMinorVersion() %>

JSP Version :
<%= JspFactory.getDefaultFactory().getEngineInfo().
getSpecificationVersion()%>

Server Version : <%= application.getServerInfo()%>

How to Remove or Hide Or Block All Facebook Ads from Profile

Have you ever felt bored while looking at your facebook profile that has been surrounded by number of adds??? If yes then you can avoid those adds by doing some tricks. Below are the steps hope this will help a lot of frustrated people.

To remove all facebook ads from yours profile you have to follow below Instruction
# You must be firefox user ,If you don’t have firefox? [ Download free from here ]
# After that Install Greasemonkey Script From [ Here ] Remember to restart firefox after downloading Greasemonkey script and then install the below script

Remove All Facebook Ads – This script was changed to remove ads upon DOM insertion in a similar fashion to New Facebook Layout Ad Killer, rather than using the previous method of waiting for the DOM to load before removing ads. Unlike ‘New Facebook Layout Ad Killer’, this script still uses XPath.

Hide Facebook Ads – Hide “Facebook Flyer” adverts on Facebook left sidebar on homepage or profile page.

NoFacebookAds - Removes Facebook flyer and network adverts, including ’social adverts’ such as the annoying Danish barber adverts.

NoPirateQuestAds
- Specific to PirateQuest ads, where it prevents any Facebook wall entries containing ads for “PirateQuest” from appearing.