Friday, April 6, 2018

New In .NET Core 2.0

.NET Core is Microsoft’s open source, cross platform framework to build Web and mobile apps.


ASP.NET Core is a complete new framework in which many concepts have changed. In this course, Building Your First ASP.NET Core Web Application, you'll learn how you can build a fully working website with ASP.NET Core, Bethany's Pie Shop. First, you'll start from scratch and you can follow along to build the entire solution in a practical way. Next, you'll learn about the project structure and project files and will see how the application is built up starting from the model and the database using Entity Framework Core. Then, you'll learn about controllers, how routing is handled in ASP.NET Core, and how you'll build several views using the new tag helpers and Razor. Finally, you'll explore what Dependency Injection is and why it plays a central role in ASP.NET Core and when the app is ready, you'll deploy it to Azure.

Asp Core 2.0 is 20% faster than its previous version .NET Core 1.0.

API Improvements

Core – Primitives, Collections, Reflection, Interop, Linq
Serialization – BinaryFormatter, Data Contract, XML
Threading – Threads, Thread Pool, Tasks
Networking – Sockets, HTTP, Mail, WebSockets

IO – Files, Compression, MMF

Platform Improvement

.NET Core 1.x on macOS required the OpenSSL toolkit's cryptographic library. .NET Core 2.0 uses the Apple cryptographic libraries and doesn't require OpenSSL, so you no longer need to install it.

.NET Core 2.0 offers a single Linux implementation that works on multiple Linux distributions. .NET Core 1.x required that you download a distribution-specific Linux implementation.


Language support
.NET Core 2.0 support C#, F#, and Visual Basic. C# 7.1 version is supported now that has few new features including async Main method, inferred tuple names, and default expressions.
Runtime Store
In .NET Core 2.0, dotnet store command runs implicitly.

Wednesday, January 29, 2014

abc

cs file

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;


public partial class Default2 : System.Web.UI.Page
{
    private SqlConnection con = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=C:\\Documents and Settings\\Administrator\\My Documents\\Rating.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True");
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            BindEmployeeDetails();
        }
    }

    protected void BindEmployeeDetails()
    {
        con.Open();
        SqlCommand cmd = new SqlCommand("Select * from inclusion where ttid=2", con);
        SqlDataAdapter da = new SqlDataAdapter(cmd);
        DataSet ds = new DataSet();
        da.Fill(ds);
        con.Close();
        if (ds.Tables[0].Rows.Count > 0)
        {
            GridView1.DataSource = ds;
            GridView1.DataBind();
        }
        else
        {
            ds.Tables[0].Rows.Add(ds.Tables[0].NewRow());
            GridView1.DataSource = ds;
            GridView1.DataBind();
            int columncount = GridView1.Rows[0].Cells.Count;
            GridView1.Rows[0].Cells.Clear();
            GridView1.Rows[0].Cells.Add(new TableCell());
            GridView1.Rows[0].Cells[0].ColumnSpan = columncount;
            GridView1.Rows[0].Cells[0].Text = "No Records Found";
        }

    }
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int userid = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Values["serialno"].ToString());
        Response.Write(userid);
        con.Open();
        SqlCommand cmd = new SqlCommand("delete from inclusion where serialno=" + userid, con);
        int result = cmd.ExecuteNonQuery();
        con.Close();
        if (result == 1)
        {
            BindEmployeeDetails();
        }
    }
    protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
    {
        GridView1.EditIndex = e.NewEditIndex;
        BindEmployeeDetails();
    }
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        //int userid = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value.ToString());
        int userid = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Values["serialno"].ToString());
        TextBox txtdesc = (TextBox)GridView1.Rows[e.RowIndex].FindControl("et1");
        TextBox txtthin = (TextBox)GridView1.Rows[e.RowIndex].FindControl("et2");
        TextBox txtthick = (TextBox)GridView1.Rows[e.RowIndex].FindControl("et3");
        con.Open();
        SqlCommand cmd = new SqlCommand("update inclusion set description='" + txtdesc.Text + "',thin='" + txtthin.Text + "',thick='" + txtthick.Text + "' where serialno=" + userid, con);
        cmd.ExecuteNonQuery();
        con.Close();
     
        GridView1.EditIndex = -1;
        BindEmployeeDetails();
    }
    protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
    {
        GridView1 .EditIndex = -1;
        BindEmployeeDetails();
    }

    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName.Equals("AddNew"))
        {
            TextBox txtdesc = (TextBox)GridView1.FooterRow.FindControl("t1");
            TextBox txtthin = (TextBox)GridView1.FooterRow.FindControl("t2");
            TextBox txtthick = (TextBox)GridView1.FooterRow.FindControl("t3");
            con.Open();
            SqlCommand cmd =
                new SqlCommand(
                    "insert into inclusion(ttid,description,thin,thick) values(" + 2 + ",'" + txtdesc.Text + "','" +
                    txtthin.Text + "','" + txtthick.Text + "')", con);
            int result = cmd.ExecuteNonQuery();
            con.Close();
            if (result == 1)
            {
                BindEmployeeDetails();
            }
            else
            {
               
            }


        }
    }
           

}

aspx file

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
    </div>
    <asp:GridView ID="GridView1" DataKeyNames="serialno"  runat="server" ShowFooter ="true" ValidationGroup="va" AutoGenerateColumns="false" 
    OnRowCommand="GridView1_RowCommand" OnRowDeleting="GridView1_RowDeleting"
    OnRowEditing ="GridView1_RowEditing" OnRowUpdating ="GridView1_RowUpdating" OnRowCancelingEdit="GridView1_RowCancelingEdit">
    <Columns >
        <asp:TemplateField >
            <EditItemTemplate >
                <asp:ImageButton ID="imgbtnUpdate" CommandName ="Update" ImageUrl ="~/Images/update.jpg" runat="server" Width="20px" Height="20px" />
                <asp:ImageButton ID="imgbtnCancel" CommandName ="Cancel" ImageUrl ="~/Images/Cancel.jpg" runat="server" Width="20px" Height ="20px" />
            </EditItemTemplate>
            <ItemTemplate >
                  <asp:ImageButton ID="imgbtnEdit" CommandName ="Edit" ImageUrl ="~/Images/Edit.jpg" runat="server" Width="20px" Height ="20px" />
                    <asp:ImageButton ID="imgbtnDelete" CommandName ="Delete" ImageUrl ="~/Images/delete.jpg" runat="server" Width="20px" Height ="20px" />
            </ItemTemplate>
            <FooterTemplate >
                  <asp:ImageButton ID="imgbtnAdd" CommandName ="AddNew" ImageUrl ="~/Images/AddNewitem.jpg" runat="server" Width="30px" Height ="30px" />
            </FooterTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Srno" >
            <ItemTemplate >
                    <%# Container .DataItemIndex + 1 %>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText ="Descripation ">
            <EditItemTemplate >
                <asp:TextBox ID="et1" runat="server" Text='<%#Eval("description") %>'></asp:TextBox>
            </EditItemTemplate>
            <ItemTemplate >
                <asp:Label ID="il1" runat="server" Text='<%#Eval("description") %>'></asp:Label>
            </ItemTemplate>
            <FooterTemplate>
                <asp:TextBox ID="t1" runat="server"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" Text="*" ControlToValidate ="t1" ValidationGroup="va"></asp:RequiredFieldValidator>
            </FooterTemplate>
        </asp:TemplateField>
         <asp:TemplateField HeaderText ="Thin ">
            <EditItemTemplate >
                <asp:TextBox ID="et2" runat="server" Text='<%#Eval("thin") %>'></asp:TextBox>
            </EditItemTemplate>
            <ItemTemplate >
                <asp:Label ID="il2" runat="server" Text='<%#Eval("thin") %>'></asp:Label>
            </ItemTemplate>
            <FooterTemplate>
                <asp:TextBox ID="t2" runat="server"></asp:TextBox>
                <asp:RequiredFieldValidator ID="r2" runat="server" Text="*" ControlToValidate ="t2" ValidationGroup="va"></asp:RequiredFieldValidator>
            </FooterTemplate>
        </asp:TemplateField>
         <asp:TemplateField HeaderText ="Thick ">
            <EditItemTemplate >
                <asp:TextBox ID="et3" runat="server" Text='<%#Eval("thick") %>'></asp:TextBox>
            </EditItemTemplate>
            <ItemTemplate >
                <asp:Label ID="il3" runat="server" Text='<%#Eval("thick") %>'></asp:Label>
            </ItemTemplate>
            <FooterTemplate>
                <asp:TextBox ID="t3" runat="server"></asp:TextBox>
                <asp:RequiredFieldValidator ID="r3" runat="server" Text="*" ControlToValidate ="t3" ValidationGroup="va"></asp:RequiredFieldValidator>
            </FooterTemplate>
        </asp:TemplateField>
    </Columns>
    </asp:GridView>
    </form>
</body>
</html>

Sunday, February 10, 2013

Writing Windows 8 Apps with C# and XAML

671768cvr.indd
XAML Syntax
A Windows 8 application is divided into code and markup because each has its own strength.
Despite the limitations of markup in performing complex logic or computational tasks, it’s good
to get as much of a program into markup as possible. Markup is easier to edit with tools and shows
a clearer sense of the visual layout of a page. Of course, everything in markup is a string, so markup
sometimes becomes cumbersome in representing complex objects. Because markup doesn’t have the
loop processing common in programming languages, it can also be prone to repetition.
These issues have been addressed in the syntax of XAML in several ways, the most important of
which are explored in this chapter. But let me begin this vital subject with a topic that will at first
appear to be completely off topic: defining a gradient brush.
The Gradient Brush in Code
The Background property in Grid and the Foreground property of the TextBlock are both of
type Brush. The programs shown so far have set these properties to a derivative of Brush called
SolidColorBrush. As demonstrated in Chapter 1, “Markup and Code,” you can create a SolidColorBrush
in code and give it a Color value; in XAML this is done for you behind the scenes.
SolidColorBrush is only one of four available brushes, as shown in this class hierarchy:
Object
        DependencyObject
            Brush
                SolidColorBrush
                GradientBrush
                    LinearGradientBrush
                TileBrush
                    ImageBrush
                    WebViewBrush
Only SolidColorBrush, LinearGradientBrush, ImageBrush, and WebViewBrush are instantiable. Like
many other graphics-related classes, most of these brush classes are defined in the Windows.UI.Xaml
.Media namespace, although WebViewBrush is defined in Windows.UI.Xaml.Controls.
The LinearGradientBrush creates a gradient between two or more colors. For example, suppose
you want to display some text with blue at the left gradually turning to red at the right. While we’re at
it, let’s set a similar gradient on the Background property of the Grid but going the other way.
In the GradientBrushCode program, a TextBlock is instantiated in XAML, and both the Grid and the
TextBlock have names:
Project: GradientBrushCode | File: MainPage.xaml (excerpt)
<Grid Name="contentGrid"
      Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
     
    <TextBlock Name="txtblk"
               Text="Hello, Windows 8!"
               FontSize="96"
               FontWeight="Bold"
               HorizontalAlignment="Center"
               VerticalAlignment="Center" />
</Grid>
The constructor of the code-behind file creates two separate LinearGradientBrush objects to set to
the Background property of the Grid and Foreground property of the TextBlock:
Project: GradientBrushCode | File: MainPage.xaml.cs (excerpt)
public MainPage()
{
    this.InitializeComponent();

    // Create the foreground brush for the TextBlock
    LinearGradientBrush foregroundBrush = new LinearGradientBrush();
    foregroundBrush.StartPoint = new Point(0, 0);
    foregroundBrush.EndPoint = new Point(1, 0);

    GradientStop gradientStop = new GradientStop();
    gradientStop.Offset = 0;
    gradientStop.Color = Colors.Blue;
    foregroundBrush.GradientStops.Add(gradientStop);

    gradientStop = new GradientStop();
    gradientStop.Offset = 1;
    gradientStop.Color = Colors.Red;
    foregroundBrush.GradientStops.Add(gradientStop);

    txtblk.Foreground = foregroundBrush;

    // Create the background brush for the Grid
    LinearGradientBrush backgroundBrush = new LinearGradientBrush
    {
         StartPoint = new Point(0, 0),
         EndPoint = new Point(1, 0)
    };
    backgroundBrush.GradientStops.Add(new GradientStop
    {
        Offset = 0,
        Color = Colors.Red
    });   CHAPTER 2  XAML Syntax  33
    backgroundBrush.GradientStops.Add(new GradientStop
    {
        Offset = 1,
        Color = Colors.Blue
    });

    contentGrid.Background = backgroundBrush;
}
The two brushes are created with two different styles of property initialization, but otherwise
they’re basically the same. The LinearGradientBrush class defines two properties named StartPoint and
EndPoint of type Point, which is a structure with X and Y properties representing a two-dimensional
coordinate point. The StartPoint and EndPoint properties are relative to the object to which the brush
is applied based on the standard windowing coordinate system: X values increase to the right and Y
values increase going down. The relative point (0, 0) is the upper-left corner and (1, 0) is the upper-
right corner, so the brush gradient extends along an imaginary line between these two points, and
all lines parallel to that line. The StartPoint and EndPoint defaults are (0, 0) and (1, 1), which defines a
gradient from the upper-left to the lower-right corners of the target object.
LinearGradientBrush also has a property named GradientStops that is a collection of GradientStop
objects. Each GradientStop indicates an Offset relative to the gradient line and a Color at that offset.
Generally the offsets range from 0 to 1, but for special purposes they can go beyond the range
encompassed by the brush. LinearGradientBrush defines additional properties to indicate how the
gradient is calculated and what happens beyond the smallest Offset and the largest Offset.
Here’s the result:
G02xx01
If you now consider defining these same brushes in XAML, all of a sudden the limitations of
markup become all too evident. XAML lets you define a SolidColorBrush by just specifying the color,
but how on earth do you set a Foreground or Background property to a text string defining two
points and two or more offsets and colors?
Property-Element Syntax
Fortunately, there is a way. As you’ve seen, you normally indicate that you want a SolidColorBrush in
XAML simply by specifying the color of the brush:
<TextBlock Text="Hello, Windows 8!"
           Foreground="Blue"
           FontSize="96" />
The SolidColorBrush is created for you behind the scenes.
However, it’s possible to use a variation of this syntax that gives you the option of being more
explicit about the nature of this brush . Remove that Foreground property, and separate the TextBlock
element into start and end tags:
<TextBlock Text="Hello, Windows 8!"
           FontSize="96">
 
</TextBlock>
Within those tags, insert additional start and end tags consisting of the element name, a period,
and a property name:
<TextBlock Text="Hello, Windows 8!"
           FontSize="96">
    <TextBlock.Foreground>
     
    </TextBlock.Foreground>
</TextBlock>
And within those tags put the object you want to set to that property:
<TextBlock Text="Hello, Windows 8!"
           FontSize="96">
    <TextBlock.Foreground>
        <SolidColorBrush Color="Blue" />
    </TextBlock.Foreground>
</TextBlock>
Now it’s explicit that Foreground is being set to an instance of a SolidColorBrush.
This is called property-element syntax, and it’s an important feature of XAML. At first it might
seem to you (as it did to me) that this syntax is an extension or aberration of standard XML, but it’s
definitely not. Periods are perfectly valid characters in XML element names.
In reference to that last little snippet of XAML it is now possible to categorize three types of XAML
syntax:
  • The TextBlock and SolidColorBrush are both examples of “object elements” because they are
    XML elements that result in the creation of objects.
  • The Text, FontSize, and Color settings are examples of “property attributes.” They are XML
      attributes that specify the settings of properties.
  • The TextBlock.Foreground tag is a “property element.” It is a property expressed as an XML
    element.
XAML poses a restriction on property-element tags: Nothing else can go in the start tag. The
object being set to the property must be content that goes between the start and end tags.
The following example uses a second set of property-element tags for the Color property of the
SolidColorBrush:
<TextBlock Text="Hello, Windows 8!"
           FontSize="96">
    <TextBlock.Foreground>
        <SolidColorBrush>
            <SolidColorBrush.Color>
                Blue
            </SolidColorBrush.Color>
        </SolidColorBrush>
    </TextBlock.Foreground>
</TextBlock>
If you want, you can set the other two properties of the TextBlock similarly:
<TextBlock>
    <TextBlock.Text>
        Hello, Windows 8
    </TextBlock.Text>
                 
    <TextBlock.FontSize>
         96
    </TextBlock.FontSize>
                 
    <TextBlock.Foreground>
        <SolidColorBrush>
            <SolidColorBrush.Color>
                Blue
            </SolidColorBrush.Color>
        </SolidColorBrush>
    </TextBlock.Foreground>
</TextBlock>
But there’s really no point. For these simple properties, the property attribute syntax is shorter and
clearer. Where property-element syntax comes to the rescue is in expressing more complex objects
like LinearGradientBrush. Let’s begin again with the property-element tags:
<TextBlock Text="Hello, Windows 8!"
           FontSize="96">
    <TextBlock.Foreground>
     
    </TextBlock.Foreground>
</TextBlock>
Put a LinearGradientBrush in there, separated into start tags and end tags. Set the StartPoint and
EndPoint properties in this start tag:
<TextBlock Text="Hello, Windows 8!"
           FontSize="96">
    <TextBlock.Foreground>
        <LinearGradientBrush StartPoint="0 0" EndPoint="1 0">

        </LinearGradientBrush>
    </TextBlock.Foreground>
</TextBlock>
Notice that the two properties of type Point are specified with two numbers separated by a space.
You can separate the number pair with a comma if you choose.
The LinearGradientBrush has a GradientStops property that is a collection of GradientStop objects,
so include the GradientStops property with another property element:
<TextBlock Text="Hello, Windows 8!"
           FontSize="96">
    <TextBlock.Foreground>
        <LinearGradientBrush StartPoint="0 0" EndPoint="1 0">
            <LinearGradientBrush.GradientStops>

            </LinearGradientBrush.GradientStops>
        </LinearGradientBrush>
    </TextBlock.Foreground>
</TextBlock>
The GradientStops property is of type GradientStopCollection, so let’s add that in as well:
<TextBlock Text="Hello, Windows 8!"
           FontSize="96">
    <TextBlock.Foreground>
        <LinearGradientBrush StartPoint="0 0" EndPoint="1 0">
            <LinearGradientBrush.GradientStops>
                <GradientStopCollection>

                </GradientStopCollection>
            </LinearGradientBrush.GradientStops>
        </LinearGradientBrush>
    </TextBlock.Foreground>
</TextBlock>
Finally, add the two GradientStop objects to the collection:
<TextBlock Text="Hello, Windows 8!"
           FontSize="96">
    <TextBlock.Foreground>
        <LinearGradientBrush StartPoint="0 0" EndPoint="1 0">
            <LinearGradientBrush.GradientStops>
                <GradientStopCollection>
                    <GradientStop Offset="0" Color="Blue" />
                    <GradientStop Offset="1" Color="Red" />
                </GradientStopCollection>
            </LinearGradientBrush.GradientStops>
        </LinearGradientBrush>
    </TextBlock.Foreground>
</TextBlock>
And there we have it: a rather complex property setting expressed entirely in markup.
Content Properties
The syntax I’ve just shown you for instantiating and initializing the LinearGradientBrush is actually a
bit more extravagant than what you actually need. You might be persuaded of this fact when you
consider that all the XAML files we’ve seen so far have apparently been missing some properties and
elements. Look at this little snippet of markup:
<Page ... >
    <Grid ... >
        <TextBlock ... />
        <TextBlock ... />
        <TextBlock ... />
    </Grid>
</Page>
We know from working with the classes in code that the TextBlock elements are added to the Children
collection of the Grid, and the Grid is set to the Content property of the Page. But where are those
Children and Content properties in the markup?
Well, you can include them if you want. Here are the Page.Content and Grid.Children property
elements as they are allowed to appear in a XAML file:
<Page ... >
    <Page.Content>
        <Grid ... >
            <Grid.Children>
                <TextBlock ... />
                <TextBlock ... />
                <TextBlock ... />
            </Grid.Children>
        </Grid>
    </Page.Content>
</Page>
This markup is still missing the UIElementCollection object that is set to the Children property of the
Grid. That cannot be explicitly included because only elements with parameterless public constructors
can be instantiated in XAML files, and the UIElementCollection class is missing such a constructor.
The real question is this: Why aren’t the Page.Content and Grid.Children property elements
required in the XAML file?
Simple: All classes referenced in XAML are allowed to have one (and only one) property that is
designated as a “content” property. For this content property, and only this property, property-
element tags are not required.
The content property for a particular class is specified as a .NET attribute. Somewhere in the actual
class definition of the Panel class (from which Grid derives) is an attribute named ContentProperty . If
these classes were defined in C#, it would look like this:
[ContentProperty(Name="Children")]
public class Panel : FrameworkElement
{
    ...
}
What this means is simple. Whenever the XAML parser encounters some markup like this:
<Grid ... >
    <TextBlock ... />
    <TextBlock ... />
    <TextBlock ... />
</Grid>
then it checks the ContentProperty attribute of the Grid and discovers that these TextBlock elements
should be added to the Children property.
Similarly, the definition of the UserControl class (from which Page derives) defines the Content
property as its content property (which might sound appropriately redundant if you say it out loud):
[ContentProperty(Name="Content")]
public class UserControl : Control
{
    ...
}
You can define a ContentProperty attribute in your own classes. The ContentPropertyAttribute class
required for this is in the Windows.UI.Xaml.Markup namespace.
Unfortunately, at the time I’m writing this book, the documentation for the Windows Runtime
indicates only when a ContentProperty attribute has been set on a class—look in the Attributes
section of the home page for the Panel class, for example—but not what that property actually is!
Perhaps the documentation will be enhanced in the future, but until then, you’ll just have to learn by
example and retain by habit.
Fortunately, many content properties are defined to be the most convenient property of the class.
For LinearGradientBrush, the content property is GradientStops . Although GradientStops is of type
GradientStopCollection, XAML does not require collection objects to be explicitly included. Here’s the
excessively wordy form of the LinearGradientBrush syntax:
<TextBlock Text="Hello, Windows 8!"
           FontSize="96">
    <TextBlock.Foreground>
        <LinearGradientBrush StartPoint="0 0" EndPoint="1 0">
            <LinearGradientBrush.GradientStops>
                <GradientStopCollection>
                    <GradientStop Offset="0" Color="Blue" />
                    <GradientStop Offset="1" Color="Red" />
                </GradientStopCollection>
            </LinearGradientBrush.GradientStops>
        </LinearGradientBrush>
    </TextBlock.Foreground>
</TextBlock>
Neither the LinearGradientBrush.GradientStops property elements nor the GradientStopCollection tags
are required, so it simplifies to this:
<TextBlock Text="Hello, Windows 8!"
           FontSize="96">
    <TextBlock.Foreground>
        <LinearGradientBrush StartPoint="0 0" EndPoint="1 0">
            <GradientStop Offset="0" Color="Blue" />
            <GradientStop Offset="1" Color="Red" />
        </LinearGradientBrush>
    </TextBlock.Foreground>
</TextBlock>
Now it’s difficult to imagine how it can get any simpler and still be valid XML.
It is now possible to rewrite the GradientBrushCode program so that everything is done in XAML:
Project: GradientBrushMarkup | File: MainPage.xaml (excerpt)
<Grid>
    <Grid.Background>
        <LinearGradientBrush StartPoint="0 0" EndPoint="1 0">
            <GradientStop Offset="0" Color="Red" />
            <GradientStop Offset="1" Color="Blue" />
        </LinearGradientBrush>
    </Grid.Background>
     
    <TextBlock Name="txtblk"
               Text="Hello, Windows 8!"
               FontSize="96"
               FontWeight="Bold"
               HorizontalAlignment="Center"
               VerticalAlignment="Center">
        <TextBlock.Foreground>
            <LinearGradientBrush StartPoint="0 0" EndPoint="1 0">
                <GradientStop Offset="0" Color="Blue" />
                <GradientStop Offset="1" Color="Red" />
            </LinearGradientBrush>
        </TextBlock.Foreground>
    </TextBlock>
</Grid>
Even with the property-element syntax, it’s more readable than the code version. What code
illustrates most clearly is how something is built. Markup shows the completed construction.
Here’s something to watch out for. Suppose you define a property element on a Grid with multiple
children:
<Grid>
    <Grid.Background>
        <SolidColorBrush Color="Blue" />
    </Grid.Background>
     
    <TextBlock Text="one" />
    <TextBlock Text="two" />
    <TextBlock Text="three" />
</Grid>
You can alternatively put the property element at the bottom:
<Grid>
    <TextBlock Text="one" />
    <TextBlock Text="two" />
    <TextBlock Text="three" />
 
    <Grid.Background>
        <SolidColorBrush Color="Blue" />
    </Grid.Background>
</Grid>
But you can’t have some content before the property element and some content after it:
<!-- This doesn't work! --> 
<Grid>
    <TextBlock Text="one" />
 
    <Grid.Background>
        <SolidColorBrush Color="Blue" />
    </Grid.Background>

    <TextBlock Text="two" />
    <TextBlock Text="three" />
</Grid
>
Why the prohibition? The problem becomes very apparent when you include the property-element
tags for the Children property:
<!-- This doesn't work! --> 
<Grid>
    <Grid.Children>
        <TextBlock Text="one" />
    </Grid.Children>
    <Grid.Background>
        <SolidColorBrush Color="Blue" />
    </Grid.Background>
     <Grid.Children>
        <TextBlock Text="two" />
        <TextBlock Text="three" />
    </Grid.Children>
</Grid>
Now it’s obvious that the Children property is defined twice with two separate collections, and that’s
not legal.

Monday, October 29, 2012

How Operating Systems Work


Computer Operating Systems

When you turn on the power to a computer, the first program that runs is usually a set of instructions kept in the computer's read-only memory (ROM). This code examines the system hardware to make sure everything is functioning properly. This power-on self test(POST) checks the CPU, memory, and basic input-output systems(BIOS) for errors and stores the result in a special memory location. Once the POST has successfully completed, the software loaded in ROM (sometimes called the BIOS orfirmware) will begin to activate the computer's disk drives. In most modern computers, when the computer activates the hard disk drive, it finds the first piece of the operating system: the bootstrap loader.
The bootstrap loader is a small program that has a single function: It loads the operating system into memory and allows it to begin operation. In the most basic form, the bootstrap loader sets up the small driver programs that interface with and control the various hardware subsystems of the computer. It sets up the divisions of memory that hold the operating system, user information and applications. It establishes the data structures that will hold the myriad signals, flags and semaphores that are used to communicate within and between the subsystems and applications of the computer. Then it turns control of the computer over to the operating system.
The operating system's tasks, in the most general sense, fall into six categories:
  • Processor management
  • Memory management
  • Device management
  • Storage management
  • Application interface
  • User interface
While there are some who argue that an operating system should do more than these six tasks, and some operating-system vendors do build many more utility programs and auxiliary functions into their operating systems, these six tasks define the core of nearly all operating systems. Next, let's look at the tools the operating system uses to perform each of these functions.

Friday, October 26, 2012

How to install mac os x 10.7 install DVD lion on your windows pc by using virtual player or vmware workstation.

1. For installing mac os x 10.7 lion on your window pc you have to require mac os x 10.7 which you have licence version or
    you may download from torrent you have to require vmware workstation 7.1.1 which you can download from torrent or
    you may purchase lisense version of virtual matchine and pach of vmware os x lion.

2. First you have require to set up your window bios hardware virtualization enable for that you have to restart your pc and
    when boot start press esc key and select system settings and set hardware virtulization enable.

3 After that install your virtual matchine select next and select typical and select next.
Picture
4. After selecting next you want to select install latter and give next after that you give memory 200 gb and you may store
    that file select your location.

5. After selecting location and give memory size 200 GB and select want to keep in single file option and give next two times
    you can see vmware player screen with you have created virtual player.
Picture
6. After that you can select edit virtual matchine settings and open your setting and set memory 2668 MB and processors 4
    both processers 2 and hard disk size is 200 GB

7. Now in CD/DVD option you can select your mac os x 10.7 lion DVD iso file or if you have Mac OS X Lion.vmdk file if you have
    iso file then you can select that file and press ok

8. Finally power on your mac os x and you can press ctrl+G to enter in wmware matchine and press F8 for boot your iso file
    after that you can select your DVD option.

9. After that you can see apple ios is boot in your virtual matchine and now you can follow installation guide of mac os x 10.7
    lion.

10. when you install mac os x on vmware player then you can see both the screen given below.
Picture
Picture

Thursday, October 25, 2012

What's new in Visual Studio 2012


It's no secret that a new age of modern apps is here. With connected devices and cloud-based services, you have bigger and better opportunities than ever before. Independent developers can plug in from anywhere, build a brilliant app, and make it available to millions of user. Large, agile teams can give their businesses a significant advantage—and the faster they execute, the greater that advantage can be.

That's why Visual Studio 2012 is one of our biggest releases yet. It comes purpose-built to help you thrive in an environment in which ideas are at a premium and speed is of the essence. Let's look at some of the ways it can help you turn ideas into applications fast.
A new look and feel

From the moment you open the IDE, you'll notice things are different. The entire interface has been redesigned to streamline workflows and provide easy access to the tools you use every day. Tool bars are simplified, tab clutter reduced, and you now have new, fast ways to find code. All of this should make it easier to navigate your application and work the way you like.
Ready for Win8

With the release of Windows 8, things have changed dramatically. Visual Studio 2012 delivers new templates, designers, and testing and debugging tools—everything you need to build addictive applications in as little time as possible. At the same time, Blend for Visual Studio gives you a visual toolkit for taking full advantage of the new (and beautiful) Windows 8 interface.
But maybe the best part of all is what you can do after you've created your application. In the old days, it wasn't always easy to get great products in front of the customers who needed them. Now you have the Windows Store, a widely available distribution channel that can reach millions of users. The terms are transparent and the potential easy to see. So you can code, sell, and maybe spend the next few years on the beach.
Web dev upgraded

When it comes to web development, Visual Studio 2012 also has you covered with new templates, better publishing tools, and full support for emerging standards, like HTML5 and CSS3, as well as the latest advances in ASP.NET. We've also made it easier to debug with the Page Inspector by interacting with the page you're coding, right in the IDE. Going mobile? With ASP.NET you can now create applications with controls that optimize for phones, tablets, and other small screens.
Cloud capable

In the old days, everyone had to maintain a server. Scaling required major investment in infrastructure. Now you have fast access to virtually unlimited servers in the cloud with the ability to add more storage and computing power on the fly. Visual Studio gives you great tools for taking your apps to Windows Azure, including new templates and publishing options, support for distributed caching, and a lower install footprint.
Up for serious business

You'll also find major improvements for SharePoint, including new designers, templates, and deployment options. You can take advantage of upgraded ALM features for SharePoint like performance profiling, unit testing, and IntelliTrace. But the pleasantest surprise of all might be LightSwitch, which enables anyone to create line of business applications without having to write a lot of code.
Flexible agile processes, solid ALM

Ok, so far we've focused mainly on development. But as applications grow more complex, you also need tools that help your team work faster and smarter. That's why we've included a flexible approach to agile. With Visual Studio and Team Foundation Server, you can adopt more productive practices at your own pace, without disrupting existing workflows. We've also invited your entire organization to the party, with new ways to track requirements and feedback from stakeholders, customers, and business team members.
You can even outsource your ALM efforts to us. With Team Foundation Service, you get ALM without the infrastructure. That way, even the smallest teams can then benefit from revision control, code reviews, and agile planning tools.
Now it's your turn

This is, of course, only a small bit of what's new in Visual Studio. You'll find plenty of more coding enhancements, ALM improvements, and tools that make your development life a little easier. (For an exhaustive list of new features,) Your task is to find out what works for you and do what you do best. Who knows? Maybe you'll write the next app that will grab everyone's attention. And that would definitely make all of our hard work worth it.