How to write a technical article ?

Few days ago, a friend of mine received a proposition to write an article for a developer magazine (french magazine Programmez). He was happy to talk about what he loves : TypeScript and Javascript in general.

I am a regular writer for this magazine so I gave him some tips & tricks. First : feel the passion into your word document you will send. The first article is always with big emotions but emotions should be replaced with passion for technologies. So there are differents ways to achieve the goal of producing a paper for a magazine. People like me talk to the reader by telling a story. Others are more “litteraire”, and with a good writing style. In my opinion, writing a technical article is giving keys and small samples and the goal is to make it attractive to the reader so that he can search in its favorite search engine topics about the stuff your write.

An article has to follow conventions : 4500 char per page. 9000 for two pages, etc. You can ship images with your articles and source code. Take care that the code should not be too much indented. There are two columns in the magazine so if one lne of source code fills 2 lines, it’s not good.

My friend gave me its article for review. I have feeled he gave everything he has to share. But it is a serie so he has to write one ou two more articles to fill the technical stuff and the deep dive of TS.

But the result is good. Now he can fly by himself. Everybody can write a technical article, it just takes time. If you known what your are talking about, it’s easy to put in Word.


Unit tests in C++

For magazine Programmez, I have made a review of Unit Testing Frameworks. I have described CPPUnit and Google Tests with it’s adapter for Visual Studio. There are two ways to tests the UT : console or Visual Studio Test Exeplorer Window.

I must admit I prefer the console version for running my tests.

Paris view from Montparnasse tower

Few days ago, I was at Tour Montparnasse for a job interview for young SupInfo students on the 16th floor. Look at the view:

Building Boost x86 and x64 – HOWTO

Just a reminder (for me). The command line to rebuild boost library with VS2017 is:

> boostrap.bat

> bjam toolset=msvc-14.1 variant=debug,release threading=multi link=shared address-model=64

My new contribution to GitHub is called MyOrganizer

Look at the prototype… It enables to create work items and edit the source code. I will make the link with¬† another prototype called VSDemo. Look :

Prototype is available at :

Building Log4cpp with VS2017

First, download log4cpp on sourceforge at .Latest version is 1.1.3. Let’s decompress the archive.
Go to logcpp/msvc10 folder. Open the mvc10.sln and upgrade the project to latest SDK and Visual Studio 2017 (v141). Done.
Build the log4cpp project… There is an error about a custom build step on file

We need to go into the folder msvc10 of the src and compile the event viewer definition file (.mc). You need to open Developer Command VS2017:

cd D:\Dev\log4cpp-1.1.3\log4cpp\msvc10>

MC: Compiling

D:\Dev\log4cpp-1.1.3\log4cpp\msvc10>rc -r -fo NTEventLogCategories.res NTEventLogCategories.rc Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384 Copyright (C) Microsoft Corporation. All rights reserved.

D:\Dev\log4cpp-1.1.3\log4cpp\msvc10>link /MACHINE:IX86 -dll -noentry -out:NTEventLogAppender.dll NTEventLogCategories.res Microsoft (R) Incremental Linker Version 14.12.25830.2
Copyright (C) Microsoft Corporation. All rights reserved.

Then in Visual Studio, remove the file from the project and let’s BUILD !
There is a compiler error. To solve it: add HAVE_SNPRINTF to the Preprocessor definitions… and REBUILD ! Now it is successful:

1> Creating library Debug\log4cpp.lib and object Debug\log4cpp.exp
1>log4cpp.vcxproj -> D:\Dev\log4cpp-1.1.3\log4cpp\msvc10\log4cpp\Debug\log4cpp.dll 1>Done building project “log4cpp.vcxproj”.
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

Unicode, TCHAR, STL std::string & std::stringw and building in mode x64

When you build a Visual Studio project, you have to consider multiple project options:

The Character Set option is very important in the way you will write code. Microsoft wants every developer to build with “Use Unicode Character Set” but bad habits were taken by developers.
They have preferred the option “Use Multi-Byte Character Set (MBCS)” where strings are things you put in “” and that’s all !

So what is the problem Doctor ? Handling Unicode allows you to target multiples languages and it’s the way we build modern softwares.
To help you achieve your migration or your new software, Microsoft provides TCHAR.h with a lot of macros:

– TCHAR means char in MBCS and wchar_t in Unicode

– _T(“toto”) means “toto” in MBCS and L”toto” in Unicode
To properly call routines of the CRT using TCHAR, you have to notice the name of the functions that care of TCHAR : Example: printf -> Unicode: wprintf, TCHAR: _tprintf
If you use _tprintf and #include , the function _tprintf will be expanded using the right function name.

TCHAR szLisa[10] = _T(“Lisa”);
_tprintf(_T(“%s\n”), szLisa);

But the question is : How do I switch from one mode to another. Example, I use STL, I can have std::string or std::wstring. Using STL strings has a mode that let you recover the characters using the c_str() function.

std::wstring s1 = szLisa;
std::wcout << s1 << std::endl;

If you want to dump from one world to another, the STL has a way:

std::string s2(s1.begin(), s1.end());
std::cout << s2 << std::endl;