Wednesday, April 9, 2014

TreeSetExample

import java.util.*;

public class TreeSetExample{
  public static void main(String[] args) {

 TreeSet <Integer>tree = new TreeSet<Integer>();
 tree.add(12);
 tree.add(03);
 tree.add(41);
 tree.add(36);

 Iterator iterator = tree.iterator();


 while (iterator.hasNext()){
 System.out.print("++++>>>> "+iterator.next() + " ");
 }
  }
}

Console Result Is : 

++++>>>> 3 ++++>>>> 12 ++++>>>> 36 ++++>>>> 41 

java.util.NoSuchElementException

import java.util.*;

public class SetIteratorTreeMapExample{
        public static void main(String[] args) {

         TreeMap <Integer, String>tMap = new TreeMap<Integer, String>();
          tMap.put(1, "Sunday");
          tMap.put(2, "Monday");
          tMap.put(3, "Tuesday");
          tMap.put(4, "Wednesday");
          tMap.put(5, "Thursday");
          tMap.put(6, "Friday");
          tMap.put(7, "Saturday");

         Set s = tMap.keySet();
         System.out.println("TreeMap Set value Is " + tMap.keySet());

         Iterator itr= s.iterator();
         try {
               while(itr.hasNext()){
               System.out.println("iterator.hasnext Value Is " + tMap.get(itr.next()));
               System.out.println("tMap Value Is " + tMap.get(itr.next()));
              }
        }
        catch(Exception e){
              System.out.println("Exception Value Is " + e);
        }

       }
}

Monday, April 7, 2014

System Slow how to rectify

Do you feel your PC is slow or hanging on very frequently you try the following simple procedures before you think of reinstalling the OS or upgrading your RAM or PC.
It is out of my experience.                                                
1.  Go to Start | RUN and type the following in the RUN textbox: %temp%    Now delete all temp files.  
2.   Then go to My Computer and select all the Hard Disk Drives right-click and select properties, then start disk cleanup wizard. It will remove all the unwanted programs present in your PC/system.                  
3.   Again, go to Start | RUN and type "msconfig" in the RUN textbox. This command will open the System Configuration. Go to Services | Start up and deselect all the possible programs you don't want to be run by your PC automatically when initializing your System. You touch this option only you are very confident and expert with the system.                        
4.   Next, go to Windows folder located in drive C and then open System32 (a sub-folder in Windows folder). Now look for the folder namely "Prefetch". Once you find it, straightly right-click on it and hit delete. Note if “prefetch” folder is not in System32 folder, you will surely find the same in windows folder and Delete it!                                                                                        
5.   Also if you are facing some critical problems/issues occurring from internet temp file, clear the entire history prevailing in that file.
6.   Pl see your PC's processor located in the CPU, whether it is properly or not.
7.   Use a good priced Antivirus software instead of free downloads.
8.   Above all you keep your computer dusts free especially RAM.

Friday, November 1, 2013

Creating simple Bat files

1)
javac *.java
java Main

and save it as Name.bat

2)
start tomcat6.exe
start http://localhost:8080/ApplicationFolderName/
start  C:\TEMP


Tuesday, October 15, 2013

How to extract a Jar file ?

Just go to the path where the jar file is located in command prompt,

1)go to start
2)type cmd
3)type d: if the jar is in d : or c:pathName1\pathName2\Folder Name
4)Just type jar xvf fileName.jar

and your class file is generated
 

Monday, October 7, 2013

Wednesday, September 11, 2013

How to add time in mysql ?

SELECT ADDTIME('1984-05-31 23:59:59', '0 0:15:01');

Here you can see 23 Hrs 59 Minutes and 59 Seconds is added with 0 Hrs, 15 Minutes and 01 Seconds

The Result is '1984-06-01 00:15:00'

Oops My Birthday....