What is Inversion of Control?

The Inversion of Control (IoC) and Dependency Injection (DI) patterns are all about removing dependencies from your code. For example, say your application has a text editor component and you want to provide spell checking. Your standard code would look something like this: What we’ve done here creates a dependency between the TextEditor and the … Read more

How to use the PI constant in C++

On some (especially older) platforms (see the comments below) you might need to and then include the necessary header file: and the value of pi can be accessed via: In my math.h (2014) it is defined as: but check your math.h for more. An extract from the “old” math.h (in 2009): However: on newer platforms … Read more

Could not find function “%<>%” with dplyr loaded

%<>% isn’t exported by dplyr (only %>% is). You need to load magrittr instead. Your reproducible example is running into a subtle magrittr bug, which causes the evaluation of pipeline expressions to search for some operators in magrittr’s scope, rather than in the calling scope. That way, x %<>% y %>% z, which evaluates as … Read more

Categories R

Git submodule update

This GitPro page does summarize the consequence of a git submodule update nicely When you run git submodule update, it checks out the specific version of the project, but not within a branch. This is called having a detached head — it means the HEAD file points directly to a commit, not to a symbolic … Read more