Category: Software development

0

CI with Jenkins, MSBuild, Nuget and Git part 2

In part 1 of this blog series we had a look at a very basic MSBuild script which enables us to compile our projects. For doing this I provided you guys with a simple batch file to make it even more simple to execute the build script. In this episode we will focus on cleaning the folders before building again and getting the Nuget packages using Nuget package restore. The latter I will explain further for you first. Nuget package restore can be enabled in Visual studio. A best practice is to enable this always, because then we won’t have to put all Nuget packages in source control. By enabling it, every team member will download the missing packages automatically when building his project in Visual Studio. However the build server won’t do this by default so we create a custom target in our build script to make this happen.

0

CI with Jenkins, MSBuild, Nuget and Git part 1

Very lately I have worked on setting up some continuous integration (CI) using MSbuild for my c# project. In this blog series I will explain to you how to set up continuous integration. First of all we will start with creating a MSBuild script which will compile our code. We will also create a small batch file for easy executing the MSbuild script. When that is in place, we will add several targets to the build script to run for example unit tests, integration tests, code coverage, packaging etc. So we will take the agile approach and improve our build process based on validated learning. First of all we need some basic knowledge about MSbuild. I think there are enough pages around on the web which will give you a basic introduction. A good starting point would be the MSDN documentation for MSBuild. Let’s consider we have the following project structure within our Git repository / local file system. src (contains our source code) lib (contains build output, and third party libs not available on nuget) reports (contains code coverage reports, test scenarios and test results) ci.msbuild (your msbuildfile) ci.msbuild.cmd (your batch file to execute the build on your local machine)

0

Recap my online year 2012

The year 2012 was for me a year that went way to fast. In the year 2012 I learned a lot new stuff, wrote several blog posts and read lots of blog posts and articles. First of all I want you to give a list of all blog posts I wrote this year. You can find the complete list here http://marcofranssen.nl/2012/ and here http://marcofranssen.nl/2012/page/2/. JavaScript http://marcofranssen.nl/writing-modular-javascript-without-polluting-the-global-namespace/ http://marcofranssen.nl/knockout-js-mappings/ Windows 8 http://marcofranssen.nl/install-windows-8-consumer-preview-on-vhd/ http://marcofranssen.nl/install-windows-8-from-rusty-256-mb-usb-stick/ Windows Phone http://marcofranssen.nl/minesweeper-7/ http://marcofranssen.nl/shortify-for-windows-phone-7/ http://marcofranssen.nl/sokoban-7/ http://marcofranssen.nl/windows-phone-theme-colors/ ASP.NET MVC http://marcofranssen.nl/secure-your-web-app-fluently/ .NET C#  http://marcofranssen.nl/delegate-your-equality-comparisons/ Powershell http://marcofranssen.nl/unblock-downloaded-files-with-powershell/ I even wrote a non-technical article http://marcofranssen.nl/pitching-equals-invisible-convincing/ Second I want to share my starred articles from my reading archive. I used pocket to bookmark, read and archive my articles, which enables me now to share all starred articles with you.

0

Knockout JS mappings

Knockout JS is a JavaScript library for creating MVVM JavaScript libraries. In a previous post I already showed some of the cool features of Knockout. http://marcofranssen.nl/knockout-that-cascading-dropdown/ If you want to spike your knowledge on Knockout a little more first, please visit Knockout’s documentation. In this article I want to zoom in on the Knockout mapping plugin. The Knockout mapping plugin enables you to easy map your JSON object into an observable JavaScript object. So here is a short example of what you’ll be able to do with it. So when you do an ajax request and receive a JSON result you can for example do the following. 12345678910111213141516var viewModel;// result could look like this: "{ "personId": 1, "firstName": "Marco", "lastName": "Franssen", "age": 26, "webpage": "http://marcofranssen.nl", "twitter": "@marcofranssen" }"$.ajax({ url: 'http://somewebpage.net/getPerson' type: 'GET', dataType: 'JSON', success: function (result) { var data = JSON.parse(result); viewModel = ko.mapping.fromJS(data); ko.applyBindings(viewModel, $('#person').get(0)); }, error: function (result) { //handle the error, left for brevity }});

0

Windows Phone Theme colors

When developing Windows Phone apps I love to use the theme accent colors in my apps. Since there are some new theme colors in Windows Phone 8 I started searching for their color codes. Lucky me I found them on msdn.aspx#BKMK_Implementation “Theme for Windows Phone”). Now you may be thinking how to use the colors in your own Windows Phone apps. The Color object doesn’t contain a color called Emerald. So I created a small class to help me out with this issue. First of all I created a small static helper method to convert the hexa colors to a color object. So we are able to put in the hexa color string and the function returns a color for us. 123456789public static Color FromHexa(string hexaColor){ return Color.FromArgb( Convert.ToByte(hexaColor.Substring(1, 2), 16), Convert.ToByte(hexaColor.Substring(3, 2), 16), Convert.ToByte(hexaColor.Substring(5, 2), 16), Convert.ToByte(hexaColor.Substring(7, 2), 16) );} Then I made some properties that caches the colors for us on their first use. The Color properties looks like this.

0

Secure your web app fluently

When building a big web application with ASP.NET MVC 3 I ran into a problem to secure my web application in a maintainable way. There are lots of examples with attributes, but this isn’t maintainable. So I started searching for other solutions, however most of the information is leaning on those un-maintainable attributes I finally found “Fluent Security“. What does Fluent Security offer you? Fluent Security provides a fluent interface for configuring security in ASP.NET MVC. No attributes or nasty xml, just pure love. Go get it on NuGet! What does that mean? Well it simply means you can bootstrap your security just from your Application_Start() and maintain it on a single place. Besides that you can easily unit test your security setup. So you can test if your security configuration matches the security setup you described in your unit tests. This is a huge advantage because you know for sure the controller actions are secured the way you like it without having the need to click through your complete web application. You can only fail when not defining your tests correctly. That’s not all… You can easily extend, modify etc. by adding your own implementations of the interfaces. Let me start to show you some code so you see for yourself how easy it is! My example is based on a default MVC 3 application and I have added a CategoryController like below to have some extra actions for my example.

0

Sokoban 7

Sokoban 7 is a classic puzzle game, the first version of Sokoban was published in 1982. Now it is also available on Windows Phone. The game includes 50 levels and will gain periodic updates with new l

0

Delegate your equality comparisons

When using Linq on your Entity Framework objects, you often need to distinct your query results. Therefore you need to implement an IEqualityComparer for the more advance scenario’s. For example if yo

0

Minesweeper 7

Today will be again a milestone for me. Today my first Windows phone app “Minesweeper 7” got certified. This app is just a port of a minesweeper version I made once with winforms. It is very basic and

0

Pitfall in FakeItEasy

The current project I’m doing is a CQRS based project, using the ncqrs framework. Today I came to a phase I needed some mocking done for some of my domain services. I choose FakeItEasy to handle this

0

Some notes on the DDD/CQRS Course

In this blog post I work out some of the notes I made in Greg Young’s DDD/CQRS course in Krakow Poland. In Domain Driven Design there are some important things to think about. In DDD we make a differe