Saturday, December 22, 2012

Enable Hibernate in Ubuntu 12.04


In Ubuntu 12.04 and newer, hibernation has been disabled by default in policykit. To enable hibernation, you can follow official documentation here.

 Before enabling hibernation, please try to test whether it works correctly by running pm-hibernate in a terminal. The system will try to hibernate. If you are able to start the system again then you are more or less safe to add an override.

To do so, start editing:

sudo gedit /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla


Paste the following lines:

[Re-enable hibernate by default]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes

Save and exit gedit.

Restart and hibernation is back!

Or run the following code to just reset the menu:
killall unity-panel-service

Source: How to enable hibernation?

AUTHOR: OBSCURE

Wednesday, December 5, 2012

Serial Port Communication From Java - RxTx Installation.

Want to communicate with serial port using Java? You may want to try RxTx library. It's easy to use.
To install follow the instruction below:

The official RxTx binary pack is available here. The provided link will download the distro with some standard binaries (for linux 32bit, 64 bit, etc). If binaries for your specific operating system are not included, you may consider recompiling RxTx yourselves.
For a custom Win64 RxTx distro, have a look at the CloudHopper's web site.
To install it, unzip the distribution file in a temporary place and do the following copies:
  • File RXTXcomm.jar should go under JDKDIR/jre/lib/ext/
  • The necessary library( .so for linux, .dll for windows) should go under JDKDIR/jre/bin/
AUTHOR: OBSCURE

Sunday, December 2, 2012

Ambiguity problem in C++

Functions with predefined value can cause ambiguity in C++. See the example below:


If I call this like this, the first call is ok, but the second call give the ambiguous function error.




AUTHOR:
OBSCURE