>STL rocks

>I’ve just been writing a small article on the “gems of STL” and found that I really like what I’m seeing. A personal favorite is the transform operation (found in the functional header file). For example, lets do some adding.

#include <functional>
#include <list>

...

{
std::list<int> list;
list.push_back( ... ); // Populate

std::transform( list.begin(), list.end(), list.begin(), std::bind2nd( std::plus<int>(), 42 ) );
}

So, the transform method takes three iterators and an functor. The operators are, from the left, the starting point of the input, the end point of the input and the starting point of the output. The function simply specifies what to do with each list entry to create the output. In this case, std::plus takes two arguments, but we bind the second argument to 2. What this does is that it adds 42 to every item in the list (between begin and end), and replaces the original items (the results are placed from begin and onwards).

If you want the results to end up in another list, just use the back_inserter magical interator and point it to your results list.

{
std::list<int> list, res;
list.push_back( ... ); // Populate

std::transform( list.begin(), list.end(), std::back_inserter( res ), std::bind2nd( std::plus<int>(), 42 ) );
}

Quite readable and really cool code if you ask me.

>QCodeEdit

>A spin-off from the Edyuk project has finally been released with a website of its own. The QCodeEdit project looks really promissing. What you get is a code editor with syntax highlighting for a range of languages (yes, you can add support for more languages) developed using Qt – i.e. 100% cross platform – and good looking as well.

>GCF Goes Commercial

>One of the nice things about Qt, in my opinion, is that they satisfy the needs not only of the F/OSS community, but also by the big dragons creating closed source software. They do this along the principle of “Quid Pro Quo”, that is, if you make money without sharing your source, you need to pay. If you share your source we [Trolltech, which I’m not affiliated with] share ours for free.

Anyway, holders of commercial Qt licenses can do the same thing for their software. This is what VCreateLogic just did with their GCF framework. According to Prashanth, they sold 13 commercial licenses in one month – congratulations!

I got to know GCF as a judge in last year’s QtCentre programming contest. It takes the abstraction one level beyond widgets and make it possible to build user interfaces using components. The cool thing is that you get a modern (albeit Microsoft-ish) look for free. And as GCF is dual licensed, you can try it out for your F/OSS project right now.

>Problem #2

>So, as a final follow-up to my desperate out-cry, I’ve solved problem #2. Thanks to nosrednaekim for pointing me in the right direction. Also, to jucato, setting TerminateServer to true did not help, however I’m using an ATI card.

So, now everything works again and I will not try to achieve window wobbliness for another couple of months :-)

>Kubuntu issues – follow-up

>I’m just following up on my last post – thanks to everyone commenting!

Regarding points #1 and #3, this was compiz running and wm. I’m back to kwin after having removed the file $HOME/.kde/share/config/compizasWM.

For point #2, I’ll deal with it as well, but is seems to be an issue in the proprietary ATI driver’s package. When changing to the free ATI driver I cannot get the resolution I want (I admit – I did not hunt for mode lines for very long).

>Kubuntu upgrade issues

>I just used the Kubuntu upgrade tool to get the latest goodies from Hardy (wobbly windows here I come). However, this resulted in a strange looking system. I’ve found three symptoms:

#1 Klipper and friends start in windows in the top left corner before finding their way down to the kicker dock.

#2 Selecting “logout” or pressing ctrl-alt-backspace results in a blank screen, a hard reset is required to get back to business.

#3 Window decorations are messed up. For instance, Firefox gets some old-style KDE 2-ish look and RMB clicking on the title bar results in what looks like an unthemed menu. However, the desktop menu looks alright.

Desktop menu

Window menu

If anyone knows of a good way to resolve these issues, do let me know.