Python FTP upload script

I am currently working on a project in Python where we generate the documentation using Sphinx. Each time I have generated a new documentation, I had to upload it manually to the public web server. After the third time it got a little bit annoyed and I wrote this small Python program to do the upload for me. #!/usr/bin/env python import… Read more →

hard disk

Partition backup with Linux

You all know the importance of backing up your digital data. As there are some decent graphical tools that help you to achieve this, I rather prefer the tools for the console. I have to make quite often backups of the filesystem of embedded devices on my work, so I write here a tiny guide how to backup a single… Read more →


Back to my Mac – Find remote Mac’s mDNS name

Apples iCould service offers a very convenient service called Back to my Mac. Basically this is a VPN (Virtual Private Network) of all the computers of an iCloud user which have activated the “Back to my Mac” feature in the iCloud settings. It uses IPv6 and IPSec to ensure the security when data is transferred over the internet. Note that… Read more →


C++11 Lambdas

Yeah, you heart it – Lambdas! C++ goes a little towards functional languages. C++11 introduced lambdas, allowing the definition of inline functionality, which can be used as a parameter or a local object. Lambdas change the way the C++ standard library and especially the algorithm package can be used. The definition of a lambda always starts with the [] brackets,… Read more →


C++11 Variadic templates

Almost everyone programming in C/C++ knows the function printf(). The function prototype of printf() is something like this: int printf(const char *format, …); printf() is a variadic function, which means that the function takes a variable amount of parameters. When defining template functions or methods in C++98, variadic parameters were not possible. Since C++11, templates can have parameters that accept… Read more →


C++11 constexpr

Since C++11, constexpr can be used to enable expressions to be evaluated at compile time. This keyword fixes a problem C++98 had when using numeric limits. Before C++11, an expression such as: std::numeric_limits<short>::max() could not be used as an integral constant, although it was functionally equivalent to the macro INT_MAX. Now, with C++11, such an expression is declared as constexpr… Read more →


C++11 noexcept

In C++98, every method or function can potentially throw an exception, even if there is no throws declaration. In C++ an the keyword noexcept was introduced in order to clearly specify that the given method or function can not throw – or is not prepared to throw – an exception. Example: void foo() noexcept; The example above defines a function… Read more →


C++11 string literals

If you need a \, % or new lines in string literals in C or C++, the literals can become rapidly a bit complicated and hard to read. C++11 offers a new form to initialize a string literal in a raw manner: const char *const s = R"(A \ on line one nothing on line 2…)";   In C++98 this would… Read more →


C++11 Move semantics

One of the most important new features of C++11 is the support of move semantics. This feature goes further into the major design goal of C++ to avoid unnecessary copies and temporaries. This new feature is very complex, so it is quite hard to explain in short. I found a very detailed explanation on Stack Overflow. If you are really… Read more →


C++11 Range based for loops

C++11 introduces a new form of for loop, which iterates over all elements of a given range, array, or collection. It’s what in other programming languages would be called a foreach loop. To calculate a sum of all number in a vector, the code in C++98 would look like: int sum(const vector<int> &params) {     int sum = 0;… Read more →


C++11 Uniform initialisation

Before C++11, programmers, especially novices, could easily become confused by the question of how to initialize a variable or an object. Initialization could happen with parentheses, braces, and/or assignment operators. For this reason, C++11 introduced the concept of uniform initialization, which means that for any initialization, you can use one common syntax. This syntax uses braces, so the following is… Read more →


C++11 auto

With C++11, you can declare a variable or an object without specifying its specific type by using auto. The type of a variable declared with auto is deduced from its initializer. Thus, an initialization is in any case required. Additional qualifiers like static and volatile are allowed. Using auto is especially useful where the type is a pretty long and/or… Read more →


C++11 nullptr and nullptr_t

C++11 lets you use nullptr instead of 0 or NULL to specify that a pointer refers to no value (which differs from having an undefined value). This new feature helps especially to avoid mistakes that occurred when a null pointer was interpreted as an integral value. nullptr is a new keyword. It automatically converts into each pointer type but not… Read more →


C++11 Nested Templates

In C++98, nested templates had to be written like this: vector<list<int> > IntegerListVector;   A space had to be placed between the two closing template expressions in order to avoid compilation errors, as a C++98 compiler would interpret the string “>>” as input stream operator. In C++11, this requirement has gone and it is completely legal to write the following… Read more →