Tuesday, October 9, 2012

Remove duplicates in excel

Excel remove duplicates :

1.Select all the rows, including the column headers, in the list you want to filter.

2.On the Data menu, point to Filter, and then click Advanced Filter.

3.In the Advanced Filter dialog box, click Filter the list, in place.

4.Select the Unique records only check box, and then click OK.

The filtered list is displayed and the duplicate rows are hidden.

5.On the Edit menu, click Office Clipboard.

The Clipboard task pane is displayed.


6.Make sure the filtered list is still selected, and then click Copy .

The filtered list is highlighted with bounding outlines and the selection appears as an item at the top of the Clipboard.
7.On the Data menu, point to Filter, and then click Show All.

The original list is re-displayed.
8.Press the DELETE key.

The original list is deleted.

9.In the Clipboard, click on the filtered list item.

The filtered list appears in the same location as the original list.

Source : http://office.microsoft.com/en-us/excel-help/delete-duplicate-rows-from-a-list-in-excel-HA001034626.aspx

Friday, October 5, 2012

Create Java inline thread

import java.util.Date;

public class InlineThreadDemo {
 public static void main(String[] args) {
System.out.println( "parent thread " + new Date(System.currentTimeMillis())); // launch child thread using
// inline declaration
new Thread( new Runnable() {
public void run() {
try {
Thread.sleep(10 * 1000);
} catch (Exception e) {
e.printStackTrace();
}
System.out.println( "child thread " + new Date(System.currentTimeMillis()));
}
}).start();

System.out.println( "parent thread " + new Date(System.currentTimeMillis())); }}


Wednesday, October 3, 2012

Two guards riddle - one will always lie

You are imprisoned in a chamber with two doors as the only exit. One door leads to death by cancer, filled with complications and malpractice; the other door leads to riches of jewelry, money and fine clothing for the rest of your life. There are two guards standing before you: one guard always lies; the other always tells the truth. Of course, you don’t know their identities. You can ask only one question to save your life. What should you ask?



Solutilon :
This is a logic question and can be answered if one realizes that the TRUTH of a LIE is a LIE, and the LIE of a TRUTH is a LIE. You need one guard to give you the other guard’s answer. Knowing this one could ask a question like, “If I were to ask the other guard which door leads to freedom, what would he say?”


If you ask the guard who always tells the truth, he would tell you the other guard would point you to the door of death. If you ask the guard who always lies, he would tell you the opposite door of the truth-telling guard and point you to the door of death. In either case, both guards will point to the door of death so you should choose the other one