NDepend is a tool that offers a wide range of features to let developers analyze a .NET code base. It comes with about 200 built in rules. But there are a few default rules that do not fit “my rules”. This blog post shows how to customize one and even more important why. Instance fields should be prefixed with a ’m_' I prefix instance fields with a ‘’ not with ‘m’ so I need to customize the default rule:
Websites and blogs of people that attended a Homebrew Website Club Düsseldorf.
Validating Code Quality with NDepend
Patrick Smacchia’s NDepend is a great tool to improve code quality and should be run quite regularly. It can be run as a strand alone GUI tool, from inside Visual Studio and as part of your build process. I’ll use the tool over the next few weeks to analyze and improve the quality of one of my personal code bases. I’ll try to share my experiences beside tips and tricks as well as giving feedback to Patrick.
Fix selection of duplicated items in form select elements with AngularJs directive
At a customer we have e.g. a country list in a select form element. It’s special because it has an option group called “top countries”. Inside the list are duplicates, that are listed in the option group “all countries” to. The browser tends to select the latest matching element – which in this special case makes no sense. Here is a directive that ensures the first matching element is selected:
ICE Lingen 2013
Yester day the yearly ICE conference happened in Lingen again. As I’m deep deep down in a project near it’s v1.0 release I haven’t had a lot time there beside my session. But at least enough to talk to Ingo, Thomas, Lars, Peter, Frank, Holger and a few others. Thanks a lot to the organization team making this happen year over year again.
Code Snippet: Surround with Task
I like to speed up my coding with for instance code snippets. Here is a new one: The markup for the snippet file:
What year is It?
We have HTML5 native video support (also with Flash or Silverlight fallback for the oh so old school browsers) so why the heck do some people out there still make it so hard to consume content – in this case Oracle (best known for providing Malware with their installers?!?): I remember that I bought software, at least eight years ago, through Digital River. These times ago I already thought there is space for improvement.
Python's urandom as non-admin
A few weeks ago I set up a new mercurial server fronted by “hgweb-cgi”. The application pool is, as python 2.66, in x64 mode. It has a dedicated ad account from the Managed Service Accounts OU. I set the privileges to deny logon locally and run as service and batch. Everything works fine… until you want to push: HTTP 502 Bad Gateway. IIS failed request tracing lead me to the relevant python source line:
CSS 3.0 as the only schema in Visual Studio
As Visual Studio keeps forgetting the settings that also affect validation and falls back to the oh-so-90-style-2.1-css-version just delete ALL other schemas. Thanks to the industry known Sweat Swank for searching the registry key.
CSS Masks – How To Use Masking In CSS Now
Visual Studio Intellisense support for parameters in JavaScript
From the perspective of a .NET developer JavaScript lacks of intellisense. Of course, Visual Studio is capable of showing intellisense for defined objects and their members, but when it comes to parameters we face the untyped world. Last year I did a project with a few developers who had to leave their beloved C# world and enter the JavaScript area. Their motivation declined from day to day. So I thought of how to provide them with what they were missing like water in the desert.
Autorun T4 templates on build
<ItemGroup> <T4Template Include="Model.tt"> <Generator>TextTemplatingFileGenerator</Generator> <LastGenOutput>Model.cs</LastGenOutput> </T4Template> </ItemGroup> ... <!-- Define target for code generation --> <Target Name="T4Generation"> <Message Text="Running Text Transformation..." /> <Exec Command=""TextTransform.exe" "%(T4Template.FullPath)" -out @(T4Template->'%(FileName).wxs')" /> </Target> <!-- Add target for code generation as dependency of "CoreCompile"-target --> <PropertyGroup> <CoreCompileDependsOn>@(CoreCompileDependsOn);T4Generation</CoreCompileDependsOn> </PropertyGroup>
Effects for the Web!
MsBuild finding directories if not given as parameter
I’m a lazy developer. Being lazy does not mean I avoid to work. It means that I like to reflect things I am doing and optimize and atomize stuff to get more time on the valuable tasks. Code generation is a tool I tend to use quite regularly and T4 is at most my generator of choice. Generated files can cause a lot of merging conflicts. So they are not to be checked into my source control system (currently my choice is HG/Mercurial).
Could not load file or assembly exception and how to fix your builds when using nuget packages
Once in a while it happens that an exception is thrown like the following: Could not load file or assembly ‘devcoach.Core, Version=1.0.11308.1, Culture=neutral, PublicKeyToken=0313e76cb5077f22’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) What did cause this exception to be fired? Lets have a look at the following picture which illustrates the scenario. The build order is defined by the dependencies.
Chaining asynchronous javascript calls
The good thing about JavaScript is that its network/ajax calls are asynchronous. The bad thing about JavaScript is that its network/ajax calls are asynchronous. It’s bad because nested calls increase complexity. Look at the following sample methods: function f1(callback) { console.log('f1'); if (callback != null) { console.log('hasCallback'); callback(); } } function f2(callback) { console.log('f2'); if (callback != null) { console.log('hasCallback'); callback(); } } function f3(callback) { console.log('f3'); if (callback != null) { console.
ICE Lingen 2011
It’s community summer again. The same procedure as every year. In the middle there is some refreshing ICE. The ICE-Conference in Lingen is something special to me because it is an admin event. I’m a developer. Maybe It’s caused by my roots – yeh, I was an admin once. Maybe caused by the fact that I tend to build bridges between admins and devs and build my developments aware of infrastructure.
Will Microsoft reveal a new IDE at the BUILD conference?
Maybe something x64? Maybe something faster? Who knows? For now I’m just dreaming…
NRW Conf 2011 community conference: The doors are open
Since the year 2005 the non-commercial organization JustCommunity e.V. organises once a year the NRW Conf community event. Over the time it has become one of the biggest community events in Germany. This years conference will be on the 8th and 9th of September located in Wuppertal, Germany. We will host over 20 speakers and sessions from Germany and Europe, and as last year there will be a workshop day upfront:
Skype / 0
Figure out if the current running application is a web application without a reference to System.Web.dll
Especially in core libraries I tend to not reference System.Web.dll to keep the .NET Framework Client Profile as an option of compilation. I use the following code to figure out if the current running application is a web application namespace devcoach.Extensions { public static partial class AppDomainExtensions { public static bool IsWebApp(this AppDomain appDomain) { var configFile = (string)appDomain.GetData("APP_CONFIG_FILE"); if (string.IsNullOrEmpty(configFile)) return false; return Path.GetFileNameWithoutExtension(configFile).Equals( "WEB", StringComparison.OrdinalIgnoreCase); } } }