Sep 30, 2008

Qt got rebranded

Trolltech web site got a rebranding and there was also a Qt 4.4.3 release dedicated to the rebranding only.
Qt 4.4.3 is a rebranding-only release. In all other aspects, it is the
same release as Qt 4.4.2. It maintains both forward and backward
compatibility (source and binary) with Qt 4.4.2, 4.4.1 and 4.4.0.

In June 2008 Nokia acquired Trolltech ASA to enable the acceleration of their cross-platform software strategy for mobile devices and desktop applications, and to develop its Internet services business. On September 29, 2008 Nokia renamed Trolltech to Qt Software.

Jul 29, 2008

Google Code Jam 2008 - Alien Numbers

As many of your may know Google Code Jam 2008 has been recently launched.
I found some free time and decided to have a look at the tasks of this competition. Just out of curiosity... :)

Today's morning I solved the first task - "Alien Numbers".
The task is just for practice and has almost nothing to do with the real competition. I mean, it is a simple problem, but it was very interesting to solve it as fast as possible :)

The decimal numeral system is composed of ten digits, which we represent as "0123456789" (the digits in a system are written from lowest to highest). Imagine you have discovered an alien numeral system composed of some number of digits, which may or may not be the same as those used in decimal. For example, if the alien numeral system were represented as "oF8", then the numbers one through ten would be (F, 8, Fo, FF, F8, 8o, 8F, 88, Foo, FoF). We would like to be able to work with numbers in arbitrary alien systems. More generally, we want to be able to convert an arbitrary number that's written in one alien system into a second alien system.


The first line of input gives the number of cases, N. N test cases follow. Each case is a line formatted as

alien_number source_language target_language

Each language will be represented by a list of its digits, ordered from lowest to highest value. No digit will be repeated in any representation, all digits in the alien number will be present in the source language, and the first digit of the alien number will not be the lowest valued digit of the source language (in other words, the alien numbers have no leading zeroes). Each digit will either be a number 0-9, an uppercase or lowercase letter, or one of the following symbols !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~


For each test case, output one line containing "Case #x: " followed by the alien number translated from the source language to the target language.


1 ≤ N ≤ 100.

Small dataset

1 ≤ num digits in alien_number ≤ 4,
2 ≤ num digits in source_language ≤ 16,
2 ≤ num digits in target_language ≤ 16.

Large dataset

1 ≤ alien_number (in decimal) ≤ 1000000000,
2 ≤ num digits in source_language ≤ 94,
2 ≤ num digits in target_language ≤ 94.


9 0123456789 oF8
Foo oF8 0123456789
13 0123456789abcdef 01

Case #1: Foo
Case #2: 9
Case #3: 10011
Case #4: JAM!

The following is my solution in C++, be advised and don't blame me, there are many missing checks, I know that, and safety procedures. That is because I tried to solve this problems and get result as fast as possible. So, here you go with the solution I came up first.

#include <fstream>
#include <iostream>
#include <vector>
#include <string>

using namespace std;

typedef vector<int> IntVect_t;

size_t to_num( const string &_base_set, const string &_val)
size_t NumRes(0);
size_t PositionPower(1);
string::const_reverse_iterator iter = _val.rbegin();
string::const_reverse_iterator iter_end = _val.rend();
for(; iter != iter_end; ++iter)
NumRes += _base_set.find(*iter) * PositionPower;
PositionPower *= _base_set.size();
return NumRes;

int main(int argc, const char* argv[])
ifstream f(argv[1]);
if( !f.is_open() )
return 1;

string outfile(argv[1]);
ofstream f_out( (outfile+".out").c_str() );

size_t nCase;
f >> nCase;
for(size_t i = 1; i <= nCase; ++i)
string _src;
string _dest;
string _to_convert;
f >> _to_convert >> _src >> _dest;

IntVect_t pos_dest;
size_t NumRes = to_num( _src, _to_convert );
for(; NumRes > _dest.size()-1;)
pos_dest.push_back( NumRes % _dest.size());
NumRes /= _dest.size();
pos_dest.push_back( NumRes );

f_out << "Case #"<< i <<": ";
IntVect_t::const_reverse_iterator iter = pos_dest.rbegin();
IntVect_t::const_reverse_iterator iter_end = pos_dest.rend();
for(; iter != iter_end; ++iter)
f_out << _dest[*iter];
f_out << endl;
return 0;

Jun 12, 2008

StatSVN 0.4.0

A new version of StatSVN has been released. See changes.
Download StatSvn 0.4.0.

New Features:

o Added support for an XML export of the main reports, just use option -xml,
based on patched proposed by Nilendra Weerasinghe. Thanks to Nilendra
o Applied patch for [ 1639462 ] Added TRAC Support. Fixes 1639462. Thanks to
Jean-Francois Burdet.
o Applied patch to StatCVS to show the Head Revision (had to change it to
hide it for CVS as it does not make sense for CVS). Fixes 1932689. Thanks
to Martin Majlis.
o Performance enhancement. If SVN 1.4 is available, do one diff per revision
instead of one diff per file per revision. Added -force-legacy-diff option
to retain previous functionality.
o Applied patch to StatCVS to add Affected files count per commit. Thanks to
Martin Majlis.
o Applied patch to StatCVS to add Revision number on commit page. Fixes
1839303. Thanks to Martin Majlis.
o I have added a validation mechanism that checks the Repository object once
the log is parsed, if root is null, it will terminate the execution.
o I have added a small project attribute which makes it more obvious which
cache belongs to what project in the repositories.xml and xml cache files.
Fixes 1687928.
o Added support for tags-dir as a way to specify 'top' directory where the
tags are stored, defaulted to "/tags/". Fixes 1692245.
o Added support for a '-anonymize' command line option, to anonymize
committer names. Fixes 1743119.

Fixed bugs:

o Changed RSS to use the common one:


o The RepoMap and LOCChurn reports have been promoted to StatCVS and hence,
removed from the StatSVN source tree.

May 21, 2008

stropts.h: No such file or directory

If during compilation your compiler complains about missing "stropts.h", don't wary. Most probably you are running on MacOS X 10.3 or FreeBSD 6.0 or NetBSD 3.0 or OpenBSD 3.8 or Cygwin or mingw or BeOS... or Fedora 9 (probably all modern Linux'es).

Simply to say, your system doesn't support STREAMS.

Linux espesially:
Linux doesn't support STREAMS (many years ago it was available as a third party module, but it hasn't worked for years). stropts.h is part of a POSIX XSR option, which Linux now, matching reality, says it is not supported.
and here we have the POSIX recommended check:

#include <unistd.h>
#if defined _XOPEN_STREAMS && _XOPEN_STREAMS == -1
/* XSR option is not available, headers, data types etc. may not be available. */
Hope it helps.

Apr 17, 2008

Visual C++ 2008 Feature Pack Release

Visual C++ 2008 Feature Pack Release

Why they just don't let MFC die?!

This final release of the Visual C++ 2008 Feature Pack extends the VC++ Libraries shipped with Visual Studio 2008 and is fully covered under Microsoft's standard support policies.

The VC++ 2008 MFC libraries have been extended to support creation of applications that have:

* Office Ribbon style interface

* Office 2007, Office 2003 and Office XP look and feel

* Modern Visual Studio-style docking toolbars and panes

* Fully customizable toolbars and menus

* A rich set of advanced GUI controls

* Advanced MDI tabs and groups

* And much more!

This feature pack also includes an implementation of TR1. Portions of TR1 are scheduled for adoption in the upcoming C++0x standard as the first major addition to the ISO 2003 standard C++ library. Our implementation includes a number of important features such as:

* Smart pointers

* Regular expression parsing

* New containers (tuple, array, unordered set, etc)

* Sophisticated random number generators

* Polymorphic function wrappers

* Type traits

* And more!

Apr 7, 2008

Snow in Germany

Despite of the fact that today is a spring day, we finally got some snow (there was no snow at all during the whole winter).
Somewhere around Frankfurt on Main:

Mar 6, 2008

C++ Master

I am now officially a C++ Master :)
Recently I have gotten a hard copy of my C++ Master certificate issued by Brainbench. Of course, to get the certificate one should pass an online test. And I can admit, the test had a number of very nice questions. Anyway I don't think that was the best test I've ever participated in, but it was definitely a nice one. After the test I had to look into books to confirm some of my answers. Good job by Brainbench! I am looking for some other tests of them to pass. It is actually entertaining and helps to keep yourself fit.

Mar 5, 2008

Singularity RDK

MS has just freely opened Singularity RDK for academic non-commercial use.
About Singularity

Singularity is a research project focused on the construction of dependable systems through innovation in the areas of systems, languages, and tools. We are building a research operating system prototype (called Singularity), extending programming languages, and developing new techniques and tools for specifying and verifying program behavior.

Advances in languages, compilers, and tools open the possibility of significantly improving software. For example, Singularity uses type-safe languages and an abstract instruction set to enable what we call Software Isolated Processes (SIPs). SIPs provide the strong isolation guarantees of OS processes (isolated object space, separate GCs, separate runtimes) without the overhead of hardware-enforced protection domains. In the current Singularity prototype SIPs are extremely cheap; they run in ring 0 in the kernel’s address space.

Singularity uses these advances to build more reliable systems and applications. For example, because SIPs are so cheap to create and enforce, Singularity runs each program, device driver, or system extension in its own SIP. SIPs are not allowed to share memory or modify their own code. As a result, we can make strong reliability guarantees about the code running in a SIP. We can verify much broader properties about a SIP at compile or install time than can be done for code running in traditional OS processes. Broader application of static verification is critical to predicting system behavior and providing users with strong guarantees about reliability.

Video on Singularity:

Feb 11, 2008

Doxygen v.1.5.5

There was a new release of Doxygen - the version 1.5.5 is out!
Here you get a list of changes.
There is a new supported tag "\tparam", which works similar to "\param" but is meant for documenting template parameters. Among other changes there is a good number of bugs fixed.

Feb 5, 2008

Exception handling

Such a nice method of C++ exception handling in big projects.

void handleException() {
try {
} catch (const Exception1& ex) {
} catch (const Exception2& ex) {

void foo1() {
try {
} catch (...) {

void foo2() {
try {
} catch (...) {

(has been taking from wxWidgets library)

Jan 31, 2008

Nokia to acquire Trolltech to accelerate software strategy

A news from Trolltech:
Today, Nokia has made a public tender offer for all the shares in Trolltech. We think this is great news for both you and us. In Trolltech, we have for a long time had a vision of “Qt Everywhere”. Being acquired* by Nokia, we will continue to provide you with the most advanced cross-platform software framework for desktop and devices in the market. There will be further investments in Qt and Qtopia and an even better long-term security in your decision to choose Trolltech for your business.

Well I am not still sure whether it is gut for users or not... Let's hope it is not :)
Thanks God, KDE have an agreement with Trolltech:
In particular, should Trolltech ever discontinue making regular releases of the Qt Free Edition for any reason — including a buyout or merger of Trolltech or the liquidation of Trolltech — the Qt Free Edition will be released under the BSD license and optionally under one or more other Open Source Licenses designated by the Board of the Foundation.

Jan 22, 2008

Fedora 8 and KNetworkManager. Part 2

It seems OpenSUSE ships already a new version of KNetworkManager.
As far as I understand Fedora needs to have the new DBus Qt 3 bindings (currently Fedora has an old version of dbus-qt), which OpenSUSE also provides.

Jan 18, 2008

stringstream bug? Part 2

It actually appeared to be a correct behavior!
See gcc bug#31456.
The following example works as expected:

#include <iostream>
#include <sstream>

using namespace std;

int main()
ostringstream ss("Test",ios::out | ios::app );
cout << "#1: " << ss.str() << endl;

ss << "--";
cout << "#2: " << ss.str() << endl;
return 0;


#1: Test
#2: Test--

stringstream bug?

What the hell happened to std::stringstream. I have just noticed this while helping my colleague to debug his code.

#include <iostream>
#include <sstream>

using namespace std;

int main()
stringstream ss("Test");
cout << "#1: " << ss.str() << endl;

ss << "another string";
cout << "#2: " << ss.str() << endl;
return 0;


#1: Test
#2: another string

stringstream has eaten the initial string, which was provided as a parameter to the constructor.

OS: Fedora 8
Compiler: g++ (GCC) 4.1.2 20070925 (Red Hat 4.1.2-33)

this one is nice:

#include <iostream>
#include <sstream>

using namespace std;

int main()
ostringstream ss("Test");
cout << "#1: " << ss.str() << endl;

ss << "--";
cout << "#2: " << ss.str() << endl;
return 0;


#1: Test
#2: --st

XML schema forever!

Recently I've redesigned a configuration file for one of my projects. It is an XML file and was designed in a hurry. Now I have implemented it in a proper way, I believe, with some structure changes and with a custom XML schema. I am using, by the way, the xerces-c DOMBuilder interface. DOMBuilder - an interface introduced by the W3C DOM Level 3.0 Abstract Schemas and Load and Save Specification (
Once again it was proven that with a properly written schema one can avoid a lot of "stupid" errors (when user or third-party application modifies XML configuration files) and improve security of the application. That's simply because the configuration file is validated and checked for errors even before the application starts to read configuration entries from it.
XML Schema 1.1 is a really powerful language, you can describe XML files in a very precise manner. I always thought that and once again it appeared to be a very true! I actually can't imagine someone doing XML development without using the schema. It will be a nightmare.

Unfortunately if your development platform is Linux you will face some leak of good XML editors - by "good", I also mean "free". :)
And, worth to be mentioned, a leak of tools for XML schema documentation generation. I found so-far only one tool, which is free and does generate HTML documentation from "*.xsd" files. Its name is xsddoc. And that all :(
May be I misused google, but I didn't find anything comparable for Linux. The output of xsddoc is not very sharming, as I would expect it, but at least it does the job and does it very well.

Jan 14, 2008

Is StatSVN dead?

When SVN user looks for a descent SVN statistics tool, StatSVN will definitely come up in the search.
Two years ago I have also looked for a free SVN statistic tools and StatSVN was my choice. In this post I will shortly describe my experience with the tool.
First of all, StatSVN is easy in use tool written in Java, and it has extremely simple installation :)
BTW, I am using StatSVN v.0.3.1.

  • Java v.1.4.x. (I recommend to use Sun's Java machine, I had some problems with machines from other vendors).
  • The SVN command-line client v.13.0 or higher.
Installation and Usage
Here you can read a detailed installation and usage instruction.


#1 Multiple projects and tags

In my project I have one SVN repository for several projects. I have something like the following:

  • SVN repository
    • Project #1
      • branches
      • tags
      • trunk
    • Project #2
      • branches
      • tags
      • trunk
I wanted to have tags of the projects to be recognized and published in reports. Unfortunately StatSVN determins tags by looking at your repository's /tags directory. To be able to use this feature, you must generate a log file from the root of your repository, so that the log contains information from both the /tags and the /trunk. The checked out version does not have to contain the tags directory. With my svn layout this feature didn't work, of course.
What I did to fix it, I've just hacked a bit the svn log output file (before giving it to StatSVN) by processing it with the following command:

sed -i "s/\/$PROJECT_NAME\/tags\//\/tags\//g" svn.log

It worked for me, since I am generating statistics for each project independently.
Newer version of StatSVN, which hasn't been yet released, supports "-tags-dir" options. This option allows to use another top-level directory than 'tags'. This actually should be a solution to multiple projects in one SVN repository, like I have, or to custom SVN layouts.

#2 Broken Font
At the very beginning I had an issue with StatSVN - font of the charts' labels was broken, "mirrored" and was difficult to read.
I think it had something to do with the version of Java runtime environment I've been using at that time, since StatSVN uses JFreeChart to generate charts. I believe I was using something from GNU or maybe IcedTea, I don't already remember it. Anyway, after I get Sun JRE installed, my problems with the font disappeared.

#3 Source code statistics
I think, the functionality StatSVN still misses is a kind of integration with SLOCCount or something. I therefore use an external call for SLOCCount in order to get a better LOC calculation. Because SLOC from StatSVN is not really what I need.
By the way there is a nice comment of Jason Kealey (StatSVN developer) on the subject:
For the moment, we measure physical lines of code; language independant
(similar to wc -l). Whitespace is not ignored. Comments are not ignored.
StatCVS computes the LOC in the same way, but since we're contacting the
repository, we have the possibility to implement other models.

My personal opinion is that LOC should not be the basis of any profound
analysis. We have the simplest form of LOC implemented in StatSVN that's
enough to give you an overview of what's happening. Regardless of the
method, if the method is known, developers can cheat the metric. Yes, the
metrics are artificially inflated by whitespace and comments, but hopefully
the inflation is uniform across the codebase.
#4 Integration with Trac
As far as I know there is no integration with Trac possible, and no work is done there, besides this attempt.

#5 Style sheet
The default style sheet of StatSVN isn't really nice. I suggest something like this.

Looking at the name of the topic "Is StatSVN dead?", I would answer "I dunno". The last version of StatSVN was released on 2007-03-10, almost a year ago. One can think that the project is dead. Probably project was suspended for some time, that's may be true. But now one can see some activity on the field. So let's see and hope that we get a new version of StatSVN very soon!

So far that's it. I'll post some more information later :)

Jan 9, 2008

The new James Bond girl!

Ladies and Gentlemen, please welcome the new James Bond girl - Olga Kurylenko!

It was released that former model Olga Kurylenko will play as the James Bond girl with Daniel Craig in Bond 22. By the way, the 28-year-old Ukrainian, recently played in Hitman (Nika Boronina), so she obviously has some action :) experience already.

Source (BBC News).

Jan 8, 2008

Visual C++ 2008 Feature Pack Beta

Recently MS has released Visual C++ 2008 Feature Pack Beta.
Well, this pack actually contains two main points worth to be mentioned, namely, MFC libraries extensions and TR1 implementation from MS.

MFC got the following additions:

  • Office Ribbon style interface

  • Office 2007, Office 2003 and Office XP look and feel

  • Modern Visual Studio-style docking toolbars and panes

  • Fully customizable toolbars and menus

  • A rich set of advanced GUI controls

  • Advanced MDI tabs and groups

  • And much more!

What can I say... Pretty impressive! Sorry guys but I really thought that MFC were already dead for several years or so.
Me, and guys I know who develop software for Windows don't use MFC in anyway, why should we, when there is ATL/WTL or Qt?

Effective C++, Third Edition (Scott Meyers):
TR1 ("Technical Report 1") is a specification for new functionality being added to C++'s standard library. This functionality takes the form of new class and function templates for things like hash tables, reference-counting smart pointers, regular expressions, and more. TR1 itself is just a document. As I write this in early 2005, the document has not been finalized, and its URL is subject to change.
I can't describe it better as Scott Meyers did!

The current TR1 draft is dated 24 June 2005.
Now back to the Visual C++ 2008 Feature Pack Beta and its TR1 part.
It seems to me that this implementation of TR1 is actually implementation from MS and not an extract of BOOST TR1 as I thought it could be. :) The following quote is the reason for my conclusion (see this document):

The following are known issues that are planned to be fixed in the final release
of TR1 for Visual Studio 2008:

* mem_fn() does not support member functions with non-default calling conventions.

* Nested bind() expressions do not compile.

* bind() expressions with explicit result types do not compile.

* bind() expressions involving function objects with templated function call
operators do not compile.

Jan 3, 2008

Happy New Year!

"Smoking a cigar is time you devote to yourself" (Gerhard "Geraldo" Dannemann)

I am actually a non-smoker, namely, I don't smoke at all :)
But once a year I like to smoke one or two gut cigars. And I usually do this on the last day of the year.
This time I was tasting Dannemann Cigars -
Tubes Brazil.
This cigar has a rich aromatic flavor, actually I was expecting a strong one, but it appears to be totally opposite with a very delicate and soft taste. Very tasty! I took two of this type. :D

HAPPY NEW YEAR to everybody!

Jan 1, 2008

Change Eclipse UI font size and type

Unfortunately the chang of the font size is not yet possible from within Eclipse itself (for some of UI components like Menu and Navigator for example), at least for Eclipse version 3.2.0.
The UI font size can only be changed via the X resource mechanism. If you are using a gtk or gtk2 build, then the font size should automatically adapt to the settings of your theme or your personal preferences.

Use xfontsel to select a font. For example:


Modify a config file: ~/.Xdefaults


Use the following command to apply the font:

xrdb ~/.Xdefaults