Saturday, July 26, 2014

Connect Oracle Database with Entity Framework

With lot of efforts I have found the actual ODAC and ODT driver that provide visual studio development enviroment with oracle 10g (11g latter) and database connection.

The ODAC you can downlaod from the url:  http://www.oracle.com/technetwork/topics/dotnet/utilsoft-086879.html















Install this ODAC driver. Now when you add EDMX (Entity Framework) file then you get the
Oracle Data Provider For .Net.
























Select this driver fill the datasource name, user name and password.
Now you connect with  your oracle database.

Thursday, July 24, 2014

Difference between == and === (equals and triple equals)

The == and === equality operator are used in JavaScript

The === sign defines that value must be equal in type as well however == not.

Example :

0==false   // true
0===false  // false, because they are of a different type
1=="1"     // true, auto type coercion
1==="1"    // false, because they are of a different type

Code Snippet:

                    <script type="text/javascript">
                            function a() {
                               if (1 ==='1') {
                                           alert('true');
                                                   }
                              else {
                                           alert('False');
                                     }
                           }
                  </script>

ListBox Multi Select Option to Move Item in asp.net

Move Item from Left to Right List Box and Vice-Versa.



Code Snippet : 

    protected void btnRight_Click(object s, EventArgs e)
        {
            int[] indexes = this.lstLeftList.GetSelectedIndices();
            ListItem[] items = new ListItem[indexes.Length];
            for (int i = 0; i < indexes.Length; i++)
            {
                items[i] = this.lstLeftList.Items[indexes[i]];
            }

            for (int i = 0; i < items.Length; i++)
            {
                this.lstRightList.Items.Add(items[i]);
                this.lstLeftList.Items.Remove(items[i]);
            }
        }

        protected void btnLeft_Click(object s, EventArgs e)
        {
            int[] indexes = this.lstRightList.GetSelectedIndices();
            ListItem[] items = new ListItem[indexes.Length];
            for (int i = 0; i < indexes.Length; i++)
            {
                items[i] = this.lstRightList.Items[indexes[i]];
            }

            for (int i = 0; i < items.Length; i++)
            {
                this.lstLeftList.Items.Add(items[i]);
                this.lstRightList.Items.Remove(items[i]);
            }
        }

What is the difference between Server.Transfer and Response.Redirect?

Response.Redirect involves a round-trip to the server whereas Server.Transfer conserves server resources by avoiding the round-trip. It just changes the focus of the web-server to a different page and transfers the page processing to a different page.

Response.Redirect can be used to redirect a user to an external websites. Server.Transfer can be used only on sites running on the same server. You cannot use Server.Transfer to redirect the user to a page running on a different server.

Response.Redirect changes the url in the browser. Whereas Server.Transfer retains the original url in the browser. It just replaces the contents of the previous page with the new one.

What are functional and non-functional requirements?

Functional requirements defines the behaviour of a system whereas non-functional requirements specify how the system should behave; in other words they specify the quality requirements and judge the behaviour of a system.
Example :
Functional - Display a chart which shows the maximum number of products sold in a region.

Non-functional – The data presented in the chart must be updated every 5 minutes.

Thursday, July 3, 2014

Abstraction, Encapsulation, and Information Hiding

I was in some interview and interviewer ask me the question to differentiate these terms of OOPs Abstraction, Encapsulation, and Information Hiding.
But at that time I'm not able to give the accurate information and differentiation with these terms.
Then, I was curious. I decided to gather a number of different definitions for abstraction, information hiding, and encapsulation, and to compare them. This article details what I found.

ABSTRACTION

"A view of a problem that extracts the essential information relevant to a particular purpose and ignores the remainder of the information."    -- [IEEE, 1983]

"The essence of abstraction is to extract essential properties while omitting inessential details."
 -- [Ross et al, 1975]

 "An abstraction denotes the essential characteristics of an object that distinguish it from all other kinds of object and thus provide crisply defined conceptual boundaries, relative to the perspective of the viewer."
-- [Booch, 1991]

One point of confusion regarding abstraction is its use as both a process and an entity. Abstraction, as a process, denotes the extracting of the essential details about an item, or a group of items, while ignoring the inessential details. Abstraction, as an entity, denotes a model, a view, or some other focused representation for an actual item. Abstraction is most often used as a complexity mastering technique. For example, we often hear people say such things as: "just give me the highlights" or "just the facts, please." What these people are asking for are abstractions.
We can have varying degrees of abstraction, although these "degrees" are more commonly referred to as "levels." As we move to higher levels of abstraction, we focus on the larger and more important pieces of information (using our chosen selection criteria). Another common observation is that as we move to higher levels of abstraction, we tend to concern ourselves with progressively smaller volumes of information, and fewer overall items. As we move to lower levels of abstraction, we reveal more detail, typically encounter more individual items, and increase the volume of information with which we must deal.

We also note that there are many different types of abstraction, e.g., functional abstraction, data abstraction, process abstraction, and even object abstraction.

INFORMATION HIDING

 "The technique of encapsulating software design decisions in modules in such a way that the module's interfaces reveal little as possible about the module's inner workings; thus each module is a 'black box' to the other modules in the system."       -- [IEEE, 1983]

"... the purpose of hiding is to make inaccessible certain details that should not affect other parts of a system."
-- [Ross et al, 1975]

ENCAPSULATION

"It is a simple, yet reasonable effective, system-building tool. It allows suppliers to present cleanly specified interfaces around the services they provide. A consumer has full visibility to the procedures offered by an object, and no visibility to its data. From a consumer's point of view, and object is a seamless capsule that offers a number of services, with no visibility as to how these services are implemented ... The technical term for this is encapsulation."                -- [Cox, 1986]

"The concept of encapsulation as used in an object-oriented context is not essentially different from its dictionary definition. It still refers to building a capsule, in the case a conceptual barrier, around some collection of things."                       -- [Wirfs-Brock et al, 1990]

Like abstraction, the word "encapsulation" can be used to describe either a process or an entity. As a process, encapsulation means the act of enclosing one or more items within a (physical or logical) container.
Programming languages have long supported encapsulation. For example, subprograms (e.g., procedures, functions, and subroutines), arrays, and record structures are common examples of encapsulation mechanisms supported by most programming languages.

If encapsulation was "the same thing as information hiding," then one might make the argument that "everything that was encapsulated was also hidden." This is obviously not true. For example, even though information may be encapsulated within record structures and arrays, this information is usually not hidden (unless hidden via some other mechanism).

- Brad Cox's definition ([Cox, 1986]) allows for encapsulation to hide some information ("full visibility to the procedures offered by an object"), while hiding other information ("no visibility to its data").

At the end we can say that encapsulation is the process to wrap-up the related data. It also provide security over this wrap-up by applying access modifiers like public, protected, private etc.

CONCLUSIONS

Abstraction, information hiding, and encapsulation are very different, but highly-related, concepts. One could argue that abstraction is a technique that helps us identify which specific information should be visible, and which information should be hidden. Encapsulation is then the technique for packaging the information in such a way as to hide what should be hidden, and make visible what is intended to be visible.