Skip to main content

Posts

Showing posts from February, 2014

Difference between Thread and Process

A Process is an instance of a running application. And a thread is the Execution stream of the Process. A process can have multiple Thread. When a process starts a specific memory area is allocated to it. When there are multiple threads in a process, each thread gets a memory for storing the variables in it, and plus they can access the global variables which are common for all the threads. Thread: is used to execute more than one program at a time. The process can execute a single program. Thread is a path of execution that runs on the CPU, a process is collection of threads that share the same virtual memory. A process has at least one thread of execution, and a thread always runs in a process context.

Difference Between readonly and const c#

Several times I read the difference between Readonly and const keyword in C#. But most of the time when I remember the difference, again and again, mismatch the concept ..Finlay, write simple code.      public class Diff_ConstNReadonly         {             public const int cons_Value = 2;             public readonly int readOnly_value;             public Diff_ConstNReadonly ()             {                 readOnly_value = 3;             }         } Differences: Const :       1.    Const can only be initialized at th...

TRY... CATCH IN Sql Server

Overview: A great option is included in sqlserver 2005 first that was the ability to use TRY .. CATCH block in sql server as C#. It is not easiest thing in early sqlserver. So this options are easy to handles Sql errors. Explanation If you are not familiar with the Try...Catch paradigm it is basically two blocks of code with your stored procedures that lets you execute some code, this is the Try section and if there are errors they are handled in the Catch section.  Let's take a look at an example of how this can be done.  As you can see we are using a basic SELECT statement that is contained within the TRY section, but for some reason if this fails it will run the code in the CATCH section and return the error information. -- ============================================= -- Author: <Md Maksudur Rahman> -- Create date: <20160501> -- Description: <Get students> -- EXEC uspTryCatchTest 'Mohammad' -- ====================...

Database View

View is a database object also called a logical table. it has no psychical existence. It is not like a simple table, but is a virtual or logical table which contains columns and data from different tables (may be one or more tables). A View does not contain any data, it is a set of queries that are applied to one or more tables that is stored within the database as an object. After creating a view from some table(s), it used as a reference of those tables and when executed, it shows only those data which are already mentioned in the query during the creation of the View. Creating view Syntax: ------------------------------------------------- CREATE VIEW [View_Name] AS [ SELECT Statement] ------------------------------------ ------------- CREATE VIEW SampleView As SELECT EmpID, EmpName FROM EmpInfo -------------------------------------------------- Data retrieve from view: SELECT * FROM SampleView WHERE EmpID ='FN0009C1'     View does not modi...

What is an Index? Explain Custered Index and Non-Clustered Index

Index Index is a database object, which can be created on one or more columns (16 Max column combination). When creating the index will read the column(s) and forms a relevant data structure to minimize the number of data comparisons. The index will improve the performance of data retrieval and adds some overhead on data modification such as create, delete and modify. So it depends on how much data retrieval can be performed on table versus how much of DML ( Insert , Delete and Update ) operations. clustered index A clustered index is something that reorganizes the way records in the table are physically stored. Therefore a table can have only one clustered index. The leaf nodes of a clustered index contain the data pages, by which I mean the key-value pair in the clustered index has the index key and the actual data value. Also remember, a clustered index will be created on a table by default the moment a primary key is created on the table. A clustered index is so...

What is Stack and Heap

We are discussing about memory management, how the memory of the computer is organized for a running program. Ok lets go to discuss :-  When a program is loaded into memory, it is organized into three areas of memory, called segments: the text segment ,  stack segment , and  heap segment . The text segment:  sometimes also called the code segment  is where the compiled code of the program itself resides. The remaining two areas of system memory is where storage may be allocated by the compiler for data storage. Two areas are called Stack and Heap Stack: Stack is a data structure in memory used for storing items in last in first out manner. The  stack contains local variables and the call stack. In C#, Value types variable are stored directly on the stack.  The advantage of using the stack to store variables, is that memory is managed . we don't have to allocate memory by hand, or free it once we don't need it any more. What's m...

What is Object Pooling (.net)

Object pooling is nothing new, it is a container that contains active object lists that are created. In a word , a container of objects that are ready for use. List of ready-to-be-used objects are keep in this pool.Whenever there is a request for a new object, the pool manager will take the request and it will be served by allocating an object from the pool.