Welcome....

Saturday, June 18, 2011

SQL server and Code names


SQL server and code names

Wednesday, November 10, 2010
In 1988, Microsoft released its first version of SQL Server. It was developed jointly by Microsoft and Sybase for the OS/2 platform.
  • 1993 – SQL Server 4.21 for Windows NT
  • 1995 – SQL Server 6.0, codenamed SQL95
  • 1996 – SQL Server 6.5, codenamed Hydra
  • 1999 – SQL Server 7.0, codenamed Sphinx
  • 1999 – SQL Server 7.0 OLAP, codenamed Plato
  • 2000 – SQL Server 2000 32-bit, codenamed Shiloh (version 8.0)
  • 2003 – SQL Server 2000 64-bit, codenamed Liberty
  • 2005 – SQL Server 2005 , codenamed Yukon (version 9.0)
  • 2008 – SQL Server 2008, codenamed Katmai (version 10.0)
  • 2010 – SQL Server 2008 R2 , Codenamed Kilimanjaro (aka KJ)
  • Next – SQL Server 2011, Codenamed Denali 
  • Microsoft Technologies
  • WCF----Indigo
  • WPF----Avalon
  • Windows Card space--Infocard

Wednesday, June 1, 2011

AppFabric Caching (aka Velocity Caching) - Microsoft .NET



AppFabric requires .NET Framework 4 as a foundation. It also requires the Windows Process Activation service (WAS) and IIS Manager. To support management and deployment of WCF and WF services, AppFabric provides management APIs and tools that you can use either from the IIS Management console or from Windows PowerShell. AppFabric also provides several run-time services and stores for the monitoring and persistence of hosted services and workflows.
AppFabric Caching Service is a distributed cache platform for in-memory caches spread across multiple systems, developed by Microsoft. It is one of Microsoft's AppFabric's Services. In its early stages of development, it was referred by a code name Velocity.
AppFabric Caching Service is available as a Windows Azure Service.
A long time ago, applications running on Windows Server were simply EXEs, where developers wrote a lot of custom code on top of the Operating System (OS) to interact with clients and other applications over the network. COM+ and Microsoft Transaction Server (MTS) were added to make it easier to write and host server-side applications and Internet Information Server (IIS) was added to make it easier to write and host Web applications. Application logic was typically written in native code and/or in scripts (CGI, ASP) back then.
 
In 2002 Microsoft shipped .NET 1.0 and IIS was extended to support ASP.NET enabling managed code Web applications to be hosted on Windows Server. In 2006, with .NET Framework 3.0, Microsoft released two new programming models designed to simplify development of application logic, namely: Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF). WCF enables service-orientation and interoperability and WF enables authoring and execution of long-running workflows. IIS was refactored in Windows Server 2008/Vista and WAS (Windows process Activation Service) was born to enable HTTP and non-HTTP activation of application hosting worker processes (w3wp.exe, also known as AppPool worker) even when the full IIS is not installed. While Windows Server 2008 and .NET 3.0 provided basic administration tools for applications written using WCF and WF programming models, there wasn’t out-of-the-box support for hosting long-running workflows (one had to self-host workflows or build a solution around WAS to ensure reliability and timer activation).
In the upcoming Windows Server AppFabric release we are evolving the application server capabilities in Windows Server to introduce enhanced application hosting and administration tooling (previously codename “Dublin”) for services written using WCF and WF programming models, and providing distributed cache capabilities (previously codename “Velocity”) for .NET applications. The high-level architecture overview of AppFabric is available at http://msdn.microsoft.com/en-us/library/ee677374.aspx.

Design

Any number of systems can be a part of the cache; the caching runtime pulls together the individual caches on each machine to present a unified view to the applications. Applications need not know on which machine the cache is stored; rather the applications query the caching runtime which in turn forwards the request to the system that houses the cache item. The API is surfaced in managed code; so any CLI-compliant language can be used to access the cache. Any serialized managed object can be added to the cache.

Caching is an essential component to speed up any web application by minimizing the number of trips to the actual database. AppFabric Caching or Velocity caching is a distributed caching system that leverages the caching infrastructure available across a cluster of cache servers efficiently to enhance application performance as well as scalability. The secret behind the effectiveness of appfabric caching lies in the fact that duplicate data is not cached by the cache cluster because whenever data is requested by any client, it is first looked up in the unified logical cache and if available the data that reaches the client can be from the physical cache memory of any of the servers in the cluster.







Velocity caching is implemented in a synchronized tier and the service can be accessed across the network with the cache servers in the cluster running the process (DistributedCache.exe). Even though several cache servers contribute to the shared cache memory, there is a common gateway for data to enter and exit in the form of a centralized and shared cache. The distributed cache is handled in code with the help of simple get and put methods that will retrieve, insert, update or delete data items in the unified logical cache as a whole. The programmer is not worried about the internal implementation or the physical location of cached data in the cluster.

Notable Aspects:
  • Each server in the cluster stores the session object data in its RAM and does not write it to disk for obvious reasons
  • No code change or new code has to be incorporated by the programmer and all that is needed is to change a configuration setting in order to activate velocity caching
  • Distributed caching means multiple web servers can each run an instance of the same application which helps in load balancing
  • Both web server (IIS) and cache server (Appfabric) can be deployed on a single application server running on Windows Server OS
  • Turning on the high-availability feature helps mitigate situations when a server in the cluster goes down by storing a synchronous secondary copy of the data item on a different server
One of the key challenges for the implementation of velocity caching involves managing parallel access to data that changes rapidly and velocity caching offers different concurrency models suitable for the concerned application. Controlling access to sensitive data among the clients is another challenge which is controlled by limiting access to such data with encryption or restricted accounts. Appfabric caching attempts to maximize the benefits from the underlying computer infrastructure with the help of a distributed yet shared architecture to provide value for both application developers and end users. Things can only get better from here.


In parallel, we were also working to elastically scale .NET applications and make them highly available, using commodity hardware. Out of this effort came the distributed in-memory cache (formerly known as Project “Velocity”) which helps cache frequently used data in-memory across multiple machines thereby increasing the performance and scale of these applications. In addition it can elastically scale up and down and replicates data to increase the availability of these applications. These capabilities make the distributed cache an ideal option to cache reference data such as catalogs, profile etc. and session data such as shopping cart.

In this blog post we go deeper into the AppFabric system and its inner workings.

Architecture Overview

The diagram below provides a high-level overview of the AppFabric system.



·         Apps are deployed into a farm of AppFabric servers that share Workflow Instance Stores and Monitoring Stores (Databases).
·         Distributed Cache provides unified data cache view to Apps while distributing and replicating data across multiple machines

Functional View

The diagram below illustrates key components of the AppFabric system and their functions from a single-machine view (one AppFabric Server view) in a typical setup.


Deployment and Configuration

Deploying and configuring an AppFabric application is as easy as deploying and configuring a Web application.
1.       An Administrator deploys and configures a Web application containing WCF and WF services.
a.       The Web application is developed using Visual Studio, and developers can easily add WCF services and WF workflow services to the application.
b.      The Web application can be packaged and deployed using MSDeploy just like any other Web application targeting IIS/WAS environment. MSDeploy is integrated with Visual Studio and IIS Manager and provides command-line scripting.
c.       AppFabric provides configuration tools for WCF and WF services via IIS Manager modules and PowerShell command-lets which enable tasks like setting application monitoring levels and configuring workflow persistence.
d.      Application artifacts are copied to a directory together with web.config and an entry in %SystemRoot%\system32\inetsrv\config\applicationHost.config.
e.      WAS watches applicationHost.config and upon registering an entry, notifies transport listeners and starts waiting for message traffic addressed to the application.

Activation

For WCF and WF services, AppFabric supports both on-demand activation and auto-start activation (Windows 7 and Windows Server 2008 R2). On-demand activation improves resource utilization at the price of the first-request response time. Auto-start activation improves the first-request response time at the price of resource utilization.
2.       A message arrives and is dispatched to a code service or a workflow service for processing.
a.       When a first message arrives to the application via HTTP or via non-HTTP transport listeners, WAS activates a w3wp.exe worker process corresponding to the AppPool that the application is associated with.
b.      CLR AppDomains are created inside the w3wp.exe for each application.
c.       A ServiceHost object is created for each code service in the AppDomain.
d.      A WorkflowServiceHost object is created for each workflow service in the AppDomain.
e.      Both the ServiceHost and WorkflowServiceHost create endpoints and dispatch the received message for processing.
                                                               i.      Based on the instancing model declared on the service, the ServiceHost either creates an instance of the service or finds an existing in-memory instance and invokes the method corresponding to the received message.
                                                             ii.      Based on the message, WorkflowServiceHost either creates a new workflow instance or loads an existing workflow instance from the Instance Store and transfers execution to the workflow instance.
f.        After activation, subsequent messages are dispatched by WAS and transport listeners directly to endpoints established by ServiceHosts and WorkflowServiceHosts during activation.
g.       If the Web application is configured for auto-start activation, corresponding w3wp.exe process, AppDomain, ServiceHost and WorkflowServiceHost objects are created whenever WAS starts.

Conclusion                                                                                                  

The upcoming Windows Server AppFabric release evolves application hosting and administration tooling capabilities in Windows to support services written using WCF and WF programming models. The AppFabric release provides powerful distributed cache capabilities to .NET applications. In this blog post we discussed inner workings of the AppFabric system components and a typical scale-out deployment topology.

References:
http://techtitude.blogspot.com/2010/08/appfabric-caching-aka-velocity-caching.html



Happy Coding.........

Wednesday, March 9, 2011

Creating XML from scratch level on the fly for Adrotator

<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Xml" %>
<%@ Page Language="C#" Debug="true" %>

here open the script tag

void Page_Load(object sender, System.EventArgs e)
{
    if(!Page.IsPostBack)
{

        XmlDocument xmlDoc = new XmlDocument();


 // Write down the XML declaration
XmlDeclaration xmlDeclaration = xmlDoc.CreateXmlDeclaration("1.0", "utf-8", null);
// Create the root element
XmlElement rootNode = xmlDoc.CreateElement("Advertisements");
rootNode.SetAttribute("xmlns", "http://schemas.microsoft.com/AspNet/AdRotator-Schedule-File");
xmlDoc.InsertBefore(xmlDeclaration, xmlDoc.DocumentElement);  xmlDoc.AppendChild(rootNode);

 string[] FileNames = Directory.GetFiles(Server.MapPath("~/Files/"));
     foreach (string filesname in FileNames)
        {            
      FileInfo filesinfo = new FileInfo(filesname);
      String newFileName = "~/Files/" + filesinfo.Name;
           
      // Create a new element and add it to the root node
      XmlElement parentNode = xmlDoc.CreateElement("Ad");
      // Set attribute name and value!
      xmlDoc.DocumentElement.PrependChild(parentNode);

      // Create the required nodes      
      // retrieve the text
     // append the nodes to the parentNode without the value

      XmlElement ImageUrl = xmlDoc.CreateElement("ImageUrl");
      XmlText ImageUrlText = xmlDoc.CreateTextNode(pathof image);
   //path of image should be like this  below           //http://www.unl.edu/dpilson/flower1.jpg
      parentNode.AppendChild(ImageUrl);
      ImageUrl.AppendChild(ImageUrlText);

      XmlElement NavigateUrl = xmlDoc.CreateElement("NavigateUrl");
  XmlText NavigateUrlText =                     xmlDoc.CreateTextNode("www.ursrips.blogspot.com");
       parentNode.AppendChild(NavigateUrl);
       NavigateUrl.AppendChild(NavigateUrlText);

 XmlElement AlternateText = xmlDoc.CreateElement("AlternateText");
 XmlText AlternateTextT = xmlDoc.CreateTextNode("StaticGlobe");
 parentNode.AppendChild(AlternateText);
 AlternateText.AppendChild(AlternateTextT);

 XmlElement Impressions = xmlDoc.CreateElement("Impressions");
 XmlText ImpressionsText = xmlDoc.CreateTextNode("4");
 parentNode.AppendChild(Impressions);
 Impressions.AppendChild(ImpressionsText);


 // save the value of the fields into the nodes

 }        
       // you can make as many childs as you want
      // string filename = @"c:\" + DateTime.Now.Day + DateTime.Now.Month + DateTime.Now.Year + ".xml";
       //string filename = @"c:\NewXML" + ".xml" or @"c:\whatever" + ".xml"

  //xmlDoc.Save(filename);
 string path =@"~\Files\" + DateTime.Now.Day + DateTime.Now.Month +     DateTime.Now.Year + ".xml";
xmlDoc.Save(Server.MapPath(path));
 Response.Write("document saved successfully");
//now the compete xml file for adrotator is formed
    }
} here close the script tag     

Explanation

The first thing we do in our ASP.NET page is to declare, that we will use "C#" as the programming language and that, the content-type of this ASP.NET page will be "text/xml".
Note: The content-type of an XML document should be "text/xml" for it to be properly handled by the client browser.
<%@ Page Language="C#" AutoEventWireup="true" ContentType="text/xml" %>
Next, we import "System.Xml" namespace in our ASP.NET page. The XmlDocument class we will use later to generate an XML document dynamically, is present in this namespace.
<%@ Import Namespace="System.Xml" %>
A 'script' tag whose 'runat' attribute is set to "server" is required for ASP.NET to process this code on the server-side.

We are going to handle the Load event of the ASP.NET page and place the code to generate XML document dynamically, in the Page_Load() method.
protected void Page_Load(object source, EventArgs e)
{
 ...
}
First, we create a new instance of XmlDocument class.
XmlDocument doc = new XmlDocument();
Every XML document has a declaration statement as the first line of the document, enclosed in tags and having an attribute with the name of 'version', whose value it set to "1.0":

To create this declaration, we call the CreateNode() method of XmlDocument class. The first argument to this method is the type of node you want to create. We pass XmlNodeType.XmlDeclaration as the type because we want to create an XML declaration node. Once that node is created, we pass its reference to the AppendChild() method of XmlDocument instance we created earlier to append this node in the XML document we are generating.
Note: If you do not append the newly created declaration node in the XmlDocument instance, it will not appear in the XML document.
// XML declaration
XmlNode declaration = doc.CreateNode(XmlNodeType.XmlDeclaration, null, null);
doc.AppendChild(declaration);
Next, we create the root element of our XML document. A root element is the element in which all other elements are nested i.e., are sub-elements of the root element.
To create the root element, we call the CreateElement() method of XmlDocument class and as its argument, we pass the name of the root element, "article". And like before, we append this element to the XmlDocument instance.
Note: The name of the root element can be anything. For the purpose of this tutorial, we are naming it "article".
// Root element: Advertisemetns
XmlElement rootNode = xmlDoc.CreateElement("Advertisements");
rootNode.SetAttribute("xmlns", "http://schemas.microsoft.com/AspNet/AdRotator-Schedule-File");
//Set Attributes will xmlns tag
The XML document at this moment, if generated, will look like this:


Next, we create a sub-element and nest it in the root element. To do that, we call the CreateElement() method of XmlDocument instance, and as its argument, we pass the name of this element, "author". Then we set the inner text of that element by setting the InnerText property of newly created XmlElement object. Finally, as before to make this element appear in the XML document, we append this element to the root element.
// Sub-element: Ad
XmlElement parentNode = xmlDoc.CreateElement("Ad");
 // Set attribute name and value!
  xmlDoc.DocumentElement.PrependChild(parentNode);

Programmatically Created XML Document

Wednesday, March 2, 2011

Sound on mouse over the button, pop window on textbox


Sound on mouse over the button, pop window on textbox

                           Hi my dear techies, Might we have seen, when installing some softwares, when u mouse over the button the it will give u a sound indicates u have moved the mouse on the button. Here I have implemented that. (NOTE: if u wish to play music files use only .wav files.).Here the code snippet below in the coding. And one more interesting thing we have seen when u r using some sites (like for example way2sms), u might observed when u place the cursor in the textbox, a pop up advertisement will be displayed here the trick I have written in the code snippet below.
Take windows forms application
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Media;

//give referrence namespace as using System.Media;
//on form1 take two button and on e textbox

namespace form1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }      

  private void textBox1_MouseDown(object sender, MouseEventArgs e)
        {
//Here I have taken one more form to show that form on
//placing the cursor in the textbox
            Form2 obj = new Form2();
            obj.Show();
        }

  private void button1_MouseEnter(object sender, EventArgs e)
        {
       SoundPlayer objSound = new SoundPlayer();
objSound.SoundLocation = @"D(some drive):\foldername\XX.wav";
            objSound.Play();
        }

  private void button2_MouseEnter(object sender, EventArgs e)
        {
            SystemSounds.Beep.Play();
        }

    }
}