Presentation Content : BCS Architecture , BCS Connectors , BCS Development Trends
When was trying to add a new project to solution, I faced following prompt error from Visual studio 2010:
“the length of the full path for the solution, project or item you are created exceeds the maximum path length allowed by the system”
Really surprising to see that because my project location length was only 143 characters long.
My operating system was windows 7 64 bit.
Did a little bit of googling to know that it is by design from Microsoft……… Strange …..:)
There is no work round, path limit is imposed via the operating system API used by VS 2010 so we cannot have a project name path longer .you have to make a smaller project location.
So bad ..bad…if a third party product has any such limitation, then it is understanding …But from Microsoft who also creator of windows-the underline operating system- it is tooo bad….
Let hope it will get fixed in next version of visuals studio…..
Today it is the last day of month and Yes, Yes, again it is more than a month and I am still not able to give time to this blog…….One reason is that I am recently married, so life was really busy in family things……:)
But still I need to be more focus on objectives and target for this blog.
Secondly, I need to make more productive use of time and efforts.
Searched on net and founds following tips for productivity increase.
1. Create Keyboard shortcuts for repetitive tasks. Learn shortcut keys for common windows operations. Use short keys for visual studio 2010 at following location.
http://www.microsoft.com/download/en/details.aspx?id=131892. Not Just completing a office task is important , main things is to get full control over domain of whatever you are doing is very important.
Programming language, business rules and technology skills must be fully understood to make more output for a give time.
1 hrs spend in learning/getting full control things, can save your a lot of time in future.
3. Planning your time is very important for better productivity. Often weak planning , results in chaos and waste valuable time. Divide bigger task into smaller pieces and track each item separately.
4. Make extensive use of Visual studio productivity tools.
For visual studio 2010, locatedhere
5. POC, instead of main product/project.
Any new feature that need to be added to project or product must be implemented as separate project. Because software development is basically a Research and development field, so POC-Proof of concept style of strategy is best suited and makes things more productive in long run.
6. Automate mostly of software development things with Application Lifecycle Management (ALM) tools. Build process automation via TFS. Continuously Integration by wiring Tests with build process improve things. So automate things as much as possible. Use .bat files heavily to automate the tasks.
7. While doing development related to AD, SharePoint and IIS create environments and scenarios via Power shell scripts. That makes things very productive for development.
Objective: To find public key token of an assembly.
Strong name utility named sn.exe can be used to find the public key token of an assembly as below:
c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin>sn.exe -T C:\Windows\Mic rosoft.NET\Framework\v2.0.50727\system.directoryservices.dll Microsoft (R) .NET Framework Strong Name Utility Version 3.5.30729.1 Copyright (c) Microsoft Corporation. All rights reserved. Public key token is b03f5f7f11d50a3a c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin>sn.exe -T C:\Windows\Mic rosoft.NET\Framework\v2.0.50727\system.data.dll Microsoft (R) .NET Framework Strong Name Utility Version 3.5.30729.1 Copyright (c) Microsoft Corporation. All rights reserved. Public key token is b77a5c561934e089
Second way is to wire thing in Visual studio 2010, Go to Tools>>External Tools and add new tool by providing:
Title: Get Public Key Token
Command: C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\sn.exe
Arguments: -T $(TargetPath)
Check the Use Output Window checkbox. So screen looks like as:
Now click on menu in tools as “Get Public Key Token” to see the public key token of current assembly in output window as:
Microsoft (R) .NET Framework Strong Name Utility Version 3.5.30729.1 Copyright (c) Microsoft Corporation. All rights reserved. Public key token is 4cb554340e8b008b
According to Wiki, Restful Webs services are described as:
A RESTful web service (also called a RESTful web API) is a simple web service implemented using HTTP and the principles of REST. It is a collection of resources, with three defined aspects: •the base URI for the web service, such as http://example.com/resources/ •the Internet media type of the data supported by the web service. This is often JSON, XML or YAML but can be any other valid Internet media type. •the set of operations supported by the web service using HTTP methods (e.g., POST, GET, PUT or DELETE).
For programming Restful services in .Net Framework, till visual studio 2008 sp1, there was a separate kit for named “WCF REST Starter Kit Preview 2” at:
But it was not upgraded for Visual studio 2010. So for Visual studio 2010/.Net 4.0, search WCF+REST related items in Visual studio gallery.
One of the best template by WCF Team in Microsoft is as below:
Download file named “WcfRestService40(CS).vsix”, and double click to install the template.
Now a new project type named “WCF REST Service application” is added.
I created a new project based on new project type named “WcfRestServiceApp”.
Added a console project to solution for running service named “ServiceServerApp”, with following code
WcfRestServiceApp.Service1 serv = new WcfRestServiceApp.Service1(); WebServiceHost host = new WebServiceHost(serv, new Uri("http://localhost/WCFRESTService/")); host.Open(); Console.WriteLine("Service is running....Press enter to stop the service..."); Console.Read(); host.Close();
When you try to run service, you will get following error:
In order to use one of the ServiceHost constructors that takes a service instance, the InstanceContextMode of the service must be set to InstanceContextMode.Single. This can be configured via the ServiceBehaviorAttribute. Otherwise, please consider using the ServiceHost constructors that take a Type argument.
As error explains, I have to change InstanceContextMode from InstanceContextMode.PerCall
After that I got following error:
HTTP could not register URL http://+:80/WCFRESTService/. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details).
So solution is to run following command incase of windows 7.
netsh http add urlacl url=http://+:80/WCFRESTService/ user=juliet\shah
For theory details see the link above.
So I am ready with service running .
While analyzing code of template, two things are important to note.
•Template uses the WebGetAttribute and WebInvokeAttribute to associate service operations with both GET and other HTTP verbs like PUT, POST, and DELETE.
•Template uses the UriTemplate and UriTemplateTable classes to provide URI processing capabilities.
For details about theory visit following
That all from my side for RestFull web Services in .Net framework 4.0/Visual studio 2010
Software Architecture – What is exactly Tuple in C# – Compare with classes, structures,Array,ArrayList,ListMarch 20, 2011
In previous post at Software Architecture – C# – 4.0 – New Feature – Tuple , I introduced Tuples. During a presentation Badar-one of my team mate asked me question that why we need a new type tuple-When there are already classes,structures,Array,ArrayList,List. So I posting my reply.
Actually Microsoft is growing C# as most prowerfull programming langauge, so they contionously extend the core language element. Tuple has been there in Pythone and F# previously, now with c# 4.0, it is also part of core c# syntyx.
Comparsion with Class/Structure:
So problem defination is that we want to group together related values/ types into one type.
First thing comes in mind to have Class and contain all elements to be grouped in side a class. Sounds good,but there are cases when there no objec t oriented concept related to grouping. Class comes with heavy concepts like Encapsulation,Pholymorphism,abstraction,inheritence,constructor and a lot more… So when grouping is required but there is no OO sense, then Tuples are best choice.
You may point out that Structures are also there. Again there have attached concepts like inheritence,constrcutor,methods,properties and lot more. So when just grouping is required but no Object oriented concepts, tuples are the best choices.
Comparsion with Array/ArrayList/List:
No..No you can’t compare Tuple with Array/ArrayList/List.Because of simple point that Tupe is treated as data type and Array/ArrayList/List are treated as data strcutures. Just visualise the basic course with “Data Structure” in BCS, you will know the differenc e. Array/Arraylist/List are affilated with general concepts of Data structure like sorting , searc hing and a lot more. For Tuple we don’t have any such concept. It is simple Grouping og related values/types.
Getting and Setting elements in tupes is totally different from other Data strcutures like Array,ArrayList/List.
Secondly, elements in array are not strongly types(Require a type casting),but elements of Tuples are strongly typed.
IntelliTrace is a historic debugger which acts like a Flight recorder or DVR Recorder.
It is only available in Visual studio 2010 ultimate.
According to MSDN:
Here are some examples of how IntelliTrace can save you time:
>>You set a breakpoint near the start of your application. After observing the state of your application at that point, you continue execution. Later, you decide you want to go back and look at the first breakpoint hit again. Without IntelliTrace, you would have to restart your application. By using IntelliTrace, you can find the breakpoint event in the IntelliTrace window, and then click the breakpoint to view the state of your application at the time that the breakpoint was hit. State information includes variables that you have examined previously through DataTips or variable windows.
>>You discover that your application has corrupted a data file or a registry entry, but you do not know where the file or registry corruption has occurred. Without IntelliTrace, you would have to look through your code to find all possible file or registry accesses, place breakpoints on those accesses, then rerun your application to find where the problem occurs. By using IntelliTrace, you can see all registry- or file-access events that have been collected and the state of your application at the time each event occurred.
>>An exception occurs. Without IntelliTrace, you receive an exception message that states the nature of the exception but you have limited information on events that led up to the exception. You can examine the call stack to see the chain of calls that led up to the exception but you cannot examine the sequence of events that occurred during those calls. By using IntelliTrace, you can examine events that occurred at multiple times prior to the exception.
Best video to get explination about IntelliTrace is as:
Some others are as below: