Yes, it's about C++ and system programming... This site is just my notepad where I make some remarks on professional topics which are mostly related to C++ and system programming. These notes appeared as answers to the questions that were asked by myself and my collegues during the work process. They may look a bit fragmentary which may explain the name of the site.
I also write some notes on web design and programming of which I have much less experience.
P.S. Comments are welcome!
From time to time I meet code snippets or get asked about functions returning const type. In 99% of cases that I saw it in code, it was absurd like this:
const int someConst();
const int a = someConst();
int b = someConst();
In both cases someConst() returns anonymous object of type int which can't be modified anyway. It is used for initializing other variables but their constancy does nothing with returning type.
Let's look what options we have to use constants as return type.
I decided to write a series of articles which deal with topics that are slightly beyond interests of entry level programmer, but are essential for moving ahead. It would be overview giving general idea of how your programs actually work from operational system perspective. Therefore I named this series "Know your program ...".
Today's subject is the format of Windows executable file. Windows as dominating desktop OS has an enormous army of software developers including myself. But the product of compilation and linking for many programmers is a black box. I would admit that it is a bit tangled, but not to the extent that would repulse us from enjoying its disassembling. To start with let's consider the basics.
Rendering modes on the one hand was a confusing invention of IE developers, on the other hand it appeared as an enlightenment. The problem was how to keep IE5's backward compatibility and at the same time step on the way of supporting CSS and other new standards. There was huge legacy of sites which were made without thinking about standards and Microsoft couldn't sacrifice them. The brilliant idea was to switch between rendering modes depending on how a web document was starting. If it contained document type declaration (DOCTYPE) the document was processed in the standard mode otherwise in old "quirk" mode.
I know that each issue deserves probably a separate article but you easily can google any details by yourselves. My goal was to make a short all in one overview of problems you can face and give some hints.
For some time I was using my own CMS client to upload images to my sites. It was very convenient to use ready Qt solution — QFtp class. But after changing my hosting company I faced a trouble, new hosting accepted only secure FTP uploads. I searched the net looking for help on how to deal with FTPES with Qt but found just general recommendations to use QSslSocket class. So I explored the possibility of tweaking the QFtp class which also would minimize code changes in my app. This article demonstrates how to implement basic secure FTP with TLS authorization slightly tweaking QFtp. Though it is not the perfect solution it worked for me. The limitations of this approach is that it works only with explicit FTPS (FTPES), it doesn't work with certificates and also I sacrificed the active mode to keep things simple. But feel free to implement these yourselves!