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 )
Friday, February 27, 2015
Thursday, February 26, 2015
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.
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 Database window is loaded. Click on Edit… to add a connection string to the database where you want the database project published to. Afterwards click Save Profile As… to save the Publish profile and add it to your Database Project.
As we don’t want to deploy immediately, you can click on Cancel to close the window after the Publish profile is saved.
Creating a new Build Definition
Now everything is configured correctly, it’s time to open up Team Explorer(View –> Team Explorer).
Go to the Builds tab to add a new Build Definition.
Specify a name for your Build and move on to the Trigger tab.
Set the Trigger type to Continuous Integration and jump directly to the Build Defaults tab.
On the Build Defaults tab, select the Build Controller where the SQL Server Data Tools are installed. In my case I’m using Visual Studio Online, so I choose the Hosted Build Controller. I also choose to copy the build results to a Drops folder inside source control. Let’s move on to the Process tab.
On the Process tab, open up the Advanced section and paste the following line in the MSBuild Arguments field:
/t:build /t:publish /p:SqlPublishProfilePath=NorthwindDBProject.publish.xml
Replace the SqlPublishProfilePath value with the name you choose for your Publish Profile in the Database Project.
Save the Build definition, you are done! There are a lot of other things, you can configure, but by default, this should be enough.
Check-in and see what happens…
As a last step, do some changes inside your database project, check them into TFS, and look how your database is rolled out for you…
Wednesday, February 25, 2015
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…
Tuesday, February 24, 2015
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.
Monday, February 23, 2015
Friday, February 20, 2015
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 String.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 passed to String.Intern is already in the pool, the method returns the reference to the string. Otherwise, the method adds the string to the pool and returns the reference to it. If you want to just check if a string is already interned, you should use the String.IsInterned method. It returns the reference to the string if its value is in the pool, or null of it isn’t.
Thursday, February 19, 2015
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:
- X-Frame-Options, Frame-Options
- Content-Security-Policy, X-Content-Security-Policy, X-WebKit-CSP
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.
The easiest way to get started is to install the package using NuGet: Install-Package SecurityHeadersMiddleware
Inside your startup.cs class, you can now add some code to enable the headers:
More information can be found here.
Wednesday, February 18, 2015
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.
Tuesday, February 17, 2015
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.
Monday, February 16, 2015
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…
Friday, February 13, 2015
How to use it…
More information about this extension can be found here: http://blogs.msdn.com/b/visualstudio/archive/2015/02/05/using-angularjs-in-visual-studio-2013.aspx
Thursday, February 12, 2015
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…
Wednesday, February 11, 2015
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
- Mocking Frameworks
- Dependency Injection
- Data Driven Tests
- SSDT (Testing Stored Procedures)
- Web Api Rest Services
Tuesday, February 10, 2015
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:
- Cloud infrastructure
- Enterprise Mobility
- Data management and analytics
- Application development
- Internet of Things
- Recently Available
- Public Preview
- In Development
Read the official announcement here: http://blogs.technet.com/b/server-cloud/archive/2015/01/30/increasing-visibility-for-our-customers-announcing-the-cloud-platform-roadmap-site.aspx
And again, my life just became a little bit easier
Monday, February 9, 2015
Friday, February 6, 2015
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/
Thursday, February 5, 2015
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:
Wednesday, February 4, 2015
Tuesday, February 3, 2015
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…
The easiest way to integrate Pickles in your project is to download it through NuGet. So let’s do that first:
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:
For more information, have a look at the following links:
Monday, February 2, 2015
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.