Showing posts with label .NET Framework. Show all posts
Showing posts with label .NET Framework. Show all posts

Monday, August 27, 2007

. NET Type Safety

Type safe means preventing programs from accessing memory outside the bounds of an object's public properties A programming language is type safe when the language defines the behavior for when the programmer treats a value as a type to which it does not belong. Type safety requires that well-typed programs have no unspecified behavior (i.e., their semantics are complete). Languages such as C and C++, which allow programmers to access arbitrary memory locations, are not type safe. An unsafe programming language supports operations (such as accessing arbitrary memory locations), which are not defined in terms of the language semantics. Type safety is a property of the programming language, and not of the programs themselves.

. NET Type Safety

Sunday, August 26, 2007

Microsoft .NET Remoting - Complete Walkthrough

 

Remoting enables you to write applications that allow objects in different .NET application domains to communicate with each other. In general, objects living in different application domains cannot access each other directly. They need an infrastructure that makes communication possible. That's what .NET Remoting is for. It's the .NET analogy to DCOM, for those of you who are familiar with DCOM. It allows interprocess and intermachine communication between objects.

Look here for a great power-point presentation and also attached interview transcript of the author about Microsoft .NET Remoting - Complete Walkthrough...Just follow him!!! !!!

Microsoft .NET Remoting WebCast

Great articles on Data Structures and Collections in .NET

Hi,

I would recommend reading these below mentioned articles from MSDN for any programmer who wants to develop or is developing using Microsoft .NET Framework technologies.

Part 1: An Introduction to Data Structures
Part 2: The Queue, Stack, and Hashtable
Part 3: Binary Trees and BSTs
Part 4: Building a Better Binary Search Tree
Part 5: From Trees to Graphs
Part 6: Efficiently Representing Sets

Data Structures in .NET

 

Why data structures are important, and their effect on the performance of an algorithm. To determine a data structure's effect on performance, we'll need to examine how the various operations performed by a data structure can be rigorously analyzed. Finally, we'll turn our attention to two similar data structures present in the .NET Framework: the Array and the List. Chances are you've used these data structures in past projects. In this article, we'll examine what operations they provide and the efficiency of these operations.

The Queue and Stack. Like the List, both the Queue and Stack store a collection of data and are data structures available in the .NET Framework Base Class Library. Unlike a List, from which you can retrieve its elements in any order, Queues and Stacks only allow data to be accessed in a predetermined order. We'll examine some applications of Queues and Stacks, and see how these classes are implemented in the .NET Framework. After examining Queues and Stacks, we'll look at hashtables, which allow for direct access like an ArrayList, but store data indexed by a string key.

While arrays and Lists are ideal for directly accessing and storing contents, when working with large amounts of data, these data structures are often sub-optimal candidates when the data needs to be searched. The binary search tree data structure, which is designed to improve the time needed to search a collection of items. Despite the improvement in search time with the binary tree, there are some shortcomings. SkipLists, which are a mix between binary trees and linked lists, and address some of the issues inherent in binary trees.

A graph is a collection of nodes, with a set of edges connecting the various nodes. For example, a map can be visualized as a graph, with cities as nodes and the highways between them as edged between the nodes. Many real-world problems can be abstractly defined in terms of graphs, thereby making graphs an often-used data structure.

Finally, in Part 6 we'll look at data structures to represent sets and disjoint sets. A set is an unordered collection of items. Disjoint sets are a collection of sets that have no elements in common with one another. Both sets and disjoint sets have many uses in everyday programs, which we'll examine in detail in this final part.

Part 1: An Introduction to Data Structures

Tuesday, August 21, 2007

Delegates in C# .NET


Delegates in C#
are objects which points towards a function which matches its signature. Delegates are reference type used to encapsulate a method with a specific signature. Delegates are similar to function pointers in C++; however, delegates are type-safe and secure.
Here are some features of delegates:

  • A delegate represents a class.
  • A delegate is type-safe.
  • We can use delegates both for static and instance methods
  • We can combine multiple delegates into a single delegate.
  • Delegates are often used in event-based programming, such as publish/subscribe.
  • We can use delegates in asynchronous-style programming.
  • We can define delegates inside or outside of classes.
Syntax of using delegates
//Declaring delegate
delegate void SampleDelegate(string message);
// declare method with same signature:
static void SampleDelegateMethod(string message) { Console.WriteLine(message); }
// create delegate object
SampleDelegate d1 = SampleDelegateMethod;
// Invoke method with delegate
d1("my program");
Technorati Tags: ,

Web Services in ASP .NET


Introduction to web service especially in asp .net

A Web service is a class that allows its methods to be called by methods on other machines via common data formats and protocols, such as XML and HTTP. In .NET, the over-the-network method calls are commonly implemented through the Simple Object Access Protocol (SOAP), an XML-based protocol describing how to mark up requests and responses so that they can be transferred via protocols such as HTTP. Using SOAP, applications represent and transmit data in a standardized XML-based format.
A Web service is a software component stored on one machine that can be accessed by an application (or other software component) on another machine over a network. The machine on which the Web service resides is referred to as a remote machine. The application (i.e., the client) that accesses the Web service sends a method call over a network to the remote machine, which processes the call and returns a response over the network to the application.

Methods in a Web service are invoked through a Remote Procedure Call (RPC). These methods, which are marked with the WebMethod attribute, are often referred to as Web service methods or simply Web methods. Declaring a method with attribute WebMethod makes the method accessible to other classes through RPCs and is known as exposing a Web method.
Web services have important implications for business-to-business (B2B) transactions. They enable businesses to conduct transactions via standardized, widely available Web services rather than relying on proprietary applications. Web services and SOAP are platform and language independent, so companies can collaborate via Web services without worrying about the compatibility of their hardware, software and communications technologies.
Web services are not the best solution for certain performance-intensive applications, because applications that invoke Web services experience network delays. Also, data transfers are typically larger because data is transmitted in text-based XML formats.

Introduction to WebMethods in ASP .NET

Methods of a class that implement a Web service do not automatically have the ability to receive Web service requests and send back responses, but with Web services created using ASP.NET, it is very simple to add that capability. Apply a WebMethod attribute to public methods. Methods of a Web service class that can be communicated with over the Web are called Web service methods.

Web service methods are a key part of the messaging infrastructure employed by Web services. That is, a client and a Web service communicate using messages, specifically SOAP messages, by default. Clients send a SOAP request to a Web service and a Web service method typically returns a SOAP response. Web services define the type of messages they accept using operations, as defined by Web Services Description Language (WSDL). These operations correlate to each of the Web service methods within a Web service.

Even though each of these Web service methods are defined in ASP.NET using a method of a class, it is important to realize that the data that is eventually communicated over the network must be serialized into XML. As such, it is important to remember that Web services are not a replacement for DCOM, but rather a messaging infrastructure for communicating across platforms using industry standards.

Attaching the WebMethod attribute to a Public method indicates that you want the method exposed as part of the XML Web service. The WebMethod attribute tells .NET that a particular public method should be exposed as a web-callable method. The WebMethod attribute has six associated properties to document and change the behavior of your web method. They are:
Description
MessageName
EnableSession
CacheDuration
TransactionOption
BufferResponse
The first two properties are used to document a web method, while the others affect its behavior.

SOAP in .NET Web Services

The Simple Object Access Protocol (SOAP) is a platform-independent protocol that uses XML to make remote procedure calls.
Each request and response is packaged in a SOAP message containing the information that a Web service requires to process the message.

SOAP supports an extensive set of types like the primitive types, DataSet, DateTime, XmlNode and others. SOAP can also transmit arrays of these types and objects of user-defined types.
When a program invokes a Web method, the request and all relevant information are packaged in a SOAP message and sent to the server on which the Web service resides.
A Web service receives a SOAP message and parses its contents (contained in a SOAP envelope) to determine the method that the client wishes to execute and the method's arguments.
After a Web service parses a SOAP message, the proper method is called and the response is sent back to the client in another SOAP message. The client parses the response to retrieve the result.

User Defined Types in Web Services

It is possible to process user-defined types (also known as custom types) in a Web service. These types can be passed to or returned from Web methods. Web service clients also can use these user-defined types, because the proxy class created for the client contains these type definitions

Custom types that are sent to or from a Web service are serialized, enabling them to be passed in XML format. This process is referred to as XML serialization.
Classes that are used to specify Web method return types and parameter types must provide a public default or parameterless constructor. Properties and instance variables that should be serialized in XML format must be declared public. Properties that should be serialized must provide both get and set accessors. Read-only properties are not serialized. Data that is not serialized simply receives its default value when an object of the class is deserialized.

Technorati Tags: ,

Tuesday, July 17, 2007

Windows PowerShell

I'm trying to provide a very quick reference to windows powershell that could help the beginners and these are the same things that helped me.

Windows PowerShell is very different.

  • Windows PowerShell does not process text. Instead, it processes objects based on the .NET platform.

  • Windows PowerShell comes with a large set of built-in commands with a consistent interface.

  • All shell commands use the same command parser, instead of different parsers for each tool. This makes it much easier to learn how to use each command.

You can download and install it for free from this Microsoft web site. Make sure to check sys. requirements.

http://www.microsoft.com/technet/scriptcenter/topics/msh/download.mspx

Windows PowerShell Cmdlets

A cmdlet (pronounced "command-let") is a single-feature command that manipulates objects in Windows PowerShell. You can recognize Cmdlets by their name format -- a verb and noun separated by a dash (-), such as Get-Help, Get-Process, and Start-Service.

Ok, so here goes the question. How do you get to know which are the possible verbs and what are the possible nouns that you can use to constitute valid powershell commands or for that matter cmdlets.

The "get" cmdlets only retrieve data, the "set" cmdlets only establish or change data, the "format" cmdlets only format data, and the "out" cmdlets only direct the output to a specified destination.

Each cmdlet has a help file that you can access by typing:

get-help <cmdlet-name> -detailed

You can download the Graphical help file at this Microsoft site.
http://www.microsoft.com/downloads/details.aspx?familyid=3B3F7CE4-43EA-4A21-90CC-966A7FC6C6E8&displaylang=en

You can run Windows command-line programs in Windows PowerShell

All in PowerShell is your .NET Framework and .NET Objects world.

For example, when you get a process in Windows PowerShell, you are really getting an object that represents the process. When you view information about a process, you are viewing the properties of its process object. And, when you start a process, that is, when you change the Status property of the process to "started," you are using a method of the process object.

You can easily do string manipulation also to leverage the returned data.

Try this command in PS...

get-process findstr "iexplore"

and it will automatically filter the rows that had "iexplore" string...It gives you all the instances of Internet Explorer process... amazingly easy and handy...isn't it?

 
Dotster Domain Registration Special Offer