Thursday, October 8, 2009

Sharepoint - when you get the message that file is locked by yourself.

I was facing an issue while editing a heavy document. The xls document was getting crashed very frequently and then I was not able to check in my changes. In this scenario, the document didn’t open as expected and I received the following message in a File in Use dialog box:
FileName is locked for editing by 'another user'.

I searched on Google and found that it’s a common issue. As per the solution, we should open the document again only after 10 minutes as described in the link below:

Have a better life after crash... time heals all wounds :)

Sunday, February 15, 2009

When to use an array of size zero ?

Question: Java provides the facility to have an array of size zero. Do we have any scenario when this zero size array can be used ?

Scenario1: Suppose, I have a method returning an array. So the method can return an array with values or null. If the code invoking method is not checking for null, can get an exception.
So sometimes it is better to return an array with size zero to avoid NullPointerException. It could be a good way to return nothing :)

Scenario 2: Think and put a comment please.....

Tuesday, January 13, 2009

SSL - How to decide if a web page is secure?

Whenever we talk about internet security, we use the word SSL. I found a very good description of SSL in a book but wanted to have something online. So while searching, I found a very nice and interesting article related to internet security and SSL. So just click the link below and feel more secure :)

I will edit the same post whenever getting something interesting and easy to learn about SSL .....

Friday, December 12, 2008

Two silly questions for abstract classes

1) In which case we need : An abstract class with no abstract methods....

Case 1: I have seen many projects using the base class declared as Abstract. Example : Base class for DVOs, Action classes, DAOs etc. These class can contain some basic methods and properties which can be used or overridden by the subclasses. Here, the main purpose of the class is to create a structure (inheritance) not creating objects.

Case 2: Some adapter classes for AWT listeners are abstract with no abstract methods. For example java.awt.event.WindowAdapter . It represents the scenario when we dont want to implement all the methods of an interface. The subclass can override the methods for a particular functionality.

Case 3: In some cases, we need a class that should not be instantiated and the sub class should use or override some of the methods.

Example : javax.servlet.http.HttpServlet


2) In which case we need : A class with all methods defined as abstract (or should we go for Interface always in this case)

Lets create the problem now :)

Wednesday, December 10, 2008

Difference between '\n' and '\f' and '\r'

  • carriage return = come to initial point of a line
  • new line= come to second line (next line).
  • form feed= some characters will be inserted at that place at run time.
Please put more light on the basic purpose of these characters.

Tuesday, December 9, 2008

How to print the diagonal elements of a square matrix in a single loop?

1st Diagonal:
for(int i=0;i< arr.length; i++)
2nd Diagonal:
for(int i=0;i< arr.length; i++)
SOP(arr[i][arr.length - (i+1)]);

Abstraction VS Encapsulation

Here is some interesting info from

Abstraction is "selective ignorance". You choose to ignore the details of implementation be it in context of exposing interfaces/abstract classes in OOP or just plain functions or files or whatever that helps you categorize various components into independent entities that can take up some responsibility to add up to provide the complete behaviour expected of a system. It is above taking up a responsibility by a module / component / class / structure/function in itself and ignoring the details of how it will be actually implemented or implementation of any relationship/dependencies with other entities. Just that component and the functionality that it would provide.

In technology, when designing applications, it is not always possible that you think that way. The thinking becomes dirty by worrying about too many details all at the same time which might be needed but not for the specific task you want to accomplish. This is all part of the divide and rule policy that helps divide a particular task into contributing components and integrating them to build up the whole thing. That is what is abstraction.

Not really about hiding the implementation details but ignoring them. The hiding is what is called encapsulation. In JAVA using private/protected/public/internal/default access specifiers. Encapsulation is about hiding unncessary details that might change or might cause strong coupling between entities or the details which are not really required by other components to achieve what they take ownership of; which is never found to be beneficial.

Also find some useful content from

Abstraction and encapsulation are complementary concepts: abstraction focuses on the observable behavior of an object... encapsulation focuses upon the implementation that gives rise to this behavior... encapsulation is most often achieved through information hiding, which is the process of hiding all of the secrets of object that do not contribute to its essential characteristics