Before starting to explain how you start your first Node.js project for building a simple web server I will first explain you what Node.js is. To do so I just include a quote of the Node.js themself, because I don’t like to reinvent the wheel.
The next thing you should know is about the Node.js Package Manager (NPM). Using NPM you can benefit from the thousands of open source packages so you won’t have to build everything yourself.
I suppose you already have installed Node.js. Let’s start with a simple Hello World in Node.js by creating a file called hello-world.js and execute our script to show the result.
We can execute the script using following command. (On Windows open the Node.js command prompt) Navigate to your folder containing the just created hello-world.js file and execute the script using node.
Your environment has been set up for using Node.js 0.10.17 (x64) and npm.
Press any key to continue . . .
C:\Users\Marco> cd MyHelloWorldCodeFolder
C:\Users\Marco\MyHelloWorldCodeFolder> node hello-world.js
In part 1, 2 and 3 I showed you how to create a simple MSBuild script and how to execute it from the command line. We had a look at how to clean your output directories, download the Nuget packages, compile your code, run MSpec tests and creating a code coverage report. In this last part of this series I will show you how to integrate it with Jenkins.
First of all we want Jenkins to pull the latest code from Github as soon as somebody has pushed new code to Github. To do this we need to install the Github plugin in Jenkins. We will also install the “MSBuild plugin” in Jenkins to be able to use MSBuild in Jenkins and the “Html publisher plugin” to publish the Coverage and MSpec reports. Also install the “Jenkins Git plugin” to configure the repository in Jenkins. Continue reading →
In the previous parts (part 1, part 2) of this series I described how to clean, download Nuget packages and build your solution using MSBuild. In this part I will explain you how to create a MSpec MSBuild target and a Code coverage MSBuild target.
MSpec is a testing framework which enables you to write living specifications. Using the MSpec console runner you can easily generate an html report. This report can later on be published using the Jenkins report plugin. By publishing this report we have some documentation on the specifications of the software available and because we did write the specifications using MSpec we also have unit tests in place. So that’s why I call it living documentation.
For generating the code coverage report we use the xml output of our MSpec tests. These reports will also be published using the Jenkins report plugin. To do so I use OpenCover and ReportGenerator.
All three packages are installed in my solution using Nuget. So the paths in my build script are based on the paths of my source/packages folders.
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.
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)
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/.
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. Continue reading →
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.
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.
Then I made some properties that caches the colors for us on their first use. The Color properties looks like this. Continue reading →
Have you ever got in the situation that you downloaded a zip-file and figured out to late the files are blocked? So you extracted the zip file into a folder with existing items. It will be damn hard to figure out which files needs to be unblocked. Besides that it will cost you many work to do so by right-clicking all of the files and clicking the unblock button.
Luckily we have PowerShell and we can easily write a little script to execute the unblock operation on the files in a specific directory. So start by opening PowerShell and key in the following command.
gci ’c:Somefolder’ | Unblock-File -WhatIf
The above command will unblock all the Child Items in the given directory. The WhatIf parameter will actually not execute it really, but it will show you what the script is going to do. To really execute the action you have to remove the parameter.
gci ‘c:Somefolder’ | Unblock-File
As you may have seen when using the WhatIf parameter, only the files in this folder will be unblocked. What if you want to unblock the files in the sub folders. This can easily be done with the Recurse parameter on your path.
Because I used the WhatIf parameter again I can pre-check what the command actually is going to do. When I’m sure I want to do it I can just remove the WhatIf parameter again and run the script against the files.
gci ‘c:Somefolder’ -Recurse | Unblock-File
So now you wont have to worry about files being blocked just execute the script and you’re ready to go. Bookmark this article to easily access the commands when you need them and share it with your friends to make their lives also a little easier. Oh and don’t forget to have a look at the ‘PowerShell Getting Started Guide‘ for more information on using PowerShell.
This is the fourth time I installed Windows 8. This time I installed it on my personal notebook instead of a VHD, because Windows 8 is finally ready to market. So I started with downloading the enterprise edition from my MSDN subscription. Unfortunately my USB drive died so I had no storage large enough to put the image on and boot from. So I started thinking to install it over the network. Luckily me I still had my rusty 10 year old 256MB USB drive which perfectly fits a Windows PE image. So I also downloaded the Windows 8 ADK to make a Windows PE boot image.
First install the Windows 8 ADK. Then open a command prompt and, key in the following commands to create a image.
The first command makes a directory on your c: drive and can be removed afterwards. The second command creates all the necessary files for a 64 installation. The third command copies the files to your usb drive (in my case F:) and makes it bootable. If you need a 32 bit installation replace amd64 with x86.
Then create a share on a pc in your network and extract the contents of the Windows 8 iso to the network share. Make sure you configure the security to allow everyone to access it. Also make sure your firewall responds to ping commands, this comes in handy when trying to connect to the share. I created a share called Win8. Continue reading →