k-World

Different ways through which we can maintain state in Asp.Net are:

1. Hidden Fields

2. View State

3. Hidden Frames

4. Cookies

5. Query Strings

KEYWORD: SELECT\FROM\WHERE\AND\OR

SELECT column_name(s) FROM table_name
WHERE condition AND|OR condition

KEYWORD: ALTER\ADD\DROP\COLUMN

ALTER TABLE table_name 
ADD column_name datatype

ALTER TABLE table_name 
DROP COLUMN column_name

KEYWORD: AS

SELECT column_name AS column_alias
FROM table_name

SELECT column_name
FROM table_name  AS table_alias

KEYWORD: BETWEEN\AND

SELECT column_name(s)
FROM table_name
WHERE column_name
BETWEEN value1 AND value2

KEYWORD: CREATE\DATABASE

CREATE DATABASE database_name

KEYWORD: TABLE

CREATE TABLE table_name
(
column_name1 data_type,
column_name2 data_type,
column_name2 data_type,
…)

KEYWORD: INDEX\UNIQUE INDEX

CREATE INDEX index_name
ON table_name (column_name)

CREATE UNIQUE INDEX index_name
ON table_name (column_name)

KEYWORD: VIEW

CREATE VIEW view_name AS
SELECT column_name(s)
FROM table_name
WHERE condition

KEYWORD: DELETE

DELETE FROM table_name
WHERE some_column=some_value

DELETE FROM table_name (Deletes the entire table)

DELETE * FROM table_name (Deletes the entire table)

KEYWORD: DROP

DROP DATABASE database_name

KEYWORD: INDEX

DROP INDEX table_name.index_name

KEYWORD: DROP\TABLE

DROP TABLE table_name

KEYWORD: EXISTS

IF EXISTS (SELECT * FROM table_name WHERE id = ?)
BEGIN
–do what needs to be done if exists
END
ELSE
BEGIN
–do what needs to be done if not
END

KEYWORD: GROUP BY

SELECT column_name, aggregate_function(column_name)
FROM table_name
WHERE column_name operator value
GROUP BY column_name

KEYWORD: HAVING

SELECT column_name, aggregate_function(column_name)
FROM table_name
WHERE column_name operator value
GROUP BY column_name
HAVING aggregate_function(column_name) operator value

KEYWORD: IN

SELECT column_name(s)
FROM table_name
WHERE column_name
IN (value1,value2,..)

KEYWORD: INSERT INTO

INSERT INTO table_name
VALUES (value1, value2, value3,….)

INSERT INTO table_name
(column1, column2, column3,…)
VALUES (value1, value2, value3,….)

KEYWORD: INNER JOIN\ON

SELECT column_name(s)
FROM table_name1
INNER JOIN table_name2 
ON table_name1.column_name=table_name2.column_name

KEYWORD: LEFT JOIN

SELECT column_name(s)
FROM table_name1
LEFT JOIN table_name2 
ON table_name1.column_name=table_name2.column_name

KEYWORD: RIGHT JOIN

SELECT column_name(s)
FROM table_name1
RIGHT JOIN table_name2 
ON table_name1.column_name=table_name2.column_name

KEYWORD: FULL JOIN

SELECT column_name(s)
FROM table_name1
FULL JOIN table_name2 
ON table_name1.column_name=table_name2.column_name

KEYWORD: LIKE

SELECT column_name(s)
FROM table_name
WHERE column_name LIKE pattern

KEYWORD: ORDER BY\ASC\DESC

SELECT column_name(s)
FROM table_name
ORDER BY column_name [ASC|DESC]

KEYWORD: SELECT

SELECT column_name(s)
FROM table_name

KEYWORD: SELECT\DISTINCT

SELECT DISTINCT column_name(s)
FROM table_name

KEYWORD: SELECT\INTO

SELECT *
INTO new_table_name [IN externaldatabase]
FROM old_table_name

SELECT column_name(s)
INTO new_table_name [IN externaldatabase]
FROM old_table_name

KEYWORD: TOP

SELECT TOP number|percent column_name(s)
FROM table_name

KEYWORD: TRUNCATE

TRUNCATE TABLE table_name

KEYWORD: UNION

SELECT column_name(s) FROM table_name1
UNION
SELECT column_name(s) FROM table_name2

KEYWORD: UNION ALL

SELECT column_name(s) FROM table_name1
UNION ALL
SELECT column_name(s) FROM table_name2

KEYWORD: UPDATE\SET

UPDATE table_name
SET column1=value, column2=value,…
WHERE some_column=some_value

KEYWORD: WHERE

SELECT column_name(s)
FROM table_name
WHERE column_name operator value

Reference:

http://www.w3schools.com/sql/sql_quickref.asp

 

Entity: Anything in the real world which can be represented as a class is referred to as an Entity.

Ex: Customer, Order etc

Class: Class consists of the properties and the methods of an entity.  Class exists even after run time, since class exists in the code of an application.

Ex: Customer Class, Order Class etc…

Sample Class of a Customer in C#:


public class Customer

{
public int CustomerId { get; set; }

public string FirstName { get; set; }

public string LastName { get; set; }

public string Validate()
{
string result = string.Empty();
if(!string.IsNullOrEmpty(FirstName))
{
result = "First Name Cannot Be Empty!!!!";
}
}
}

Object: Object is an instance of a class, it only exits at the run time. Object retains the state of a variable, where it retains the value of its properties and methods.

Ex: Customer customer = new Customer();

Object is created with the new keyword.

Now i think we can go forward to define What is Object Oriented Programming?

Object Oriented Programming is an approach to build and design the applications which are flexible, extensible, testable and easier to maintain in future, by mainly focusing on the objects that interact with each other.

Below are the few points which helps in Object Oriented Programming (popularly know as OOP)

Identifying Classes: While developing an application we must know to identify the classes/entities of the real world, through which we can create required classes for a give problem.

Separating Responsibilities: We also must know how to separate each individual responsibilities of the classes etc. Popularly known as Separation Of Concern in many programming languages.

Establishing Relationships: One must know how the relationships needs to be maintained in between the classes so that if helps to build the extensible and robust applications.

Leveraging Reuse: We also need to know how to reuse the classes which are created to solve the given problem. Commonly know as the Inheritance in the OOP.

Margin: Margin is the space around the edges of an element.

Padding: Padding is the space between the content  and the margin of an element.

Sql NO LOCK is used only with the SELECT statements, it helps us to read the un-commited data thus helps in preventing the deadlocks.

Using Sql NO LOCK:

SELECT * FROM CUSTOMERS WITH (NOLOCK) WHERE CUSTOMERNAME = ‘JASON’

Similar NO LOCK can also be written as below:

SELECT * FROM CUSTOMERS WITH (READUNCOMMITTED) WHERE CUSTOMERNAME = ‘JASON’

Tech Abbreviations

Here below I am mentioning the Abbreviation’s used in the different technologies:

MVC – Model View Controller

MVP – Model View Presenter

MVVM – Model View View-Model

IIFE – Immediately invoked Function Expression (Angular.js)

AJAX – Asynchronous Java Script and Xml

LINQ – Language Integrated Query

WCF – Windows Communication Function

WWF – Windows Workflow Foundation

HTTP – Hyper Text Transfer Protocol – GET, POST, PUT, DELETE

HTTPS – Hyper Text Transfer Protocol Secure

FTP – File Transfer Protocol

TCP – Transmission Control Protocol

JSON – Java Script Object Notation

SPA – Single Page Application

SGML – Standard Generalized Mark-up Language

CORS – Cross Origin Resource Sharing

API – Application Programming Interface

Many of the programmers are using Implicit and Explicit word when speaking about technology. Here in brief I am trying to explain the meanings in technical terms.

Implicit : Implicit in case of C# programming, whatever the work (casting) needs to be done will be taken care by the CLR (Common Language Run time) in the .Net. So there is no need for the programmer to cast the values.

Ex: Converting the int data type to the long data type doesn’t need any casting.

    int number = 69;

    long longNumber = number; //Implicitly casting is taken care by the CLR.

Explicit: Explicit in case of C# programming, here programmer need to write the extra code to cast the value as it’s not taken by the CLR of .Net.

Ex: Converting the double data type to the int needs casting.

    double doubleNumber = 2.345;

    int integerNumber = (int) doubleNumber;

Extension Methods

Extension methods allow existing compiled types (Ex: classes, interface implementations) as well as types currently being compiled (EX: types in a project that contains extension methods) to gain new functionality without any need to update the type being extended.

Generally a extension methods are used to create the Utility classes in an application.

 

Partial Methods

Partial class definitions are written using the Partial keyword, partial keyword allows us to write a code across multiple files. But all the files must be under the same fully qualified namespace.

We can also create a partial class as well as partial methods.

Points to be taken care while creating the partial methods:

– Partial method can only be defined within a partial class.

– Partial methods must return void.

– Partial methods can be static or instance level.

– Partial methods can have arguments (including parameters modified by this, ref or params – but not with the out modifier).

– Partial methods are always implicitly private.

Reference:

– Pro C# 2010 and the .NET 4 Platform – by Andrew Troelsan

The different ways how we can make a text box read only as mentioned below:

1. Using the read-only attribute in the TextBox HtmlHelper, i.e.

@Html.TextBoxFor(Model => Model.Customer, new { @readonly = “readonly” })

2. Also by setting the read-only attribute to true in the TextBox HtmlHelper, i.e.

@Html.TextBoxFor(Model => Model.Customer, new { @readonly = true })

Reference:

http://kreotekdev.wordpress.com/2007/11/08/disabled-vs-readonly-form-fields/

Attribute filters in jquery uses the attribute of the selected elements in jquery.

Attribute FilterMeaning

1. [attr] → Matches any value that have an attr attribute.

2. [attr=val]  → Matches any elements that have an attr attribute whose value is val.

3. [attr!=val] → Matches elements that have no attr attribute, or whose attr is not equal to val.

4. [attr^=val] → Matches elements whose attr attribute has a value that begins with val.

5. [attr$=val] → Matches elements whose attr attribute has a value that ends with val.

6. [attr*=val] → Matches elements whose attr attribute has a value that contains val.

7. [attr~=val] → Matches elements whose attr attribute, when interpreted as a list of words separated by spaces, includes the word val.  Ex: “p.customer” is similar to “p[class~=customer]”.

8. [attr|=val] → Matches elements whose attr attribute has a value that begins with val and is optionally followed by a hyphen and any other character.

Reference:

1. jQuery – Pocket Reference – by David Flanagan.

2. http://api.jquery.com/attribute-contains-prefix-selector/