Skip to main content

Posts

Showing posts from July, 2010

Changing the TFS temp location

To optimize performance TFS uses a temp folder to get the files that you view. By default the location of that folder is %TMP%\TFSTemp. the TMP environment variable. Unfortunately there is no option in Visual Studio or Team Explorer to change this location. The only way I found to change it, is by changing the %TMP% environment variable itself: 1: set TMP=D:\Temp 2: set TEMP=%TMP% 3: md %TMP% Remark: Notice that it is possible that the same environment variable is used for other applications too. So be careful when changing this value.

The correspondence between examples and use cases

Most of time we use use cases to extract the domain model from the business people mind’s. As stated by the term itself, use cases should be created by the business user itself. But for a lot of persons(both analysts and business people), wrapping your head around the concept of a use case is very hard. Most of the time the only business persons you can ask for a use case have a technical background. So I think it’s better to take another approach and don’t ask for a use case, ask for an example. If a business person cannot give you an example, you’re talking to the wrong person. That implies that they are two different approaches to the same goal, both use cases and examples have their place in helping to understand and create the domain model.

Create random text in Word 2007

An almost unknown feature of Word 2007  is that you can insert lorem ipsum text into the document to create some random text.  Just type in =lorem() into your document, and hit the enter key… If you need more text, you can also use the following syntax:     =lorem(paragraphs,sentences) For instance, for 6 paragraphs of 20 sentences each, you would use:    =lorem(6,20)

Enable Intellisense for your custom config sections

Start by creating an XSD file that defines the format of the xml of your config section. You can easily do this in Visual Studio by opening an XML file and choosing XML –> Create Schema from the Toolbar menu. Imagine we have the following custom configuration 1: < CustomSettings name ="Something" > 2: < ApplicationName > SomethingElse </ ApplicationName > 3: </ CustomSettings > This will result in the following schema:   1: <? xml version ="1.0" encoding ="utf-8" ? > 2: < xs:schema attributeFormDefault ="unqualified" elementFormDefault ="qualified" xmlns:xs ="http://www.w3.org/2001/XMLSchema" > 3: < xs:element name ="CustomSettings" > 4: < xs:complexType > 5: < xs:sequence > 6: < xs:element name ="ApplicationName" type ="xs:string" /> 7: </ xs:sequence

Clearing a table: the fast way

Just something that can be handy: if you have to clear a table , I always used the following statement before 1: DELETE FROM TABLE Now if you have a table with a large amount of records, this can take a long time. A lot faster way is to use the following SQL statement instead: 1: TRUNCATE TABLE Remark: This is only for SQL Server. I have no idea if this is also true for other database systems.

jQuery Fundamentals

jQuery is a great library and it helped me a lot in starting to like web development. Abstracting away all the typical Javascript problems and giving a nice syntax instead, it makes web development fun again. Of course learning jQuery still requires some investment from your side, you still need to understand HTML, Javascript and CSS. To help you learn jQuery Rebecca Murphey wrote a free book about the jQuery Fundamentals. A must read for all web developers and a resource to keep close to you.

Powershell: Include other scripts in your Powershell script

I don’t used Powershell a lot before. But lately I’m starting to discover more and more of it’s richness and how it can make my life a lot simpler. One of the things that took me some time to figure was how to include other scripts inside your own Powershell script. Now doing is this is very easy(once you know it). One way to use functions from another script is to use the dot sourcing operator to run the script so that the functions from the script are part of the calling scope. To dot source the script, you use the dot source operator (a period) followed by the path to the script containing the functions you wish to include in your current scope. After you do this, you can call the functions from the other script directly. An example: PS C:\> . C:\scripts\ConversionFunctions.ps1 PS C:\> convertToMiles 6 6 kilometers equals 3.7266 miles

Dynamic mapping for NHibernate

In most ORM solutions, you have to create some mapping between your tables and columns in your database and the objects and properties in your domain. Entity Framework allows you to this through a designer, NHibernate has XML support and some Fluent Mapping options. You can even start introducing conventions to minimize the amount of mapping needed. But of course, lazy as we are, in some occasions this is still too much work. So if you have some simple objects and some simple queries, another option is available for you; NHibernate transformers . NHibernate transformers  are used to transform the results of the query into something useful.  To give you an example, imagine I have a simple product class: 1: public class Product 2: { 3: public string ID{ get; set; } 4: public string ProductName{ get; set; } 5: } I’ll can create a simple SQL query and let NHibernate do the mapping for me by calling the AliasToBean transformer: 1: var sql = "SELE

Building a business app with Silverlight, RIA Services and NHibernate

You want to build Rich Internet Applications(RIA) with Silverlight but Linq 2 SQL or Entity Framework doesn’t suit your needs? Then the flexibility of NHibernate could be the answer to help you build maintainable and testable applications.  But how do you get started? Brad Abrams extended his business app example with NHibernate support . Go check it out!

ASP.NET MVC 3 is getting closer…

Time goes fast and for the ASP.NET MVC team it even goes faster. I just figured out most of the features inside ASP.NET MVC 2 and version 3 is already showing up. So what's new in ASP.NET MVC 3? Razor Syntax View Engine - Cleaner view syntax Dynamic View and ViewModel properties - passing data between controllers and views using dynamic rather than a dictionary "Add View" Dialog Box Supports Multiple View Engines - You two can be in this box. Service Location and Dependency Injection Support - Get your DI hooked into controller factories, dependency injection, action filters and View Pages. Global Filters - put filters on the all control methods New JsonValueProviderFactory Class - Model bind directly to JSON-encoded data Support for .NET Framework 4 Validation Attributes and IValidatableObject - Easier validation including validating one property based on another. New IClientValidatable Interface - Discovering at runtime if the cli

Microsoft released the Microsoft Visual Studio Scrum 1.0 Process Tempplate

Last week Microsoft announced Microsoft Visual Studio Scrum 1.0 , a process template built from the ground up specifically for Scrum teams. You can download and install Microsoft Visual Studio Scrum 1.0 from the Visual Studio Gallery or you can use the Extension Manager of Visual Studio 2010 (listed under Online Gallery → Tools → Process Templates ): Looking for more information? Check out a detailed overview of Microsoft Visual Studio Scrum 1.0 on MSDN .

NHibernate 3.0.0 Alpha 1

Just being back from vacation I noticed that an Alpha version of NHibernate 3.0.0 is released. Don’t wait and start downloading this  great piece of software. An overview of the new features: Guid support in MySql dialect Query duration is logged Strongly typed configuration WCF Support through the WcfSessionContext    Better exception details Lazy load columns DetachedCriteria support for IStatelessSession New QueryOver syntax And many more… And of course a lot bugs are fixed too.

The Big Boy MVC Series

Interested in learning every step–and I mean every –step it takes to create your own website?  Have a look at the Big Boy MVC Series. Written in an informal style, you learn everything about building a successful website with ASP.NET MVC. The Big Boy MVC Series: Building an Asp.Net MVC Web Application All By Yourself – Part 1 The Big Boy MVC Series – Part 2: Pimp Your Proverbial Ride The Big Boy MVC Series – Part 3: Getting Visual Studio 2010, SQL Server 2008, and Other Stuff For Free The Big Boy MVC Series – Part 4: MVC and MVP; Your First Free Business Lesson The Big Boy MVC Series — Part 5: Some MVP/Agile Guidelines The Big Boy MVC Series — Part 6: Useless Metrics for Determining the Success of Your Website The Big Boy MVC Series — Part 7: We’re Not All Dead… Yet The Big Boy MVC Series — Part 8: The Doodle Abides; Creating a Simple Conceptual Website Map The Big Boy MVC Series — Part 9: Creating Page Prototypes The Big Boy MVC Series — Part

WPF ResourceDictionaries

One thing that I noticed when using WPF ResourceDictionaries (and something that I couldn’t find anywhere in any kind of documentation) is that the order in which you add items to your ResourceDictionary is important. So if you have a DataTemplate that refers to another DataTemplate, you’ll have to put the DataTemplate you refer to first(!). This XAML gives an error at runtime(Notice how the LinkTemplate refers to the LinkActionTemplate ): 1: < DataTemplate x:Key ="LinkTemplate" > 2: < StackPanel VerticalAlignment ="Stretch" HorizontalAlignment ="Stretch" MinWidth ="106" MinHeight ="35" 3: Cursor ="Hand" Background ="Transparent" > 4: < TextBlock Text ="{Binding Title}" TextWrapping ="Wrap" /> 5: < ItemsControl ItemsSource ="{Binding ChildNodes}" 6: ItemTemplate ="{Sta

Clean up your server after a TFS 2008 to TFS 2010 migration

After upgrading your old TFS 2008 environment to a TFS 2010 environment,the old databases are merged into the new TFS_Configuration and TFS_DefaultCollection databases. So you are left with some unused databases that eat up your diskspace. So after you have confirmed that your new environment is doing it’s job, you can safely drop the following old databases: TFSActivityLogging TFSBuild TFSIntegration TFSWarehouse TFSWorkItemTracking TFSWorkItemTrackingAttachments TFSVersionControl

Bad request on Report Server

After upgrading to a new domain, all our request to the Report Server start failing. The only thing we got back was the very useful ‘Bad Request’ error message in our browser. It took us some time to find out that the problem was related to the Kerberos authentication that was introduced in the new domain. This helped us tracking the issue and brought us to the following page on the MSDN website; http://msdn.microsoft.com/en-us/library/cc281253.aspx#proxyfirewallRSWindowsNegotiate . An extract: On a report server that is configured for Negotiate or Kerberos authentication, a client connection to the report server will fail if there is a Kerberos authentication error. Kerberos authentication errors are known to occur when: The Report Server service runs as a Windows domain user account and you did not register a Service Principal Name (SPN) for the account. The report server is configured with the RSWindowsNegotiate setting. The browser chooses Ke

Changing identities in TFS 2010

Changing identities in TFS 2010 is a lot harder than you should think at first. There are some things you need to keep in mind while updating identity information inside your TFS environment. As identity information is stored in a lot of places in TFS, some tools are available to help you. In TFS 2008, identity change was accomplished by running the TFSAdminUtil Sid command. In TFS 2010 this functionality moved into the TFSConfig Identities command. Some considerations: Target account restriction - the target account of the mapping should not already exist in TFS. This is a key restriction of TFSConfig Identities , as well as the older TFSAdminUtil Sid . If the target account is somehow introduced, either by being granted permissions or by group membership sync, it cannot be undone. Simply "removing" the user from group(s) will not work. Removing identities in TFS simply marks the record as logically deleted, and does not physically delete because the identity may o

Reactive Extensions for .NET Hands-on Labs

The Reactive Extensions(Rx) for .NET are great, but is not very easy to get your head around it. To help you understand and use Rx, the Reactive Extensions team has created hands on labs for both JavaScript and .NET to get you started incrementally with the Reactive Extensions.  Both labs largely follow each other in terms of format and what areas are covered.  The .NET lab has the following sections: Exercise 1: Getting started with Rx interfaces and assemblies Exercise 2: Creating Observable Sequences Exercise 3: Importing .NET Events into Rx Exercise 4: A First Look at the Standard Query Operators Exercise 5: More Operators to Tame the User Input Exercise 6: Rx’s concurrency model and synchronization support Exercise 7: Bridging the asynchronous method pattern with Rx Exercise 8: SelectMany: the Zen of composition Exercise 9: Testability and mocking made easy

Microsoft.WebApplication.targets error on TFS 2010 Build Server

After upgrading a client’s environment from TFS 2008 to TFS 2010, the build server started to produce failing builds. Looking through the build log I noticed following error: “The imported project “C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\ WebApplications\Microsoft.WebApplication.targets” was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.” Solving this issue is easy. Just copy the v10.0\WebApplications\Microsoft.WebApplication.targets files from your local machine to the directory reported in the error. On your local system you’ll probably find this target file at C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets All builds were green again…

Having problems debugging a Silverlight application?

Last week, a colleague was desperately trying to debug a Silverlight application. But nothing seemed to work. Just adding a breakpoint in the code… Didn’t work. Attaching the Silverlight runtime to Visual Studio… Didn’t work. Loading symbols(PDB file) explicitly in the debug window… Didn’t work But the last one set me on the way to the solution. When we were in the Modules window(Debug –> Windows –> Modules), it was clear that the DLL was not loaded. Clicking load symbols and selecting the PDB file failed with the following error message “A matching symbol is missing” . I realized that the issue could be related to the XAP file not being updated for one or other reason. After removing the existing XAP file and rebuilding, debugging worked fine.

Integrating MS Project Server with Team Foundation Server 2010

An official story about integrating MS Project Server with TFS 2010 is finally there. Microsoft has  just released a CTP demonstrating integration between Team Foundation Server 2010 and Project Server 2010. There is not much information available yet, but to get you going:   Brian Harry’s announcement on TFS 2010 support for MS Project Server MSDN Section on Scheduling Tasks and Assigning Resources Using Microsoft Project A Channel 9 video about Enterprise Project Management with Visual Studio Team System 2010 The TFS Integration platform by the VSTS Rangers. Virtual Machine available for download with the Integration CTP between Project Server and TFS 2010. http://www.microsoft.com/downloads/details.aspx?FamilyID=f221c660-161b-43ca-95f3-e0e4aad8d43e&displaylang=en

Impress your colleagues with your knowledge about…the TextFieldParser class

Sometimes when working with C# you discover some hidden gems. Some of them very useful, other ones a little bit harder to find a good way to benefit from their functionality. One of those hidden gems that I discovered some days ago is the TextFieldParser class. This class is well hidden in the Microsoft.VisualBasic namespace – which makes it not very accessible for the C# developer – although there’s nothing VB.NET specific about it. It makes it very easy to process filetypes like CSV and similar formats. A quick sample: 1: using (var csvFile = new TextFieldParser(myFilePath) 2: { 3: csvFile.TextFieldType = FieldType.Delimited; 4: csvFile.SetDelimiters( "," ); 5: csvFile.CommentTokens = new [] { "HEADER" }; 6: 7: while (!csvFile.EndOfData) 8: { 9: string [] fieldArray; 10: try 11: { 12: fieldArray = csvFile.ReadFields(); 1

TFS 2010 API: Connecting to a TFS collection using a specific user

Just a quick code snippet to describe how to authenticate with a specific user to a TFS collection: 1: TfsTeamProjectCollection collection = new TfsTeamProjectCollection( 2: new Uri(http: //tfs:8080/tfs/DefaultCollection, 3: new System.Net.NetworkCredential( @"domain_name\username" , "password" )); 4:   5: collection.EnsureAuthenticated();

TFS 2010 DLL location

If you want to write your own applications that integrate with the Team Foundation Server environment, you’ll need some DLL’s to access the TFS Object Model and API’s. With the 2010 release the location where these DLL’s live has changed to: C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ ReferenceAssemblies\v2.0 Something to remember…

Microsoft ALM site

Microsoft has added a new section  to the MSDN site focusing on the ALM aspects of Visual Studio.  If you are looking for anything that’s related to ALM and Visual Studio, this should be the first place to look. Check it out: http://msdn.microsoft.com/visualstudioalm

TFS 2010 bug in upgrade process

Last week after upgrading a TFS 2008 environment to TFS 2010, we discovered that our merge history was no longer correct. After some investigation I found this post by Brian Harry where he explains that their is a bug in the TFS upgrade process. '”We have discovered a potentially serious issue that can affect upgrades from TFS 2005 or TFS 2008 to TFS 2010.  The issue is triggered by a specific pattern of labels, renames, deletes and/or branches that existed before the upgrade.  Once the upgrade is complete the contents of the affected labels could be incorrect.  Also some internal merge tracking data could be incorrect, resulting in the need to reapply previous merges.”   There is already a hot fix available here : http://code.msdn.microsoft.com/KB2135068 . Apply the fix after the initial installation, but before you start the Team Foundation Server configuration. Therefore uncheck the “Launch Team Foundation Server Configuration Tool” checkbox at the end of the installation.  Unf

DB2 Error codes

One of the things that make working with IBM DB2 hard, are the very useful(read: useless) errorcodes you get back. No other information is returned so you don’t have a clue what’s going on. To find the corresponding error message, you have two options: Browse to the IBM site and search for the error. For people who have already tried finding their way in this site, it’s very easy to get lost. Search for the error message using the DB2 tools. Let’s have a look at the second option: Open a DB2 command window Execute "db2 ? [errorcode]" One sample. When the Error Code was SQL0668N than execute: 1: db2 ? SQL0668N This will return a list of reason codes and their explanation.

Free Visual Studio 2010 Database Edition for Oracle

A lot of developers among us have to work with Oracle databases. Unfortunately the Visual Studio 2008 Database Edition only supported SQL Server databases. With the release of Visual Studio 2010, Quest, the organization behind well-known database tools like TOAD, have released a database edition plugin that supports Oracle. This Toad Extension for Visual Studio 2010 even supports more features than the SQL Server version! To make it even better, Quest has just released their FREE version of the Toad Extension for Visual Studio 2010 . Developers with a Visual Studio 2010 Professional License can now manage database change under source control as they can for SQL Server. Important remark: Developers that use Visual Studio Premium and Ultimate, still need the Commercial version of Toad Extension for Visual Studio.

Debugging databinding

WPF and Silverlight are great thanks to the rich databinding support. Important to notice is that late bound data binding is used bindings in XAML files. This feature allows a DataContext to be set at run-time and the objects within that DataContext to resolve their property bindings then. This late binding enables cool features like DataTemplates, composable applications and run-time loading of loose XAML. A side effect of late bound binding resolution that databinding will fail silently if a value can not be found.  So troubleshooting why a specific field is not loaded in a control can be painfull. Therefore some tips to get some useful debugging information. View the Debug Output Window If you have the DataContext set, any data bindings within that DataContext that can't be resolved will be listed in the Debug Output Window at run-time. WPF Trace Settings, Data Binding The default value of the WPF Trace Settings, Data Binding is "Error." To get more data binding inform