GIDS.Net kicks off today
Tuesday, April 20, 2010The fresh morning, we headed towards beautiful place amidst city traffic. IISc, a dreamland for all GATE aspirants has been a perfect place to have such a summit that provides all the means to organize evnt and at the same time surrounded by in campus greenry. We entered the reception area, got our id, meal coupon and other goodies.
The entire day was heavily loaded with sessions from different technologies. I could see some microsoft techology evangelist, key note speakers walking around. some of the faces from speakers and developers I could easily recollect from last year conference at same place. Personally, I liked Stephen Forte's presentation last year and was looking forward to attend at least one of his sessions. Finally Idecided to attend his session on SQL 2008 R2 just after the lunch and it was very interesting. Another session that I liked most was "Hands on MVVM for WPF and silverlight
What I learnt Today
Monday, November 30, 2009
I thought of creating a series of what I learnt today. I feel almost everyday I learn something new and it gets slipped somewhere at the back of mind if I don't recall it. So its better to post it so that it will be a sort of revision for me and would be helpful to others. So I'll post my day to day learning under this post.
Today when I was working on Merging 2 databases and making them one, we had to define new constraints and keys . While defining new keys we found the following type of error coming.
The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK__Grid__Page_ID__523BA32C". The conflict occurred in database "STATSONLINE", table "dbo.Page", column 'Page_ID'.
This error was caused when I ran the following query to give foreign key constraint.
ALTER TABLE Grid ADD FOREIGN KEY (Page_id ) REFERENCES Page(Page_Id)
After looking at the error one would guess that query is trying to define some foriegn key on the table 'Grid' which is already there and hence not allowing to overwrite that. At least I did think that way and started serching for all the Keys defined on the table. To my surprise there wasn't any such constraint define. Finally I concluded that It happens when this constraint can not be defined on the table because of inconsistent data. I had many grid records defined with the pages that are not there in page table. So it violates the basic requirement of foreign key.
About FK__Grid__Page_ID__523BA32C I feel it is the in memory name that server has given temporarily and then it checks all the records against this constraint and if it doesn't meet the criteria it throws aforesaid exception.
Microsoft .Net 2010
Sunday, November 29, 2009It’s always been fun watching how Microsoft has eased the whole SDLC to promote RAD, with the release of their programming framework and tool. Same had happened with .Net 4.0 video series, spanning over a week, one hour every day ahs finished last Thursday under the guidance of Naresh Sharma. His inputs were definitely helping to understand the concept.
Our strategy to learn new technology is to learn elements of .Net 4.0 first and then divide the team into groups to dig into more specialized features. So far the exercise of watching videos has prepared a ground for the developer to know the basics. I’ll just brief the things we have learnt. And then more detailed about the topics will be covered in upcoming posts.
I’ll begin with the feature that I liked most ‘Managed Extensibility Framework’. I liked the ability to reuse the components already built. Using MEF .net applications are composed dynamically instead of compiling statically. It tackles the problem of software maintenance in a much better way by providing built in extensibility points that can easily be discovered, and which supports discovery of extension.
Another feature is Type Equivalence which fixes the pain re distributing Primary Inter-Op Assemblies. Version independence can be achieved using “Embed Interop Types” compilation option. Entity Framework 2.0 allows you to Model your application first before you design your database. MEF 2.0 actually designs the database for you based on your entities in the model. It makes fairly smart choices in defining Data Types and relationships. So developer always focuses on entities alone not on the mechanism of data persistence. C# 4.0 comes with the feature of named parameters. This features prevent you from the headache of writing multiple overload of same method. Parallel Extension in
Visual Studio 2010 supports Test Driven Development (TDD) by enabling you to write your tests first and then it generates the template for classes, functions and properties. Also debugging has been made deeper to look into calls within .net classes. One simple but exciting feature “Camel Case Search” is also very helpful, if your solution is having a large number of classes spanning across multiple projects. VS2010’s editor is also customized to have your own extension. Deploying an application in different environment has been made easier than ever by maintaining different configuration settings for different environment. UI functional testing is capable of automating Web and Windows application. It records all state of application automatically and run.
While talking about .Net 4.0, I can’t miss ASP.NET to talk about. 4.0 version allows you to control the client side id of controls. So instead of programming against some complex ids that are generated by .net 3.5 or earlier version (something like _dlGenControls__ctl0_CtrlPrintPageInstructions1_lblSubSection ) , Control ids can be defined. Javascript intellisense is more intelligent to list functions available. Mark up editing in ASPX page is also quicker with the features like easy tabbing, auto populating of controls with their short name etc.
Other than C#, ASP.Net and VS 2010; we also covered elements of F#. All in all, it was a good exercise to watch in a group and discuss than distributing videos to individuals and ask them to watch. So by the time you read this posting we would have divide the team for specialization and get them ready for post on the specialized topics.
First Program with WorkFlow (Part II)
Thursday, July 24, 2008You need to see the previous post to begin with. Now we will add the code.
To do so, click on Solution Explorer’s View Code toolbar button to open the Workflow1.cs C# file for editing. In the constructor InitializeComponent is called. InitializeComponent is there in WorkFlow1.designer.cs where it initializes the events we inserted using designer. We will locate EvaluatePostalCode method in Workflow1.cs and insert the following code.
string USCode = @"^(\d{5}$)|(\d{5}$\-\d{4}$)";
string CanadianCode =@"[ABCEGHJKLMNPRSTVXY]\d[A-Z]\d";
e.Result = (Regex.IsMatch(_code, USCode) || Regex.IsMatch(_code, CanadianCode));
here e is an instance of ConditionalEventArgs, used to tell the IfElse activity which branch to take.
e.Result = true, means left branch is executed
To accept the incoming string, we add public property.
private string _code = String.Empty;
public string PostalCode
{
get{ return _code;}
set{_code = value;}
}
At this point our code will compile but no result. We need to add handlers for the conditional branches. Write following line of code in PostalCodeValid method.
Console.WriteLine("The postal code {0} is valid.",_code);
Similarly, handler for right branch in PostalCodeInvalid method.
Console.WriteLine("The postal code {0} is invalid.",_code);
This is all, workflow portion is complete. Now we’ll add code to Main method for startup.
You will see the following code in Main method:
WorkflowInstance instance = workflowRuntime.CreateWorkflow(typeof(PCodeFlow.Workflow1));
Replace it by following.
Dictionary
wfArgs.Add("PostalCode", args.Length>0?args[0] : "");
WorkflowInstance instance = workflowRuntime.CreateWorkflow(typeof(PCodeFlow.Workflow1), wfArgs);
Autogenerated code would work fine, however we want to pass the postal code found on the command line so we have replaced it by our own code.
Now you can run it and type the following command pcodeflow 12345 and hit “Enter” key. You see the output as “The postal code 12345 was valid. You can check for invalid condition.
Woooo….w! Our first program is running.
First Program with WorkFlow
Thursday, July 17, 2008- Download .Net Framework 3.0 runtime components ( dotnetfx3setup.exe) and run the setup.
- Install Windows SDK
- Install Visual Studio Extension for Workflow.
Visual Studio 2005 Support for WF fall into 2 main categories:
a. Visual Editing – drag drop functionality
b. Templates – for adding workflow-based projects, it adds assemblies’ references.
As usual, we would create first ‘console-based’ workflow project. In Visual Studio open a new project. In project types pane expand Visual C#, click on Workflow and select “Sequential Workflow Console Application”. Clicking on “OK” creates basic project for you and bring up the workflow visual designer user interface. It will create 2 files for you.
i. Program.cs
ii. Workflow1.cs
In solution explorer you can select Workflow1.cs and click on toolbox.
Drop IfElse activity. We would use this to check whether the input string is a valid postal code or not? When you drop IfElse activity you will see the exclamatory sign that tells that you have not written the code for the decision and gives compile time error. Click on left branch go to properties and set condition property to “Code Condition”. And it will ask for the name of event that needs to be fired for evaluation. Type event name as EvaluatePostalCode in “Condition” Property (Child Property of Condition). Now drop the Code activity on the left branch to add code that will execute when EvaluatePostalCode returns true. Select property “ExecuteCode” and write PostalCodeValid.
So what Visual Studio 2005 has done, It has inserted events that will execute code that we will provide. The first event handler, EvaluatePostalCode, executes when the workflow needs to evaluate the test condition. The second event handler, PostalCodeValid executes when the left branch is taken.
Similarly we can add Code to right branch and name the event PostalCodeInvalid.
Windows Workflow Foundation - An Introduction
Wednesday, July 9, 2008Introduction
WF provides you with the multithreading capability without the hassle. Without WF you either execute your workflow tasks in the same thread that runs your UI or main process or you write multithreaded software yourself (It’s not so easy) and have a separate threads execute the process logic.
Comparing WF with Microsoft Biztalk and WCF
Orchestration is Biztalk’s term for workflow. You can use a Graphical Editor to lay out business processes, and some of these processes might even include external egencies, such as a trading partner, through external communications protocols. Communication with your trading partners is easy and seamless with BizTalk.
Biztalk is designed for inter application (multiple apps). WF, on the other hand, is designed to work at OS level and is therefore appropriate for integration into a single app within a single domain. But it doesn’t mean you can’t communicate with external processes and servers using WF, but WF’s primary focus is facilitating WF functionality within your app.
When, in a application, we change a given method’s signature, name etc, I must recompile all the software that that uses that method. So we use web service by changing our mentality from “use this method” to “use this service”. That is called SOA. Service based software is integrated using contracts and policy. It’s expected that services will morph and change, and the goal is to have dependent processes recognize changes and adjust accordingly. Contract identify what services are available. Policy describes how the services are to be used. When contracts or policies are changed, ideally service consumers automatically adjust and change as well
Actually, when contracts or policies change, things don’t magically fix themselves. In reality, service provider should communicate how many previous versions they’ll support and service sonsumer should update their code to most up-to-date version asap.
Though WF provides you with some basic tool to use XML web services, you can expose and consume web services. But WCF is much more powerful. Primary goal of WCF is to unify the programming model for all electronic processes, certainly second goal is to implement Internet standards for Web Services and allow you to build connection based SOA. If you require string SOA support, by all means use WCF.
Must know for Developers (Part -1)
Tuesday, July 8, 2008I would like to discuss essential things that a developer must be familiar with. In todays competitive world, as more technologies are emerging and so are technology terms. If you look around the internet you will find so many new things that people are talking about. If you don't know the meaning of those terms you'll be not understanding what they are talking about. So I'll be posting the definitions and very very high level of understanding on those terminologies. After that as and when I'll start different blogs for a particular type of technology for detail discussion.
Let us start with
1. Web service
Web service is a performing remote method calls over HTTP.
A software system designed to support inter operable machine to machine interactiona over network.
Web services are frequently just Web APIs can be accessed over a network, such as the Internet, and executed on a remote system hosting the requested services
In Simple terms
You want to use some function e.g. a function DayDiff which takes two dates as parameters and results back the difference of days between both the dates. If somebody has already written the same function, you would not like to reinvent the wheel. You would like to use it. Web service is the way through which he can publish (or expose) this function over the internet and you can discover it and use it in your application. Though lot of things are going on behind the hood. But for introduction purpose you can skip all that.
2. SOAP
On your way to web service you will come across this term. It stands for Simple Object Access Protocol. This is a protocol for exchanging XML based messages over HTTP. SOAP forms the foundation layer of the web services protocol stack providing a basic messaging framework upon which abstract layers can be built.
As a layman's example of how SOAP procedures can be used, a correctly formatted call could be sent to a Web Service enabled web site - for example, a house price database - with the data ranges needed for a search. The site could then return a formatted XML document with all the required results and associated data (prices, location, features, etc). These could then be integrated directly into a third-party site
3. Mashup
Mashup is a web application that combines data from more than one source into a single integrated tool.
Creating a new web service by combining two or more services available that was not originally provided by either source.
There are basically three types of mashups
- consumer mashups
- data mashups
- Enterprise mashups
- Business mashups
