Friday, June 28, 2013

Team Foundation Server 2012: Customize the quick add panel

On the TFS 2012 Product Backlog page on the Web Access, you’ll find the quick add panel, a fast and easy way to add new work items to your product backlog. By default, you can only specify a Title field but it is possible to customize it and add more fields.

image

Here are the required steps to customize the panel:

  • Open a command line console and navigate to the Visual Studio Common7\IDE folder(or open a Developer Command prompt for VS2012).
  • Call the Witadmin tool with the exportagileprocessconfig option to export the agile process configuration file.

witadmin exportagileprocessconfig /collection:http://tfsserver:8080/tfs/defaultcollection /p:ProjectName /f:c:\agileconfig.xml

  • Open the exported xml file and locate the AddPanel element.

image

  • Add a field element that specifies the reference name of the TFS field that you want to add to the panel.

image

  • Save the file
  • Call the Witadmin tool again but this time with the importagileprocessconfig option to import the updated configuration file.

witadmin importagileprocessconfig /collection:http://tfsserver:8080/tfs/defaultcollection /p:ProjectName /f:c:\agileconfig.xml

  • That’s it!

Thursday, June 27, 2013

Effort - Entity Framework Unit Testing Tool

Effort offers a solution for the hard to (unit)test Data Access Logic in your application. Effort is basically an ADO.NET provider that executes all the data operations on a lightweight in-process main memory database instead of a traditional external database.

From the Codeplex site:

What is Effort?
Effort is an easy-to-use tool that enables a robust way of testability for applications that rely on Entity Framework.

Where does the name come from?
Effort is an acronym of Entity Framework Fake ObjectContext Realization Tool. Obviously it is also able to work with DbContext objects.

How does it work?
It emulates the relational database server with a completely .NET based lightweight in-memory database. All the data operations are redirected to it, so the tests can run completely in-process.

Getting started
  • Create an Entity Framework DbContext like you’re used to(Model First, Code First,… it doesn’t matter):
  • Add a second constructor to the DbContext class that allows you to specify a connection string:
  • Include the Effort library to your project using NuGet.

image

  • A fake database also requires fake data. Effort allows you to populate the database using CSV files. The first line contains the name of the table fields; each remaining line represents a data row. Each table requires its own CSV file named as {table name}.csv (e.g. in this case: Products.csv).
  • Let’s now write our test and add some initialization logic to create the fake context and load the CSV data:
  • And as a last step let’s write the test of course:

Wednesday, June 26, 2013

Metro theme for Bootstrap

If you like the Windows 8 ‘Metro’ UX and you want to provide a similar experience in your web applications, go have a look at the Cosmo Bootstrap theme.

It contains a set of customized fonts, navigation bars, buttons, forms, and so on…

image

Tuesday, June 25, 2013

SQL is Hard

Despite the simplicity of Entity Framework, NHibernate or other ORM solutions, sooner or later you still have to write some SQL(unless you are using a NoSQL solution of course).

If you lack some SQL knowledge, go have a look at SQLisHard.com. SQLisHard.com provides guided, interactive exercises to help you learn T-SQL against a live SQL Server database.

image

Monday, June 24, 2013

Free JavaScript ebooks

Looking for some JavaScript books? Maybe you can find what you want on JSBooks.

And best of all it’s free!.

image

Friday, June 21, 2013

Team Foundation Server local workspaces: the .tfignore file

Team Foundation Server 2012 introduced the concept of local workspaces. A local workspace offers several advantages compared to a server workspace.  It allows you to work offline easily. You can perform core version control operations even when you're not connected to your Team Foundation Server.

By default certain types of files (for example, .dll files) are ignored by version control(this information is stored in the registry). So if you want to change the list of files that are excluded, you can change the registry key.

However this is not the only way: you can also specify which kinds of files are ignored by placing text file called .tfignore in the folder where you want rules to apply. The effects of the .tfignore file are recursive. However, you can create .tfignore files in sub-folders to override the effects of a .tfignore file in a parent folder.(This is similar to what a .gitignore file does in GIT)

The following rules apply to a .tfignore file:

  • # begins a comment line

  • The * and ? wildcards are supported.

  • A filespec is recursive unless prefixed by the \ character.

  • ! negates a filespec (files that match the pattern are not ignored)

An example:

Thursday, June 20, 2013

Team Foundation Server: change cache location

To reorganize the disk usage on our Team Foundation Server, I decided to move the TFS cache folder to a different location. TFS uses a specific folder to cache files that are under version control on the application-tier server. By default, this cache is enabled so that users can download files more quickly from the cache instead of directly from the database.

To change the cache location execute the following steps:

  • Create a new folder on the application tier.
  • Give the TFS_APPTIER_SERVICE_WPG local group Modify permissions on this folder.
  • Go to the web.config path of the TFS webservices(by default this is %programfiles%\Microsoft Team Foundation Server 2012\Application Tier\Web Services).
  • In the appSettings section add a line that points to the folder we created:
    • <add key="dataDirectory" value="NewCacheRootFolderLocation" />
  • Save the file.
  • Do an IISReset.

More information can be found on http://msdn.microsoft.com/en-us/library/vstudio/ms400793.aspx.

Wednesday, June 19, 2013

Entity Framework: Calling SQL Server specific functions

Calling a SQL Function from your Entity Framework LINQ query is easy thanks to the availability of the SqlFunctions class. This class provides methods that call functions in the database in LINQ to Entities queries.

Here is an example where I call the DatePart function:

Remark: The SqlFunctions specifically apply to SQL Server and cannot be used for other databases.

Tuesday, June 18, 2013

Linq: group by multiple values

For an application I’m building I had to group a set of results by 2 key values. Doing this using LINQ is a piece-of-cake:

Monday, June 17, 2013

Error when uploading package to Windows Azure

When trying to upload a package to Windows Azure, it failed with the following error message:

  • The certificate with thumbprint {guid} was not found.

clip_image001

This was on a machine where I never deployed the Azure package before. So the reason was easy to figure out:

I had enabled "Enable Remote Desktop for all roles".  This added the following line to my ServiceConfiguration.Cloud.cscfg and ServiceConfiguration.Local.cscfg:

<Certificates>
     <Certificate name="Microsoft.WindowsAzure.Plugins.RemoteAccess.PasswordEncryption" thumbprint="C1D8FB16365D7CD3B918849346FAAD2F9BA43AE6" thumbprintAlgorithm="sha1" />
</Certificates>

But on this system I didn’t had the remote certificate installed locally. So you have 2 options to solve this:

  • Replace the Remote Desktop certificate with a new one
  • Copy the Remote Desktop certificate from another machine over to the current machine

Friday, June 14, 2013

Team Foundation Server 2012 Health monitoring

In previous versions of TFS, I used some Administrative reports to monitor the health of TFS. In TFS 2012, some reporting is built-in, although well hidden inside the TFS Web Access.

To access this information browse to the following URL: http://{servername}/tfs/_oi/. This will open up the TFS Control Panel with 2 tabs:

  • Activity Log: Shows you a list of recent actions
  • Job monitoring: Allows you track all TFS jobs, their execution time and the current job queue

image

Activity Log

The Activity log can be filtered by Team Project Collection and user. Results can be exported to CSV for further processing.

image

Job Monitoring

The Job Monitoring is further split into 3 sections:

  • Job Summary
  • Job Queue
  • Job History

The Job Summary contains the following reports:

  • Total Run Time For Each Job: displays total amount of run time a particular job has taken over the time period.

TotalRunTimeForEachJob

  • Results Count: displays the number of different result types over the time period.

ResultsCount

  • Number Of Jobs Run: displays the number of times a job has run combined with the number of result types for that particular job.

NumberOfJobsRun

The Job Queue contains the following reports:

  • Job Queue Types: describes the job queue; it provides the counts for each queue type.

JobQueueTypes

  • Job Queue Details:  list of job queue entries for the specific type.

The Job History contains the following reports:

  • Average Run and Queue Time With Total Number of Jobs: combines the average queue time and run time for jobs; you can also view how many jobs were run at each hour.

AverageRunAndQueueTime

  • Job History: shows the job history results over the stated period of time (up to 500 entries).

image

Thursday, June 13, 2013

Clean code cheat sheet

Looking for some principles, patterns, smells and guidelines for:

  • clean code
  • class and package design
  • TDD – Test Driven Development
  • ATDD – Acceptance Test Driven Development
  • Continuous Integration

?

Urs Enzler created the a new version of the Clean Code Cheat sheet, a short and useful list of DOs and DONTs for every professional software developer.

image

Wednesday, June 12, 2013

Windows Azure announcement: Per Minute Billing and No Charge for Stopped VMs

I think the Windows Azure team never sleeps because they keep releasing new features at an incredible pace.

Last week Scott Guthrie announced some great enhancements to Windows Azure:

  • Dev/Test in the Cloud: MSDN Use Rights, Unbeatable MSDN Discount Rates, MSDN Monetary Credits
  • BizTalk Services: Great new service for Windows Azure that enables EDI and EAI integration in the cloud
  • Per-Minute Billing and No Charge for Stopped VMs: Now only get charged for the exact minutes of compute you use, no compute charges for stopped VMs
  • SSL Support with Web Sites: Support for both IP Address and SNI based SSL bindings on custom web-site domains
  • Active Directory: Updated directory sync utility, ability to manage Office 365 directory tenants from Windows Azure Management Portal
  • Free Trial: More flexible Free Trial offer

The one feature I liked the most(and my credit card will agree) is the Per Minute Billing and No Charge for Stopped VM's.  Before when you stopped a VM(without deleting it), Microsoft continued to bill you for the VM. With this update, when you stop a VM you are  longer charge you any compute time for it while it is stopped. And all deployment data and configuration is safely stored.

The other one is that the pricing model changed from per-hour to per-minute. Before when you ran a VM for 6 minutes, you would still be charged for a full hour of usage.  With the new pricing model, you only pay for the actual 6 minutes of compute usage.

Keep going guys!

Tuesday, June 11, 2013

Enable a wireless connection in Windows Server 2008(R2)

For testing purposes I configured a laptop with Windows Server 2008(R2). However I couldn’t connect to the Internet via wireless. I first thought that some drivers were missing but even after installing the WiFi drivers myself, I still couldn’t connect.

I discovered that by default Wireless is disabled in Windows Server 2008(which makes sense if you start thinking about it).

To enable it, execute the following steps:

  • Open the Server Manager.
  • Click on the Add Features button in the Features Summary.
  • In the Add Features Wizard, select the Wireless LAN Service.

wirelesslan

  • Click Next to confirm the selection.
  • Click Install to start the installation process.
  • Click Close after the installation completed.

Now you should have the option to choose a WiFi network.

Monday, June 10, 2013

Yelo TV for Windows 8 released

Normally I don’t talk about the exact projects I’m doing for customers. Mostly because the larger part of these applications are build for internal using. But for once I make an exception. Last week Telenet, a Belgian Telecom company, released YeloTV for Windows 8(announcement in Dutch).

I’m proud to be part of the team that created this application(although I have to admit I only contributed a small Windows Azure component to the application) It’s a good example of how to build a great touch friendly Windows 8 app.

Congratulations to the whole team!

OpnamesYeloTV

TVGidsYeloTV

StreamingYeloTV

Friday, June 7, 2013

DebugSettings.IsOverdrawHeatMapEnabled property

When looking at some ways to optimize the performance of my Windows Store application, I stumbled over the following property: DebugSettings.IsOverdrawHeatMapEnabled.

This property helps you determine where and when an app draws objects on top of one another. It’s not uncommon to find objects being drawn that you may not have known were even in the scene.

Venn diagram with three solid circles Venn diagram that shows overlapping areas

This visualization is useful during application development for detecting layout, animation, and other operations that are graphics processing intensive.

Some other useful tips can be found in the Optimize loading XAML article.

Thursday, June 6, 2013

My journey in discovering Grunt: A JavaScript Task Runner

Some weeks ago, I was looking at the html2canvas library on GitHub. I wanted to test the code so I decided to clone it to my local repository. However the source code is split over multiple files, so if you want to use it inside your application you have to build it first.
My first naïve attempt, was just running the grunt.js file as found in the project directory. This failed with the following message:
clip_image002
Going back to the project site, I found that you have to use Grunt(a node.js plugin) for building:
The library uses grunt for building. Alternatively, you can download the latest build from here.
Run the full build process (including lint, qunit and webdriver tests):
$ grunt
Ok, let’s try this. I opened a command window and tried to execute the command(notice that I already have node.js installed on my machine):

npm install -g grunt-cli

This will put the grunt command in your system path, allowing it to be run from any directory.

Let’s now run the grunt command(you can use both grunt and grunt.cmd):

clip_image002[5]

Woops. No success. I figured out that I was using a more recent version of Grunt than the project was using. In the meanwhile the convention had changed and instead of having a grunt.js file in your project directory, you need to name it gruntfile.js(More info here: http://gruntjs.com/getting-started).

clip_image002[7]

The Gruntfile.js or Gruntfile.coffee file is a valid JavaScript or CoffeeScript file that belongs in the root directory of your project, next to the package.json file, and should be committed with your project source.

A Gruntfile is comprised of the following parts:
· The "wrapper" function
· Project and task configuration
· Loading grunt plugins and tasks
· Custom tasks
Run the command again, still failure:


image

Grunt itself is doing nothing, it only loads a set of plugins and tasks and execute them. It seems that grunt tried to execute some tasks that I didn’t install. So let’s install the missing packages and try again:

 image

Ok, last attempt, this time we finally got Grunt working:

image

And now I have a nice new tool in my toolbox.

image

For a good introduction on Grunt, I can recommend reading http://www.elijahmanor.com/2013/04/angry-birds-of-javascript-mighty-eagle.html

Wednesday, June 5, 2013

Hosting a WCF service inside an ASP.NET MVC project

Adding a WCF service to an ASP.NET MVC project, just choose Add new item and choose the WCF Service item. However when you try to connect to your WCF service(e.g. http://localhost:8000/sampleservice.svc), you’ll end up with the following exception:

“Resource not found”

The WCF service URL interferes with the default MVC routing so instead of loading up the WCF service, the ASP.NET MVC framework tries to find a matching controller and action.

To fix this, extend the routing with 2 extra ignores:

Tuesday, June 4, 2013

Change the log directory in IIS

Last week, a developer entered my office telling me that he couldn’t check in his code into the Team Foundation Server Source Control. Instead he got an error message although he forgot what the message was saying… Verwarde emoticon

I connected to our Team Foundation environment and noticed the problem immediately, the OS disk  was filled up with data leaving a 600k of free disk space behind. And although TFS is a really great system, it cannot function with just so little disk space.

Some further investigation on the server brought us to the conclusion that almost 10GB of IIS logs were eating up all this disk space.

Luckily, this is easy to solve, let’s move the IIS logs to another disk:

  • Connect to the server
  • Open the Internet Information Services Manager
  • Click on the Server name
  • Double-click on the Logging icon

image

  • Change the log directory to a different path

image

  • Don’t forget to click Apply to confirm the changes

The new directory will be created (if it doesn’t already exist) when the next log entries are written by IIS.

Monday, June 3, 2013

SQL or NoSQL, that’s the question…

imageAre you still using your ‘old school’ relational database or do you want to work with one of the hip and funky NoSQL(Not Only SQL) solutions?  Either way your applications will probably have to store some data. To help you find the best solution for your problem domain, the Microsoft Patterns & Practices team released a new guide about Building Highly-Scalable Solutions for Storing and Retrieving Data (Using SQL and NoSQL Databases) 

From the guide:

This guide focusses on the most common types of NoSQL database currently available, describes the situations for which they are most suited, and shows examples of how you might incorporate them into a business application. To illustrate good practice, the guide summarizes the experiences of a fictitious organization named Adventure Works, who implemented a solution based initially on a relational database. Some inefficiencies in the resultant system caused them to modify their system to take advantage of different NoSQL databases to better handle a set of common business scenarios.

Download it here.