Making Screenshots under Windows

To copy a screenshot of the active window into the clipboard: Alt + PrntScrn (Alt + Druck on a German keyboard) Note that the clipboard will be overwritten, so if you want to take two screenshots, you have to paste the first screenshot before taking the second one.

To copy the whole screen into the clipboard: PrntScrn (Druck on a German keyboard)

To make a screenshot with customized clipping, press Winkey + Shift + S.

To save a screenshot of the active window: Alt+ Winkey + PrntScrn (Alt + WinKey + Druck on a German keyboard) The image will be saved in PNG format into the folder Videos\Captures (Videos\Aufzeichnungen on a German Windows)

To save a screenshot of the whole screen: Winkey + PrntScrn (WinKey + Druck on a German keyboard) The image will be saved in PNG format into the folder Pictures\Screenshots (Bilder\Bildschirmfotos on a German Windows)

While it is crazy that two different folders are used for saving the images, other than that the shortkeys are a convenient method to quickly obtain and save screenshots.

Avoid distracting advertisements

Avoid distracting advertisements on your browser and Skype with the following three tips (they can be applied independently):

    • Install an Ad-blocker for your web browser. Adblock Plus works very well. Some pages block their content if you have an adblocker installed. Therefore, Adblock Plus can be quickly deactivated/activated with a middle mouseclick on the symbol.
    • Deactivate Criteo: Criteo is using tracking cookies to present personalized advertisement. This page explains how to block Criteo cookies
    • Block advertisement in Skype by adding Skype to the restricted internet sites: WinKey+R > inetcpl.cpl > Security > Restricted Sites > Sites and then add https://apps.skype.com to the list

You are welcome!

Turn off ligatures in LateX

Latex ligatures make a fine typesetting, but sometimes you might want to turn them off — for example if people should be aber to copy the text from the pdf document or if you need to export the pdf to a doc.

You can turn off ligatures with the following commands in the preamble of the Latex document:

\usepackage{microtype}
\DisableLigatures{encoding = *, family = * }

Missing fonts when starting X-application on Linux

Recently, I got the following error message when I tried to start an X-application under Linux:

Some fonts seem to be missing in your system, you should install either xfonts-100dpi or xfonts-75dpi and then restart Xorg to get xboard running.

I got this error message despite having the packages xfonts-100dpi and xfonts-75dpi installed. After scratching my head for some time I found the problem: I was running the application via ssh with X-forwarding from a Windows PC. And the Xserver was actually running on Windows, namely the Xming application.
The problem was quickly fixed by downloading the font packages from the Xming page.

How to test the thread limit on Linux

/* compile with: gcc -pthread -o thread-limit thread-limit.c */
/* originally from: http://www.volano.com/linuxnotes.html */

#include <stdio.h>
#include <unistd.h>
#include <pthread.h>
#include <stdlib.h>

#define MAX_THREADS 100000
int i;

void run(void) {
char c;
if (i < 10)
printf(“Address of c = %u KB\n”, (unsigned int) &c / 1024);
sleep(60 * 60);
}

int main(int argc, char *argv[]) {
int rc = 0;
pthread_t thread[MAX_THREADS];
printf(“Creating threads …\n”);
for (i = 0; i < MAX_THREADS && rc == 0; i++) {
rc = pthread_create(&(thread[i]), NULL, (void *) &run, NULL);
if (rc == 0) {
pthread_detach(thread[i]);
if ((i + 1) % 1000 == 0)
printf(“%i threads so far …\n”, i + 1);
}
else
printf(“Failed with return code %i creating thread %i.\n”,
rc, i + 1);
}
exit(0);
}

Additional information

If you are an administrator of a server, you can configure various limits in /etc/security/limits.conf

Download an entire Web site for off-line viewing with wget

$ wget \
–recursive \
–no-clobber \
–page-requisites \
–html-extension \
–convert-links \
–restrict-file-names=windows \
–domains website.org \
–no-parent \
www.website.org/tutorials/html/

This command downloads the Web site www.website.org/tutorials/html/.

The options are:
–recursive: download the entire Web site.
–domains website.org: don’t follow links outside website.org.
–no-parent: don’t follow links outside the directory tutorials/html/.
–page-requisites: get all the elements that compose the page (images, CSS and so on).
–html-extension: save files with the .html extension.
–convert-links: convert links so that they work locally, off-line.
–restrict-file-names=windows: modify filenames so that they will work in Windows as well.
–no-clobber: don’t overwrite any existing files (used in case the download is interrupted and resumed).

Codepad

codepad is an online collaboration tool for exchanging code which also integrates various compilers/interpreters. After entering code, codepad will run it and print the output.
New pads can be created without registration. For each pad you get a short URL for sharing the code.

Codepad provides syntax highlighting depending on the language. Supported languages are C, C++, D, Haskell, Lua, OCaml, PHP, Perl, Python, Ruby, Scheme, and Tcl. It can be also used to share plain text.