Happy tickets benchmark

| category: Testing | author: st
Tags: , , ,

Some countries have integer numbers printed on the transport tickets, for example, in ex-USSR. The ticket is "happy" when the sum of the first half of digits equals to the second one. Then you should eat it and make a wish.

Example:

123456 and 111222 are not happy tickets
123123 …

Interface implementations and multiple inheritance in C++

| category: Programming | author: st
Tags:

Multiple inheritance of interfaces which are pure abstract classes indeed is not a problem until you need to use the interface implementation in other classes.

Suppose there are two interfaces, the implementation of which will be used in other classes.

class IA
{
public:
    virtual void m1() = 0;
};

class IB : public …

Crack C# namespaces in 30 seconds

| category: Programming | author: st
Tags:

The namespaces conception in C# seems to be exhaustive and insufficient at the same time compared with a strong module notation in Oberon-2 and even with a modular programming approaches in Free Pascal/Delphi.

Why insufficient? You cannot declare constants and functions within namespaces but you should add a class …

DateTime in C++

| category: Programming | author: st
Tags:

Many years ago we had a need to manipulate the data of types "date" and "time" (DateTime in C# and Delphi/C++Builder). I had developed the corresponding class for these purposes.

Here is the interface with comments:

/*
 * Initializes the object with the values taken from the formatted string like …