Category: Linux

How to install .ttf fonts in Xubuntu

Fonts only for your user

mkdir ~/.fonts
cp <myfont.ttf> ~./fonts/

Or system wide fonts

cp <myfont.ttf> /usr/share/fonts/truetype/

Then reload the fonts cache

sudo fc-cache -f

Disable output buffering on stdout

Why does printf not flush after the call unless a newline is in the format string?

By default, the stdout stream is buffered while stderr is not, so stdout will only display what’s in the buffer after it reaches a newline (or when it’s told to). You have a few options to print immediately:

Print to stderr instead using fprintf:

fprintf(stderr, "I will be printed immediately");

Flush stdout whenever you need it to using fflush:

printf("buffered, will be flushed");
fflush(stdout); /* will now print everything in the stdout buffer */

flush everything:

fflush(NULL)

disable buffering on stdout by using setbuf:

setbuf(stdout, NULL);

Skype: fix “Fatal: QWidget: Must construct a QApplication before a QPaintDevice Aborted (core dumped)” or “Segmentation fault (core dumped)”

If you are running Prelink on your Gnu/Linux distribution you could get a crash when launching Skype. To inspect the real error just launch Skype using the CLI, you might get:

Fatal: QWidget: Must construct a QApplication before a QPaintDevice
Aborted (core dumped)

or

Segmentation fault (core dumped)

It has taken me several days before realise that there was a issues with Prelink. To fix it you simply have to blacklist Skype in the Prelink configuration file.

Remove Skype

sudo apt-get purge --remove skype-bin*
sudo nano /etc/prelink.conf

Add the line

-b /usr/bin/skype

Reinstall skype

sudo apt-get install skype

Rebuild the shared libraries cache

sudo ldconfig

Tested on Xubuntu 12.04. More info on this issue here:

https://bugs.launchpad.net/ubuntu/+source/skype/+bug/1002187

Speed up your GNU/Linux machine with Preload and Prelink

This is simply my memo how to install the PreLink and Preload packages in order to speed up the operating system (actually Xubuntu 12.10).

Preload is an “adaptive readahead daemon” that runs in the background of your system, and observes what programs you use most often, caching them in order to speed up application load time. By using Preload, you can put unused RAM to good work, and improve the overall performance of your desktop system. The original project website is here.

Install it easily with:

sudo apt-get install preload

Once installed, Preload will start, and no further action is necessary, refer to the original documentation for configuration options.

To check up what resources Preload is using:

sudo tail -f /var/log/preload.log

To get more information about the specific files that Preload is caching:

sudo less /var/lib/preload/preload.state

Prelink is a similar application but has its focus on the required libraries loaded into RAM, in order to load them faster than from a hard drive. Wikipedia explains how it works better here.

Install it by typing:

apt-get install prelink
Enable prelinking by editing this file:
sudo gedit /etc/default/prelink
change the value of “PRELINKING” from “unknown” to “yes
Start it immediately:
sudo /etc/cron.daily/prelink
and close the terminal. Since now the prelink daemon will fetch informations about used libraries. What actually is cached can be shown by running:
prelink -p
while the configuration is stored here:
/etc/prelink.conf
Running Prelink and Preload I have visibly now a faster desktop environment. For instance, in XFCE 4.10 launching the file manager Nautilus, it took few seconds every time and if the harddisk was busy even more. Now Nautilus appears immediately under every circumstances. I will install these applications to all my GNU/Linux machines.

WordPress Themes