Spiga

How To Sort a File On the basis of the column Using Java

How To Sort a File On the basis of the column Using Java

Java Program to sort the file.
In the earlier post we have seen how to sort the CSV file. Now, we will see the generalised java code to sort the file on the basis of particular column. This code can be used for any type of files, like csv, txt etc. This can be useful to sort the big files on the basis of the column. For using this code, we need to take care of few things:
The format of the file should be like in this format:
The header or the column should be there and should be the first line of the file, else we will missed the first line.
Header/Col1: Header/Col2 : Header/Col3
a : c : e
s : a  : d
.. : .. : ...
Algorithm Used:
It’s not the rocket science, we have keep it simple and have used the simple algorithm. The each row has been considered as one java object. The column on which we have to sort is taken as the key and against this key we have the associated row data java objects as values. We sort the key and display the respective values.
For example: If we have to sort the above file on column 2, we will create two java objects which will have values:
Java@Obj1: a,c,e
Java@Obj2: s,a,d

Now, we are sorting on column 2, so for first row, key will be c and c will be mapped with the value Java@Obj1: a,c,e and for the second row: key will be a and a will be mapped with the value Java@Obj2: s,a,d. Now we will sort the keys, i.e. c and a and then we will display the mapped value for the sorted keys.

Here is the Java Class Example:

Default Author Name in Eclipse

Default Author Name in Eclipse


By default, the Eclipse show the file author name as the Windows Id name. This is because, the eclipse read the ${user} variables value from the environment variables and display that variables. So we can change that default values in different name.

Different Ways:
1) By changing the eclipse setting for that. Go to the
  Window -->Preferences -->Java -->Code Style -->Code Templates -->Comments
  Change the Comments format over there, like
  If it is like this:
  /**
  * @author ${user}
  *
  * ${tags}
  */
  Romove this with:
  /**
  * @author Sonu Mishra
  *
  * ${tags}
  */

2) Use the VM arguments -Duser.name=Sonu Mishra. You can set this in the eclipse.ini files of eclipse.

Difference Between Eclipse Ganymede/Galileo/Helios/Indigo

Difference Between Eclipse Ganymede/Galileo/Helios/Indigo

What  is the difference between Eclipse Ganymede/Galileo/Helios/Indigo?
Basically those are just the different versions or the major release  of the eclipse.  So, instead of using the version number, they are using the name like helios or indigo. Since 2006, the Eclipse Foundation has coordinated an annual Simultaneous Release. So the different versions of eclipse till now are:


Copy Paste In DOS Command Prompt Using Mouse

Copy Paste In DOS Command Prompt Using Mouse

Copy/Paste in the DOS and Command Console is not easy. First you have to do the right-click and then select the data and then again do the right click and then paste the data. Now, in this post we will see the easier way that will allow the copy paste using the mouse.
After the trick, You will be able to select the data by highlighting the area by mouse and hitting the ‘Enter’ button will copy that highlighted area. To paste the copied thing, just right click the mouse and that will paste the thing.
Follow the Below steps to configure the Console.
1. Open a Command Prompt/Command Console.
2. Right-click on the title bar.
3. Select Properties.
4. Select QuickEdit Mode.
5. Select Save Properties for future windows with same title if you want to make this a permanent change. Select Apply Properties for current window only if you only want to enable QuickEdit for this session.
6. Click OK.

How To Sort The CSV File

How To Sort The CSV File:
Always we came across at some point where we want to sort the data, or we want to compare similar kind of data. So, in this post, we will focus on some of the quick ways to sort the data of the CSV file. Windows provide the SORT command, and using that command we can sort the data of the files.
Sorting Using Windows SORT Command
1)      You can use the sort command to sort the files. In the command prompt, type following:
a.       Sort  Input_filename  : This will sort the file and will display the output on the console. This will sort the file on the basis of first column. Let’s suppose your input is :
Input:
1              g              k
3              f              d
2              c              a
                                             Output will be:
sort Book.csv
1,g,k
2,c,a
3,f,d
b.      Sort  Input filename Output Filename : This will sort the input file data and will store the result in the OutputFile.
Example:     sort Book.csv  outputBook.csv
c.       Sort  Input_filename Output_Filename /+Column_Number: This will sort the file on the basis of column number. If we provide column number as 2, it will sort the file on the basis of column 2nd column. E.g.:
sort Book.csv /+2
2,c,a
3,f,d
1,g,k
2)      You can write the Customized java written program also to sort as per requirement. In the next post we will see the customized Java Program to sort the files. This one is my favourite.
3)      There are several software’s available in the market for this and as well as other purposes.

View Match Live Online

There are different websites which provide the luxury to watch the live matches online.
Here are few links. If you dont have the tv, don't worry, this will help you watch the matches live.

1) http://www.ipl.indiatimes.com/            Provides Video
     This is one over slower then live.
2) http://www.crictime.com/watch-live-cricket-streaming.htm         Provides Video
     This is faster one.
3) youtube.com
4) cricbuzz.com         Only Webpage  faster one
5) cricinfo.com          Only Webpage 

Note:- This review is based on my experiances.