Skip to main content

Posts

Showing posts from February, 2015

Microsoft Engineering Guidelines

Microsoft has put a list of Engineering Guidelines online. This document is their if you want to contribute to any of the open-sourced components that Microsoft has(and that’s a long list ). Now if you want to contribute some code or not, I can recommend to check these guidelines. There is a lot of useful information inside. (Always cool to look inside the head of the Microsoft software engineers )

SQL Server Data Tools: Setup Continuous Integration for your Database Projects

In Visual Studio 2013, the SQL Server Data Tools are available out-of-the-box. They give you a new project template, the Database project, that allows you to manage your database objects and scripts in a structured way. In this post I want to explain how you can enable continuous integration and automatically deploy your database changes each time you check-in some code. Preparation Before we start make sure that you created a database project and added some database objects. On your TFS build agent, the SQL Server Data Tools should also be installed. If you are using Visual Studio Online(like I will do) together with a hosted Build Controller, the Data Tools are already installed.(Here is the full list of installed components: http://listofsoftwareontfshostedbuildserver.azurewebsites.net/ ) Add a Publish Profile Open Visual Studio and load your Database Project. Once Visual Studio is ready, right-click on your Database Project and click on Publish… The Publish Data

Microsoft Virtual Academy–Web Development Wednesdays

Microsoft Virtual Academy started a new initiative to get you going as a Web Developer: the Web Development Wednesdays. Every Wednesday they release a new web development training session where they explore platforms, frameworks, and everything somewhat related to web development. From the site : Web developers, do you want help navigating the modern world of web development? Join us for Web Wednesdays, an online web development training series, as we explore platforms, frameworks, and browsers to connect data and people. Entertaining and informative experts address scalability, design, and performance issues in each of these online web development courses. This training for web developers offers practical tips and explores real-world scenarios to help make your job easier. Don’t miss these opportunities to get the rest of the “web story”! These sessions are offered for free, so no excuse for not signing up…

TFS Build Definition–Loading process template takes forever

While preparing a demo for a session I give later this week, I stumbled over the following problem: I created a Build Definition for a build controller in TFS Online. When I try to edit the build definition(Right click –> Edit Build Definition…) and go to the Process tab, the only thing that shows is a ‘Preparing build definition environment’ message and an endless spinning wheel… I found the issue on Connect but it was closed as ‘Not reproducable’ . Anyone with a solution? Update: The workaround mentioned on the Connect site; repairing Visual Studio; solved the problem for me. 

Nice quote: The Legacy Code Dilemma

The Legacy Code Dilemma: When we change code, we should have tests in place. To put tests in place, we often have to change code. Michael Feathers

Impress your colleagues with your knowledge about…String.Intern

Sometimes when working with .NET 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 S tring.Intern(). The String.Intern() method allows you to internalize string values explicitly. Ok, but what does this mean? In a typical .NET application, the same string values are used over and over again. As this would end up with a lot of duplicated memory, .NET will allocate strings with unique content just once by using the string interning mechanism. This leads to the question. As this interning is done for you, why do we need this method?  The thing is that only explicitly declared string literals are interned on the compile stage. The strings created at runtime are not checked for being already added to the string intern pool. To solve this problem .NET offers two methods: String.Intern and String.IsInterned . If the string value pa

Securing your OWIN middleware through Security Headers

If you like at the OWASP site, you’ll find a while list of common security-related HTTP headers that every web application should implement. These headers are an essential part of building a secure web application. If you are too lazy to click on the link, here is the full list: Strict-Transport-Security X-Frame-Options , Frame-Options X-XSS-Protection X-Content-Type-Options Content-Security-Policy, X-Content-Security-Policy, X-WebKit-CSP Content-Security-Policy-Report-Only There are multiple ways to add these security headers to you application. You can configure IIS to include them, add some extra ASP.NET (MVC) configuration or you can build some OWIN middleware to add these headers to every HTTP request. If you decide to use OWIN, be aware that most of the work is already done for you. On GitHub I found the SecurityHeadersMiddleware project which implements most of the headers mentioned above. Get started The easiest way to get started is t

Simplify OpenXML editing

Working with OpenXML is not that easy. Although very powerful, the XML structure is complex especially when you want to programmatically edit existing OpenXML documents. One tool that can help you to make this job somewhat easier are the PowerTools for Open XML . It contains a wide range of features and guidance for accomplishing various tasks using the Open XML SDK. While browsing through the code, a colleague discovered the following hidden gem inside the PowerTools: the MarkupSimplifier class. This class allows you to cleanup an OpenXML document before you start editing it. The end result after the cleanup operation is a simplified XML structure that is easier to manipulate using the OpenXML SDK .

Angular 1.3 $pending

Inside an Angular 1.3 sample, I noticed the usage of ‘$pending’. Strange, never seen that object before. Let’s find out where it’s useful! ‘$pending’ finds it use together with the new $asyncValidator pipeline. The $asyncValidator pipeline contains validation rules that will typically be rules that needs server-side logic to make a decision. As long as the async validation rule promise isn’t resolved $pending will return true. This can be useful to give the users a visual indication while the validation rule is executing.

Angular: jQuery events not firing

On a web application we were building I had a strange issue. A jQuery widget was working as expected until I also tried to use it inside an Angular application. The widget that was responsible to expand or collapse a panel, refused to work. Clicking on the panel header had no effect anymore. This was one of those situations where the solution is obvious afterwards, but I had no clue at first what was going on . When looking inside the widget, I found code similar to this: Nothing wrong with that code you should say! Unless you realize that this code is only executed when the DOM is ready. The HTML views that are loaded by Angular are loaded afterwards when the document ready already fired. So the initialization logic for the widget is not executed for new elements loaded by Angular. To fix it, I updated the widget to use the (newer) jQuery event delegation syntax: So simple, once you know it…

Angular.js IntelliSense in Visual Studio

Today Visual Studio already offers you Angular.js IntelliSense. However it’s functionality is limited to a standard list of keywords and doesn’t recognize your own directives, controllers, etc… This is because the JavaScript editor doesn’t understand the way that Angular dynamically loads object references when your app is launched. John Bledsoe , a member of the Visual Studio community, created a great extension that helps the Visual Studio editor with this. By simulating the execution of your Angular application as you write your code, it provides a significantly better IntelliSense experience. How to use it… To get started, you need to install the AngularJS extension for Visual Studio. To do this, download the angular.intellisense.js file and place it in the Program Files (x86)\Microsoft Visual Studio 12.0\JavaScript\References folder. More information about this extension can be found here: http://blogs.msdn.com/b/visualstudio/archive/2015/02/05/using-angularjs-in-visual-s

CSS: Highlight current row and column

A while ago, we had  to write some functionality to highlight the current row and column for the current active cell inside an HTML table. I didn’t pick up the work item but a colleague implemented the functionality. I don’t know the exact implementation details anymore, but I do know that it involved a large amount of custom JavaScript and CSS code(at least a lot more than I expected). Recently I found another clean solution(with far less code) to implement this functionality on css-tricks . No idea, if I ever get a similar question, but just in case, I post the link here…

Unit Testing Examples

If you tried to write Unit Tests before, you know it can be hard. If you are looking for a little guidance, check the Unit Testing Examples and Labs on Github created by Dan Hellem. It covers the very basics to more in-depth materials such as dependency injection, mocking, and TDD. Here is the full list of covered topics: MSTest Unit Testing Basics XUnit Mocking Mocking Frameworks Dependency Injection TDD Data Driven Tests SSDT (Testing Stored Procedures) Exceptions Testing your JavaScript Jasmine Web Api Rest Services

Microsoft Azure Cloud Roadmap

With the continuous flow of new functionality that is announced, in preview, in GA(General Availability), and so on… provided by the Azure team, it is impossible to keep up-to-date. When customers ask me if feature X is already available on Azure, my default answer was ‘I have to look it up, I’ll come back to you’. And than I had to spend a long time searching through the Azure Portal, blog posts, forums,… before I could return to my customer with a good(at least better than ‘I don’t know’) answer. Recently, Microsoft made my job as a consultant a little bit easier. They created the Cloud Platform Roadmap website .  The Cloud Platform roadmap provides a snapshot of what we’re working on in the Cloud Platform business. Use the roadmap to find out what we’ve recently made generally available, released into public preview, are still developing and testing, or are no longer developing. In a nice and structured way, all features are shown grouped by the following topics: Clou

GitHub Training

Interested in using GitHub? But you don’t know where to start. The Roslyn team put their internal training, done by Jared Parson , online. Roslyn on GitHub from Immo Landwerth

Pace.js–A great progress bar for all your web applications

Pace.js gives you a beautiful progress indicator for your page load and AJAX navigation. What makes it even better is you don’t need write any code to get it working. Pace will hook into your browser events and detect progress automatically. Can it be any easier? More information can be found here: http://github.hubspot.com/pace/

Angular.js: re-use your validation messages

One really handy trick with Angular's ng-messages module is the ability to re-use messages. Instead of specifying the list with possible validation messages over and over again for every form field, just create one HTML template and load that: In case you don’t want a generic validation message or want to add extra validation messages, this remains possible as well:

Pickles–Generate documentation from your SpecFlow tests

I’m a big fan of SpecFlow, a BDD framework that allows you to write your tests as executable specifications. A colleague mentioned another tool, Pickles , that generates documentation in a variety of formats from your specifications. Time to give it a try… Installing Pickles The easiest way to integrate Pickles in your project is to download it through NuGet. So let’s do that first: Install-Package Pickles This will download the Pickles Powershell DLL and load it in the Package Manager shell. Running Pickles from Powershell Let’s write some Powershell code to test Pickles. First initialize some variables to simplify the readability: And now invoke the Pickle-Features command: You should see similar results like below: Let’s have a look at the generated results. You get a nice website which shows you all the features and their test results: Specflow also supports other formats then HTML. Here is the full list: HTML DHTML (javascript-enabled,

Free eBook: The developer’s guide to the new .NET

2015 will be an important year for the .NET framework. What started end 2014 with .NET going Open Source, will continue in 2015 with the release of Roslyn, C# 6.0, .NET on Mac and much more… Michael Crump and Sam Basu released a free (registration required) eBook “ The Developer’s Guide to the new .NET ”. This book gives you a quick and easy-to-read tour through all the new and upcoming changes in .NET and its ecosystem.