Slides From Lecture about CppCMS
At August 3rd, I had given a lecture about CppCMS at the annual Israeli FOSS conference August Penguin.
The slides are now available for download:
http://cppcms.com/files/ap2012/
CppDB 0.3.1 Released
This is an important bugfix release.
It is recommended for all users to upgrade to latest version:
Critical Bugs fixed:
- Fixed bug #3536452:
cppdb::transaction::~transaction()
could leak an exceptionbusy_timeout
option was not working for sqlite3 backend
- Fixed incorrect use of
SQLITE_STATIC
that could cause crash
Full Changelog: http://cppcms.com/sql/cppdb_0.3.1/changelog.html
Downloads: https://sourceforge.net/projects/cppcms/files/cppdb/
How not to do Unicode...
All started from a small problem, how to print Unicode text to the Windows Console with option redirect to a file.
Let's say we have a program Hello that prints few words in several languages to the screen..
#include <stdio.h>
int main()
{
printf("Мир Peace Ειρήνη\n");
return 0;
}
The program above is trivial and works fine under Windows if current console codepage is set to UTF-8. Also this can be fixed from the program by calling SetConsolseOutputCP(CP_UTF8)
.
Now simple tweak... Instead of that standard C printf
we would use standard C++ std::cout
... It works fine for GCC. But under Visual C++ it prints squares...
If I try redirection test.exe >test.txt
- I get perfectly fine UTF-8 text...
I had started researching the issue and found the post of one of the Windows Unicode Gurus Michael Kaplan's.
I've tried to run _setmode(_fileno(stdout), _O_U8TEXT)
as recommended by the
Microsoft's Unicode guru and... By program crashed on attempt to write
to the output stream.
Keeping searching for an answer I've got to this bug report...
Short summary:
- User: Can't print UTF-8 to console with std::cout
- MS: Closing - this is by design, see Michael Kaplan's article about writing to console
- User: But if I do what suggested program crashes, and I still can't write Unicode to console
- MS: Reactivate the ticket if it does not works
- User: it does not!
- MS: Use wide output...
- User: I'd rather use fprintf in first place!?
To the summary...
If you use Visual C++ you can't use UTF-8 to print text to std::cout
.
If you still want to, please read this amazingly long article about
how to make wcout
and cout
working, but it does not really give a simple
solution - finally falling to redefinition of the stream buffers...
So please, if you design API or Operating System, do not use kind of "Wide" API... This is is the wrong way to do Unicode.
Which reminds me... Spread around:
http://www.utf8everywhere.org/
Related Posts: http://blog.cppcms.com/post/62
RPM Repositories for CppCMS
Additionally to DEB Repositories, RPM repositories are ready as well.
The packages are build using Open Build Service:
- Distributions: Fedora 15 and 16, CentOS 6, OpenSuse 11.4 and 12.1
- Architectures: x86, x86_64
- Packages: libcppcms, libcppcms-devel, cppcms-tools
- Sources: cppcms
http://download.opensuse.org/repositories/home:/artyom-beilis/
CppCMS 1.0.1 - Bug Fix Release
CppCMS 1.0.1 Released
It is a bug fix release:
- Fixed crash when using process-shared memory cache, when CppCMS compiled in Release mode with gcc 4.5 and 4.6.
- Added support of CMake LIBDIR option to allow installation of libraries to lib64 instead of lib as required by Rad Had based distributions.
Additionally to the deb releases, now source-rpm is available at sourceforge.
In order to create RPMs for your system:
Install dependent packages:
yum install cmake gcc-c++ gcc make zlib-devel pcre-devel libicu-devel libgcrypt-devel
Download source rpm and rebuild it as:
rpmbuild --rebuild cppcms-1.0.1-1.src.rpm
You will get 3 binary rpm packages: libcppcms, libcppcms-devel and cppcms-tools in the ~/rpmbuild/RPMS/
directory. Install them and use them.
Special Thanks: to Sagi Ben-Akiva for initial spec file that made this process much simpler for me.