My favorites C++ books

There are various books about C++. The reference manuals and the optimizations ones. For example, Addison Wesley has a serie called “C++ In-Depth – Bjarne Stroustrup” also called the red books. Look at this titles:

  • Accelerated C++: Practical Programming by Example, Andrew Koenig
    and Barbara E. Moo
  • Applied C++: Practical Techniques for Building Better Software, Philip Romanik and Amy Muntz
  • The Boost Graph Library: User Guide and Reference Manual, Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine
  • C++ Network Programming, Volume 1: Mastering Complexity Using ACE and Patterns, Douglas C. Schmidt and Stephen D. Huston
  • C++ Network Programming, Volume 2: Systematic Reuse with ACE and Frameworks, Douglas C. Schmidt and Stephen D. Huston
  • C++ Template Metaprogramming: Concepts, Tools, and Techniques from Boost and Beyond, David Abrahams, Aleksey Gurtovoy
  • Essential C++, Stanley B. Lippman
  • Exceptional C++ Style 40 New Engineering Puzzles, Programming Problems, and Solutions, Herb Sutter
  • Exceptional C++; 47 Engineering Puzzles, Programming Problems,
    and Solutions, Herb Sutter
  • Modern C++ Design: Applied Generic Programming and Design Patterns,
    Andrei Alexandrescu
  • More Exceptional C++: 40 New Engineering Puzzles, Programming Problems, and Solutions, Herb Sutter

Not in the serie:

  • Effective C++ Third Edition, 55 Specific Ways to Improve Your Programs and Designs, Scott Meyers

The book of the language is:

  • The C++ programming language, Fourth edition, Bjarne Stroustrup

The books to understand rapidly the new features of C++11 is:

  • A Tour of C++, Bjarne Stroustrup
  • C++ Primer, Fifth Edition, Stanley B. Lippman, Josée Lajoie, Barbara E. Moo

The book to understand the compilers is:

  • Inside the C++ Object Model, Stanley B. Lippman

The book to learn the STL:

  • The C++ standard library : a tutorial and reference, 2nd Edition, Nicolai M. Josuttis

Private communications using GnuPG

If you want to send me a private email using encryption tools like GnuPG, use this:
Email : christophepichaud@hotmail.com |PGP Public Key
Email : christophep@mail.ru |PGP Public Key

Download UltraFluid modeler

You can download my application here:

http://www.windowscpp.com/Appz/UltraFluid_Modeler.zip

In the archive there are 2 main folders: bin and images. I have also created a shortcut. Adjust the shortcut to start the app located in bin but place the working directory on the upper folder.

I have a little bug on displaying images by setting the current folder. It will be fixed sooner.

To run the application, you must have vcredist from VS2015. These dll are not distributed in the zip archive.

ultrafluid_modeler_2

Updating Scintilla open-source project and Naughter’s wrappers and Boost 1.63

When I have updated Scintilla’s wrappers written by Naughter, I encountered compilation errors…
This the MFC class view that operates with the scintilla control. I need to update that class too. But first of all, I need to update Boost. Current version is 1.63. Just compile it with bjam. Classic stuff. Result is in stage\lib folder.

boost_stage_lib_163

For the moment I use Boost only for serialization stuff for XML stuff.

modeler1_saveasxml

Here is a XML file:

modeler1_data_xml

Boost serialization is not easy because it is designed that data has to be read by a Boost app…

Bye-Bye Sogeti – Welcome Microsoft France

I have worked 6 years to Sogeti and I was belonging to the “.NET Rangers” team by Sogeti. Check http://www.dotnetrangers.fr web site to enter into our blog. The Team was managed by François MERAND and we work in various places in France. There are guys in Paris, Lyon and Bordeaux.
medium-sdnr netrangersbysogeti

Now, I join Microsoft France to do Senior PFE job (Premier Field Engineer).

Using open-source libraries for MyModeler C++ project

I will make some enhancements to my modeler project (http://ultrafluid.codeplex.com). I have moved to Visual Studio online.

image001

MyModeler

My project use three open-source projects:

– Scintilla (http://www.scintilla.org/)

– MFC Naughter classes to encapsulate Scintilla edit control with MFC (http://www.naughter.com/scintilla.html)

– Boost (http://www.boost.org/)

My project was primary built in the 2012′. It was an idea to make my daughter Lisa able to place elements with the mouse.
It is a family project. It was also an free-time occupation when I was consultant for the “Banque de France” to build Architecture diagrams.
The initial goal of the project is to build diagrams with individual shapes elements. These elements contains properties and everything is store in a database.
Then, it is possible to make requests to find things. For the moment, I have no database. I need to implement that part of the software.

First surprise when I rebuilt the project with the latest version of Scintilla, the Naughter classes produced C++ compilation errors.
I needed to get the latest classes but also make some minor corrections (hide the code of 2 methods).
For boost, I have a version 1.59 on my computer and I have no evidence to jump to the latest version because I just use serialization and XML stuff which belong to a very stable library : serialization.

I rebuilt the project and it just works. The project updated to MSVC140 build tools with Visual Studio 2015.
This is the magic of C++ : it works along all theses years… But my open-source libraries has evolved and most of the time, getting an updated version can bring some changes.
In my case, the Naughter MFC classes depends on Scintilla project so the GET operation must assure that the 2 projects are synced.

Using log4cpp with Visual Studio 2015

First, let’s download log4cpp from sourceforge: http://log4cpp.sourceforge.net/

Log4cpp version is log4cpp-1.1.2rc5.

Let’s open log4cpp-1.1.2rc5log4cppmsvc10log4cpplog4cpp.vcxproj in VS2015. Try to build it. It fails. 2 errors…

snprintf & vsnprintf stuff. Ugly & cryptic error. Multiples definitions of body…

Let’s dive in the source code and we can see that a preprocessor declaration will help us.

Add HAVE_SNPRINTF to the project settings in preprocessor stuff. Build it. It is ok.

1> Creating library Debuglog4cpp.lib and object Debuglog4cpp.exp

1> log4cpp.vcxproj -> D:Devcpplog4cpp-1.1.2rc5log4cppmsvc10log4cppDebuglog4cpp.dll

========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

Now, let’s build a sample client for using this dll.

We add a Win32 console project to the solution.

Add include folder to the client project:

Add the library folder to find the .lib file:

Add in your stdafx.h the following code:

#pragma once

#include "targetver.h"

#include <stdio.h>

#include <tchar.h>

#include <string>

#include <iostream>

using namespace std;

#include <log4cpp/RollingFileAppender.hh>

#include <log4cpp/Category.hh>

#include <log4cpp/Configurator.hh>

#include <log4cpp/Portability.hh>

#include <log4cpp/PropertyConfigurator.hh>

#pragma comment(lib, "log4cpp.lib")

The main program just put some data in file:

#include "stdafx.h"

#include "Logger.h"

int main()

{

MyLogger log;

if (!log.Init())

return 0;

log.LogDebug("Enter main...");

log.LogInfo("Main...");

log.LogDebug("Exit main");

return 0;

}

All the magic is contained in this code snipet:

#pragma once

class MyLogger

{

public:

MyLogger()

{

}

virtual ~MyLogger()

{

log4cpp::Category::shutdown();

}

bool Init()

{

try

{

string initFileName = "log4cpp.property";

log4cpp::PropertyConfigurator::configure(initFileName);

}

catch (log4cpp::ConfigureFailure& f)

{

std::cout << "Configure Problem" << f.what() << std::endl;

return false;

}

return true;

}

void LogDebug(string message)

{

log4cpp::Category & mylogger = log4cpp::Category::getInstance("MyLogger");

mylogger.debug(message);

}

void LogInfo(string message)

{

log4cpp::Category & mylogger = log4cpp::Category::getInstance("MyLogger");

mylogger.info(message);

}

};

The configuration file is defined like:

#file log4cpp.property

log4cpp.rootCategory=DEBUG, rootAppender

log4cpp.category.MyLogger=DEBUG, aLogger

log4cpp.appender.rootAppender=ConsoleAppender

log4cpp.appender.rootAppender.layout=BasicLayout

log4cpp.appender.aLogger=RollingFileAppender

log4cpp.appender.aLogger.fileName=c:tempaLogger.log

log4cpp.appender.aLogger.maxFileSize=10240

log4cpp.appender.aLogger.maxBackupIndex=5

log4cpp.appender.aLogger.layout=PatternLayout

log4cpp.appender.aLogger.layout.ConversionPattern=[%d{%H:%M:%S,%l}] %m%n

#end of file