<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Posts on toeb / notes</title><link>https://toeb.github.io/post/</link><description>Recent content in Posts on toeb / notes</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Sun, 11 Oct 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://toeb.github.io/post/index.xml" rel="self" type="application/rss+xml"/><item><title>Unit tests for 3D</title><link>https://toeb.github.io/post/unit-tests-for-3d/</link><pubDate>Sun, 11 Oct 2026 00:00:00 +0000</pubDate><guid>https://toeb.github.io/post/unit-tests-for-3d/</guid><description>&lt;p&gt;I wanted to 3D-print an ampoule case for my wife, and it fit on the first print. The trick was not the CAD.&#10;A verification harness checked every design virtually before the printer saw it. You choose which ampoules and how&#10;many; the generator either packs them into a fixed case or designs the smallest case that holds them.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;Try it:&lt;/strong&gt; &lt;a href="https://toeb.github.io/toeb.parametric3d/"&gt;paramcad designer&lt;/a&gt;, which runs entirely in your browser.&lt;/p&gt;&#10;&lt;h2 id="from-cad-to-print"&gt;From CAD to print&lt;/h2&gt;&#10;&lt;p&gt;The printed case is the fork-clip version: two 10 ml and four 2 ml ampoules in a 121.5 × 121.5 mm PETG case.&#10;It went together on the first print. Only the closing clamps and the clips showed small deviations, which is exactly&#10;what the outer loop below turns into calibration data and new rules.&lt;/p&gt;</description></item><item><title>cmakepp: Expression Syntax</title><link>https://toeb.github.io/post/cmakeppexpressionsyntax/</link><pubDate>Mon, 04 Jun 2018 00:00:00 +0000</pubDate><guid>https://toeb.github.io/post/cmakeppexpressionsyntax/</guid><description>&lt;p&gt;“CMake’s syntax is not sexy.” Is a statement that probably everyone can understand. It does not allow the developer rudimentary constructs which almost all other languages have. But because CMake’s language is astonishingly flexible I was able to create a lexer and parser and interpreter for a custom 100 % compatible syntax which (once “JIT transpiled”) is also fast. I call it cmakepp expressions or expr for short. I want to emphasize that all of this is written in 100% compatible cmake code and you can use it without the need to preprocess any cmake files or adding any dependencies (except cmakepp).&lt;/p&gt;</description></item><item><title>Modern CMake Slides</title><link>https://toeb.github.io/post/moderncmakeslides/</link><pubDate>Tue, 30 Aug 2016 00:00:00 +0000</pubDate><guid>https://toeb.github.io/post/moderncmakeslides/</guid><description>&lt;p&gt;I’ve held a Presentation about “modern CMake” at the C++ Meetup in Wiesbaden a week ago and wanted to share the slides with the Internet. I try to highlight the parts of a CMake project which I consider as modern (I guess there is room for interpretation here)&lt;/p&gt;&#10;&lt;p&gt;I give a small introduction to CMake command line, script mode and then mostly about targets, scoping etc. Of course you cannot hear my voice but maybe the slides themselves can give you some insight. There is also a small github repository added in which I added a few examples which I talk about in the slides. I plan to extend these CMake examples and add some documentation because CMake seems to be lacking small well configured projects from which C++ developers start (copy) from ;).&lt;/p&gt;</description></item><item><title>cmakepp: reflecting and manipulating CMakeLists</title><link>https://toeb.github.io/post/cmakeppreflectingandmanipulatingcmakelists/</link><pubDate>Thu, 19 Mar 2015 00:00:00 +0000</pubDate><guid>https://toeb.github.io/post/cmakeppreflectingandmanipulatingcmakelists/</guid><description>&lt;p&gt;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 to manipulate CMakeLists.txt files while still allowing you to manually working on them. This functionality is wrapped by a command line interface which I present to you in this post. You can find this part of cmakepp here. Feel free to try and please give me feedback if you like it or find any bugs.&lt;/p&gt;</description></item><item><title>cmakepp: Template Generation in CMake</title><link>https://toeb.github.io/post/cmakepptemplategeneration/</link><pubDate>Wed, 11 Feb 2015 00:00:00 +0000</pubDate><guid>https://toeb.github.io/post/cmakepptemplategeneration/</guid><description>&lt;p&gt;Find it at &lt;a href="http://github.com/toeb/cmakepp"&gt;http://github.com/toeb/cmakepp&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;Download cmakepp standalone file here&lt;/p&gt;&#10;&lt;p&gt;As with all my work I appreciate all feedback given and am particularly happy about virtual internet points 🙂&lt;/p&gt;&#10;&lt;p&gt;To the Post:&#10;While working on the documentation of cmakepp I grew wary of always doubling the documentation – one in the source code and a mirror in the README.md. Also I was frustrated when I refactored and renamed functions or changed signatures which is not uncommon – especially when working on a new feature. So I needed a tool which could generate the documentation by copying the comment header and the function signature from my CMake files.&lt;/p&gt;</description></item><item><title>Heterogeneous Package Search and Retrieval in CMake</title><link>https://toeb.github.io/post/cmakeppheterogenouspackagesearchandretrieval/</link><pubDate>Wed, 04 Feb 2015 00:00:00 +0000</pubDate><guid>https://toeb.github.io/post/cmakeppheterogenouspackagesearchandretrieval/</guid><description>&lt;p&gt;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, ….). So everything is very decentralized and heterogeneous.&lt;/p&gt;&#10;&lt;p&gt;On the other hand there is CMake the standard when it comes to creating platform independent projects for various build and developer environments. (of course it is not the only build tool but it is the standard for platform independent C/C++ projects) Most notably it generates MSBuild for Visual Studio and MAKE output which are the most commonly used build systems. CMake is as platform independent as it comes.&lt;/p&gt;</description></item><item><title>Parallel Processes in CMake</title><link>https://toeb.github.io/post/cmakeppparallelprocesses/</link><pubDate>Tue, 16 Dec 2014 00:00:00 +0000</pubDate><guid>https://toeb.github.io/post/cmakeppparallelprocesses/</guid><description>&lt;p&gt;If you need to check out multiple large repositories or build and install large separate projects you might want to use parallel processes in CMake. Dividing your tasks to use multiple CMake and or other processes can speed up your build and configuration steps immensely.&lt;/p&gt;&#10;&lt;p&gt;Since all cmake host OSs support multitasking from the command line it is possible to use cmake to contol them in turn. Using this approach I implemented a ‘platform independent’ control mechanism for starting, killing, querying and waiting for processes. Only the very basic functions are platform specific and the others are based on the abstraction layer that they provide.&lt;/p&gt;</description></item><item><title>CMake and the Filesystem</title><link>https://toeb.github.io/post/cmakeppfilesystem/</link><pubDate>Thu, 27 Nov 2014 00:00:00 +0000</pubDate><guid>https://toeb.github.io/post/cmakeppfilesystem/</guid><description>&lt;h1 id="filesystem"&gt;Filesystem&lt;/h1&gt;&#10;&lt;p&gt;I have always been a bit confused when working with cmake’s file functions and the logic behind paths (sometimes they are found sometimes they are not…) For ease of use I reimplemented a own path managing system which behaves very similar to powershell and bash (see ss64.com) it is based around a global path stack and path qualification. All of my functions which work with paths use this system.&lt;/p&gt;</description></item><item><title>CTest and TextExplorer</title><link>https://toeb.github.io/post/ctesttestadapter/</link><pubDate>Sat, 22 Nov 2014 00:00:00 +0000</pubDate><guid>https://toeb.github.io/post/ctesttestadapter/</guid><description>&lt;h2 id="motivation"&gt;Motivation&lt;/h2&gt;&#10;&lt;p&gt;I have long searched for an extension in VisualStudio which allows you to control kitware’s CTests via the Test Explorer. Since no such thing existed I have developed a workable proof of concept myself :D.&lt;/p&gt;&#10;&lt;p&gt;This software is currently not in its finished state, It still needs polishing because it can be slow and is not well tested. However it works so if you want to give it a ride – go ahead. Feedback is welcome. But even more welcome would be if you chose to work on it and make it better.&lt;/p&gt;</description></item><item><title>Renameable Namespaces using the Preprocessor</title><link>https://toeb.github.io/post/cpprenameablenamespaces/</link><pubDate>Tue, 14 Oct 2014 00:00:00 +0000</pubDate><guid>https://toeb.github.io/post/cpprenameablenamespaces/</guid><description>&lt;h2 id="motivation"&gt;Motivation&lt;/h2&gt;&#10;&lt;p&gt;If you are starting to work on a library and do not know exactly how your namespaces are going end up these macro helper are for you. I have written helpers that simplify using namespaces and lets you build up your namespaces with preprocessor defines. This allows you to quickly rename your namespaces which in turn makes it alot more flexible. You can find the code on github. It is licensed under the MIT license.&lt;/p&gt;</description></item><item><title>Alternative `typedef` Syntax</title><link>https://toeb.github.io/post/alternativetypedefsyntax/</link><pubDate>Mon, 13 Oct 2014 00:00:00 +0000</pubDate><guid>https://toeb.github.io/post/alternativetypedefsyntax/</guid><description>&lt;p&gt;&lt;strong&gt;Disclaimer: This post will be more interesting to you if you work with the preprocessor.&lt;/strong&gt;&lt;/p&gt;&#10;&lt;p&gt;Here you can find a preprocessor only solution for changing the &lt;code&gt;typedef&lt;/code&gt; syntax from &lt;code&gt;typedef int number_type&lt;/code&gt;; to &lt;code&gt;int typedef_as number_type&lt;/code&gt;; – an alternative &lt;code&gt;typedef&lt;/code&gt; Syntax.&lt;/p&gt;&#10;&lt;p&gt;If your wondering where this might be useful let me tell you why I needed it: I was working on a preprocessor macro which defines a property – a field, a getter and a setter. The easiest syntax I was able to achieve was the following: &lt;code&gt;typedef int property(MyValue)&lt;/code&gt; which expanded into something similar to this:&lt;/p&gt;</description></item><item><title>Dynamic Object in C++</title><link>https://toeb.github.io/post/cppdynamicobject/</link><pubDate>Wed, 08 Oct 2014 00:00:00 +0000</pubDate><guid>https://toeb.github.io/post/cppdynamicobject/</guid><description>&lt;p&gt;You can find my implementation at &lt;a href="https://github.com/toeb/cppdynamic"&gt;https://github.com/toeb/cppdynamic&lt;/a&gt; it is licensed under the MIT license. I’d be happy for feedback and or optimizations :)&#10;Dynamic object are useful, especially in rapid prototyping, non-performance critical situations, and situations in which data/functions -bags are needed (non schema specific data). Also when serializing and deserializing dynamic objects can be a very valuable asset.&lt;/p&gt;&#10;&lt;p&gt;Dynamic programming languages inherently support this. e.g.&lt;/p&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;var obj = {};&#10;obj.a = &amp;#39;asd&amp;#39;;&#10;obj.b = {};&#10;obj.b.c = 3;&#10;obj.d = function(i,j){ return i+j;}&#10;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;C# Also supports dynamic objects utilizing the dynamic keyword:&lt;/p&gt;</description></item><item><title>Useful extensions for CMake</title><link>https://toeb.github.io/post/usefulextensionsforcmake/</link><pubDate>Fri, 05 Sep 2014 00:00:00 +0000</pubDate><guid>https://toeb.github.io/post/usefulextensionsforcmake/</guid><description>&lt;p&gt;When using cmake for more than just simple projects it is lacking in various aspects. Some list and string functions are missing. Interaction with command line applications and the file system are harder than they need to be. Especially however using structured data (maps and objects) and more complex funtional programming is not easy at all. So a couple of months ago I started implementing some extensions for object oriented programming 1 2. I which I continued to refine and which are the basis for my pure cmake package manager. They have now reached a level which I am confident enough in to describe in another post which I will try to distribute around the internet a bit so I can see if others find this useful as well.&lt;/p&gt;</description></item><item><title>dynamically calling `any` thing in C++</title><link>https://toeb.github.io/post/cppdynamicallycallanything/</link><pubDate>Tue, 15 Jul 2014 00:00:00 +0000</pubDate><guid>https://toeb.github.io/post/cppdynamicallycallanything/</guid><description>&lt;p&gt;Extending upon boost’s any class which stores a type and a void ptr to any type of value, I created a callable version were you can assign any function, lambda, memberfunction etc. to the any and call it dynamically. This is a basic and important step for runtime reflection which I’m currently working on. Tell me if you like what I did and if you have any improvements.&lt;/p&gt;&#10;&lt;p&gt;You can look at the running example at ideone&lt;/p&gt;</description></item><item><title>`is_callable` type trait</title><link>https://toeb.github.io/post/cppiscallabletypetrait/</link><pubDate>Sat, 12 Jul 2014 00:00:00 +0000</pubDate><guid>https://toeb.github.io/post/cppiscallabletypetrait/</guid><description>&lt;p&gt;I’ve developed a &lt;code&gt;type_trait&lt;/code&gt; for checking if a type is callable, ie has defined a single &lt;code&gt;operator()&lt;/code&gt;. Also on ideone&lt;/p&gt;&#10;&lt;p&gt;Tell me if you like it or if you know of a better version :D&lt;/p&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;/// function traits for member functions &#10;// gives you the class_type, return_type and arguments tuple for any member function (const and not const)&#10; template&amp;lt;typename T&amp;gt;&#10; struct func_traits{&#10; static const bool is_const_call = false;&#10; typedef void class_type;&#10; typedef void return_type;&#10; typedef void args_tuple;&#10; };&#10; // specialization for non const call member functions&#10; template &amp;lt; typename TClass ,typename TRet, typename ... TArgs&amp;gt;&#10; struct func_traits&amp;lt;TRet(TClass::*)(TArgs...)&amp;gt;&#10; {&#10; static const bool is_const_call = false;&#10; typedef TClass class_type;&#10; typedef TRet return_type;&#10; typedef std::tuple&amp;lt;TArgs...&amp;gt; args_tuple;&#10; };&#10; // specialization for const call member function&#10; template &amp;lt; typename TClass, typename TRet, typename ... TArgs&amp;gt;&#10; struct func_traits&amp;lt;TRet(TClass::*)(TArgs...)const&amp;gt;&#10; {&#10; static const bool is_const_call = true;&#10; typedef TClass class_type;&#10; typedef TRet return_type;&#10; typedef std::tuple&amp;lt;TArgs...&amp;gt; args_tuple;&#10; };&#10;&#10;// checks wether a single call operator exists by sfinae ideom&#10; template&amp;lt;typename T&amp;gt;&#10; struct is_callable{&#10;&#10; private:&#10; // if the argument type is deducable this function is used&#10; template&amp;lt;typename TX = T&amp;gt;&#10; static char check(typename func_traits&amp;lt;decltype(&amp;amp;TX::operator())&amp;gt;::class_type);&#10; // else this function is used&#10; static double check(...);&#10; static T t;&#10; // if first function is used the call operator exists and the size is sizeof(char) instead of sizeof(double)&#10; enum{ _value = sizeof(check(t)) == sizeof(char) };&#10; public:&#10; const static bool value = _value;&#10; };&#10;&#10;int main() {&#10; // B is a functor class, A not callable&#10; class B{ public:void operator()(int i)const{} };&#10; class A{};&#10; // this order works in MSVC 2013&#10; static_assert(is_callable&amp;lt;B&amp;gt;::value == true, &amp;#34;should be true&amp;#34;);&#10; static_assert(is_callable&amp;lt;A&amp;gt;::value == false, &amp;#34;should be false&amp;#34;);&#10; // &#10; return 0;&#10;}&#10;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Some Sources I queried when developing:&lt;/p&gt;</description></item><item><title>cmakepp: Reading and Writing JSON</title><link>https://toeb.github.io/post/cmakereadingandwritingjson/</link><pubDate>Wed, 05 Mar 2014 00:00:00 +0000</pubDate><guid>https://toeb.github.io/post/cmakereadingandwritingjson/</guid><description>&lt;p&gt;While working on a package manager for CMake I came across the problem of finding a suitable format for my package descriptor files. First I thought about and tried using plain old CMake file that simply sets variables and can be included to access its contents. It was very quick and easy to implement. Hierarchical data structures however where hard to implement and a none standard format makes it harder to exchange data with a webservice/other programs. So I opted for using JSON as my import/export format. JSON is alot easier to parse than XML and is still ubiquitous in software developement so I cast aside XML (for now).&lt;/p&gt;</description></item><item><title>Object Oriented CMake: Next Iteration</title><link>https://toeb.github.io/post/objectorientedcmakenextiteration/</link><pubDate>Tue, 25 Feb 2014 00:00:00 +0000</pubDate><guid>https://toeb.github.io/post/objectorientedcmakenextiteration/</guid><description>&lt;p&gt;I worked on my object oriented extensions for CMake and am on a much higher level of usability than before!&lt;/p&gt;&#10;&lt;p&gt;try it at &lt;a href="https://github.com/toeb/oo-cmake"&gt;https://github.com/toeb/oo-cmake&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;and as always: Feedback is most welcome&lt;/p&gt;&#10;&lt;p&gt;See the following object tutorial for ease of use: (for the current version look at the readme.md on github)&lt;/p&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;### using objects&#10;### =============&#10;# oo-cmake is very similar to javascript&#10;# I actually used the javascript reference to figure out how things could be done :)&#10;# oo-cmake is a pure object oriented language like javascript (only objects no types per se)&#10;# oo-cmake is currently file based and relies heavily on dynamic functions to be upfron about it:&#10;# oo-cmake is very slow (depending on what your doing)&#10;&#10;## creating a object&#10;## =================&#10;obj_new(myobject)&#10;# ${myobject} now is a reference to an object&#10;obj_exists(${myobject} _exists)&#10;assert(_exists)&#10;&#10;## deleting a object&#10;## =================&#10;# oo-cmake does not contains automatic memory management&#10;# you can however remove all objects by calling obj_cleanup &#10;# (a very crude way of garbage collection) I would suggest calling it at the end of cmake.&#10;obj_new(object_to_delete)&#10;obj_delete(${object_to_delete})&#10;# object_to_delete still contains the same reference&#10;# but the object does not exists anymore and the following returns false&#10;obj_exists(${object_to_delete} _exists)&#10;assert(NOT _exists)&#10;&#10;## setting and setting property&#10;## ==================&#10;obj_new(myobject)&#10;# call obj_set passing the object reference&#10;# the propertyname &amp;#39;key1&amp;#39; and the value &amp;#39;val1&amp;#39;&#10;# everything beyond &amp;#39;key1&amp;#39; is saved (as a list)&#10;obj_set(${myobject} key1 &amp;#34;val1&amp;#34;)&#10;#call obj_get passing the object refernce the result variable and&#10;# the key which is to be gotten&#10;obj_get(${myobject} theValue key1)&#10;assert(theValue)&#10;assert(${theValue} STREQUAL &amp;#34;val1&amp;#34;)&#10;&#10;## setting a function and calling it&#10;## =================================&#10;obj_new(obj)&#10;obj_set(${obj} last_name &amp;#34;Becker&amp;#34;)&#10;obj_set(${obj} first_name &amp;#34;Tobias&amp;#34;)&#10;#obj_setfunction accepts any function (cmake command, string function, file function, unique function (see function tutorial))&#10;# if you use a cmake function be sure that it will not be overwritten&#10;# the safest way to add a function is to use obj_declarefunction&#10;# you can either specify the key where it is to be stored or not&#10;# if you do not specify it the name of the function is used&#10;function(greet result)&#10; # in the function you have read access to all fields of the proeprty&#10; # as will as to &amp;#39;this&amp;#39; which contains the reference to the object&#10;&#10; # this sets the variable ${result} in PARENT_SCOPE (returning values in cmake)&#10; set(${result} &amp;#34;Hello ${first_name} ${last_name}!&amp;#34; PARENT_SCOPE)&#10;&#10;endfunction()&#10;obj_setfunction(${obj} greet)&#10;obj_callmember(${obj} greet res)&#10;assert(res)&#10;assert(${res} STREQUAL &amp;#34;Hello Tobias Becker!&amp;#34;)&#10;# alternatively you can also use obj_declarefunction&#10;# this is actually the easiest way to define a function in code&#10;obj_declarefunction(${obj} say_goodbye)&#10;function(${say_goodbye} result)&#10; set(${result} &amp;#34;Goodbye ${first_name} ${last_name}!&amp;#34; PARENT_SCOPE)&#10;endfunction()&#10;obj_callmember(${obj} say_goodbye res)&#10;assert(res)&#10;assert(res STREQUAL &amp;#34;Goodbye Tobias Becker!&amp;#34;)&#10;&#10;## built in methods&#10;## ================&#10;# obj_new creates a object which automatically inherits Object&#10;# Object contains some functions e.g. to_string, print, ...&#10;# &#10;obj_new(obj)&#10;obj_callmember(${obj} print)&#10;&#10;# this prints all members&#10;# ie&#10;#{&#10;# print: [function], &#10;# to_string: [function], &#10;# __ctor__: [object :object_Y3dVWkChKi], &#10;# __proto__: [object :object_AztQwnKoE7], &#10;#}&#10;&#10;## constructors&#10;## ============&#10;# you can easily define a object type via constructor&#10;function(MyObject)&#10; # declare a function on the prototype (which is accessible for all objects)&#10; # inheriting from MyObject&#10; obj_declarefunction(${__proto__} myMethod)&#10; function(${myMethod} result)&#10; set(${result} &amp;#34;myMethod: ${myValue}&amp;#34; PARENT_SCOPE)&#10; this_set(myNewProperty &amp;#34;this is a text ${myValue}&amp;#34;)&#10; endfunction()&#10;&#10; # set a field for the object&#10; this_set(myValue &amp;#34;hello&amp;#34;)&#10;endfunction()&#10;&#10;obj_new(obj MyObject)&#10;# type of object will now be MyObject&#10;obj_gettype(${obj} type)&#10;assert(type)&#10;assert(${type} STREQUAL MyObject)&#10;# call&#10;obj_callmember(${obj} myMethod res)&#10;assert(res)&#10;assert(${res} STREQUAL &amp;#34;myMethod: hello&amp;#34;)&#10;obj_set(${obj} myValue &amp;#34;othervalue&amp;#34;)&#10;obj_callmember(${obj} myMethod res)&#10;assert(res)&#10;assert(${res} STREQUAL &amp;#34;myMethod: othervalue&amp;#34;)&#10;obj_get(${obj} res myNewProperty)&#10;assert(res)&#10;assert(${res} STREQUAL &amp;#34;this is a text othervalue&amp;#34;)&#10;&#10;## functors&#10;## ========&#10;&#10;## binding a function&#10;## ==================&#10;# you can bind any function to an object without&#10;# setting it as property&#10;# causing the function to get access to &amp;#39;this&amp;#39;&#10;# and all defined properties&#10;function(anyfunction)&#10; this_callmember(print)&#10;endfunction()&#10;obj_new(obj)&#10;obj_bindcall(${obj} anyfunction)&#10;## print the object&#10;# alternatively you can bind the function to the object&#10;obj_bind(boundfu ${obj} anyfunction)&#10;call_function(${boundfu})&#10;# prints the object&#10;# alternatively you can bind and import then function&#10;# beware that you might overwrite a defined function if you append REDEFINE&#10;# &#10;obj_bindimport(${obj} anyfunction myBoundFunc REDEFINE)&#10;myBoundFunc()&#10;# print the object&#10;&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>Objects and Maps in CMake</title><link>https://toeb.github.io/post/cmakeppobjectsandmaps/</link><pubDate>Sun, 16 Feb 2014 00:00:00 +0000</pubDate><guid>https://toeb.github.io/post/cmakeppobjectsandmaps/</guid><description>&lt;p&gt;Get it at &lt;a href="https://github.com/toeb/oo-cmake"&gt;https://github.com/toeb/oo-cmake&lt;/a&gt; and tell me if you like it&lt;/p&gt;&#10;&lt;p&gt;For more complex build system features oo programming would be a major boon. So I took it upon myself to create a usable and tested oo-extension for cmake (in pure CMake) so I could continue developing and extending my plattform independent tooling support (cutil) .&lt;/p&gt;&#10;&lt;p&gt;It’s too bad that Kitware decided to use their own language (with very little high level language features) for their build system product because CMakes project generation capabilties are unparalleled . I can understand that it seemed like a good idea at first ( the CMake scripting Language is platform independent and easier to use than make or bash or cmd also it was not intended to do complicated things). I however strongly believe that building a programm should be as easy as possible and therefore a high level language should have been used. CMake’s creators Bill Hoffman and Kenneth Martin have said that they would have done this differently if they had to do it again (&lt;a href="http://www.aosabook.org/en/cmake.html"&gt;http://www.aosabook.org/en/cmake.html&lt;/a&gt;)&lt;/p&gt;</description></item><item><title>Normalized Attribute Names in Angular</title><link>https://toeb.github.io/post/normalizedattributenamesinangular/</link><pubDate>Tue, 14 Jan 2014 00:00:00 +0000</pubDate><guid>https://toeb.github.io/post/normalizedattributenamesinangular/</guid><description>&lt;p&gt;I have been doing some hard directive/ html markup work and I came across a problem where I needed the normalized html tag attribute names. (I was trying to create a html element but needed access to the normalized names without turning it into a directive)&lt;/p&gt;&#10;&lt;p&gt;Angular.js normalizes names like “test-name” and “data-test-name” to “testName”. So I went ahead and extracted and wrapped the functions needed into the following function:&lt;/p&gt;</description></item><item><title>Enabling MVC5 intellisense in a ClassLibrary Project</title><link>https://toeb.github.io/post/enablingmvc5intellisensinclasslibraryproject/</link><pubDate>Sun, 05 Jan 2014 00:00:00 +0000</pubDate><guid>https://toeb.github.io/post/enablingmvc5intellisensinclasslibraryproject/</guid><description>&lt;p&gt;I’ve been searching and searching the internet for someone, somewhere who might know how to enable correct IntelliSense for cshtml (MVC 5.0) in VS2013 when developing in a ClassLibrary type project.&lt;/p&gt;&#10;&lt;p&gt;This is the problem I was encountering:&lt;/p&gt;&#10;&lt;p&gt;Missing Intellisense&lt;/p&gt;&#10;&lt;p&gt;It’s all thanks to Mohammad Chehab, who was also stumped for a while (probably not as long as me), that I was able to find the solution. His blog post explains that one must change the output path for the class library to bin/ (instead of bin/) for Intellisense to work.&lt;/p&gt;</description></item><item><title>Typescript in V2013</title><link>https://toeb.github.io/post/enabletypescriptcompilationforvs2013classlibrary/</link><pubDate>Wed, 18 Dec 2013 00:00:00 +0000</pubDate><guid>https://toeb.github.io/post/enabletypescriptcompilationforvs2013classlibrary/</guid><description>&lt;p&gt;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)&lt;/p&gt;&#10;&lt;p&gt;Vanilla way of enabling TypeScript:&lt;/p&gt;&#10;&lt;p&gt;Create a “Class Library” project&#10;Add a Typescript file (.ts)&#10;This is were the bug occurs, normally the TypeScript file should compile on save. However it does not. So after searching around and looking at the csproj file and comparing it to a MvcApplication csproj file I found out what the problem is:&lt;/p&gt;</description></item><item><title>A Fluent Way of Exception Handling</title><link>https://toeb.github.io/post/csharpfluentexceptionhandling/</link><pubDate>Mon, 09 Dec 2013 00:00:00 +0000</pubDate><guid>https://toeb.github.io/post/csharpfluentexceptionhandling/</guid><description>&lt;p&gt;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 more easy and more general way to handle exceptions I developed a small extensible try-repeat-framework which allows me to configure waiting and repeating strategies and also to only react to specific exceptions. I have written it with a fluent interface which allows easy usage:&lt;/p&gt;</description></item><item><title>Parsing Web Asset Files</title><link>https://toeb.github.io/post/csharpparsingwebassetfiles/</link><pubDate>Wed, 04 Dec 2013 00:00:00 +0000</pubDate><guid>https://toeb.github.io/post/csharpparsingwebassetfiles/</guid><description>&lt;p&gt;To parse versioned web asset filenames ala&#10;jquery-1.4.min.js&#10;I wrote a simple class&lt;/p&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;/// &amp;lt;summary&amp;gt;&#10;/// simple class for describing a file library like &#10;/// jquery-1.4.min.js&#10;/// bootstrap.min.css&#10;/// libname-1.0.0.0.tag1.tag2.tag3.extension&#10;/// ... etc&#10;/// contains methods for parsing these kind of filenames&#10;/// &amp;lt;/summary&amp;gt;&#10;public class FileLib&#10;{&#10; /// &amp;lt;summary&amp;gt;&#10; /// regular expression for parsing the filename&#10; /// &amp;lt;/summary&amp;gt;&#10; public static readonly string libRegex = @&amp;#34;((?&amp;lt;libname&amp;gt;[^.-]*)-?)((?&amp;lt;major&amp;gt;d+))?(.(?&amp;lt;minor&amp;gt;d+)(.(?&amp;lt;revision&amp;gt;d+)(.(?&amp;lt;build&amp;gt;d+))?)?)?(.(?&amp;lt;tags&amp;gt;.+))*&amp;#34;;&#10; /// &amp;lt;summary&amp;gt;&#10; /// parses a path as a lib&#10; /// &amp;lt;/summary&amp;gt;&#10; /// &amp;lt;param name=&amp;#34;path&amp;#34;&amp;gt;&amp;lt;/param&amp;gt;&#10; /// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&#10; public static FileLib ParsePath(string path)&#10; {&#10; var filename = Path.GetFileName(path);&#10; return Parse(filename);&#10; }&#10; /// &amp;lt;summary&amp;gt;&#10; /// parses a filename as a file lib &#10; /// &amp;lt;/summary&amp;gt;&#10; /// &amp;lt;param name=&amp;#34;filename&amp;#34;&amp;gt;&amp;lt;/param&amp;gt;&#10; /// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&#10; public static FileLib Parse(string filename)&#10; {&#10; var match = Regex.Match(filename, libRegex);&#10; match.NextMatch();&#10; var lib = match.Groups[&amp;#34;libname&amp;#34;].Value ?? &amp;#34;&amp;#34;;&#10; var major = match.Groups[&amp;#34;major&amp;#34;].Value ?? &amp;#34;&amp;#34;;&#10; var minor = match.Groups[&amp;#34;minor&amp;#34;].Value ?? &amp;#34;&amp;#34;;&#10; var revision = match.Groups[&amp;#34;revision&amp;#34;].Value ?? &amp;#34;&amp;#34;;&#10; var build = match.Groups[&amp;#34;build&amp;#34;].Value ?? &amp;#34;&amp;#34;;&#10; var tags = match.Groups[&amp;#34;tags&amp;#34;].Value.Split(&amp;#39;.&amp;#39;);&#10; var extension = tags.LastOrDefault() ?? &amp;#34;&amp;#34;;&#10; tags = tags.Reverse().Skip(1).Reverse().ToArray();&#10; var result = new FileLib()&#10; {&#10; Extension = extension,&#10; LibName = lib,&#10; Major = major,&#10; Minor = minor,&#10; Revision = revision,&#10; Build = build,&#10; Tags = tags&#10;&#10; };&#10; return result;&#10; }&#10; /// &amp;lt;summary&amp;gt;&#10; /// Major version number&#10; /// &amp;lt;/summary&amp;gt;&#10; public string Major { get; set; }&#10; /// &amp;lt;summary&amp;gt;&#10; /// Minor version number&#10; /// &amp;lt;/summary&amp;gt;&#10; public string Minor { get; set; }&#10; /// &amp;lt;summary&amp;gt;&#10; /// Revision Number&#10; /// &amp;lt;/summary&amp;gt;&#10; public string Revision { get; set; }&#10;&#10; /// &amp;lt;summary&amp;gt;&#10; /// Build number&#10; /// &amp;lt;/summary&amp;gt;&#10; public string Build { get; set; }&#10;&#10; /// &amp;lt;summary&amp;gt;&#10; /// Creates a version object for the Filelib. returns null if this is not possible&#10; /// &amp;lt;/summary&amp;gt;&#10; /// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&#10; public Version GetVersion()&#10; {&#10;&#10; Version parsedVersion = null;&#10; try&#10; {&#10; var version = Major + &amp;#34;.&amp;#34; + Minor + &amp;#34;.&amp;#34; + Revision + &amp;#34;.&amp;#34; + Build;&#10; while (version.EndsWith(&amp;#34;.&amp;#34;)) version = version.Substring(0, version.Length - 1);&#10; if (version == &amp;#34;&amp;#34;) return parsedVersion;&#10; parsedVersion = new Version(version);&#10; }&#10; catch (Exception exception) { }&#10; return parsedVersion;&#10;&#10; }&#10; /// &amp;lt;summary&amp;gt;&#10; /// the name of the lib&#10; /// &amp;lt;/summary&amp;gt;&#10; public string LibName { get; set; }&#10; /// &amp;lt;summary&amp;gt;&#10; /// the tags of the lib. e.g. min, intellisense, etc&#10; /// &amp;lt;/summary&amp;gt;&#10; public IEnumerable&amp;lt;string&amp;gt; Tags { get; set; }&#10; /// &amp;lt;summary&amp;gt;&#10; /// the extension of the lib&#10; /// &amp;lt;/summary&amp;gt;&#10; public string Extension { get; set; }&#10;}&#10;&lt;/code&gt;&lt;/pre&gt;</description></item></channel></rss>