Monthly Archives: November 2013

Python: Erklärungen und Tutorials

Sequence Types — list, tuple, range

Data Structures – List – Functional Programming Tools
There are three built-in functions that are very useful when used with lists: filter(), map(), and reduce().

Python: List Comprehensions
Listen-Abstraktion (List Comprehension)

How to quit the Python prompt

To exit the prompt, press Ctrl-d if you are using IDLE or are using a Linux/BSD shell. In case of the Windows command prompt, press Ctrl-z followed by Enter.

shebang line

Python does not use comments except for the special case of the first line here. It is called the shebang line – whenever the first two characters of the source file are #! followed by the location of a program, this tells your Linux/Unix system that this program should be run with this interpreter when you execute the program.

#!/usr/bin/env python

How to execute Python scripts(.py) in Linux
run a python script in terminal without the python command

String Note for Regular Expression Users

Always use raw strings when dealing with regular expressions. Otherwise, a lot of backwhacking may be required. For example, backreferences can be referred to as ‘\\1′ or r’\1’.

Variables: Identifier Naming


Remember, Python refers to anything used in a program as an object. This is meant in the generic sense. Instead of saying ‘the something’, we say ‘the object’.
Python is strongly object-oriented in the sense that everything is an object including numbers, strings and even functions.


Whitespace is important in Python. Actually, whitespace at the beginning of the line is important. This is called indentation. Leading whitespace (spaces and tabs) at the beginning of the logical line is used to determine the indentation level of the logical line, which in turn is used to determine the grouping of statements.
This means that statements which go together must have the same indentation. Each such set of statements is called a block. We will see examples of how blocks are important in later chapters.

Web Application Framework

Flask is a microframework for Python based on Werkzeug, Jinja 2 and good intentions. And before you ask: It’s BSD licensed!
Flask (A Python Microframework)
Wikipedia: Flask
Adding Flask support to an existing Pycharm project


What does `if __name__ == “__main__”:` do?
A module’s __name__ Objektorientierte Programmierung (OOP)
Galileo <openbook>: Objektorientierung

Eclipse Shortcuts

CTRL + H         = C/C++ Search
CTRL + O         = Jump to Function (in the same file using a dropdown)
CTRL + SHIFT + R = Open File
CTRL + SHIFT + P = Jump to open/close bracket
CTRL + SHIFT + R = Open Resource (Files, etc.)
CTRL + SHIFT + T = Open Element (Class, Struct, etc.)

Eclipse Shortcuts
10 Eclipse Navigation Shortcuts Every Java Programmer Should Know
What is the keyboard shortcut to go to a file in Eclipse?

Linux Time Subsystem: High-Resolution Timer API


Measuring Latency in Linux
Kernel Timer Systems
High Resolution Timers
How to detect if your timer system supports high resolution

Hrtimers and Beyond: Transforming the Linux Time Subsystems (PDF)
The high-resolution timer API
Leaping seconds and looping servers
The Inside Story of the Extra Second That Crashed the Web
hrtimer repeating task in the Linux kernel
Python: Add monotonic time, performance counter, and process time functions


hrtimer – High-resolution timer subsystem
[PATCH v2] tracing/function-graph-tracer: prevent from hrtimer interrupt infinite loop
[ 074/108] ntp: Fix leap-second hrtimer livelock
[ 080/108] timekeeping: Maintain ktime_t based offsets for hrtimers
[PATCHv3 linux-next] hrtimer: Add notifier when clock_was_set was called
Re: [PATCHv3 linux-next] hrtimer: Add notifier when clock_was_set was called

Doppel-Bremshebel / Bremshebel für zwei Bremsen

Dia Compe Tech77 Doppelbremshebel Links schwarz
DIA-COMPE “Tech 77 Double” Brakelever
PROMAX “Double” Brakelever
PROMAX “Polo” Brakelever
Bremshebel, 2-zügig mit Feststellknopf
PAUL “Duplex” Bremshebel

Dimension Double Barrel Left Brake Lever Synchronized
Paul Duplex Dual Pull Brake Lever
Dimension Double Barrel Brake Lever

U.S. Patent 6298744

Kettler Bremshebel mit dem Sie die Vorderrad- + Hinterradbremse gleichzeitig betätigen können US. Patent Nr. 6298744


PHP mit FastCGI

Apache2-Prefork & FastCGI
Apache + Chroot + FastCGI + PHP FAQ
Does PHP work with FastCGI?

mod_fcgid Permission Problems

[Sun Jun 08 21:19:52 2014] [notice] Apache/2.2.27 (FreeBSD) PHP/5.5.12 mod_fcgid/2.3.9 DAV/2 configured -- resuming normal operations
[Sun Jun 08 21:19:52 2014] [info] Server built: May 31 2014 13:29:13
[Sun Jun 08 21:19:52 2014] [debug] prefork.c(1023): AcceptMutex: flock (default: flock)
[Sun Jun 08 21:19:56 2014] [info] mod_fcgid: server started
[Sun Jun 08 21:19:56 2014] [warn] [client] (53)Software caused connection abort: mod_fcgid: error reading data from FastCGI server
[Sun Jun 08 21:19:56 2014] [error] [client] Premature end of script headers: phpinfo.php
[Sun Jun 08 21:19:59 2014] [info] mod_fcgid: process /usr/local/etc/apache22/php-wrapper(60862) exit(communication error), terminated by calling exit(), return code: 255
[root@gateway /usr/local/etc/apache22]# ls -la
-rw-r--r--   1 www   www      109 Jun  8 21:12 php-wrapper
[root@gateway /usr/local/etc/apache22]# chmod 755 php-wrapper

[root@gateway /usr/local/etc/apache22]# ls -la
-rwxr-xr-x   1 www   www      109 Jun  8 21:12 php-wrapper

php5 with mod_fcgid results in 500 error – probably wrong permissions



SUBDOMAIN=`echo $USER | awk -F_ '{print $1}'`

export PHPRC="$HOME/../.config/php/$SUBDOMAIN"

exec /usr/local/bin/php-cgi $@

Apache, PHP Fastcgi and PHP_FCGI_CHILDREN
Warum man PHP_FCGI_CHILDREN statt auf “1” lieber gar nicht setzen sollte
php5-cgi fills up memory, too many processes
Apache Module mod_fcgid
Apache with fcgid: acceptable performance and better resource utilization

Apache Module mod_fcgid

Special PHP considerations

By default, PHP FastCGI processes exit after handling 500 requests, and they may exit after this module has already connected to the application and sent the next request. When that occurs, an error will be logged and 500 Internal Server Error will be returned to the client. This PHP behavior can be disabled by setting PHP_FCGI_MAX_REQUESTS to 0, but that can be a problem if the PHP application leaks resources. Alternatively, PHP_FCGI_MAX_REQUESTS can be set to a much higher value than the default to reduce the frequency of this problem. FcgidMaxRequestsPerProcess can be set to a value less than or equal to PHP_FCGI_MAX_REQUESTS to resolve the problem.

PHP child process management (PHP_FCGI_CHILDREN) should always be disabled with mod_fcgid, which will only route one request at a time to application processes it has spawned; thus, any child processes created by PHP will not be used effectively. (Additionally, the PHP child processes may not be terminated properly.) By default, and with the environment variable setting PHP_FCGI_CHILDREN=0, PHP child process management is disabled.

The popular APC opcode cache for PHP cannot share a cache between PHP FastCGI processes unless PHP manages the child processes. Thus, the effectiveness of the cache is limited with mod_fcgid; concurrent PHP requests will use different opcode caches.

Physik: Felder & Wellen


Elektrischer Widerstand
Spezifischer Widerstand
Elektrische Stromdichte
Elektrischer Leiter
Elektrische Ladung
Elektrischer Fluss
Magnetische Flussdichte
Magnetische Feldstärke

Linienintegral / Kurvenintegral


Magnetische Flussdichte
Magnetisches Feld Der elektrische Strom mit Driftgeschwindigkeit, el. Leitfähigkeit (PDF) Stromdichte Elektrischer Strom, Ladungsmenge und Stromdichte (gute Bilder)


Vektoranalysis: Teil II, mit Bild von Potential


Springer: Gerthsen Physik – Dieter Meschede, Christian Gerthsen
Springer: Physik für Ingenieure – Martin Stohrer, Ekbert Hering, Rolf Martin
Spektrum: Physik für Wissenschaftler und Ingenieure – Paul A. Tipler, Gene Mosca