Building kde4

Last weekend I was trying to get kde4 working. I follow KDE3to4 guide on KDE wiki. I’ve done it on OpenSUSE 10.0.

Some useful hints (some are SUSE agnostic):

  • Install giflib-devel, openssl, an cmake packages using Yast.
  • Having a new user is necessary, if you want to lunch kde4 itself.
  • Then follow wiki guide. Note that compiling and downloading takes some time. It is a good idea to put commands together (using semicolon (“;”) and do something else. Note 2: Don’t forget that Qt configure will ask you to accept license.
  • If there will be any problems with cmake, don’t forget to delete cmake’s cache before re-running cmake.
  • First try to lunch single application using SSH. If it fails, check if your firewall allow this.
  • Setting kde4 desktop is a bit tricky here is my guide:
    1. switch to other console (e.g. Ctrl+Alt+F5)
    2. log in as KDE-devel; type “X :1″; switch to another console (e.g. Ctrl+Alt+F6)
    3. log also as KDE-devel and type “export DISPLAY=:1; startkde”
    4. then switch to your launched KDE (Ctrl+Alt+F8)
    5. do whatever with start wizard (go through or cancel)
    6. check version (any app/Help/About KDE). it wouldn’t be 3.9(pre 4), but it’s ok
    7. turn off KDE and X (or just kill them)
    8. switch back to primary display(Ctrl+Alt+F7)
    9. look at KDE-devel home. You wouldn’t see your compiled files, but don’t panic
    10. log as KDE-devel user and move files from trash (mv ~/.local/share/Trash/files/* ~)
    11. do again steps from 1-4
    12. now you should be in KDE4

Now enjoy and develop for a new major KDE release. I will play/work on it in comming days.

From other news, my CAE exams will be soon.

BTW:
I update fire simulation, now window version is bundled with needed library. It should work out of box.

Discussion Join the discussion (0 comments)

C++ and object-oriented programming: encapsulation

Encapsulation is a well known term for software developers, but there is an important bit that is often ignored. Encapsulation hide some variables and methods in two ways, depending on the language. It is done on object or class level.

Encapsulation on object level prevent from using private methods and variables of one object in another object. This approach presents in Java.

Class level mean that the private members can not be accessed from objects of others classes. However, if there are two objects of the same class, they can access their private members each other. In this way encapsulation works in C++.

Example:
[code lang="c++"]
#include
#include
//
using namespace std;
//
class person {
private:
string secret_value;
public:
person( string item ):secret_value(item) { }
void steal( person &victim)
{
cout < < "steal: " << victim.secret_value << "\n";
}
};
//
int main()
{
person men("wallet"), thief("nothing special");
cout << "Thief try to get secret value.\n";
thief.steal( men );
return 0; //that program compiles and works
}
[/code]

Of course I have assumed in above descriptions that there were not any “friends”. A friend of an object can always use its private members.

That was my first article (and hopefully not last) on c++/object-oriented programming/design patterns. I hope you learn something new.

Discussion Join the discussion (0 comments)