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).

Book organizing over the internet

Hmm today I noticed that we at home have too many books. For example I want to read a novel and I am not sure if we have that or not and where it stays on those shelves and in bookcases. Enter books.google.com with My Library support. Now i only need to organize those a little :) . Another nice open software for that is Tellico (yes I use KDE). I will have to choose one of them for the job.

Problem with file endings

Today I had the same problem with mixed file endings. It seems that many editors are still dealing bad with that on different platforms, so you get different line endings. This times instead of manually dealing with the problem I googled and it seems that there is a nice workaround, you just need to type

:%s/\r//

and you are done. This will take care of you, I also have ff=unix in most of my files and in my vimrc.