Uncategorized

Langeoog: 22° Moon Halo

“The familiar 22° halo around the Sun or Moon occurs because of refraction in tiny hexagonal ice crystals in the air. With the 60° apex angle of the prism formed by extending the sides of the crystal and the index of refraction of ice (n=1.31) one can calculate the angle of minimum deviation to be…

cmakepp: reflecting and manipulating CMakeLists

The basic CMakeLists.txt files for cmake based projects are usually very simple. Their manipulation lends itself to be automated and for this purpose I developed a parser for cmake script which allows you to manipulate it programatically from within cmake itself. On top of the cmake script parser I generated utility functions which allow you…

Heterogeneous Package Search and Retrieval in CMake

Finding and Retrieving third party sources, tools and binaries is currently a hot subject for C++. There are quite a few solutions (biicode, cpm, hunter, …) Also there is github, bitbucket, source balls etc. Further there are many package managers for many different platforms which also can contain packages (apt-get, chocolatey, nuget, npm, pip, ….).…

E2E Tests for OWIN based Web Application

Motivation End to End tests have alluded me for a while in .Net/OWIN/WepApi/Angular/etc. Now I have finally found my solution and I thought I would share it with you. Btw please let me know if this is usefull or if you have suggestions to improve it. Abstract I provide you wiuth a GitHub repository containing…

How to enable Typescript Compilation for a VS2013 Class Library Project

I know its a little obscure, but I recently needed to find out how to enable Typescript in a Visual Studio 2013 Class Library project, because per default this is not enabled. (probably a bug) Vanilla way of enabling TypeScript: Create a “Class Library” project Add a Typescript file (.ts) This is were the bug…

A Fluent Way of Exception Handling

While doing some filesystem work I encountered alot of AccessViolationExceptions because a file is being opened to write multiple times.  Even after closing the file explicitly a short timeframe exists in which the file could not be opened again.  The simplest approach for me was to retry openening the file until it worked.  To allow…

A Quick Way of Parsing versioned Web Asset Files

To parse versioned web asset filenames ala jquery-1.4.min.js I wrote a simple class /// <summary> /// simple class for describing a file library like  /// jquery-1.4.min.js /// bootstrap.min.css /// libname-1.0.0.0.tag1.tag2.tag3.extension /// … etc /// contains methods for parsing these kind of filenames /// </summary> public class FileLib {   /// <summary>   /// regular expression for parsing the filename   /// </summary>   public static readonly string libRegex = @”((?<libname>[^.-]*)-?)((?<major>d+))?(.(?<minor>d+)(.(?<revision>d+)(.(?<build>d+))?)?)?(.(?<tags>.+))*”;   /// <summary>   /// parses a path as a lib   /// </summary>   /// <param name=”path”></param>   /// <returns></returns>   public static FileLib ParsePath(string path)   {     var filename = Path.GetFileName(path);     return Parse(filename);   }   /// <summary>   /// parses a filename as a file lib    /// </summary>   /// <param name=”filename”></param>   /// <returns></returns>   public static FileLib Parse(string filename)   {     var match = Regex.Match(filename, libRegex);     match.NextMatch();     var lib = match.Groups[“libname”].Value ?? “”;     var major = match.Groups[“major”].Value ?? “”;     var minor = match.Groups[“minor”].Value ?? “”;     var revision = match.Groups[“revision”].Value ?? “”;     var build = match.Groups[“build”].Value ?? “”;     var tags = match.Groups[“tags”].Value.Split(‘.’);     var extension = tags.LastOrDefault() ?? “”;     tags = tags.Reverse().Skip(1).Reverse().ToArray();     var result = new FileLib()…