Thursday, May 17, 2012

Cruise Control

What is Curise Control
  • Free and open source build scheduler
  • Consists of two components:
    • Build loop (runs as a service/daemon)
    • Status Dashboard (runs as web application)
  • Works with many version control systems (CVS, PVCS, Subversion, ClearCase, ...)
  • Works with any build tool that produces parseable output (Ant, Maven, ...)
  • Cross platform (written in Java)
  • Easily extensible:
    • Configuration easily extended by custom plugins
    • Well defined interfaces for version control systems, build tools and publishers
  • Well supported:
    • Complete reference documentation
    • Active users mailing list
    • Numerous tutorials
    • "Pragmatic Project Automation" book by Mike Clark

    How CC works:
    • Developer checks work into version control
    • CC polls version control
    • If CC detects any changes, it...
      • triggers a build
      • captures logs and build artifacts
        • Examples: jar, war, javadoc, unit test report, code coverage report, code quality metrics
      • publishes results
        • Examples: send email, send instant message, turn on lava lamp

        (Following is the image of build report by CC)

     Project Page

Install CruiseControl.NET :
Download the latest CruiseControl.NET release from: SourceForge or the latest build from CCNetLive.
You can find release notes here. For this article I used the installer for version 1.4 (CruiseControl.NET-1.4-Setup.exe), downloaded from the CCNetLive website.

Run the setup executable file and, when prompted, you must specify your choices for a couple of actions:
‘Install CC.Net server as windows service’ must be checked so that the setup will install CruiseControl as a Windows service.
In the Services management console the CruiseControl service will be displayed with the name: CruiseControl.NET.
‘Create virtual directory in IIS for Web dashboard’ will create a virtual directory named ccnet in the machine’s IIS web server. If you have an IIS server installation supporting multiple web sites (this is not the case for Windows XP Professional) and prefer to have a separate web site for the CCNet web dashboard you should uncheck this option. This is my choice. In the next paragraph I will show you how to create an IIS web site for the CruiseControl.NET web dashboard.

When the install process is finished all the content will be installed in the folder:
C:\%ProgramFiles%\CruiseControl.NET (e.g. C:\Program Files\CruiseControl.NET).
Under this path you will find a directory called server, containing all the CCNet binary files and executables, and a directory called webdashboard, containing the CruiseControl.NET web interface.


Create a CCNet Website in IIS
 Here I will add and configure a Website in IIS for the CruiseControl.NET Webdashboard: the administrative interface of CruiseControl.NET.
Open IIS Manager in Administrative Tools, right-click on the Web Sites node and select New Web Site.
The Web site creation wizard will start.
Click Next and you will be prompted for a Web Site Description.
Type CCNet and click Next, leave Unassigned the IPAddress, choose a port number (say: 222) and leave empty the ‘Host Header for this site’ field, then click Next.
Choose C:\%ProgramFiles%\CruiseControl.NET\webdashboard as the path for the Website and click Next.
Allow ‘Read’ and ‘Run scripts’, the default, and click Next. The wizard is finished and the new Website created.

Continous Integration

Continuous Integration is a software development practice where members of a team integrate their work frequently, usually each person integrates at least daily — leading to multiple integrations per day. Many teams find that this approach leads to significantly reduced integration problems and allows a team to develop cohesive software more rapidly.

Continuous Integration (CI) involves producing a clean build of the system several times per day, usually with a tool like CruiseControl, which uses Ant and various source-control systems. Agile teams typically configure CI to include automated compilation, unit test execution, and source control integration. Sometimes CI also includes automatically running automated acceptance tests such as those developed using FitNesse. In effect, CI means that the build is nearly always clean. 

Tools for automatic Build and Release Management:
1. Microsoft Visual Studio Team System
2. Cruise Control .NET
3. Team City
4. Hudson
5. Bamboo
6. Arbit
7. Go,
8. BuildForge,
9. TeamBuild,
10.FinalBuilder Pro
11.Automated Build Studio
12.LuntBuild
13. BuildMaster
14. BuildBot
15. Draco.NET



Continuous Integration Benefits

  • Instant build feedback
  • Increased code stability
  • Efficient and fast bug detection
  • Increased development speed 
Process
There are really two separate parts to gettings started with CI.
  1. Setting up the build server and
  2. Creating the build (e.g. Nant files)

Tuesday, January 17, 2012

RavenDB

http://www.codeproject.com/KB/cs/RavenDBIntro.aspx

What is Raven?

Raven is a .NET Linq enabled Document Database, focused on providing high performance, schema-less, flexible and scalable NoSQL data store for the .NET and Windows platforms.

What does this mean?

Unlike a traditional RDMBS, Raven doesn't store data in rows and columns, instead allowing you to store any JSON document inside the database. Raven is schema-less, which means that you don't have to pre-define how the documents that are stored in the database will be formed. Because the data is not limited to simply columns and rows, you can store arbitrarily complex data such as arrays, dictionaries and trees with ease.
On top of the documents, you can define indexes (using C#'s Linq syntax) that the database will maintain for you. This gives you the best of both worlds, you get a schema free nature (no upfront agonizing about the database schema or trying to shoehorn data into a relational model) but you are still able to perform efficient queries.

Sunday, November 29, 2009

Impersonation

Layers of an application may be deployed across multiple physical tiers. Due
to this fact, there must be a way of transferring the user’s identity information across tier boundaries.
This is often called impersonation.

Sunday, August 23, 2009

Windows Communication Foundation (WCF)

What is service:
A service is some functionality that is exposed via a structured messaging scheme. This functionality could be shared on any transport protocol like HTTP, TCP, MSMQ. The structure messaging scheme could be somthing like what is defined in HTTP requests/responses.

image

Originally code named "Indigo", WCF is one of four APIs introduced with the .NET Framework 3.0, in December 2006. WCF unifies several other existing distributed communication APIs supported by the .NET Framework 2.0. Previously, separate APIs for SOAP-based communications for maximum interoperability (Web Services), binary-optimized communications between applications running on Windows machines (.NET Remoting), transactional communications (Distributed Transactions), and asynchronous communications (Message Queues) existed. WCF unified all these mechanisms into a single, common, general service-oriented programming model for communications.

image

The principles of Service orientation says “we don’t think in terms of objects (Object Oriented) or components (Component oriented) because these two have problems when they come in distrubuted environments. There are differences whether you talk locally (in case of objects or components developed locally) and when you are talking in a distributed environment. So we are thinking in terms of messages. We accept messages and send messages”

Four tenets of SOA and how is it implemented in WCF Technology in a way,how can WCF to avoid the well-known pitfalls of using current technologies such as (WSE):
1) Boundaries are explicit :
Applications is communicating to each other by sending and receiving messages to each other.
2) Services are autonomous: you can't control any service out of your organization boundaries.
Your solution should be loosely coupled ,so it can tolerate these changes and continue running if one or more services are un available.
3) Services share schema,contracts not classes or types: simply each service publish the schema of the data which will be exchanged between the service and clients and how can be binded to the clients,these information is used by clients to consume the published services.
4)Compatibility is based on policy:Schemas and contracts exposed by the service is define the "Shape" of the service.if you familiar with WS Enhancements,it has its specification on WS-Security,WS-Interoperability....etc which has been encapsulated into the WCF unified platform.

Additional Service Oriented principles (you should adhere to simply because it is the right thing to do) :
1.  Services are secure.
2.Services leave the system in a consistent state.
3.Services are thread-safe.
4.  Services are reliable & robust.
        Interoperable
        Scaleable
        Available
     Responsive
     Disciplined

 

image

WCF a part of the .NET Framework that provides a unified programming model for rapidly building service-oriented applications that communicate across the web and the enterprise. It is a microsoft platform for SOA (service oriented architecture). So service oriented is a key feature of WCF. It is an attempt to do interoperability with other platforms.

It is a single extendable object model.

WCF is a core component of the .NET Framework 3.0 (formerly WinFX) which is included with Windows Vista and will support Windows 2003 and Windows XP platforms as well as the future version of Windows Server.

As its name suggests, WCF provides the .NET Framework with a basis for writing code to communicate across components, applications, and systems.
services and endpoints
Services expose one or more endpoints where messages can be sent by the clients in order to get some information from the service or submit some data to the service.

Each endpoint consists of 3 properties (ABC)

Address (Where) :  URI indicates where the service is located.

Binding (How) : Technical implementation of the communication. It defines how i

Contract (What) : It is a technical description or interface.


Services expose one or more endpoints where messages can be sent. Each endpoint consists of an address, a binding, and a contract. The address specifies where to send messages. The binding describes how to send messages. And the contract describes what the messages contain. Clients need to know this information before they can access a service.

 

image

Services can package up endpoint descriptions to share with clients, typically by using Web Services Description Language (WSDL). Then clients can use the provided service description to generate code within their environment capable of sending and receiving the proper messages.

WCF Architecture

The WCF Architecture

 

ABCs of WCF : Address, Binding and Contact.

When we are creating a service library, we will be applying attributes on our interfaces and classes to build something called Data Contracts and Service Contracts.

Contracts

Contracts define various aspects of the message system. It is a platform-neutral and standard way of describing what the service does.

In WCF we have 4 types of contract:
· Service Contract: Service contracts define the operations that a service will perform when executed. They tell the outside world a lot about the service such as message data types, operation locations, the protocols the client will need in order to communicate with the service, and the operations the service provides. It maps CLR types to WSDL.

Service contracts uses two types of attributes:

ServiceContract - This attribute is used to define the Interface.
OperationContract - This attribute is used to define the method inside Interface.

· Data Contract: It describes a data structure. It defines which data types can be transferred in the service. A Data Contract marks a business entity (class) as a participant in a Service Contract and Service Operation. It maps CLR types to XSD.

Data contracts uses two types of attributes:
DataContract : is used to define the class.
DataMember : is used to define the  properties.

· Fault Contract: A Fault Contract is the definition of how errors are raised and handled by WCF clients. There is no concept of an exception in WCF (this is a .NET only idea). Fault Contracts describe error conditions and behavior for managing these conditions.


· Message Contract: It is an extra functionality allows you to send message in a customized way.It defines the structure of the message over the wire. It can be typed or untyped and useful when there is an existing message format to comply with. It maps CLR types to SOAP messages.

Steps to create and use a WCF service:

image

WCF Message Exchange Patterns
WCF service contracts can express three message exchange patterns that can be used in your
services:

1. Simplex (One way)
One-way is a “fire-and-forget” style of messaging as in this scenario, the client initiates communication and sends a message to the service without for a reply from the service. The service consumes the message and performs some action but does not communicate back to the client. The client in the Simplex message pattern suffers from short-term memory loss. When the client sends the message, it has no idea it sent a message because it is not expecting a response.

image

2. Duplex : It allows client and service to communicate openly by exchanging messages at both ends. It is a peer-to-peer connection.

image

3. Request-Reply: This is the default pattern of exchanging messages in WCF. This is the most common pattern in today’s web services (ASMX) world. In this the client sends a message(Request) and waits until a reply is sent back(Reply).

image