PROGRAMMER DESK

April 17, 2009

New Features in Microsoft VS 2010

Filed under: VS-2010 — vinayhatwal @ 8:31 am
Tags: , ,

New Features in Microsoft VS 2010

 

 

Cloud Development

With Windows Azure Tools for Microsoft Visual Studio, developers can build, debug and deploy services and applications for Azure, the new cloud environment Microsoft announced in October 2008.

 

 

Web Development

In Visual Studio 2010, Microsoft is continuing their investment in great web development tools. Visual Studio 2010 enhancements for web developers include:

·         A high-performance and standards-compliant JavaScript, IntelliSense® engine

·         ‘One Click Deployment’ for quickly and easily publishing a website’s files and configuration settings from the development machines to the final deployed site

·         Full support for Silverlight for developers wishing to build cutting-edge, rich internet applications.

 

 

 

 

Democratising Application Lifecycle Management

Microsoft Visual Studio Team System 2010 will deliver new capabilities that embrace the needs of the users in the lifecycle – from architects to developers, from project managers to testers. Among the great new functionality in Visual Studio Team System 2010:

·         Discover and identify existing code assets and architecture with the new Architecture Explorer

·         Design and share multiple diagram types, including use case, activity and sequence diagrams

·         Improve testing efforts with tooling for better documentation of test scenarios and more thorough collection of test data

·         Easily identify and run only the tests affected by a code change with the new Test Impact View

·         Enhanced version control capabilities including gated check-in, branch visualisation and build workflow.

 

 

 

 

Inspiring Developer Delight

Since the first release of Visual Studio, Microsoft has made application development more productive, efficient, flexible and profitable to the developers and companies that use it. Visual Studio 2010 continues to deliver on the core developer experience by significantly improving the day-to-day process for development teams:

·         Understand existing (and write new) code

·         Intuitive web development from the back-end to the end result

·         Wrangle disparate C++ code into one arena

·         Build new Windows 7 applications or upgrade existing applications

·         Enable Office tools to make your solutions more flexible and productive for specific needs.

 

 

Resource –

 

http://download.microsoft.com/download/C/0/9/C0965791-049B-4200-9008-F07A783026F6/VisualStudio2010_ProductOverview.pdf

.Net Framework 4.0

Filed under: .Net Framework 4.0 — vinayhatwal @ 7:51 am
Tags: , , , ,

.Net Framework 4.0

 Every year the industry develops new technology and new trends. Now Microsoft is again come to provide next version of .net framework i.e. .Net Framework 4.0. As a result MS Visual Studio 2010 is just around the corner with the new innovation in application architecture, development, and deployment. So in this article I am describing some new features coming in the .Net Framework 4.0. Before describing new features of .Net Framework 4.0, I am giving a summary of some of the main functionality in each .net version. 

 

 

.NET Framework 4.0

(The Future Release)

PLINQ

TPL

.NET Framework 3.5

LINQ

ADO.NET Entity Framework

.NET Framework 3.0

WPF

WCF

WF

Card Space

.NET Framework 2.0

WinForms

ASP.NET

ADO.NET

Base Class Library

CLR

 

So you have just seen the major change in each version on .Net Framework. Above figure defines the feature stack of the .Net Framework.  

Following are new features provided by .NET Framework 4.0 – 

  • New Languages 

.NET 4.0 will include IronPython, IronRuby, and F#, among others. The three named languages have been available in some form for a few years now, but it appears that with .NET 4.0 they become “official” in the same way as C#, Visual Basic .NET. Both IronPython and IronRuby leverage the Dynamic Language Runtime (DLR), a subsystem that supports dynamic languages on .NET. The DLR has been around for a couple of years now, but with .NET 4.0 becomes an integral part of the .NET runtime. 

In order to support the new languages, and to ensure language interoperability, the CLR team did make some changes. Two additions are particularly interesting to me: BigInteger and Tuple. Because these features are in the base class libraries, all .NET languages can use them 

  • Threading improvements 

Framework 4.0 includes the Task Parallel Library (TPL), a library of objects that make it easier to write code that takes advantage of multiple cores. Not only do TPL functions relieve you of the tedium involved with starting and managing threads, they also help you to structure your code to make the most of the computing resources available. 

During development and use of the TPL, the CLR team found a number of areas in which the .NET thread pool (the subsystem that the TPL depends on) was less than optimum. They have since improved the thread pool, giving a performance boost not only TPL programs, but to all programs that make use of .NET threading services.  

  • Garbage Collector Improvements 

All in all, the .NET garbage collector is considered a good thing. However, it does have some drawbacks. In particular, it can severely impact performance in some cases.

The server garbage collector in .NET 3.51 and earlier versions is optimized for higher throughput, but has to pause all threads when it does a full collection. The result is that processing comes to a halt whenever a full collection occurs. This can be very annoying. 

The pauses still occur in .NET 4.0, but the system will notify your program before a full collection starts, and notify it again when the garbage collector has finished with collection. In a multi-server environment, you can use this feature to direct traffic away from your server while it’s in the middle of a full collection. That helps with server farms, but doesn’t help with memory-intensive applications that are running on a single machine. 

The workstation garbage collector in 4.0 gets a new background collection feature, which results in fewer pauses and doesn’t require any changes to your code. Only very unusual circumstances will result in the long latency that you might have seen in versions 3.51 or earlier 

  • PLINQ 

.Net Framework 3.5 introduced new concept i.e. LINQ(Language Integrated Queries). Microsoft original motivation behind LINQ was to address the impedance mismatch between programming languages and database 

Microsoft LINQ defines a set of proprietary query operators that can be used to query, project and filter data in arrays, enumerable classes, XML (XLINQ), relational database, and third party data sources. While it allows any data source to be queried, it requires that the data be encapsulated as objects. So, if the data source does not natively store data as objects, the data must be mapped to the object domain. Queries written using the query operators are executed either by the LINQ query processing engine or, via an extension mechanism, handed over to LINQ providers which either implement a separate query processing engine or translate to a different format to be executed on a separate data store (such as on a database server as SQL queries (DLINQ)). The results of a query are returned as a collection of in-memory objects that can be enumerated using a standard iterator function such as C#’s foreach. 

Like all constructs in LINQ, PLINQ is based on extension methods, in this case the AsParallel method. Once you’ve built the expression tree representing the query, the AsParallel operation is added at the very end, which tells the “LINQ engine” to figure out parallel jobs and do all of the magic required to make the app benefit from multi-threaded execution. A conceptual example is shown below: 

var result = (from p in db.Products join pd in xml.ProductDescriptions on p.ID equals pd.ID where p.Price > 100 select new { p.Name, p.Price, pd.Description }).AsParallel(); 

April 10, 2009

Windows Services

Filed under: Windows Services — vinayhatwal @ 7:58 am
Tags: , , ,

Windows Services

By: Vinay Hatwal

Dated: Apr 10, 2009

Level: Beginner

 

The idea of using Windows services came into my mind when I was working on Finger Print Attendance System for Bajaj Capital Ltd. This system was going to be used by all the branches of the company. So I wanted to synchronize the attendance of the employees of each branch with our company’s ERP system. So that, I decided to develop windows services for the same purpose. There was one issue in real time synchronization of attendance with the Head Office. The issue was slow internet connection and no internet connectivity available all the time. So the solution was to send the attendance when internet is connected not on the time of attendance punching. So the solution was WINDOWS SERVICES.

In this article I will explain how to make Windows Services by using c#.net.

Windows services are long running executable file developed for running in background as long a windows is running. These executables run in the background and there is no any requirement for the user interaction. They run in the background so that there is no need to take graphical interface in the Windows Services. You can think about UNIX Daemon if u r familiar with the UNIX environment. On the Windows the same concept is Windows Services. Windows Services can be configured to run automatically when Windows is booted. They can also be configured to run on Local machine, single user account, and also on Network.

You can find windows services in your local machine on

Start-> Control Panel -> Administrative Tools -> Services

These services looks like this—

Windows Service Browser

Windows Service Browser

 

By using windows service you can use databases, text files, and all shareable resources with it etc.

To create Windows Services in .net (I am creating in .net 2.0)

Creating Windows Services

<!–[if !supportLists]–>1) <!–[endif]–>To create windows services, go to File menu and then select New Project, then select Windows Service. You will see the dialog box shown below. Name the project – MyWindowService.

12

2) After clicking on OK you will see the following. Change the name of the service from Service1.cs to MyService.cs.

2

3) Now go to in on the properties on the MyService and change the property Service Name to MyService.

 

 

4) Do right click on the MyService design view and select View Code option from the context menu. You can see two overrided methods in the window OnStart() and OnStop().

 

 

These are the members of the ServiceBase class and inheritted by the MyService Class. There are some more members also present in the ServiceBase class like OnContinue(), OnPause() etc. but I am just describing about these two only.

 

The idea of using windows service is only behind these to methods. Any work u want to perform on the sharable resources, you can write code for that in the OnStart() method. I have just put Beep () here. It will give the beep sound on starting the Window Service. And just 2 beep on Stoping it. You can see in the coding below.

3

<!–[if !supportLists]–>5) <!–[endif]–>to install this Windows Service on the local system you need to add installers in your Service. Just right click on the Service Design window and then select Add Installer.

<!–[if !supportLists]–>6) <!–[endif]–>Project Installer will automatically be added in your solution, name ProjectInstaller.sc. and you can also find two component in it

<!–[if !supportLists]–>a. <!–[endif]–>serviceProcessInstaller1

<!–[if !supportLists]–>b. <!–[endif]–>serviceInstaller1

 

 

<!–[if !supportLists]–>7) <!–[endif]–>You can now decide how your Windows Process will be display, you can set the account for your service on which it will be running, and you can give the Display Service Name, Description and the start type of the service like Automat, Manual, or Disabled. For doing all these you can follow these steps

<!–[if !supportLists]–>a. <!–[endif]–>Go to on the properties of serviceProcessInstaller1, and set Account property to Local System, so that it would be sharable to all users.

<!–[if !supportLists]–>b. <!–[endif]–>Now go to on the properties of serviceInstaller1, and ser Description as u like and set Display Name as u want to display in the Services Console, and now set StartType to Automatic so that the service can be run on the starting of the Windows operation system.

 

<!–[if !supportLists]–> 8) <!–[endif]–>After doing all the configuration just press F6 for building the solution. Now Your Window Service is ready to use.

 

<!–[if !supportLists]–>9) <!–[endif]–>Now for using it u have to install this service on your local machine. You can do this by using the instalUtill.exe utility provided by .net framework to install this service on your machine.

 

Now take the executable of this service and jus copy it into your system32 directory.

 

Go to your application path where your project is running, and go to the bin\debug directory then copy MyWindowServices.exe and paste it into syetem32.

 

 

Now go to on the Visual Studio 2005 Command Prompt and type the following for installing the newly developed Window Service–

 

C:\> installutil c:\windows\system32\ MyWindowServices.exe

4

To uninstall use –

 

C:\> installutil /u c:\windows\system32\ MyWindowServices.exe

 

 

You can see your service in the service console like

5

Now just do right click on it and the start. You will listen one beep on starting and two beep on stopping the Windows Service.

 

So friends. Enjoy the Window Services, hope your will learn by this article. Hope you will be enjoying after creation the windows service.

 

I am always waiting for your comments and suggestion so that I can improve my articles.

 

Again Coming Soon…………………….

 

 

 

Vinay Hatwal

Blog at WordPress.com.