Friday 27 May 2011

C++ tips: use forward declaration when possible

Found a good explanation of forward declaration in C++ header files here. Basically, if a class A is only used as a reference or a pointer, it should only need to be included as:
class A;
//#include <A.h> // Not like this

Monday 23 May 2011

Eclipse crashes when having CDT projects

This seems to be a problem since Oracle Java 6 update 23. I have update 24, and still have the same problem. The work around is adding -XX:-UseCompressedOops to the eclipse.ini file in the eclipse directory. This disables compressed oops.

In Java HotSpot VM, options that are specified with -XX are not stable and are not recommended for casual use. Such options, if they are boolean, can be turned on with -XX:+[option] and turned off with -XX:-[optoin].

What is compressed oops then? "Oop" means "ordinary object pointer". In HotSpot parlance, it is a managed pointer to an object. Compressed oops represent managed pointers as 32-bit values which must be scaled by a factor of 8 and added to a 64-bit base address to find the object they refer to. Some details can be found here. According to this bug report, the crash is not due to a compressed oops bug per se but an existing bug that could only be triggered under the object layout that results from compressed oops.

Friday 20 May 2011

Recovering grub boot-loader after installing Windows

Installing Windows after Ubuntu will wipe out the boot-loader. To recover the boot-loader, follow the instructions here:
https://help.ubuntu.com/community/RecoveringUbuntuAfterInstallingWindows

This worked great for me, except once. After doing the steps in that website, it directly booted into Ubuntu without listing Windows. Then I typed the following command, and it worked:
$ sudo update-grub

Wednesday 18 May 2011

4-Projector Display under Ubuntu 11.04

For my tabletop interaction research project, I need to create a large extended display with 4 projectors in a 2x2 configuration. I could not make all 4 projectors to display at the same time with the original 2 Nvidia GeForce 8600GT graphics cards. Turns out it is especially hard to do this, if not impossible. Also, the Nvidia cards are kind of old, so I switched to a new graphics card, ATI Radeon HD 6870 with two DVI ports, 2 Mini DisplayPorts and 1 HDMI port.

After connecting the projectors to the 2 DVI ports and 2 Mini DisplayPorts, all 4 projectors can display now, however the displayed areas are not well-aligned as before. Specifically, the two displays from the projectors connected to the DVI ports are smaller with black area around them.

The problem is with underscan. The Catalyst Control Center does have the underscan and overscan option for HDMI but it doesn't always show up. It is supposed to be under "Display Manager" -> <a particular projector/monitor> -> Adjustment, but the "Adjustment" tab does not always appear. For me, it appears for one projector and I changed the scaling to 0% underscan. This did expand the displayed area for that projector. But I couldn't do the same for the other projector.

Finally, what worked is using the command line to disable underscan:
sudo aticonfig --set-pcs-val=MCIL,DigitalHDTVDefaultUnderscan,0

Sunday 8 May 2011

The Unbearable Lightness of Being

Part 1.1 (p4)
... the idea of eternal return implies a perspective from which things appear other than as we know them: they appear without the mitigating circumstance of their transitory nature. The mitigating circumstance prevents us from coming to a verdict. For how can we condemn something that is ephemeral, in transit?

... the profound moral perversity of a world that rests essentially on the nonexistence of return, for in this world everything is pardoned in advance and therefore everything cynically permitted.

Part 3.3 (p91)
But what is betrayal? Betrayal means breaking ranks. Betrayal means breaking ranks and going off in the unknown. Sabina knew of nothing more magnificent than going off into the unknown.

Part 3.4 (p98)
She had an overwhelming desire to tell him, like the most banal of women, Don't let me go, hold me tight, make me your plaything, your slave, be strong! But they were words she could not say.

The only thing she said when he released her from his embrace was, "You don't know how happy I am to be with you." That was the most her reserved nature allowed her to express.

Part 4.8 (p142)
What is flirtation? One might say that it is behavior leading another to believe that sexual intimacy is possible, while preventing that possibility from becoming a certainty. In other words, flirting is a promise of sexual intercourse without a guarantee.

Part 4.28 (p169)
But the fragile edifice of their love would certainly come tumbling down. For that edifice rested on the single column of her fidelity, and loves are like empires: when the idea they are founded on crumbles, they, too, fade away.

Part 5.23 (238)
He suddenly recall the famous myth from Plato's Symposium: People were hermaphrodites until God split them in two, and now all the halves wander the world over seeking one another. Love is the longing for the half of ourselves we have lost.