Sunday, February 22, 2009

Ajax Tab Control

ASP.NET AJAX Control which creates a set of Tabs that can be used to organize page content. A TabContainer is a host for a number of TabPanel controls.

Each TabPanel defines its HeaderText or HeaderTemplate as well as a ContentTemplate that defines its content. The most recent tab should remain selected after a postback, and the Enabled state of tabs should remain after a postback as well.

< ajax Toolkit:TabContainer runat="server"
OnClientActiveTabChanged="ClientFunction"
Height="150px">
< ajax Toolkit:TabPanel runat="server"
HeaderText="Signature and Bio"

...

/>

Friday, February 20, 2009

Test Driven Development (TDD)

Test Driven Development
Is an approach to design better software. Test Driven Development (TDD) starts the development cycle with gathering requirements, but then quickly moving to writing test cases that document the requirement and force the designer to think about exactly what the system is supposed to do. It takes automated unit testing and regression testing and makes them a basis for all development activities. This means that when adding new functionality a test is written first, it will fail this test at first, then as it is implemented it will eventually pass the test. The best part is now refactoring can take place because we have regression testing already in place to verify by refactoring that we did not break anything. This promotes clean, clear, modularized code because if you can test the code it is likely that it is modular and easier to maintain.

TDD Advantages Some TDD advantages are as following:
Safe Refactoring When you use TDD, because you have tests already written, you can easily refactor your existing code and you can still be sure that your code does what it needs to be doing, because you have tests.
More Testable Software Design As explained in the refactoring section, TDD helps you design your software for testability, so it will be loosely coupled and more maintainable.
You will have more modularized, flexible, and extensible code which guarantees the Code Quality.
Automated Testing After you created the tests, you can run all the tests at the same time, also you can use some tools like CruiseControl.Net to automate the tests.
Automated Testing significantly reduces the time taken to retest the existing functionality for each new build of the system.
Change Cost Reduced The reason is you have tests, so the change you make has very controllable effect on your system, though it depends on the type of change. In the other words, the Developer will have more confidence on making the decisions and applying the changes.
Greater Reliability & Reduced Debugging Time The reason is you have tests to cover all the production code, so the bugs are caught in the Testing Framework.
Test Cases as Documentation It is very important that the developer has a clear understanding of the specifications and requirements as TDD is applied and the fact is the test cases will be gradually a good source of documentation for your software functionalities.
Requirements Better Detailed TDD helps better understanding of the requirements, analysis and design because the developer cannot create the production code without truly understanding what the desired result should be and how to use it and this approach is done in an iterative manner.

TestFixture Attribute
The TestFixture attribute is used to indicate that a class contains test methods. When you attach this attribute to a class in your project, the Test Runner application will scan it for test methods. The following code illustrates the usage of this attribute. (All of the code in this article is in C#, but NUnit will work with any .NET language, including VB.NET. See the NUnit documentation for additional information.)

namespace UnitTestingExamples
{
using System;
using NUnit.Framework;
[TestFixture]
public class SomeTests
{
}
}

The only restrictions on classes that use the TestFixture attribute are that they must have a public default constructor (or no constructor which is the same thing).

Test AttributeThe Test attribute is used to indicate that a method within a test fixture should be run by the Test Runner application. The method must be public, return void, and take no parameters or it will not be shown in the Test Runner GUI and will not be run when the Test Fixture is run. The following code illustrates the use of this attribute:

namespace UnitTestingExamples
{
using System;
using NUnit.Framework;
[TestFixture]
public class SomeTests
{
[Test]
public void TestOne()
{
// Do something...
}
}
}

SetUp & Teardown Attributes

Sometimes when you are putting together Unit Tests, you have to do a number of things, before or after each test. You could create a private method and call it from each and every test method, or you could just use the Setup and Teardown attributes. These attributes indicate that a method should be executed before (SetUp) or after (Teardown) every test method in the Test Fixture. The most common use for these attributes is when you need to create dependent objects (e.g., database connections, etc.). This example shows the usage of these attributes:

Next version of .NET Framework

.NET Framework 4.0 will be the next version of .NET Framework and VSTS2010 (code-named “Rosario”) uses it.It continues to deliver on the core developer experience by speeding up the day-to-day process for development teams. ALM (Application Life Cycle Management) uses Visual Studio 2010 and the .NET Framework 4.0.

Microsoft is making a commitment to make parallel development accessible to a wide range of developers with Visual Studio 2010:

• Visual Studio IDE support for Parallel development
• Native C++ libraries and compiler support for Parallel applications
• .NET Framework 4.0 with P-LINQ and parallel language semantics and framework components

Visual Studio 2010 also includes a Parallel-capable performance analyzer that enables you to extensively instrument code to see the concurrency issues in applications.

VS2010 will offer features like multi-monitor support, richer code editing and richer code visualization.also Visual Studio 2010 and the .NET Framework 4.0 will include programming models for adding parallel programming for multi core processers.You can download VS 2010 and .NET 4.0 (CTP) from here

Sunday, February 15, 2009

What's New in the .NET Framework 4.0

· Next versions of Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) will provide better support for Web 2.0 technologies like REST, POX, ATOM.

· Performance and Scalability of WCF and WF are expected to increase by minimum 10X.

· New workflow models.

· Seamless integration between WCF and WF including a new Visual Designer.

· Parallel Programming framework using PLINQ, Task Parallel Library and Coordination Data Structures to better utilize power of multi-processor and multi-core machines.

· Build declarative applications with WF, WCF and WPF using XAML. So, XAML is no more only for WPF and WF.

1. WCF enhancements :

1.1 RESTful enhancements

1.1.1 Simplifying the building of REST Singleton & Collection Services, ATOM Feed and Publishing Protocol Services, and HTTP Plain XML Services using WCF

WCF REST Starter Kit to be released on Codeplex to get early feedback

o Messaging enhancements

Transports - UDP, MQ, Local in-process

Protocols - SOAP over UDP, WS-Discovery, WS-BusinessActivity, WS-I BP 1.2

Duplex durable messaging

o Correlation enhancements

Content and context driven, One-way support

o Declarative Workflow Services

Seamless integration between WF and WCF and unified XAML model

Build entire application in XAML, from presentation to data to services to workflow

· WF enhancements :

o Significant improvements in performance and scalability

Ten-fold improvement in performance

o New workflow flow-control models and pre-built activities

Flowcharts, rules

Expanded built-in activities – PowerShell, database, messaging, etc.

o Enhancements in workflow modeling

Persistence control, transaction flow, compensation support, data binding and scoping

Rules composable and seamlessly integrated with workflow engine

o Updated visual designer

Easier to use by end-users

Easier to rehost by ISVs

Ability to debug XAML


.

Thursday, February 12, 2009

Regex Regular Expressions in ASP.NET

Regular expressions are a good way to validate text fields such as names, addresses, phone numbers, and other user information. To validate input captured with server controls, you can use the RegularExpressionValidator control.
To validate other forms of input, such as query strings, cookies, and HTML control input, you can use the System.Text.RegularExpressions.Regex class.
Using the Regex Class

1)Add a using statement to reference the System.Text.RegularExpressions namespace.
2)Call the IsMatch method of the Regex class, as shown in the following example.
// Instance method:
Regex reg = new Regex(@"^[a-zA-Z'.]{1,40}$");
Response.Write(reg.IsMatch(txtName.Text));
// Static method:
if (!Regex.IsMatch(txtName.Text, @"^[a-zA-Z'.]{1,40}$"))
{
}

Regex regex = new Regex(@"
^ # anchor at the start
(?=.*\d) # must contain at least one numeric character
(?=.*[a-z]) # must contain one lowercase character
(?=.*[A-Z]) # must contain one uppercase character
.{8,10} # From 8 to 10 characters in length
\s # allows a space
$ # anchor at the end",
RegexOptions.IgnorePatternWhitespace);

Trimming a String
string initialText = “abc-12-xyz-786″;
System.Text.RegularExpressions.Regex noNumbers = new System.Text.RegularExpressions.Regex (@”\D”);
String numbersOnly = noNumbers.Replace (initialText, String.Empty);

Wednesday, February 11, 2009

ASP.Net 2010

Next generation of developer tool from Microsoft is available now (CTP version) Some Links for ASP.Net 2010(4.0) explaining about the features of .NET Framework 4.0
http://msdn.microsoft.com/en-us/vs2008/products/cc948977.aspxhttp://www.codeproject.com/KB/cs/concept_ide.aspxhttp://blogs.msdn.com/somasegar/archive/2008/09/29/what-s-next-for-visual-studio-and-net-fx.aspx
You can also download the Beta Version of ASP.Net 2010(v4.0).
https://connect.microsoft.com/VisualStudio/content/content.aspx?ContentID=9790

Tuesday, February 10, 2009

SQL Server 2008 New Features


Microsoft SQL Server 2008 is at the heart of a comprehensive data platform that enables you to access and manipulate business-critical data from a variety of diverse devices, platforms, and data services across the enterprise.

Top New Features

Map data structures to business entities by using the new ADO.NET Entity Framework

Use consistent syntax to query diverse data through .NET Language Integrated Query (LINQ) extensions to Microsoft Visual C# and Microsoft Visual Basic.NET

Create occasionally connected solutions using SQL Server 2008 Compact Edition and Microsoft Synchronization Services

Consolidate data storage through the SQL Server 2008 support for relational, XML, Filestream, and geo-location-based data

Get your hands on

http://www.microsoft.com/sqlserver/2008/en/us/app-dev.aspx

Sunday, February 8, 2009

.NET Framework 3.5 New Features

Microsoft Pre-release Software Visual Studio Code Name "Orcas" - March 2007 Community Technology Preview (CTP)

NET Framework 3.5 New Features

Faster .NET Framework execution

1. Faster garbage collection

2. Smarter, faster NGen requiring smaller working set RAM

3. 64 bit client improvements

4. ThreadPool performance improvements

5. Security check caching during NGen

Base Class Library – New Class Additions

6. BigInteger, HashSet and DateTime2 types

7. NSA Suite ”B” and FIPs compliant cryptography

8. Lightweight Reader/Writer Lock Classes

9. Anonymous and Named Pipes IO Classes

10. Integration with Event Tracing for Windows

11. New Addin hosting model for extensibility


Language Integrated Query (LINQ)

Deep integration of LINQ data-awareness into the programming languages and framework.


Workflow Enabled Services – Process and Messaging together

Using workflow to provide for durable and long-running services. New Tools, WF activities and new programming model classes have been added to simplify building workflow-enabled services using WF and WCF. This allows a .NET Framework developer to build business logic for a service using WF and expose messaging from that service using WCF. These improvements not only provide tools for this scenario but they reduce the amount of glue code that was previously required.



Web 2.0 Friendly and AJAX Enabled WCF Services

Ajax is a web development technique for making asynchronous exchanges of small amounts of data between browser and web service calls from the browser client script to the web server. A programming model is provided for building Ajax style web applications using WCF services. An HTTP programming model is also provided allowing for REST style web services.



Visual Studio Developer Tools for WF, WCF and in Visual Studio “Orcas”

Visual Studio”Orcas” has built in tools for web service authoring with WCF and for building workflow enabled software with WF. There are new project templates for WCF services, WF business logic, workflow enabled services, and AJAX services. The templates are conveniently set up to compile and run even before any custom code is added enabling .NET developers to get going quickly. There are also numerous other tools for developing with WF, WCF and WPF.


More WS-* Standards Support

Implementation in WCF of the latest OASIS specifications Web Services Atomic Transaction (WS-AtomicTransaction) 1.1, WS-ReliableMessaging 1.1, WS-SecureCOnversation and Web Services Coordination (WS-Coordination) 1.1.



RSS and ATOM Syndication API

Applications built using WCF will be able to easily expose syndicated data which can be consumed by an RSS or ATOM reader.


Partial Trust Support for WCF Hosting

Partial trust on the vlient is provided for ASMX parity focussing mainly on partially trusted WCF applications deployed through click-once. Support is provided for basic HTTP binding provided that the application runs in the Internet zone permissions and have granted the apropriate WebPermission. Secure communication is possible through transport security only. All other features are not available to partially trusted applications including hosting services, duplex communications, non-HTTP transports, WS-* protocols and any WF use.


Rules Data Improvements

The rules engine in WF is improved to add support for C# 3.0 extension metods, and for operator overloading . Also the ”new” operator is added to compete the base set of expression types.


Built-in WPF tools for Visual Studio “Orcas”

The Visual Studio designer for WPF was previously released as a CTP. It is not integrated into the development environment and is significantly improved.


Additional WPF Features and Improved Performance

WPF has smoother animations, faster startup and better overall performance. There are also new data types available for data binding with LINQ. Better integration support is now provided for with codename “WPF/E”.