-->

Friday, March 7, 2014

Main Features of Silverlight

As started earlier, silverlight was previously known as WPF/E because it is a subset of WPF, inheriting many functionalities of WPF. For example, Silverlight supports XAML, 2-D vector graphics, animations, and multimedia. However, certain features, such as 3-D graphics and hardware rendering of WPF, are not available to Silverlight. You may wonder about the difference between XAML browser Applications (XBAPs) in WPF and Silverlight. One of the notable differences between the two is that XBAPs can run only in Internet Explorer and firefox, whereas Silverlight applications can run in multiple Web browsers. Secondly, XBAPs require .NET Framework to be available on the users’ computers, while Silverlight provides the necessary components on itsown and does not need .NET Framework. Thirdly, an XBAP has access to the computer WPF functionality, while a Silverlight application has only limited WPF functionality.

The first version of silverlight unveiled by Microsoft was Silverlight 1.0. this version was released in 2007 and was based on the JavaSript application model. You could incorporate the functionality of Silverlight 1.0 in .NET Framework 2.0 and Visual Studio 2005 applications. Now, let’s go through these main features of Silverlight.

Improved Programming Model

Silverlight technology supports the .NET Framework programming model to develop Silverlight applications easily. Silverlight leverages many functionality and features of .NET Framework, such as type safety and exception handling. It also includes many classes from the base class liberary, and offers you the provision of working with IO, collections and generics, and threading. You can use any of the .NET languages, such as VB and C# to develop Silverlight applications. You can also use other dynamic language such as IronPython and IronRuby. Furthermore, you integrate Silverlight functionalities with the existing ASP.NET Web applications. You can combine ASP.NET AJAX and Silverlight to get the best of both the technologies. Silverlight also supports language Integrated Query (LINQ) to objects, which facilitates you to work with various types of data in the Web applications.

Note that Silverlight seamlessly integrates with the HTML, JavaScript Document Object Model (DOM) as with XAML parser providing you with the facility to work with HTML, JavaScript, and XAML simultaneously. In this way, Silverlight extends a cohesive platform for developing interactive and superior quality  Web applications.

Comprehensive UI Framework

Silverlight has a comprehensive UI framework to allow you to design the UI of Web applications by using the predefined controls, styles, themes, and templates. Silverlight offers a wide range of controls and layout features to build exceptionally attractive Web applications. Most of the controls and layout features are the same as those available in WPF. For example, the Grid, StackPanel, Calendar, Button, TextBox, and RadioButton controls of WPF are also available in Silverlight. You can also use styles and control templates in the Silverlight applications. Moreover , there are additional controls, such as MultiScaleImage that are specific to Silverlight. You can also use the data binding and data manipulation controls, such as DataGrid. These new controls were designed from scratch to give an extra edge to the Web applications.
These predefined Silverlight controls and layout features help you to quickly and easily develop some high-end Web applications. You can set the properties of these controls to get the desired effect. Note that these properties can also be set using XAML. XAML is the facilitator for separating the design and the code of Web applications.

Support for Deep Zoom Technology

Silverlight  includes a new feature called Deep Zoom, which allows you to zoom high-resolution images in the applications. You can use the Deep Zoom technology to deliver unbelievably creative and uniquely interactive Web applications. With the Deep Zoom technology, you can easily, quickly, and smoothly zoom in or out multiple photographs simultaneously. You can see a highly detailed and fine view of the photographs by using the MultiScaleImage control available in Silverlight 

Support for 2-D Graphics, Animations, and Multimedia

Silverlight has built-in support for using 2-D vector graphics and animations in Web applications. You can create 2-Dshpes, such as rectangles and ellipses, geometries, and brushes. You can also transform and animate the shapes and geometries. In addition, you can make your Web applications dynamic by using storyboards controlling the animation timeline and speed, and much more.
There is an extensive support in Silverlight for captivating multimedia experience on the Web. You can include .jpeg or images in the applications to give them an attractive UI. In addition, Silverlight supports various multimedia formats, such as .wma, .wmv, and .mp3 and has some of the essential codecs for playing back multimedia content. You can also use High-Definition (HD) quality video (up to 720p) in Silverlight applications. Silverlight also offers protection through authentication  and authorization of users and Digital Rights Management (DRM) for the multimedia content that you add to your Web applications.

Support for Networking

Silverlight  contains classes to support networking and predefined sockets. It allows you to use various HTTP, XML, RSS and REST services. Furthermore, you can use an XML format to use the data and resources on other web sites. Silverlight extends the cross-domain support for networking. You can also use Silverlight  for communication with sockets over standard network protocols, such as IPv4 and IPv6.

How to develop rich-interactive applications with silverlight

In the initial years of the Internet and Web development, websites were developed using only Hypertext Markup Language (HTML). The content built using only HTML for the Web pages is mostly static. Gradually, with the advent of other new technologies and languages, such as cascading Style Sheets (CSS), XHTML, and Javascript, it is now possible to add user interactivity and a little bit of dynamism to webpages. With the passing years, some other technologies, such as Adobe flash and JavaFx, gave a new dimension of interactivity to Web pages as these technologies gave a huge boost to various fields of business, such as e-learning and online advertising. However, some of these technologies are expensive to deploy, varied in performance, and also have inadequate compatibility with different programming technologies.

How to develop rich-interactive applications with silverlight


To overcome the limitations of earlier technologies, such as Adobe Flash and the ever increasing demand of Rich Internet Applications (RIA), Microsoft brought out Silverlight. Formerly known as Windows presentation Foundation/Everywhere (WPF/E), Silverlight is an inexpensive small plug-in that can work in a cross-platform, cross-browser, and cross-device environment. Silverlight is supported by both Microsoft Windows and Apple Macintosh family of operating systems as well as popular Web browsers, such as Microsoft Internet Explorer, Mozilla Firefox, and Apple Safari.

Silverlight is a Web-based technology that allows Web designers and developers to stretch the boundaries of Web application development. It is an integration of the rich user interface (UI) of desktop applications and the transparency of other Web languages, such as HTML and JavaScript . Silverlight allows you to develop Web applications that contain high-fidelity multimedia content and eye-catching visual effects. Web applications.

Thursday, March 6, 2014

How to use Primary Key Constraint on Column in SQL

In SQL, Primary Key constraint is defined on a column or a set of columns whose values uniquely identify all the rows in a table. These columns are referred to as the primary key columns. A primary key column cannot contain NULL values since it is used to uniquely identify rows in a table. The primary key constraint ensures entity integrity.

You can define a primary key constraint while creating the table or you can add it later by altering the table. However, if you define the primary key constraint after inserting rows, the SQL Server will give an error if the rows contain duplicate values in the column. While defining a primary key constraint, you need to specify a name for the constraint. If a name is not specified, the SQL Server automatically assigns a name to the constraint.

If a primary key constraint is defined on a column that already contains data, then the existing data in the column is screened. If any duplicate values are found, then the primary key constraint is rejected. The syntax of applying the primary key constraint when creating table is:

CREATE TABLE table_name
(
Col_name [CONSTRAINT constraint_name PRIMARY KEY
 [CLUSTERED|NONCLUSTERED]
Col_name [, col_name [, col_name [, … ] ] ]
)

Where,

  • Constraint_name specifies the name of the constraint to be created.
  • CLUSTERED|NONCLUSTERED are keywords that specify if a clustered or a nonclustered index is to be created for the primary key constraint.
  • Col_name specifies the name of the column(s) on which the primary key constraint is to be defined.

In the preceding example of the EmployeeLeave table, you can add a primary key constraint, while creating the table. You can set the EmployeeID and the LeaveStartDate columns of the EmployeeLeave table as a composite primary key. You can use the following statement to apply the primary key constraint:

CREATE TABLE HumanResources.EmployeeLeave
(
EmployeeID int,
LeaveStartDate datetime CONSTRAINT cpkLeaveStartDate PRIMARY KEY (EmployeeID, LeaveStartDate),



)

The preceding statement creates the EmployeeLeave table with a composite primary key constraint on EmployeeID and LeaveStartDate. The name of the constraint is cpkLeaveStartDate.

How to Apply Constraints on Columns in SQL Programming?

In SQL Programming, consider an example where a user entered a duplicate value in the EmployeeID column of the Employee table. This would mean that two employees have same employee ID. This would further results in erroneous results when anybody queries the table. As a database developer, you can prevent this by enforcing data integrity on the table by using constraints.

Constraints define rules that must be followed to maintain consistency and correctness of data. A constraint can either be created while creating a table or can be added later. When a constraint is added after the table is created, it checks the existing data. If there is any violation, then the constraint is rejected.

A constraint can be created by using by using either of the following statements:

CREATE TABLE statement
ALTER TABLE statement
A constraint can be defined on a column while creating a table. It can be created with the CREATE TABLE statement. The syntax of adding a constraint at the time of table creation is:
CREATE TABLE table_name
(
Column_name CONSTRAINT constraint_name constraint_type [, CONSTRAINT
)
Where
  • Column_name is the name of the column on which the constraint is to be defined.
  • Constraint_name is the name of the constraint to be created and must follow the rules for the identifier.
  • Constraint_type is the type of constraint to be added.
Constraints can be divided into the following types:

Difference between structure and class

Structure
Class
Structure use public modifier by default
Class use private modifier by default
In concept of inheritance, derived structure is public by default when access modifier doesn’t use in base class.
In case of class concept, derived class is private by default when access modifier doesn’t use in base class.
Use ‘struct’ keyword in language c, c# and ‘structure’ keyword use in VB for implementing structure block
Use ‘class’ keyword for implementing class block.
Structure is a collection of bits.
Class is a collection of members of society.
Structure is based on procedural approach
Class is based on object-oriented approach.
It doesn’t support Data hiding concepts. Means you can’t implement security in it.
You can implement security in it Using data hiding.
It is a value type
It is reference type
Size of empty structure is 0 byte
Size of empty class is 1 byte
In case of template, we can’t use it.
Always we use class in case of structure.
template<struct T> // ERROR, struct not allowed here
template<class T> // OK
Structure may represent real world object.
Class is highly suitable to represent real world objects rather than "Structures"
Structure value will be stored in stack memory
Class members are stored in heap memory.
Structure used for light weight object.
Class is used for complex data type

Wednesday, March 5, 2014

What are the types of Data Integrity in SQL Programming?

If checks are not applied while defining and creating tables, the data stored in the tables can become redundant. For example, if you do not store the data about all the employees with complete address details, then the data would not be useful.

Similarly, if a database used by the Human Resource department stores employee contact details in two separate tables, the details of the employees might not match. This would results inconsistency and confusion.
Therefore, it is important to ensure that the data stored in tables is complete and consistent. The concept of maintaining consistency and completeness of data is called data integrity. Data integrity is enforced to ensure that the data in a database is accurate, consistent, and reliable. It is broadly classified into the following categories:

  • Entity integrity: ensures that each row can be uniquely identified by an attribute called the primary key column contains unique value in all the rows. In addition, this column cannot be NULL. Consider a situation where there might be two candidates for an interview with the same name ‘Jack’. By enforcing entity integrity, the two candidates can be identified by using the unique code assigned to them. For example, one candidate can have the code 001 and the other candidate can be 002.
  • Domain integrity: Ensures that only a valid range of values is stored in a column. It can be enforced by restricting the type of data, the range of values, and the format of the data. For example, you have a table called Branchoffice with a column called offices are located in ‘Berkeley’, ‘Boston’, ‘Chicago’, ‘Dallas’, ‘Munchen’, ‘New Jersey’, ‘New York’, ‘Paris’, and ‘Washington’. By enforcing domain integrity, you can ensure that only valid values (as per the list specified) are entered in the City column of the BranchOffice TABLE.
  • Referential integrity: Ensures that the values of the foreign key match the value of the corresponding primary key. For example, if a bicycle has been ordered and an entry is to be made in the OrderDetail table, then that bicycle code should exist in the product table. This ensures that an order is placed only for the bicycle that is available.
  • User-defined integrity: Refers to a set of rules specified by a user, which do not belong to the entity, domain, and referential integrity categories.

When creating tables, the SQL Server allows you to maintain integrity by:

  • Applying constraints
  • Applying rules
  • Using user-defined types

Difference between procedure and function

Procedure
Function
A procedure is a block of code that can't returning a value. You can say it’s a types of function when that doesn’t return the value.

Example.
Module ABC

    Sub Main()
      
        SProcedure()
       
    End Sub
   
    Sub SProcedure()
        Console.WriteLine("dotprogramming.blogspot.com")
    End Sub
   
End Module

A function is a block of code and after running its code returns a value to the calling code.

Example
Module ABC

    Dim a As Integer = 10
    Dim b As Integer = 20
   
    Dim result As Integer

    Sub Main()

        result = Addition(a, b)
        Console.WriteLine(Addition(a, b))
       
    End Sub
   
    Function Addition(ByVal c As Integer, _
                       ByVal d As Integer) As Integer
        Return c+d
    End Function
   
End Module
Procedure are not categorize or you can say it doesn’t divide in parts.
Functions are divide in two parts
1.       Built-in function
2.       User-defined function
Use “Sub” keyword for creating procedure
Use “function” keyword for creating function.
Procedure will execute when action is called
But in case of function you can say it’s a loop.
© Copyright 2013 Computer Programming | All Right Reserved