 Saturday, July 10, 2010
 This weekend (July 9-11, 2010) techno-geeks from all around the midwest have converged on the Microsoft office in Downers Grove IL to use their skills to help 6 different charities at the inaugural Midwest GiveCamp. I am acting as PM for “Team Dream” and our group is working to help out Dreams for Kids with their web site, social networking, picture display of their events (check out the example below), and contact gathering. It could be a lot of work but it’s also going to be a good time. Definitely, go check out Dreams for Kids they are a great organization! They’ve been around for over 20 years helping empower children all around the world. In fact they are doing this in 30+ countries. Good Stuff! In their own words, here is what Dreams for Kids does: “Dreams for Kids empowers youth living in poverty and those with disabilities, by uniting them with their peers, recognizing their abilities, and allowing their voices to be heard. The most isolated young people from every community are reminded they have something to give. While fearlessly pursing their dreams, they are leading others to their own and compassionately changing the world.” An example of a Dreams for Kids event and getting the kids involved and having fun. More empowering through Dreams for Kids  Kyree Gerson from Dreams for Kids and me talking about what they do and what we are going to try to do for them. Clark (the main organizer and my Developer Smackdown cohost) is in the background.  Here’s “Team Dream” jammin on some code (clockwise): Aaron King, BJ Dibbern, Alex Vargas, Steve Murawski, me Dreams for Kids www.dreamsforkids.org Twitter: @dreamsforkids
 Saturday, May 15, 2010
 Friday, May 14, 2010
Like me, you may have to do demos as part of your job. One of the things I demo often is TFS. Lately, I’ve been tapping into the powers of Team Foundation Server 2010 Basic. With the Basic edition, I can install real TFS on my laptop BUT I don’t have to install SharePoint (MOSS or WSS) or SQL Server Reporting Services. On top of that, I can implement it with SQL Server Express. I don’t have to run Windows Server. I don’t have to do this through a VM like VPC or boot to VHD. I can run it right on my laptop. And, with the Basic edition, I get source control, work items AND automated build. It’s truly an awesome thing. The problem with pre-2010 TFS is that all my demo projects were mingled in with my “real” projects and it became a little bit of a mess especially when demoing. Keeping all the projects straight wasn’t a huge thing but still a bit of a pain. Now we have project collections and it’s easy to separate real from demo. There’s always a gotcha though and it starts with the way TFS is architected. A project collection is associated with a single build controller and that controller is associated with a Windows Service. You’re not supposed to have more than one controller/service per machine whether the controller is on the app tier or on a build machine. Here’s the problem: I can only set up builds for one of my collections. There is a solution. Keep in mind though, it’s considered a hack and something you should NOT do on any kind of production system (because it’s completely non-supported) but it does seem to work. I found the solution as posted by Jim Lamb but my experience was a little different so I decided to post what I did with screen shots. So, here goes. The solution is to manually install another build service and register another build controller to the 2nd collection – with the new build controller, you can create new build agents. Here is the order of how I set up my machine before I realized the build issue: - Installed TFS Basic
- Created the “DefaultCollection” as part of the install. That name can be anything you want but as I was a little short on creativity at the time, I used it.
- Created a couple Team Projects for some applications that I was working on (at this point I didn’t create any builds – I wasn’t to that point yet in the code)
- Realized that I had a couple demos coming up so I decided to take advantage of the collections feature and created a “Demos” collection
- Created a couple builds for the new demo projects assigning the build controller and created multiple build agents
- Did my demos of the automated build process (which all worked just fine)
- Went back to my “real” projects and wanted to create builds for them but realized the situation
In a nutshell, here’s the steps to create a new build controller: - Install/Create another Windows Service which is a host for the build process
- Register the new build service and configure properties
- Create a new build controller and configure properties
There’s a few more actual steps involved but after that you can create agents to fire up the build definitions. Here’s the actual steps: 1) Install/Create another Windows Service which is a host for the build process and works directly with the build controller (1:1 relationship) a. Open a command prompt window (must be opened “As Administrator”) b. Call the “Service Control Manager” command line API to setup another Windows Service which will host the new build controller. The call format is: sc.exe create ServiceName binpath= “C:\Program Files\Microsoft Team Foundation Server 2010\Tools\TfsBuildServiceHost.exe /NamedInstance:InstanceName” DisplayName= “Name that appears in the services list display” Note: the spaces after binpath= and DisplayName= are required. This will set up another windows service instance that another build controller can be associated with. Naming suggestion is to include the collection name so you can easily see which service is assigned to which collection. Here’s the example of what I did:  2) Register the new build service and configure properties a) The Team Foundation Administration Console can use the Windows environment variable “TFSBUILDSERVICEHOST” to identify the service that it should be administering and in the next step you need to start up the console and make it work with the right service. You do this in two steps. First, you just set the environment variable in the command window already open by typing this: set TFSBUILDSERVICEHOST=InstanceName where InstanceName is the name you gave your instance in the SC.exe command…hit enter. b) Then, in the same command console window, you call up the TFS Administration Console with the command: "%programfiles%\Microsoft team foundation server 2010\tools\tfsmgmt.exe" (include the quotes) If you get the following error message,  then you either didn’t create the service (SC.exe command) or your instance name/service instance names don’t match c) The TFS Admin console will appear and will be working with the new service  In Jim Lamb’s post he mentions looking at the registry setting: “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\TeamFoundation\Build\tfsbuildservicehost1” to verify a unique URI but in my RTM install that key did not exist so I went on to the next step. d) Click Register and this window will appear:  e) Click “Browse” under “Communications” to assign the right collection to the build controller  f) Identify the TFS server, select the collection and click “Connect” g) Now, you need to make sure that you are communicating on a port number that is different that your current one. The default build port is 9191 so I just made mine 9192  h) You can change the service credentials if you wish but then click “Start” to get the service/controller running 3) Create a new build controller and configure properties  a) Click “New Controller”  b) There is nothing you have to add at this point but you can add a description if you wish, limit the number of concurrent builds this controller will initiate, and finally, you can identify a location in source control where you can store assemblies that the build workflow may need to use (i.e., custom activities). Click “OK” and the controller will start up  That’s it as far as creating a new controller. Now all you have to do is create the build agent(s). You do this as you did before. There are some things to keep in mind though: - When identifying the working directory for the new controller/agent make sure it is different than the original controller/agent otherwise there is a possibility of a conflict when builds occur. Just appending a description on the end of the build agent ID (e.g.: $(BuildAgentId)_CollName) or an additional subfolder (e.g.: “$(SystemDrive)\Builds\$(BuildAgentId)\CollName\$(BuildDefinitionPath)”) should be more than sufficient.
- Along the same lines, make sure the drop folders are different. This shouldn’t be an issue unless you name two projects the same but it’s still a possibility.
- If upgrades or patches are to be made to the system, remember that you have more than the original number of services active and if you need to quiet the services for that patch, there’s an additional service out there.
- Running multiple, simultaneous builds could cause performance issues. Just something to keep in mind.
Oh, yeah, when you need to use the TFS Admin Console and you go to “Build Configuration”, it may not be pointing at the collection/controller that you want to work with. To launch an admin console specifically for the collection/controller you want do the following: - Launch a command window as administrator. If you don’t run “as admin” then the TFS console will probably not let you define the collection you want to work with.
- Set the environment variable TFSBUILDSERVICEHOST to the name of the service (like you did above in step 2.a.)
- Call up the Admin console with: "%programfiles%\Microsoft team foundation server 2010\tools\tfsmgmt.exe"
- Console should now be running against the right service and controller.
I just created a .bat file with those commands to make things easier. Again, launch it “as administrator”. Again, this is a hack and not supported. Since doing this modification (several weeks now) I have not had any issues. I can do builds in both collections so it is definitely working on my machine . Have fun building.
 Wednesday, April 28, 2010
(Updated to include VS 2005) You can most definitely access TFS 2010 from the Team Explorer within VS ‘08 and ‘05 BUT there is a very defined installation order and a final update patch to make it all work. So, below is a description of the installation order of all of the pieces needed to be in place before VS ‘08 can get to a TFS 2010 environment. You must install the components in the following order. If you do not, then it most likely will not work – meaning you won’t be able to attach to a TFS Server. If you do install the components in a different order that does not mean you cannot recover without uninstalling (yea!). All it means is that, at the end of the day, the components will need to be “layered” as defined below. Visual Studio 2008 - Visual Studio 2008
- TFS Team Explorer 2008
- Visual Studio 2008 SP1 (installer only) (ISO – Full download)
- Visual Studio Team System 2008 Service Pack 1 Forward Compatibility Update for Team Foundation Server 2010 (nice concise naming…NOT!)
Visual Studio 2005 - Visual Studio 2005
- TFS Team Explorer 2005
- Visual Studio 2005 Team Suite SP1
- Visual Studio Team System 2005 Service Pack 1 Forward Compatibility Update for Team Foundation Server 2010 (Installer)
So, if, for example, you install VS and then VS SP1 and then Team Explorer you won’t be able to just add the Forward Compatibility Update and have things work. You will need to re-install VS SP1 so that it is on top of Team Explorer and then the Forward Compatibility Update. At that point the pieces will be layered in the right order. Kind of a pain, but that’s how it works. The description below should be used for 2005 and 2008: Once the install is done you can add your server and this is how you used to add a server in Team Explorer ‘08 and still is if you are attaching to TFS ‘08:  Server name, port and protocol and you are done. TFS 2010 is different because of the concept of project collections. You need to add the virtual directory and the collection name in addition to the server, port and protocol. In Team Explorer 2010 you get this dialog box:  which allows you to add everything separately - except for the collection which is done later:  In TE ‘08 you add all of the details in the server name text box as a URL including the name of the collection since there isn’t any place else to add it.  When you hit OK it will churn for a couple seconds and then should display the new connection in the remaining dialog box:  That should be it. You should have access to the TFS project collection. I definitely ran into the layering issue and figured it out with some research along with trial and error. Hopefully, this helps.
 Wednesday, April 21, 2010
 Tuesday, April 20, 2010
Creating an OData Publisher I did a simple overview of OData in a previous post and on our recent Developer Smackdown Podcast (Episode 23) Clark and I talked about the capabilities and how you can use the OData standard to publish all kinds of data without knowing exactly how your consumers will use it. In this post I will show how you can utilize Entity Frameworks and create an OData service VERY easily. I will do this in Visual Studio ‘08 as well as 2010 since Microsoft loves to add a little confusion to the mix and changed the names of WCF/ADO.NET Data Services and how you initially get at them as VS projects. First of all, “ADO.NET Data Services” in .NET 3.5 SP1/VS 2008 is now “WCF Data Services” in .NET 4/VS 2010. The original name was “Project Astoria”. Depending on the timing, blogs and articles on the net may be using any of those names.
VS 2008/.NET 3.5 SP1 (with Data Services Update – link below): For these service applications I installed the AdventureWorks demo database that you can get on CodePlex which can be installed in a SQL Server database. I installed locally in SQL Express. 1. Start Visual Studio and create a WCF Service Application. OK, so there’s more confusion. Why isn’t there an ADO.NET Service Application. Dunno. But this is an easy way at getting the initial project in place. We will actually delete the service that this template creates and use an ADO.NET Data Service.  If you look at your solution, you will see something like this:  2. Delete the service class and interface. They will just get in the way otherwise. 3. Add a new item to the project. Select Web and an “ADO.NET Data Service”. In a moment of pure inspiration I named mine “ODataService.svc”.  If you look at your references, you will see that several new assemblies were added. System.Data.Entity, System.Data.Services, System.Data.Services.Client and System.ServiceModel.Web are all added. 4. The next thing is to add the database. I did this through Entity Frameworks. Some people like EF, some don’t. Thing is, EF makes this exercise stupid easy so I added a new item “ADO.NET Entity Data Model”. 5. This will start the wizard and the next step is to “Generate from database” and click Next.  6. Choose your connection and create the connection string.  7. Pick the tables that you want to publish and Finish.  System.Security gets added to the references and the EF data model also gets added.  8. So you have all the parts but there is code missing. In the data service code file “YourServiceName.svc.cs” or whatever your file name is, there are some changes. First, for OData to work the service inherits from the “DataService” class and you have to pass in your data type. In my example, the type generated from the EF wizard is “AdventureWorksLT2008Entities”. As a result my class definition for the service is: public class ODataService : DataService<DataEntities.AdventureWorksLT2008Entities> 9. Inside the “InitializeService” method of your new service you will need a few lines of code as well. Especially since out of the box that method contains nothing but comments. Unfortunately, for those of us who preach dependency injection and the use of interfaces, you have to change the method parameter from an IDataServiceConfiguration interface type into a DataServiceConfiguration class type. It appears that the config type contains a required “DataServiceBehavior” property that the interface doesn’t know about. 10. Within the InitializeService method you add a few lines of code. Here’s the whole thing: using System.Data.Services;
using System.Data.Services.Common;
namespace OdataWcfServiceApplication
{
public class ODataService : DataService<DataEntities.AdventureWorksLT2008Entities>
{
// This method is called only once to initialize service-wide policies.
// DataServiceBehavior is part of the DataServiceConfiguration type - not IDataServiceConfiguration
public static void InitializeService(DataServiceConfiguration config)
{
config.SetEntitySetAccessRule("*", EntitySetRights.AllRead);
// Use this especially for debugging. This line will respond with additional
// info if an error is encountered
config.UseVerboseErrors = true;
// This line tells your service to use version 2 of the OData services.
// Version 2 allows you to do more such as control paging of output
config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
}
}
}
OK, that’s it. You can now run the application, the service will be hosted locally and the browser will pop up. The result you get depends on the database that you use and the tables selected but it will appear something like this:
To test out the OData query capabilities just add your query to the end of the URL. For example, in my case I have a list of products that I can request. At the end of the URL I add “Product?top=10”. This says I want the listing of products but to limit it to the first 10. There are a lot of products in the database and if I didn’t filter then I would be waiting a while till all of the products were put in a list. Nice that I can do that.
Here is the output of that query:

If this is what you see…

and you want to see the raw data being sent back by the query (and why wouldn’t you?) you need to go into IE/Tools/Internet Options/Content tab/Feeds and Web Slices/Settings button and uncheck “Turn on feed reading view”. You may need to restart IE for that to take effect but after that you will see the raw data feed.
.NET 4/VS 2010
I’m just going to go over the differences here because for the most part, it is all pretty much the same.
- The first difference is with step 3. Because of the new names for the services, instead of creating an “ADO.NET Data Service”, create a “WCF Data Service”.
- In step 7, there is another option in the EF Wizard. “Pluralize or singularize generated object names” is a checkbox that is defaulted on. This is important because if I did everything else the same, the object that I exposed in the feed is not called “Product”, it’s now “Products” since the name was pluralized by EF. Obviously, queries must use the correct name or they don’t work.
I believe that’s it. Not much difference between the two. Just remember:
- To use OData in VS2008/.NET 3.5, you need to install the Data Services Update (link below) – It is now part of .NET 4
- As stated above, the object names may or may not be pluralized depending on the EF Wizard. “Product” != “Products”
- Queries are case sensitive. “Product” != “product”. If you are having trouble with a query take a look at the object names
- If you can’t see the raw data in IE, change the content setting in Internet Options (described above)
- If you publish OData, the query processing is done on your server so keep in mind how much it is accessed, how much data is being queried and the potential complexity of the queries as this relates specifically to sizing and bandwidth
Resources:
OData.Org
Data Services Update for .NET 3.5 SP1: update to .NET that installs the libraries that give you the OData capabilities.
Click here for Win7 and W2K8 R2.
Click here for all other OS versions.
Technorati Tags: OData, WCF, Web Service
 Monday, April 19, 2010
 Wednesday, April 14, 2010
 Friday, March 19, 2010
Just got back from the MIX10 conference. Hanging out with by buddy Clark Sell and doin podcasts, we took in and tried to absorb as much as we could. Of course the big news was around Windows Phone 7 Series and Silverlight 4 but there was also quite a buzz about OData. Personally, the moniker is a little boring but who am I to judge – the capability is the big thing. If you haven’t heard about it, it is an open protocol for working with ATOM and JSON data feeds. Just from that description, you might be thinking “so what” – well, keep reading. This protocol isn’t just so you can publish or consume feed data, you know you can do that. But, now you can output a customizable data feed without knowing the full intention of the consumer ahead of time. In other words, you can provide a data feed service that can directly respond to the consumer’s requests/queries and output the feed with only the data requested in the way best suited for them to consume and you don’t need a custom set of API endpoints to do it. Some OData Facts: - The OData spec is around the protocol, not the implementation. (BTW, already, there are libraries available for JavaScript, PHP, Java, Objective-C and .NET)
- It is based on REST calls through HTTP so (GET, PUT, DELETE, POST, etc.) so strictly speaking, you don’t even need a client api to access OData feeds – you could do it from a browser URL/Address line.
- Feeds can be output in ATOM as well as JSON again, from the same endpoint.
- The protocol is for reading from AND writing data back to a data source
- Security around the data can be enforced
Try it: Go to http://services.odata.org/Northwind/Northwind.svc/ The OData site has provided access to the sample Northwind database. When you get there you will see all of the data that you can access and query against. Notice from the result set that there is a list of all the different collections of data that you can access from this single service. You have Customers, Shippers, Products, Suppliers, Regions, Orders, etc. All you need to do to access any one of the collections is to type the collection name in the URL. This example will return a list of all products: http://services.odata.org/Northwind/Northwind.svc/Products Note: at this point things are case-sensitive so “Products” works but “products” won’t. If you are in Internet Explorer, and don’t see the detailed data stream, you might want to go to “Tools \ Internet Options \ Content \ Feeds and Web Slices \ Settings”. Then, uncheck “Turn on feed reading view”. After that, you will see the actual feed data in the browser. Cool. But, what if I only want products with a unit price over 50.00? Add a filter: http://services.odata.org/Northwind/northwind.svc/Products?$filter=UnitPrice gt 50 Notice that the UnitPrice is typed and is a Decimal. Others are 16bit integers, 32bit integers, booleans, etc. Now, sort: http://services.odata.org/Northwind/northwind.svc/Products?$filter=UnitPrice gt 50&$orderby=UnitPrice Would you rather the data being sent back be in JSON format? http://services.odata.org/Northwind/northwind.svc/Products?$filter=UnitPrice gt 50&$orderby=UnitPrice&$format=JSON All of this is being done through a single endpoint. Even more important, it is being done with a standard set of query parameters which means that you will know how to publish and consume (i.e., select, extract, filter, sort and format) data coming from any feed that uses the OData Protocol. Schweeet! Next up…Create your own publisher with WCF Data Services. Resources and Info: Technorati Tags: OData, MIX10, ATOM, JSON
 Wednesday, March 17, 2010
The MIX10 conference is over and Clark and I are jazzed over the announcements about Windows Phone 7, Silverlight 4, OData, Web Deploy, etc., etc., etc. Check out the last day recap. DeveloperSmackdown.com
© Copyright 2010 Mark Nichols
Theme design by Bryan Bell
newtelligence dasBlog 2.3.9074.18820  | Page rendered at Saturday, September 04, 2010 7:40:58 AM (Central Daylight Time, UTC-05:00)
Pick a theme:
|
On this page....
| | Sun | Mon | Tue | Wed | Thu | Fri | Sat |
|---|
| 29 | 30 | 31 | 1 | 2 | 3 | 4 | | 5 | 6 | 7 | 8 | 9 | 10 | 11 | | 12 | 13 | 14 | 15 | 16 | 17 | 18 | | 19 | 20 | 21 | 22 | 23 | 24 | 25 | | 26 | 27 | 28 | 29 | 30 | 1 | 2 | | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
Search
Navigation
Categories
Blogroll
Sign In
|