Skip to main content

Posts

Showing posts from June, 2011

Circular Reference Warning/Error message

In Excel when you refer the cell where the formula lies in, it is a circular reference as you get the workbook confused...

For Ex: You are writing a formula in A1 and the formula you enter is =Sum(A1:A5) this is a circular reference as you have the formula in A1 and you want the sum to include A1

Now the frustrating part in the circular reference error message is that it doesn't point you to the location which has the error.

Thankfully there is an easy way to figure out which cells have circular reference:
To locate circular references: Go to Formulas --> Error Checking --> Circular Reference
(Excel 2010)

Once you hover over it, you will see all the cells which have circular references...you can then rectify the errors...

there are resources which explain in good detail:
Video

or in excel help go to "Excel 2010 Home > Excel 2010 Help and How-to > Formulas > Correcting formulas"

"double" datatype doesn't accept null values

The application gets a double value from the database. Database has and allows "null" values for a double type variable but in my java code I can't assign null values to the variable type double.

double var1 = null; -- this throws an error
Double var2 = null; -- no error thrown here
reason: double is a primitive datatype and thus can't initialize it to a null but we can assign a null to Double as it takes the input as an object which encapsulates a primitive datatype. its like a wrapper to the primitive datatype thus can be initiated to null

we can read the null value into our code as
double var1 = resultset.getDouble(columnIndex);
if the column has null it will return a zero

thus saving your variable from the null pointer exception!