Solving display error in OpenSUSE 10.0

I’ve got a strange problem with my monitor Philips 107T5 in OpenSUSE 10.0 . It is impossible to set 1024×768 resolution and have all of the screen visible. Sax2 doesn’t help, because XFine (moving and resizing display on screen) doesn’t work. However, there is a simple way to avoid hassles. I hope that this solution will be useful for someone.

Just log in as root and “init 3″. Then again log in as root. Move somewhere yours X config and Sax cache (e.g. mv /etc/X11/xorg.conf /etc/X11/xorg.conf.old ; mv /var/cache/sax/files /var/cache/sax/files_old ; mkdir /var/cache/sax/files ). Then run “sax2″. Enter yours setting. If test is not satisfactory, try to choose generic monitor (e.g. –>VESA 1024×[email protected]). Save and exit. Log as normal user “su normal_user” and run X (“startx”).

I don’t know the reason of that problem, it didn’t appear in priori versions of SUSE. I quess that it’s Xorg related.

UPDATE:
Or simply type “sax2 -r -x -V 1024×[email protected]″ ;-).

Discussion Join the discussion (0 comments)

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)

First application published

I decided that I will publish some of my projects. The first app is a simple one. Its main task is to test, if packaging to different platforms works. Some files are big, because I included libraries in them.

Screenshot of fire simulation

This app is written in C++ using Qt 4 library. I’m not sure if I use painting in a right way. Profiler shows that app is spending most of the time in drawing functions. I’m wondering if it’s possible to draw on screen more effective using the same library. Unfortunately, I can’t find a document or tutorial that describe this issue.

Discussion Join the discussion (0 comments)