Sorted map vs hashed map

| category: Testing | author: st
Tags:

In theory, hash map structure should be very fast on retrieving by key operations, close to O(1) like for an array. A sorted map (keys are sorted) should be O(log2 N) instead. The following test checks the difference.

Common scenario

We will use one tester class per …

Watching heap memory usage in Free Pascal/Delphi

| category: Testing | author: st
Tags: ,

Free Pascal (like Delphi) provide some useful functions to watch heap memory state in your application.

function GetHeapStatus: THeapStatus;

THeapStatus is documented here

Example of using this function is below

program ProgWatchMem;

uses
  Math, FGL;

type
  TLongIntArr = array of LongInt; // LongInt is a 4-byte signed integer
  PLongIntArr = ^TLongIntArr;
  TMySortedMap = specialize …

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 …

GenieLamp

| category: Design | author: st
Tags:

GenieLamp is the software factory and model-driven development framework. You have no more to write a boilerplate!

Quick start on the project's wiki.

I'm looking for contributors, please, contact me at Github

how it works

Install HP LaserJet Pro CP1025 on Ubuntu

| category: My notes | author: st

HP LaserJet Pro CP1025 is detected automatically by Ubuntu but it is not sufficient for printing. You should configure HPLIP.

At first time, check that HPLIP installed and its version is 3.11.1 at least

dpkg -l hplip

In Ubuntu 14.04 you should see something like this:

ii …

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 …