Sunday, August 19, 2012

Converting rows to columns in excel

1. Copy the whole table

2. Paste it to a different location with the Paste special option, the transport box ticked, as shown below.

Thursday, March 29, 2012

How to apply customized code styles to Idea


To apply a customized code style first you have to put the style file to the below given path.

(C:\Documents and settings\user\)\.IdeaIC11\config\codestyles\

Then in the idea IDE go to Settings----Code style----java---global settings

Form the schema drop down list you can select the code style you have added to the above given path and apply it, :) !

Tuesday, March 27, 2012

Using String Buffer to optimize string concatenation

It is always better in performance to use String Buffer in string concatenation over using + . We can consider a code segment as follows where + is used to concat a string. If one and two a two defined strings; 


String s = one+two;

This is similar to ;

StringBuffer buf = new StringBuffer(one);
buf.append(two);
String s = buf.tostring();

In a situation as above, it doesn't make a difference using StringBuffer over + in string concatenation. Let's consider a situation where a string concatenation happens within a loop as given below.


String xx;
for ( int i = 0; i < name.length(); i++ )
{
xx = String.valueOf( name.charAt( i ) );
tempName = tempName + xx;
}
              return tempName;




This will end up creating  name.length() number of string objects in memory. If the following code segment is used instead, it will enhance the performance significantly.


String xx;
        StringBuffer buf = new StringBuffer();
for ( int i = 0; i < name.length(); i++ )
{
xx = String.valueOf( name.charAt( i ) );
                        buf.append( xx );

}
                       tempName= buf.toString();
return tempName;

Tuesday, March 13, 2012

& Versus && and | Versus ||

&/ | - These are logical operators
&&/|| - These are short circuit operators

This means basically that,

& and | will evaluate both the right hand side and the left hand side operands of a statement and && and || will not necessarily evaluate both. If  the result is confirmed, it will be short circuited.


  • For an example, lets consider the following statement;


if((x!=null) && (x.size() ==0))

if x!=null returns false we are sure that the out put is false since this is an AND operations.So if it is false the second operand will not be evaluated.So this is safe to use since the null pointer exception is avoided in this case.


  • Lets consider the statement 


if((x==null)  || (x.size()==0))

if x==null returns true the whole result of is true since this is an OR operation. So the second operand will not be evaluated. And this is also safe to use since the null pointer is avoided.


  • But following statements are not safe to use since null pointer exception can occur in run time.


if((x!=null) & (x.size() ==0))
if((x==null)  | (x.size()==0))

if((x==null) && (x.size() ==0))
if((x!=null)  || (x.size()==0))


Saturday, December 10, 2011

The cache of the Google chrome in Vista



The cache is in the following path from the system root:
Users/<user>/AppData/Local/Google/Chrome/User Data/Default/Cache


(system root - The default hard drive, C: on most PCs)

Thursday, December 8, 2011

How to check whether your phone is original or not?

What you have to do is press the following on your mobile *#06# and the-international mobile equipment identity number appears. Then check the 7th and 8th numbers of the identity number:


IF the Seventh & Eighth digits are
02 or 20 this means your cell phone was assembled in Emirates which is very Bad quality

IF the Seventh & Eighth digits are
08 or 80 this means your cell phone was manufactured in Germany which is fair quality

IF the Seventh & Eighth digits are
01 or 10 this means your cell phone was manufactured in Finland which is very Good

IF the Seventh & Eighth digits are
00 this means your cell phone was manufactured in original factory which is the best Mobile Quality

IF the Seventh & Eighth digits are
13 this means your cell phone was assembled in Azerbaijan which is very Bad quality and also dangerous for your health    
 

These are some information I got through a mail! :)

Monday, October 10, 2011

How to count filtered data in Excel 2007



Let's say you have filtered some rows of an excel sheet by a certain value etc. These rows will not be in proper numbering since some rows will be filtered away and the filtered rows will be numbered like, 1 ,4 7, 8 and so on, for an example. So the function COUNT will not be useful here.
The solution for this is:

=SUBTOTAL(3,A2:A15)

Here the parameter 3 is the number of a function and it is the function COUNTA and the A2:A15 is the filtered range.

In this way you can get the count of the filtered rows of data!