UPDATE: I updated this article with some information about password cracking with the reason to use the algorithms bcrypt or scrypt to store the user’s password instead of hash + salt mechanisms. Moreover, I proposed a new RNG based on the usage of /dev/urandom if OpenSSL is not available.
If you are a professional web developer, Read More →

C++ Copy Constructor passed by value or by reference ?
Sollution
The parameter in the copy constructor A(A other) is an instance of type A.
When the copy constructor is executed, it calls the copy constructor itself because of the pass-by-value parameter.
Since endless recursive calls cause call stack overflow, a pass-by-value parameter is not allowed in the C++ Read More →

To create the shared (*.so) library, use these steps
Example instructions for compiling
1) g++ -fpic -c CLib.cpp
2) g++ -shared -o libCLib.so CLib.o
3) g++ CLibTest.cpp -o CLibTest -L. -lCLib
C Programming Tutorial in Linux #040 - Dynamic Shared Library
https://www.youtube.com/watch?feature=player_detailpage&list=WL&v=c8TxXFEDDF4

http://www.parashift.com/c++-faq/separate-template-class-defn-from-decl.html
Tell your C++ compiler which instantiations to make while it is compiling your template class's .cpp file.
(If you've already read the previous FAQ, this answer is completely symmetric with that one, so you can probably skip this answer.)
As an example, consider the header file Foo.h which contains the following template class. Note that method Foo<T>::f() Read More →

Google C++ Style Guide

Table of Contents

Header Files

Self-contained Headers
The #define Guard
Forward Declarations
Inline Functions
Function Parameter Ordering
Names and Order of Includes

Scoping

Namespaces
Nested Classes
Nonmember, Static Member, and Global Functions
Local Variables
Static and Global Variables

Classes

Doing Work in Constructors
Initialization
Explicit Constructors
Copyable and Movable Types
Delegating and Inheriting Constructors
Structs vs. Classes
Inheritance
Multiple Inheritance
Interfaces
Operator Overloading
Access Control
Declaration Order
Write Short Functions

Google-Specific Magic

Ownership and Smart Pointers
cpplint

Other C++ Features

Reference Arguments
Rvalue References
Function Overloading
Default Read More →

Intent
Provide a surrogate or placeholder for another object to control access to it.
Use an extra level of indirection to support distributed, controlled, or intelligent access.
Add a wrapper and delegation to protect the real component from undue complexity.
Problem
You need to support resource-hungry objects, and you do not want to instantiate such objects unless and until they Read More →

Since a time_t is only required to represent time intervals of ±68 years, and many implementations use a base year of 1970 for representing the current time, there is an inability for many popular C++ implementations to represent dates and times after 2038. This means that a lot of software could break in 2038, if Read More →

Contents
1. Mapping Objects to Databases
2. Active Record
3. Data Mapper
4. Using a Repository
5. Identity Map
6. Lazy And Eager Loading
7. Virtual Proxy Pattern
8. Taking the Next Step
Data access is a popular subject among developers. No doubt you've heard plenty of opinions on specific data access technologies and persistence frameworks, but what's the best way to consume these Read More →

This piece of code illustrates how your compiler library handles different settings of the TZ environment variable. It also shows
the problematics arising from time zone conversion localtime/gmtime when daylight saving is currently in effect and the time to be converted would have no daylight time set and vice versa.
In your shell set the environment variable Read More →

Problem
You have two objects, and you need to know if their respective classes have a base class/derived class relationship or if they are unrelated.
Solution
Use the dynamic_cast operator to attempt to downcast from one type to another. The result tells you about the class’s relationships.
Example presents some code for doing this.
Determining class relationships

#include <iostream>
#include <typeinfo>
using namespace Read More →

ODB is an open-source, cross-platform, and cross-database object-relational mapping (ORM) system for C++. It allows you to persist C++ objects to a relational database without having to deal with tables, columns, or SQL and without manually writing any mapping code. ODB supports MySQL, SQLite, PostgreSQL, Oracle, and Microsoft SQL Server relational databases as well Read More →

In this article we will learn to implement a One-To-One relationship between two classes. As in the previous article, at first we will try to understand the best use of a One-To-One relationship.
There might be a situation where we need to implement a relationship between a student and his registration number. In a university a Read More →

In this article we will learn to implement a Many-To-One relationship in a C# class. As in the previous two articles, we will explain the scenario where a Many-To-One relationship is relevant. Think about the situation where we want to represent a relationship between a teacher and a student. It is a very common scenario Read More →

In this article we will see how to implement a Many-To-Many relationship in a C# class. Let's explain a few scenarios where a Many-To-Many relationship is relevant.
The relationship between a Cricket match and Cricketer is one example of a Many-To-Many relationship. One Cricket match is played by many Cricketers and one Cricketer takes part in Read More →

The following macro is not quite as compact as a single-use ostringstream or boost::lexical_cast.
But if you need conversion-to-string repeatedly in your code, this macro is more elegant in use than directly handling stringstreams or explicit casting every time.
It is also very versatile, as it converts everything supported by operator <<(), even in combination.
Definition:

#include <sstream>
#define SSTR( Read More →