Data Lake WTF

After an Update of Visual Studio 2015 (14) I wanted to use my usual keyboard short cut ([ALT] + [D]) to expand the “Debug”-menu and … Two menu entries listening to [D] now? For this ridiculous amount of 4 (in words four) menu entries? Seriously? Just delete the folder. And voila: Back. Productive. Done. Dear Microsoft, please stop that kind of *marketing* making developers every day life harder. I know you can do much better! HTH,Daniel

.NET Framework 4.6 Release

The new framework version is out. As with every new release it seems to me that the search indexes on Microsoft downloads have not been rebuilt yet. So I abuse this blog post and note the download links to myself…Microsoft .NET Framework 4.6 (Offline Installer) for Windows Vista SP2, Windows 7 SP1, Windows 8, Windows 8.1, Windows Server 2008 SP2 Windows Server 2008 R2 SP1, Windows Server 2012 and Windows Server 2012 R2 Microsoft Build Tools 2015Windows 10 and .NET Framework 4.6 SDKIntelliTrace Collector for Visual Studio 2015 (Just replace the Version number in the Installation Path)

Enable or disable FxCop Code Analysis solution wide in Visual Studio Package Manager Console

I really like FxCop. But in a debugging session it can be useful to save time by temporarily disabling the code analysis. Sadly there is no *global switch* to turn it off and on again. So here is my approach: Create a new text file in the directory "C:\Users\{your user}\Documents\WindowsPowerShell" named "NuGet_profile.ps1" and add the following code: Restart Visual Studio. Click the menu "View" | "Other Windows" | "Package Manager Console". Now you can execute the following commands: > Enable-CodeAnalysis > Disable-CodeAnalysis

Batch processing Visual Studio ProjectItems with the Nuget Package Management Powershell Console

Today I helped a customer to minify and bundle a bunch of JavaScript files. We used WebGrease triggered from MsBuild to do the job. The next thing to do is changing the BuildAction property on all non-bundled-and-minified JavaScript files so that only minified and bundled files are published. Here is my script: Hope that helps

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. My approach is based on the facade pattern. It allows to instanciate objects of a type with an instance of the same type, to acts as a wrapper to restore intellisense a JSON object, to be able to load data from a server request into a domain object Here is the code: function Person(data) { /// <summary>Instantiates a new instance of a Person. /// <para> 1. An JSON object containing data.</para> /// <para> 2. A Person object.</para> /// </summary> /// <param name="data" type="object"> /// An object. /// <para>containing data to initialize a person.</para> /// <para>- or -</para> /// <para>of type Person beeing returned by the facade /// to activate intellisense.</para> /// </param> var args, arg, member, lcMember, memberValue; this.firstName = ''; this.lastName = ''; this.fullName = function () { /// <summary> /// Returns the full name of the person. /// </summary> return this.firstName + ' ' + this.lastName; }; //#region Facade pattern to keep intellisense alive... if (arguments !== null || arguments.length === 1) { args = arguments; arg = args[0]; if (arg instanceof Person) { return arg; } else if (arg instanceof Object) { for (member in arg) { lcMember = member.substring(0,1).toLowerCase() + member.substring(1); if (this.hasOwnProperty(lcMember)) { memberValue = arg[lcMember]; if (arg.hasOwnProperty(lcMember)) { memberValue = arg[lcMember]; } else if (arg.hasOwnProperty(member)) { memberValue = arg[member]; } if (typeof(memberValue) === 'string' && memberValue.indexOf('/Date(') === 0) { memberValue = new Date( parseInt( memberValue.substr(6))); } this[lcMember] = memberValue; } } } } //#endregion return this; } The only thing I don’t like about is the fact that I need to name the type when comparing by instanceOf… Wrapped in an Visual Studio snippet eases up the pain… And here is an example of the usage: $(document).ready( function () { // After an object is instantiated intellisense works... var person = new Person({ firstName: 'daniel', lastName: 'fisher' }); // ... but when passed as a parameter it gets lost ... printFullName(person); }); function printFullName(person) { // ... using the facade pattern we let intellisense // know what *type* it is. var thePerson = new Person(person); console.log(thePerson.fullName()); } I hope this helps!

More comfort reading values from lines in CSV-files

Today I had to read values from multiple CVS-files. I wanted to build a testable and reusable solution instead of the ugly sequential spaghetti that easily happens. So here is a sample of a line: 1 var lineReadFromCsv = 2 "42;Daniel;Fisher;1980-03-25;{79704C0D-1A4F-4DDD-80F6-CA79E81BF7CD}"; To increase the readability I created enumerations that point to the index of the position of the values in each line that I wanted to read: 1 public enum DataFormatField 2 { 3 Id = 0, 4 GivenName = 1, 5 Surname = 2, 6 DateOfBirth = 3, 7 UniqueId = 4, 8 } I created a class called ParserParameter that contains enums that 1 public class ParserParameter 2 { 3 prop Enum FirstName { get; set; } 4 //... 5 } 6 Last but not least an extension class the provides a generic method TryGetValueOrDefault<T>(). It takes an enum member as parameter. It can convert int, long, float, decimal, double, guid, datetime as well as string and can easily be extended. 1 int id; 2 if (fields.TryGetValueOrDefault( 3 DataFormatField.Id, 4 out id)) 5 { 6 Console.WriteLine(id); 7 } 8 9 string givenName; 10 if (fields.TryGetValueOrDefault( 11 DataFormatField.GivenName, 12 out givenName)) 13 { 14 Console.WriteLine(givenName); 15 } 16 The complete code can be downloaded at forkcan.