Nice plasma shortcut

Today while i was looking at kdevelop4 to see the new stuff i clicked
<Ctrl><F12> accidentally and plasma showed up in front of me. I am using this shortcut more and more and it is really a huge fun. For example to see what’s the time or notes on the Desktop. The new folder view also :) . The little things made the difference once more :)

Trac and Eclipse

Yesterday I wanted to integrate Trac tasks from the kbgoffice task list in my IDE. I was sure that eclipse should have that feature so I search in google and found that indeed there is a connector for Trac in mylyn-extras. Well i wanted to find an update site for that but it seems there isn’t any. So i downloaded the the extras version from the main download page and installed it locally.

It seems that eclipse is getting really mature since last time i did that i had bad problems with dependencies not resolved and things like that. Now it included the package as just another update site source, so the package manager can resolve dependencies if any.

All in all the plugin is not really what i was hoping for. I had some tasks from mylyn throughout the project and wanted to synchronize those but i couldn’t. Also the trac tasks when opened just open a browser which is not really what i was hoping for(i wanted to get a nice view which should look like a normal mylyn task). It is better than opening an external browser and searching for the task you want though, but not the best and i hope they fix it for the next release.

C++ can have nasty syntax sometimes

Hmm today on IRC in the channel ##C++ @ Freenode someone posted the following code

/*In g++ this does not work*/
template
struct hello
{
 hello(){};
 ~hello(){};
 template
 int world()
 {
  return _b+_a;
 }
};

template
void try_hello()
{
hello h;
h.world();
}

so i tried to help the person telling him that he should use a typename before h.world(); because it can ambitious for the compiler. It turns out that the right solution was

h.typename world();

someone asked why is

world()

ambitious for the compiler and seldon said that the compiler can’t know the type of world in that context. Well but world is explicitly called with


. Hmm the problem is that when the compiler see that expression it assume that

<

after world is the operator less than. Oh that my brain started to hurt badly :D . Maybe the syntax of C++ is getting really complicated with the years. I think that the new standards won’t get rid of those, because they can’t. Too much code have been written already to work that way :(

Back from the vacation

Hmm yesterday i finally came back from the vacation in the mountain. I prefer it instead of the sea, because the sea is too dirty in the last years. As you maybe know i live in Bulgaria and it is near the Black sea which is pretty much aweful. Most of the time i was fishing swimming in a nice Pool near Ribarica. I also almost read Code complete second edition which is pretty old book but is still adequate for most of the tips. The author is one of those writers which make you think about every single word without making you bored of the book ;) . It is language independent – there are examples in VB(which i don’t know but you can understand the idea of the examples with no problem), C#, Java, C++, C. One thing is for sure – the mountain was damn better than the dirty sea :) .

More kbgoffice fun

Yesterday i finally managed to port kbgoffice completely to Qt4, so everyone with no qt3support can compile it. I am not happy with what i got however. The code is really bad and there are no testcases so i might write those for now. With no tests the development is really hard. I might use the test framework provided with Qt which really rocks. The program is also hard coded with a class named Properties which is really broken, because it seems that when they wrote the program there was no QSettings class which is times better :) .

Eclipse for c++

Hmm lately I started using eclipse more and more. It seems they made it to not crash so much with the new release. I am pretty happy with it for C++ development it seems to own. I am not sure but i think that I am even more productive with it now than with vim. I have used the 3.2 version but it was full crap back then ;) . Besides it is written in java it is worth looking in it.

Supress some warning in vim

Maybe you know that vim parses the output from the compiler so it can jump to the right line which cause the error(:h quickfix for more info). Well it seems that the default compiler options parse even warning which are sometimes pretty annoying. There were some warning for depracated conversion from the compiler because of xmp files. Well i am sure that i don’t want to see those. So here is what i have in my ~/.vim/ftplugin/cpp.vim for some time:

let &errorformat = "%-G%f\:%l\:\ warning\:\ deprecated\ conversion\ from\ string%.%#\,".&errorformat

I know that maybe this only works for gcc, but it is a start. You can get more info about the erroformat with :h errorformat in vim. Happy vimming :)

kbgoffice again working(sort of)

The code for kbgoffice is working already on my machine. It is not really ported to Qt4, because right now it relays on the qt3support which will not be there and for good ;) . There are also some annoying bugs(I will see where they came from, so keep calm :P ). The instructions to compile the code(notice there is no target to install it for now) are in the INSTALL file. To get the code you will need subversion. Search google if you don’t know how to get it. The command to checkout the code is

svn co http://svn.assembla.com/svn/kbgoffice/trunk kbgoffice;cd kbgoffice

now

cat INSTALL

and follow the instructions. You will also need the dictionary files which you can find over here

kbgoffice fun

Today at the Bulgarian linux forum someone asked to port the kbgoffice program to KDE4. I have used the damn thing pretty much so I decided to go for it. After 2 hours of fighting with compiler errors it finally compiled but most of the code is just commented out so I got a prototype… I started to look at the classes this night and I see some bad code :( . Not sure why but many people still write ugly C++ code. The idea of the whole program is rather nice and the design is cool but there are some things that drive me nuts. For example the author reads the config file everytime he needs to save/read a property which is not efficient at all. I will try to fix some of the problems and I hope I will have the time for that. I will post a snippet which bit me today while I was working on the damn thing.

 1 #include <iostream>  2 #include <cstdlib>  3 #include <ifstream>  4 #include <string>  5 #include <map>  6  7  8 int main (int argc, char const* argv[])  9 { 10     std::map<std::string, std::string> myMap; 11     std::ifstream iofile(“example.txt”); 12     std::string key; 13     std::string value; 14     while(! iofile.eof()){ 15         getline(iofile,key); 16         int position = key.find(“=”); 17         if (position == std::string::npos)  18             break; 19         value = key; 20         value.erase(0,(position+1)); 21         key.erase(key.begin()+position, key.end()); 22         std::cout << “The key is “ << key << ” and the value is “ << value << std::endl; 23     } 24     return 0; 25 } 26 //    std::string home = getenv(“HOME”); 27 //    std::ofstream file(“example.txt”, std::ios::app | std::ios::out); 28 //    file << “WithSplash=0\n”; 29 //    file.close();

Well where is the problem with that you ask :? The answer is here so we change the code to this:

 1 #include <iostream>  2 #include <cstdlib>  3 #include <fstream>  4 #include <string>  5 #include <map>  6  7  8 int main (int argc, char const* argv[])  9 { 10     std::map<std::string, std::string> myMap; 11     std::ifstream iofile(“example.txt”); 12     std::string key; 13     std::string value; 14     while( getline(iofile,key) ){ 15         int position = key.find(“=”); 16         if (position == std::string::npos)  17             break; 18         value = key; 19         value.erase(0,(position+1)); 20         key.erase(key.begin()+position, key.end()); 21         std::cout << “The key is “ << key << ” and the value is “ << value << std::endl; 22     } 23     return 0; 24 } 25 //    std::string home = getenv(“HOME”); 26 //    std::ofstream file(“example.txt”, std::ios::app | std::ios::out); 27 //    file << “WithSplash=0\n”; 28 //    file.close();

and we are ready to continue.

The Aurora project.

Maybe you’ve heard about the Aurora project from mozilla labs, well I wasn’t and I was impressed from the videos over here. It seems that maybe the Web will outperform the Desktop some day. I hope that it doesn’t happen so soon, because I really like the Desktop more and most of the applications I use today are Desktop based(mostly Qt/KDE).