Download as pdf or txt
Download as pdf or txt
You are on page 1of 424

Kombluder Are Strange /

Kompendium

Jedzia

A Thesis presented for the degree of


Doctor of Sexuality

University Heidelberg
Department of Astrophysical Sciences
Room 23
Germany
01/2011

1
Ko_mbl[oo]der is like my Grandma talks
Dedicated to
Christine and the Kids
Computers are strange!

Jedzia

Submitted for the degree of Doctor of Hegemonothy


01 2011

Abstract

Dieses Dokument dient dem Wissen. Obwohl wir nicht wissen. Da wir vergessen. Und
vermissen. Unter der GPL v2 kann Frau viel veröffentlichen, aber ICH hoffe das Sie finden
was sie suchen ..... ALLE und niemand. Wie sagte XYZ einst: „Hajo“. In diesem Sinne viel
Spaß beim Essen und ihren sexuellen Aktivitäten. Dies hier ist leider nur ein Buch.
iv
Declaration
in this thesis is based on research carried out at the Oberhirnis, Germany. No part of this
thesis has been submitted elsewhere for any other degree or qualification and it all my own
work unless referenced to the contrary in the text. [If your thesis based on joint research
, you have to mention what part of it is your individual constribution, see Rules for the
Submission of Work for Higher Degrees for detail. You will get one from the Graduate
School.]

Copyright © 2011 by Jedzia.


“The copyright of this thesis rests with the author. No quotations from it should be pu-
blished without the author’s prior written consent and information derived from it should
be acknowledged”. <- d.h Quote Jedzia!

v
vi
Acknowledgements
Thank to someone who prepared this template. Thank to someone who prepared this
template. Thank to someone who prepared this template. Thank to someone who prepared
this template. Thank to someone who prepared this template. Thank to someone who
prepared this template. Thank to someone who prepared this template. Thank to someone
who prepared this template. Thank to someone who prepared this template.Thank to
someone who prepared this template. Thank to someone who prepared this template.
Thank to someone who prepared this template. Thank to someone who prepared this
template. Thank to someone who prepared this template. Thank to someone who prepared
this template. Thank to someone who prepared this template. Thank to someone who
prepared this template. Fresse da vorne !

vii
Inhaltsverzeichnis

. Acknowledgements vii

Abbildungsverzeichnis i

Tabellenverzeichnis iii

Listings v

Beispiel-Verzeichnis vii

I. Windows 1
1. Wo ist was 5
1.1. Systemwiederherstellungspunkt . . . . . . . . . . . . . . . . . . . . . . . . 5
1.2. MSC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.2.1. certmgr.msc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2.2. ciadv.msc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2.3. compmgmt.msc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2.4. devmgmt.msc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2.5. dfrg.msc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2.6. diskmgmt.msc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2.7. eventvwr.msc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2.8. fsmgmt.msc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2.9. gpedit.msc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2.10. lusrmgr.msc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2.11. ntmsmgr.msc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2.12. ntmsoprq.msc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2.13. perfmon.msc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2.14. rsop.msc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2.15. secpol.msc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2.16. services.msc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2.17. wmimgmt.msc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

2. Tips und Tricks 7


2.1. Arbeitsplatz erweitern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2. Boot-Dateien defragmentieren . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.3. Windows-Explorer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.3.1. Absturz verhindern . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

i
Inhaltsverzeichnis

2.3.2. Schneller kopieren . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8


2.4. Windows Installer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.4.1. Windows Installer Clean Up . . . . . . . . . . . . . . . . . . . . . . 9
2.5. Druckfunktion reparieren . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.6. Schnelltasten . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.6.1. Eingabeaufforderung . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.6.2. Schnellaufruf der „Eigenschaften“ . . . . . . . . . . . . . . . . . . . 9
2.7. Fehlerberichte verhindern . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.8. Herstellerhinweise löschen . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.9. Symbolleiste aus Ordner . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.10. Tasks schließen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.11. Dateisystem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.11.1. Dateinameerweiterung an ein Programm binden . . . . . . . . . . . 11
2.11.2. NTFS Hardlink erstellen . . . . . . . . . . . . . . . . . . . . . . . . 11
2.11.3. NTFS Symlink erstellen . . . . . . . . . . . . . . . . . . . . . . . . 12
2.11.4. Den letzten Zugriff bei NTFS nicht speichern . . . . . . . . . . . . 12
2.11.5. Die Größe der Master File Table erhöhen . . . . . . . . . . . . . . . 13
2.11.6. Die Unterstützung für alte 8+3 Dateinamen ausschalten . . . . . . 13
2.12. Tastenkombinationen für Windows . . . . . . . . . . . . . . . . . . . . . . 14
2.12.1. Tastenkombinationen für das Windows-System . . . . . . . . . . . . 14
2.12.2. Tastenkombinationen für Windows-Programme . . . . . . . . . . . 14
2.12.3. Kombination aus Maus- und Tastaturtaste für Desktopobjekte . . . 14
2.12.4. Allgemeine Tastaturbefehle . . . . . . . . . . . . . . . . . . . . . . 14
2.12.5. Tastenkombinationen für Desktop, Arbeitsplatz und Windows Explorer 15
2.12.6. Tastenkombinationen für den Arbeitsplatz . . . . . . . . . . . . . . 16
2.12.7. Tasten für die Windows Explorer-Verzeichnisstruktur . . . . . . . . 16
2.12.8. Tastenkombinationen für das Eigenschaftenfenster . . . . . . . . . . 17
2.12.9. Tastenkombinationen für Eingabehilfen . . . . . . . . . . . . . . . . 17
2.12.10.Microsoft Natural Keyboard-Tastenkombinationen . . . . . . . . . . 17
2.12.11.Microsoft Natural Keyboard mit installierter IntelliType-Software . 18
2.12.12.Tastenkombinationen für Dialogfelder . . . . . . . . . . . . . . . . . 18

3. TERROR 21
3.1. TERROR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.1.1. Visual Studio Debug Dll’s fehlen . . . . . . . . . . . . . . . . . . . 21
3.1.2. Automatisches ScanDisk ausschalten . . . . . . . . . . . . . . . . . 22
3.1.3. Meine Dateien enden alle mit .vicrypt . . . . . . . . . . . . . . . . . 22

4. Hilfsprogramme 25
4.1. Programmieren und Entwicklung . . . . . . . . . . . . . . . . . . . . . . . 25
4.1.1. WinMerge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.1.1.1. Bezugsquelle . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.1.2. GreenShot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.1.2.1. Modi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.1.2.2. Bildbearbeitungsfenster . . . . . . . . . . . . . . . . . . . 26
4.1.2.3. Bezugsquelle . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.2. Sicherheit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

ii
Inhaltsverzeichnis

4.2.1. Sandboxie . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.3. Filesystem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.3.1. DoubleKiller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.3.2. DoubleCommander . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

5. Firefox 31
5.1. Sicherheit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
5.1.1. Tracking-Cookies ausbremsen . . . . . . . . . . . . . . . . . . . . . 33
5.1.2. Chronik begrenzen . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
5.1.3. Supercookies deaktivieren . . . . . . . . . . . . . . . . . . . . . . . 33
5.1.4. Firefox im Safe-Mode . . . . . . . . . . . . . . . . . . . . . . . . . . 34
5.1.5. Noscript bändigen . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
5.2. Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
5.2.1. Verzögerung entfernen . . . . . . . . . . . . . . . . . . . . . . . . . 35
5.2.2. Pipelining aktivieren . . . . . . . . . . . . . . . . . . . . . . . . . . 35
5.2.3. Speicherverbrauch . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
5.2.4. RAM-Cache einstellen . . . . . . . . . . . . . . . . . . . . . . . . . 35
5.2.5. Festplatten-Cache festlegen . . . . . . . . . . . . . . . . . . . . . . 36
5.2.6. Offline-Cache begrenzen . . . . . . . . . . . . . . . . . . . . . . . . 36
5.2.7. Speicherintervall festlegen . . . . . . . . . . . . . . . . . . . . . . . 36
5.3. Bedienung . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
5.3.1. Autovervollständigung kürzen . . . . . . . . . . . . . . . . . . . . . 36
5.3.2. Google-Suche über Adressleiste . . . . . . . . . . . . . . . . . . . . 36
5.3.3. Suchergebnisse in neuem Tab . . . . . . . . . . . . . . . . . . . . . 37
5.3.4. Einfügen mit mittlerer Maustaste . . . . . . . . . . . . . . . . . . . 37
5.3.5. Autovervollständigung aufräumen . . . . . . . . . . . . . . . . . . . 37
5.3.6. Webseite in neuem Tab laden . . . . . . . . . . . . . . . . . . . . . 37
5.3.7. Mehrere Startseiten . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
5.3.8. Autovervollständigung anpassen . . . . . . . . . . . . . . . . . . . . 38
5.3.9. Tab-Größe ändern . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
5.4. Tipps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
5.4.1. .NET-Add-on löschen . . . . . . . . . . . . . . . . . . . . . . . . . . 38
5.5. Add-ons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
5.5.1. Adresszeile im Retro-Look . . . . . . . . . . . . . . . . . . . . . . . 39
5.5.2. Zugangsdaten Ex- und Importieren . . . . . . . . . . . . . . . . . . 39

6. Netzwerk 41
6.1. P2P . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
6.1.1. Blocklist Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
6.1.2. Vuze . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
6.1.2.1. IP-Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
6.1.3. Emule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
6.1.3.1. IP-Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
6.2. Hilfsprogramme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
6.2.1. Fport . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
6.2.2. netstat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

iii
Inhaltsverzeichnis

7. Windows PowerShell 43

8. Alternativen zu Bordmitteln 45
8.1. Mediaplayer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
8.1.1. VLC media player . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

II. Office 47
9. Microsoft Office Allgemein 49
9.1. Zertifizieren einer Macro-Anwendung . . . . . . . . . . . . . . . . . . . . . 49
9.1.1. Sicherheitsstufe auf "Niedrig" setzen. . . . . . . . . . . . . . . . . . 49
9.1.2. Zertifikat erstellen . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

10.Microsoft Access 53
10.1. Rezepte . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
10.1.1. Mausrad abfragen . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

III. Visual Studio 55


11.Updates für Visual Studio 2005 57
11.1. Hotfixes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
11.1.1. Editor reagiert nicht mehr bei CDATA[] Tag . . . . . . . . . . . . . 57

12.Updates für Visual Studio 2008 59

13.Erweiterungen 61
13.1. Source Server - Reference Source Code . . . . . . . . . . . . . . . . . . . . 61
13.1.1. Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
13.1.2. VS2005 Setup For NetMassDownloader . . . . . . . . . . . . . . . . 62
13.1.2.1. Forum Hinweis . . . . . . . . . . . . . . . . . . . . . . . . 62
13.2. Power Toys for Visual Studio . . . . . . . . . . . . . . . . . . . . . . . . . 64
13.3. Cool Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

14.MSBuild 67
14.1. Erweiterungen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
14.1.1. MSBuild Extension Pack . . . . . . . . . . . . . . . . . . . . . . . . 67
14.1.2. MSBuild Community Tasks Projekt . . . . . . . . . . . . . . . . . . 67
14.2. Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
14.2.1. Microsoft Build Sidekick . . . . . . . . . . . . . . . . . . . . . . . . 67

15.Eigenes 69
15.1. CodeXS Custom-Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
15.2. SHFBRelContent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

16.Microsoft SQL Server 2008 71

iv
Inhaltsverzeichnis

IV. Eclipse 73
17.Wo finde ich Was 77
17.1. Grundeinstellungen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
17.1.1. Author-Namen ändern . . . . . . . . . . . . . . . . . . . . . . . . . 77
17.2. Java . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
17.2.1. Ant-Build Scripts exportieren . . . . . . . . . . . . . . . . . . . . . 77

18.Updates und Patches 79


18.1. Hotfixes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
18.1.1. Bla . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79

19.Erweiterungen 81
19.1. Oxygen-XML Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
19.1.1. Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
19.1.2. Wissenswertes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

V. Programmieren 83
20.C und C++ 85
20.1. Sprachreferenz . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
20.2. Rezepte . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
20.2.1. Mausrad abfragen . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
20.3. Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
20.3.1. Boost . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
20.3.1.1. Übersicht . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
20.3.1.2. Installation . . . . . . . . . . . . . . . . . . . . . . . . . . 88
20.3.1.3. Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
20.3.2. neon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
20.3.3. apr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
20.4. Standard Template Library . . . . . . . . . . . . . . . . . . . . . . . . . . 92
20.4.1. Streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
20.4.1.1. std::stringstream . . . . . . . . . . . . . . . . . . . . . . . 92
20.5. Tutorien . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
20.5.1. Introduction to Classes . . . . . . . . . . . . . . . . . . . . . . . . . 93
20.5.2. Constructors and Destructors in C++ . . . . . . . . . . . . . . . . 93
20.5.3. Creating a collection class in C++ . . . . . . . . . . . . . . . . . . 93

21.C++/CLI 95
21.1. Sprachreferenz . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
21.1.1. ^ (Handle to Object on Managed Heap) . . . . . . . . . . . . . . . 95
21.1.2. % (Tracking Reference) . . . . . . . . . . . . . . . . . . . . . . . . . 97
21.1.3. Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
21.2. Interfacing mit C# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
21.2.1. Marshaling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
21.2.1.1. Overview of Marshaling in C++ . . . . . . . . . . . . . . 98

v
Inhaltsverzeichnis

21.3. Rezepte . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
21.3.1. Passing Arguments by Reference . . . . . . . . . . . . . . . . . . . 99
21.3.1.1. Passing by Native Reference . . . . . . . . . . . . . . . . . 99
21.3.1.2. Passing by Constant Reference . . . . . . . . . . . . . . . 100
21.3.1.3. Passing by Tracking Reference . . . . . . . . . . . . . . . 102
21.3.2. next . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106

22.C# 107
22.1. Sprachreferenz . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
22.1.1. Lambda expressions . . . . . . . . . . . . . . . . . . . . . . . . . . 107
22.2. Coding Guideline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
22.2.1. Benutzerschnittstelle zum Code . . . . . . . . . . . . . . . . . . . . 107
22.2.1.1. Listen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
22.2.1.2. Exposing a Generic List . . . . . . . . . . . . . . . . . . . 108
22.2.2. Dokumentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
22.2.2.1. Namespace Summary . . . . . . . . . . . . . . . . . . . . . 109
22.2.2.2. Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
22.3. Snippets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
22.3.1. Mausrad-Meldungen abfragen . . . . . . . . . . . . . . . . . . . . . 113
22.3.2. Threadsicherer Codeaufruf im Control-Kontext (Invoking) . . . . . 114
22.3.3. SynchronizationContext . . . . . . . . . . . . . . . . . . . . . . . . 115
22.3.4. Thread-sicheres Zuweisen von Control-Eigenschaften . . . . . . . . 115
22.3.5. Ordner mit Inhalt kopieren (rekursiv) . . . . . . . . . . . . . . . . . 116
22.3.6. Custom Generic EventArgs . . . . . . . . . . . . . . . . . . . . . . 117
22.3.6.1. Core Classes . . . . . . . . . . . . . . . . . . . . . . . . . 118
22.3.6.2. Implementation . . . . . . . . . . . . . . . . . . . . . . . . 119
22.3.6.3. An Example . . . . . . . . . . . . . . . . . . . . . . . . . 119
22.3.6.4. Wrap up . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
22.4. Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
22.4.1. IServiceProvider . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
22.5. Klassen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
22.5.1. Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
22.5.1.1. Dictionary generisch einschränken . . . . . . . . . . . . . 120
22.5.1.2. BinarySearch des dichtesten Elementes in C# . . . . . . . 124
22.6. Typen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
22.6.1. Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
22.7. Daten . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
22.7.1. Serialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
22.7.1.1. SerializationBinder . . . . . . . . . . . . . . . . . . . . . . 127
22.7.1.2. Mono Serialization Format . . . . . . . . . . . . . . . . . . 128
22.7.2. MS-Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
22.7.2.1. TableAdapter Delete . . . . . . . . . . . . . . . . . . . . . 128
22.8. LINQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
22.8.1. Links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
22.9. Assembly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
22.10.Bibliotheken . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
22.10.1.Log4Net . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131

vi
Inhaltsverzeichnis

22.10.2.ICSharpCode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
22.10.2.1.ICSharpCode.NRefactory . . . . . . . . . . . . . . . . . . 132
22.10.3.Tesseract OCR Library . . . . . . . . . . . . . . . . . . . . . . . . . 132
22.11.Domain Driven Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
22.12.Fluent Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
22.13.Design Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
22.13.1.Structural Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
22.13.1.1.Decorator . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
22.13.2.Creational Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
22.13.2.1.Singleton . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
22.13.3.Grafisch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
22.13.3.1.Model-View-ViewModel pattern . . . . . . . . . . . . . . . 139
22.14.Rezepte . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
22.14.1.Datenaustausch mit C++ . . . . . . . . . . . . . . . . . . . . . . . 140
22.14.1.1.Marshaling . . . . . . . . . . . . . . . . . . . . . . . . . . 140
22.14.1.2.P/Invoke . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
22.14.2.Threading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
22.14.2.1.Unterbrechen von Threads . . . . . . . . . . . . . . . . . . 140
22.14.2.2.Abbrechen von Threads . . . . . . . . . . . . . . . . . . . 150
22.14.2.3.Thread.Suspend() . . . . . . . . . . . . . . . . . . . . . . 151
22.14.3.Kommandozeilen Programme . . . . . . . . . . . . . . . . . . . . . 159
22.14.3.1.Die Ausgabe der Konsole umleiten . . . . . . . . . . . . . 159
22.14.4.Quellcode Parsen . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161

23.LLBLGen Pro 163

24.WPF 167
24.1. XAML Editoren . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
24.1.1. Kaxaml . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167

25.Silverlight 169
25.1. Tutorien . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
25.1.1. Animation in SilverLight, C# and Visual Studio 2008 . . . . . . . . 169

26.XNA + C# 171
26.1. Begriffserklärungen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
26.1.1. Grundlegendes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
26.1.1.1. Vertex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
26.1.1.2. Grafisches Primitiv . . . . . . . . . . . . . . . . . . . . . . 171
26.1.1.3. Polygon . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
26.1.1.4. Mesh, Polygon mesh . . . . . . . . . . . . . . . . . . . . . 172
26.1.1.5. Octree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
26.1.1.6. Sichtbarkeitsproblem . . . . . . . . . . . . . . . . . . . . . 174
26.1.2. Texturen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
26.1.2.1. Mip Mapping . . . . . . . . . . . . . . . . . . . . . . . . . 177
26.1.2.2. Multi-Texturing, Texture splatting . . . . . . . . . . . . . 179
26.1.2.3. Volumentexturen . . . . . . . . . . . . . . . . . . . . . . . 179

vii
Inhaltsverzeichnis

26.1.2.4. Tipps und Hinweise . . . . . . . . . . . . . . . . . . . . . 180


26.1.3. Terrain, Landscape . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
26.1.3.1. LOD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
26.1.3.2. Progressive Meshes . . . . . . . . . . . . . . . . . . . . . . 182
26.1.3.3. Chunked LOD with geomorphing for progressive LOD . . 182
26.2. Szenen Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
26.2.1. Terrain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
26.3. Grafik-Programmierung und Theorie . . . . . . . . . . . . . . . . . . . . . 183
26.3.1. Geoclipmaps vs Geomipmaps . . . . . . . . . . . . . . . . . . . . . 183
26.3.2. Shader Programmierung . . . . . . . . . . . . . . . . . . . . . . . . 183
26.3.2.1. Fundamentals of Vertex Shaders . . . . . . . . . . . . . . 183
26.3.2.2. Vertex Shaders in the Pipeline . . . . . . . . . . . . . . . 185
26.3.2.3. Vertex Shader Tools . . . . . . . . . . . . . . . . . . . . . 187
26.3.2.4. Vertex Shader Architecture . . . . . . . . . . . . . . . . . 195
26.3.2.5. High Level View of Vertex Shader Programming . . . . . . 197
26.3.2.6. Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . 219
26.3.2.7. Programming Vertex Shaders . . . . . . . . . . . . . . . . 221
26.3.2.8. Fundamentals of Pixel Shaders . . . . . . . . . . . . . . . 221
26.3.2.9. Programming Pixel Shaders . . . . . . . . . . . . . . . . . 221
26.3.2.10.Diffuse & Specular Lighting with Pixel Shaders . . . . . . 222
26.4. Tutorien . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
26.4.1. RB Whitaker’s Wiki A Game Development Launchpad . . . . . . . 222
26.4.2. xnadevelopment.com . . . . . . . . . . . . . . . . . . . . . . . . . . 224

27.Java 227
27.1. FAQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227

28.Perl 229

29.Die Autoconf und Automake Toolchain 231


29.1. FAQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231

30.CMAKE 233
30.1. FAQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233

31.Unit Testing 235


31.0.1. abchecken: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
31.1. NUnit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
31.1.1. NUnit: A tutorial Jump to Comments . . . . . . . . . . . . . . . . 235

32.SVN 243
32.1. SVN aus dem Quellcode erstellen . . . . . . . . . . . . . . . . . . . . . . . 243

33.SQL 245
33.1. Rezepte . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
33.1.1. JOIN - Normalisierte Tabellen für eine Abfrage wieder zusammenfassen245
33.1.2. Zwei Spalten aus zwei Tabellen zu einer zusammenfügen . . . . . . 245

viii
Inhaltsverzeichnis

34.Tools 247
34.1. Help Authoring Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
34.2. File Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
34.2.1. AptDiff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
34.2.2. AptDiff - Visual Files Comparison and Merging Utility . . . . . . . 247
34.3. Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
34.3.1. Fuslogvw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
34.3.2. NtCore - Explorer Suite . . . . . . . . . . . . . . . . . . . . . . . . 249
34.3.2.1. Features: . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
34.3.2.2. Download und Installation . . . . . . . . . . . . . . . . . . 250
34.3.2.3. Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
34.3.2.4. CFF Explorer . . . . . . . . . . . . . . . . . . . . . . . . . 250

35.Ida Professional 253


35.1. Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
35.1.1. pyemu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253

VI. Developer Express Produktfamilie 255


36.DXperience 259
36.1. WinForms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
36.2. eXpressApp Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
36.2.1. Tipps und Tricks . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
36.2.1.1. MySQL als Datenbank-Server . . . . . . . . . . . . . . . . 259

VII.Cygwin 263
37.Befehlsreferenz 267
37.1. Bash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
37.1.1. Find . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
37.1.1.1. Rekursiv in Dateien suchen . . . . . . . . . . . . . . . . . 267
37.1.1.2. Bla . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
37.2. Hilfsprogramme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
37.2.1. bsdiff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
37.2.2. X1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
37.2.2.1. X11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
37.2.2.2. Mono Serialization Format . . . . . . . . . . . . . . . . . . 268
37.3. Y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268

38.Rezepte 269
38.1. HMMunter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
38.1.1. Dateilisten erstellen . . . . . . . . . . . . . . . . . . . . . . . . . . . 269

VIII.XAMPP 271

ix
Inhaltsverzeichnis

39.MySQL 275
39.1. Wissenswertes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
39.1.1. Die utf8_unicode_ci Collation . . . . . . . . . . . . . . . . . . . . . 275
39.2. SQL & Co . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
39.2.1. Logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
39.2.1.1. General log in CSV Tabelle . . . . . . . . . . . . . . . . . 276
39.2.1.2. Slog slow log . . . . . . . . . . . . . . . . . . . . . . . . . 277
39.3. PHP Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
39.3.1. Datenbank . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
39.3.1.1. Collation aller Tabellen ändern . . . . . . . . . . . . . . . 278
39.4. Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
39.4.1. mysqldiff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
39.4.2. maatkit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
39.4.3. Toad® for MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
39.4.4. MySQL Workbench . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
39.4.5. Liquibase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282

40.Mantis Bugtracker 283

41.LifeType 285

IX. Grafik 287


42.Cinema 4d 289
42.1. Displacements maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
42.2. Import/Export . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
42.2.1. Collada . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
42.3. Tutorials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
42.3.1. Creating a Renderer in Cinema4D using a VideoPost plugin . . . . 292
42.3.2. Getting started with the Cinema4D SDK and Visual Studio C++
2008 Express Edition . . . . . . . . . . . . . . . . . . . . . . . . . . 292
42.3.3. Using RakNet in Cinema4D to connecting 2 "players" to control ob-
jects in the scene . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
42.3.4. Importing Quake files into Cinema4D and preview levels using Irrlicht293

43.Lightwave3d 9.6 295

44.Messiah 297
44.1. Morph Targets erstellen . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
44.2. Mehrere Effekte auf einem Objekt . . . . . . . . . . . . . . . . . . . . . . . 299
44.3. Mehrere Effekte auf einer Objekthierarchie . . . . . . . . . . . . . . . . . . 299
44.4. Animate Immediate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
44.5. Box Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300

45.3d Studio max 301


45.1. Plugins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
45.2. Scripting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301

x
Inhaltsverzeichnis

45.3. Import/Export . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301


45.3.1. MD3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
45.3.2. MD5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301

46.Render Engines 303


46.1. Externe Cinema 4D Renderer . . . . . . . . . . . . . . . . . . . . . . . . . 303
46.1.1. Luxrender . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
46.1.1.1. Installation . . . . . . . . . . . . . . . . . . . . . . . . . . 303
46.1.1.2. Preferences . . . . . . . . . . . . . . . . . . . . . . . . . . 303
46.1.1.3. Lights . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304
46.1.1.4. Scene and Render Settings . . . . . . . . . . . . . . . . . . 304
46.1.1.5. Material Conversion . . . . . . . . . . . . . . . . . . . . . 305

47.Terragen 307

48.Tools 309
48.1. Vektorisieren . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
48.1.1. Inkscape . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
48.2. Fraktale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
48.2.1. Apophysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
48.3. Icons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
48.3.1. IconForge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309

X. Spiele 311
49.Eve Online 313
49.1. Externe Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
49.1.1. EVE-MEEP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
49.1.2. Eve Mon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
49.1.3. Eve Fitting Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
49.2. EVE Development Information . . . . . . . . . . . . . . . . . . . . . . . . 314
49.2.1. EVE API Documentation . . . . . . . . . . . . . . . . . . . . . . . 314
49.2.2. The EVE-Dev Wiki . . . . . . . . . . . . . . . . . . . . . . . . . . 314
49.2.2.1. CCP Database Dump Resources . . . . . . . . . . . . . . 314
49.3. Ships und Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
49.3.1. Meta / Named Modules . . . . . . . . . . . . . . . . . . . . . . . . 315
49.3.2. Best Named Versus Tech II . . . . . . . . . . . . . . . . . . . . . . 315
49.4. Guides . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
49.4.1. Industry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
49.4.1.1. Planetary Interaction Guide . . . . . . . . . . . . . . . . . 315

50.Enemy Territory 317


50.1. Wissenswertes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
50.1.1. autoexec2.cfg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
50.1.2. varconfig.cfg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
50.2. Befehle und Schalter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326

xi
Inhaltsverzeichnis

50.2.1. Dummy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327


50.2.2. Befehle definieren . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
50.2.2.1. \newcommand . . . . . . . . . . . . . . . . . . . . . . . . 327
50.2.2.2. \renewcommand . . . . . . . . . . . . . . . . . . . . . . . 327
50.2.2.3. \providecommand . . . . . . . . . . . . . . . . . . . . . . 328
50.2.2.4. Anmerkungen . . . . . . . . . . . . . . . . . . . . . . . . . 328
50.2.3. Variablen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328
50.2.3.1. Zähler . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328
50.2.3.2. Längenangaben . . . . . . . . . . . . . . . . . . . . . . . . 328
50.2.4. Rezepte . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328
50.2.4.1. Hmmm. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328

51.GtkRadiant 329
51.1. Plugins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329
51.2. Scripting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329
51.3. Import benutzerdefinierter Modelle . . . . . . . . . . . . . . . . . . . . . . 329
51.3.1. MD3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329
51.3.2. MD5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329
51.4. Links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329

52.X3-Reunion 331
52.1. Xtended-Mod . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331
52.2. Schiffs Reviews . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331
52.3. Waffen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331
52.4. Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331
52.4.1. Kampfskripte . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331
52.4.1.1. ACC: Anarkis Carrier Commands . . . . . . . . . . . . . . 331
52.5. X3 Bonus-Packet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332
52.5.1. Satelliten-Warnservice . . . . . . . . . . . . . . . . . . . . . . . . . 332
52.5.2. Commodity Logistics Software MK1 . . . . . . . . . . . . . . . . . 332
52.5.2.1. A Bug . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332
52.5.3. Commodity Logistics Software MK2 . . . . . . . . . . . . . . . . . 337
52.5.3.1. A Bug . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337
52.6. Zu Bearbeiten . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339

XI. Spiele Engines 347


53.UDK, Unreal Engine 3 353
53.1. Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
53.1.1. Complete Editing Environment . . . . . . . . . . . . . . . . . . . . 353
53.1.2. Pure Rendering Power . . . . . . . . . . . . . . . . . . . . . . . . . 353
53.1.3. State-of-the-Art Animation . . . . . . . . . . . . . . . . . . . . . . 353
53.1.4. Powerful Scripting . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
53.1.5. Real World Physics . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
53.1.6. Lighting and Shadows . . . . . . . . . . . . . . . . . . . . . . . . . 353
53.1.7. Gorgeous Cinematics . . . . . . . . . . . . . . . . . . . . . . . . . . 354

xii
Inhaltsverzeichnis

53.1.8. Terrain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354


53.1.9. Built-in Networking . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
53.1.10.Real-time Shaders . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
53.1.11.Broad Audio Support . . . . . . . . . . . . . . . . . . . . . . . . . . 355
53.1.12.Particle Effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
53.1.13.Artificial Intelligence . . . . . . . . . . . . . . . . . . . . . . . . . . 355
53.1.14.Distributed Computing . . . . . . . . . . . . . . . . . . . . . . . . . 355
53.1.15.Destructible Environments . . . . . . . . . . . . . . . . . . . . . . . 355
53.1.16.Bink Video Codec . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
53.1.17.SpeedTree Foliage Editor . . . . . . . . . . . . . . . . . . . . . . . . 355
53.1.18.FaceFX Facial Animation . . . . . . . . . . . . . . . . . . . . . . . 355
53.2. Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
53.3. Preferences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
53.4. Bla . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
53.5. Ble . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355

54.Vision 7 Game Engine 357


54.1. Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
54.1.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
54.1.2. Engine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358
54.1.3. tools & workflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
54.1.4. 3rd party integration . . . . . . . . . . . . . . . . . . . . . . . . . . 360
54.1.5. multiplatform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362
54.1.6. support & documentation . . . . . . . . . . . . . . . . . . . . . . . 362
54.1.7. serious games . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362
54.1.8. five good reasons . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362
54.1.9. evaluation kit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362

55.Unity 363

56.Torque_3D 365

57.Truevision3D 367

58.Ogre 3d 369
58.1. Tutorien . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
58.1.1. Creating a 3D game with Ogre - Adding the Player . . . . . . . . . 369
58.1.2. How to begin writing games in C++ . . . . . . . . . . . . . . . . . 369

59.Editoren 371
59.1. Worldweaver.DX.Studio.Commercial.Pro.v3.2.7.0 . . . . . . . . . . . . . . 371
59.2. 3D World Studio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371

60.Libs 373
60.1. Wissenswertes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373
60.1.1. ABC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373
60.1.1.1. XYZ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373

xiii
Inhaltsverzeichnis

61.Ressourcen 375
61.1. Weblinks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375

. Bibliography 376

Literaturverzeichnis 377

Literaturverzeichnis 381

XII.Appendix 383
Stichwortverzeichnis 385

. Appendix 385

A. Basic and Auxiliary Results 387


A.1. Basic Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387

B. Testbereich 389

C. Nomenklatur 391

xiv
Abbildungsverzeichnis

2.1. Arbeitsplatz auf dem Desktop: Eine Änderung in der Registry erweitert
das Kontextmenü. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2. Autoruns 9.39: Abstürze des Windows-Explorers verhindern Sie, indem
Sie in dem Tool auf der Registerkarte „Explorer“ fehlerhafte Erweiterungen
für den Windows-Explorer deaktivieren. . . . . . . . . . . . . . . . . . . . 8
2.3. Elemente kopieren: Wählen Sie in diesem Fenster das Verzeichnis aus, in
das eine Datei oder ein Ordner kopiert werden soll . . . . . . . . . . . . . . 8
2.4. Druckwarteschlange: Nur wenn dieser Dienst beendet ist, lassen sich be-
schädigte Dateien in der Warteschlange löschen . . . . . . . . . . . . . . . 9
2.5. Eingabeaufforderung: Die Taste [F7] ruft eine versteckte Befehls-Chronik
auf. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.6. Fehlerberichterstattung: In diesem Dialogfenster deaktivieren Sie die Feh-
lerberichte an Microsoft . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.7. Verschiedene Filesystem Tweaks. . . . . . . . . . . . . . . . . . . . . . . . 13

4.1. greenshot Screenshot-Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

5.1. Versteckte Einstellungen ändern: So geht’s . . . . . . . . . . . . . . . . . . 32


5.2. Chronik: Firefox speichert die besuchten Seiten der vergangenen 180 Tage 33
5.3. Abgesicherter Modus: Hier lassen sich Add-ons deaktivieren und Einstel-
lungen zurücksetzen. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
5.4. Task-Manager: Der Speicherbedarf von Firefox ist weit größer als der aller
anderen Programme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
5.5. Autovervollständigung: Firefox macht zwölf Vorschläge, die Anzahl lässt
sich aber beliebig ändern . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
5.6. Einstellungen: Hier lassen sich auch mehrere Startseiten festlegen, die Sie
getrennt durch das Pipe-Zeichen eintragen . . . . . . . . . . . . . . . . . . 38
5.7. Registrierungs-Editor: Das .NET-Add-on für Firefox lässt sich nur in der
Registry löschen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
5.8. Autovervollständigung: Die Erweiterung Old Location Bar sorgt dafür,
dass das Adressfeld bei verschlüsselten Verbindungen wieder gelb ist . . . . 40

6.1. Vuze IP-Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

9.1. Microsoft Access: Sicherheitswarnung . . . . . . . . . . . . . . . . . . . 49


9.3. Microsoft Office: Sicherheitseinstellungen . . . . . . . . . . . . . . . . . . 49
9.2. Microsoft Office: Einstellungen zur Macro-Sicherheit . . . . . . . . . . . 50
9.4. Microsoft Office: Digitale Signatur für VBA-Projekte . . . . . . . . . . . 50
9.5. Zertifikat-Manager: Einstellungen für lokales Zertifikat . . . . . . . . . . 51
9.6. Visual Basic Editor: Project signieren. . . . . . . . . . . . . . . . . . . . . 51

i
Abbildungsverzeichnis

13.1. Visual Studio Power Toys PackInstaller . . . . . . . . . . . . . . . . . . . . 64

22.1. UML-Diagramm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134


22.2. Pause and Resuming Threads . . . . . . . . . . . . . . . . . . . . . . . . . 147

26.1. Schema eines Octrees. Links die Unterteilung des würfelförmigen Volumens,
rechts der resultierende Octree. . . . . . . . . . . . . . . . . . . . . . . . . 174
26.2. Beispiel für eine MIP-Map. Die Kantenlänge des größten Bildes beträgt 28
= 256 Pixel. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
26.3. Texturschichten bei einer Multi-Textur . . . . . . . . . . . . . . . . . . . . 180
26.4. Direct3D Pipeline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
26.5. NVIDIA Effects Browser . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
26.6. NVIDIA Shader Debugger . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
26.7. Jack Palevich Shader City . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
26.9. NVIDIA NVLink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
26.8. John Schwab’s Shader Studio: Phong Lighting . . . . . . . . . . . . . . . . 192
26.10.NVIDIA Normal Map Generator . . . . . . . . . . . . . . . . . . . . . . . 192
26.11.NVIDIA Compression Plugin . . . . . . . . . . . . . . . . . . . . . . . . . 193
26.12.Diffusion Cubemap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
26.13.Ádám Moravánszky’s DLL Detective . . . . . . . . . . . . . . . . . . . . . 194
26.14.3D Studio Max 4.x/gmax 1.1 . . . . . . . . . . . . . . . . . . . . . . . . . 195
26.15.Vertex Shader Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . 196
26.16.128 bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
26.17.Swizzling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
26.18.Swizzling #2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216

34.1. http://www.ntcore.com/exsuite.php . . . . . . . . . . . . . . . . . . . . . . 249


34.2. http://www.ntcore.com/exsuite.php . . . . . . . . . . . . . . . . . . . . . . 250

36.1. MySQL Data Provider in der expressApp Konfiguration . . . . . . . . . . . 260


36.2. Datenbank-Update mit dem DBUpdater-Tool . . . . . . . . . . . . . . . . 262

42.1. Displacement Export Einstellungen . . . . . . . . . . . . . . . . . . . . . . 291


42.2. Material Displacement Einstellungen . . . . . . . . . . . . . . . . . . . . . 292

44.1. Exportier-Einstellungen . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297


44.2. Exportier-Einstellungen . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
44.3. Gruppierung der Effekte . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
44.4. MorphBlender Einstellungen . . . . . . . . . . . . . . . . . . . . . . . . . . 299
44.5. BoneDeformer Einstellungen . . . . . . . . . . . . . . . . . . . . . . . . . . 299
44.6. Messiah: Animate Immediate . . . . . . . . . . . . . . . . . . . . . . . . . 300

45.1. 3dsMax8: MD3Exporter . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301


45.2. 3dsMax8: MD5Exporter . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301

i
Abbildungsverzeichnis

ii
Tabellenverzeichnis
2.1. mftzone Parameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

11.1. Neue Cslangsvc.dll . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

20.1. BoostBook Ausgabe Formate . . . . . . . . . . . . . . . . . . . . . . . . . 91

26.1. Grafikkarten-Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197

iii
Tabellenverzeichnis

iv
Listings
26.1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
26.2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
26.3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
26.4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
26.5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
26.6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
26.7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
26.8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209

39.1. lst:mysql-collation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278

50.1. Das ist ein Listing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317

52.1. X3 colored Listing test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340

v
Listings

vi
Beispiel-Verzeichnis

vii
Teil I.

Windows

1
Beispiel-Verzeichnis

3
Beispiel-Verzeichnis

4
1. Wo ist was

1.1. Systemwiederherstellungspunkt

Um einen Systemwiederherstellungspunkt zu setzen: Start >Programme>Zubehör>Systemprogramme>Sys

1.2. MSC

Die Microsoft Management Console (MMC) ist eine Komponente zur Strukturierung und
Konsolidierung von Snap-Ins bzw. kleinen Programmen zur Ausführung administrativer
Aufgaben in Netzwerken und Computersystemen. Die hierarchische Anzeige ähnelt der des
Windows-Explorer. Seit Windows 2000 ist sie fester Bestandteil aller Windows-Versionen.
Die aktuelle Version 3.0 ist als kostenloses Update für Windows Server 2003 und für Win-
dows XP verfügbar.

Der Arbeitstitel für die nächste Generation der Microsoft Management Console (MMC)
lautet Aspen. Chef-Architekt des zuständigen Teams ist Jeffrey Snover. Zukünftig sollen
alle Windows-Administrationswerkzeuge der MMC unter der grafischen Benutzeroberfläche
auf der Windows PowerShell aufbauen, so dass sich Windows sowohl komplett über die
grafische Benutzeroberfläche als auch alternativ über die Kommandozeile administrieren
lässt.

Es gibt unter anderem folgende Snap-Ins:

5
1. Wo ist was

1.2.1. certmgr.msc

1.2.2. ciadv.msc

1.2.3. compmgmt.msc

1.2.4. devmgmt.msc

1.2.5. dfrg.msc

1.2.6. diskmgmt.msc

1.2.7. eventvwr.msc

1.2.8. fsmgmt.msc

1.2.9. gpedit.msc

1.2.10. lusrmgr.msc

1.2.11. ntmsmgr.msc

1.2.12. ntmsoprq.msc

1.2.13. perfmon.msc

1.2.14. rsop.msc

1.2.15. secpol.msc

1.2.16. services.msc

1.2.17. wmimgmt.msc

6
2. Tips und Tricks

2.1. Arbeitsplatz erweitern


Das Kontextmenü des Arbeitsplatz-Symbols auf dem
Desktop besitzt nur wenige Funktionen. Ein gehei-
mer Registry-Trick macht aus dem Symbol eine Kom-
mandozentrale, über die Sie etwa den PC herunter-
fahren oder direkt auf Tools wie den Registrierungs-
Editor zugreifen (Bild 2.1). Hierfür sind umfang-
reiche Manipulationen des Registry-Schlüssels „HKEY_CLASSES_ROOT\CLSID\{20D04FE0-
3AE-1069-A2D8-08002B30309D}\shell“ notwendig. Die
REG-Datei „arbeitsplatz.reg“ (kostenlos, www.com-
magazin.de /ergaenzungen) erledigt die Änderungen au-
tomatisch. Laden Sie die Datei auf Ihren PC und führen
Sie sie mit einem Doppelklick aus. Bestätigen Sie mit „Ja,
OK“. Um die Änderung rückgängig zu machen, führen Sie
die Datei „arbeitplatz_backup.reg“ wie oben beschrieben
aus.

2.2. Boot-Dateien defragmentieren


Der Rechner braucht relativ lange für den Systemstart.
Durch die Defragmentierung der Boot-Dateien beschleu-
nige Sie den Vorgang. Bild 2.1.: Arbeitsplatz auf
dem Desktop: Eine Ände-
Drücken Sie die Tasten [Windows R] und geben Sie den rung in der Registry erweitert
Befehl „defrag.exe␣C:␣-b“ ein. Ändern Sie den Lauf- das Kontextmenü.
werkbuchstaben C: gegebenenfalls in den Laufwerkbuch-
staben Ihrer Boot-Partition. Klicken Sie auf „OK“. Der
Vorgang dauert einige Zeit. Er ist beendet, sobald sich
das Konsolenfenster schließt.

2.3. Windows-Explorer

2.3.1. Absturz verhindern

7
2. Tips und Tricks

Wenn Sie im Windows-Explorer


mehrere Dateien markieren und
anschließend mit der rechten Maustas-
te darauf klicken, stürzt der
Windows-Explorer ab.
Meist sind hierfür nachträglich in-
stallierte Explorer-Erweiterungen
verantwortlich, die sich ins Kon-
textmenü integrieren. Deaktivie-
ren Sie nacheinander die Erwei-
terungen, bis Sie den Übeltäter
entlarvt haben. Nutzen Sie da-
zu das Tool Autoruns ( http://
technet.microsoft.com/de-de/sysinternals
). Entpacken Sie das Archiv und Bild 2.2.: Autoruns 9.39: Abstürze des Windows-
starten Sie Autoruns mit einem Explorers verhindern Sie, indem Sie in dem Tool
Doppelklick auf „autoruns.exe“. auf der Registerkarte „Explorer“ fehlerhafte Erwei-
Holen Sie den Reiter „Explorer“ terungen für den Windows-Explorer deaktivieren.
nach vorn (Bild 2.2). Auf dieser
Registerkarte finden Sie alle Explorer-Erweiterungen. Um den Start eines Prozesses beim
nächsten Windows-Start zu unterbinden, entfernen Sie das Häkchen vor dem Prozessna-
men.

2.3.2. Schneller kopieren

Mit diesem Trick kopieren Sie eine Datei oder einen


Ordner, ohne ihn umständlich mit der Maus zu ver-
schieben:
Öffnen Sie den Registrierungs-Editor, indem Sie
[Windows R] drücken, regedit eingeben und
mit „OK“ bestätigen. Markieren Sie den Schlüs-
sel „HKEY_CLASSES_ROOT\AllFilesystemObjects\
shellex\ContextMenuHandlers“. Legen Sie mit
„Bearbeiten, Neu, Schlüssel“, den neuen Schlüs-
sel Copy␣To an. Markieren Sie „Copy To“ und
klicken Sie im rechten Fensterbereich doppelt auf
den Eintrag „(Standard)“. Geben Sie unter „Wert“
{C2FBB630-2971-11D1-A18C-00C04FD75D13} ein und
bestätigen Sie mit „OK“. Wenn Sie fortan eine Datei
oder einen Ordner mit der rechten Maustaste ankli- Bild 2.3.: Elemente kopieren:
cken, lässt sich das Objekt mit dem Kontextmenü- Wählen Sie in diesem Fenster das
Eintrag „In Ordner kopieren . . . “ direkt in einen be- Verzeichnis aus, in das eine Da-
liebigen Ordner kopieren. Das Fenster „Elemente ko- tei oder ein Ordner kopiert werden
pieren“ (Bild 2.3) öffnet sich. Wählen Sie einen Ziel- soll
ordner aus und bestätigen Sie mit „Kopieren“.

8
2.4. Windows Installer

2.4. Windows Installer


2.4.1. Windows Installer Clean Up
D:\Downloads>msizap T MySql.Data.msi
entfernt produktinformationen
unter C:\Program Files\Windows Installer Clean Up
msicuu.exe .> grafisch.
——————–

2.5. Druckfunktion reparieren


Wenn der Rechner beim Versuch,
einen Text auszudrucken, nicht
reagiert, befindet sich möglicher-
weise ein beschädigtes Dokument
in der Druckwarte- schlange. So
löschen Sie es: Drücken Sie [Win-
dows R], geben Sie services.mscein
und klicken Sie auf „OK“. Kli-
cken Sie doppelt auf „Druck-
warteschlange“ und auf „Been-
den“ (Bild 2.4). Schließen Sie das
Dialogfenster nicht. Drücken Sie
[Windows E] und navigieren Sie
zu „C:\WINDOWS\system32\PRIN-
TERS“. Löschen Sie alle Datei-
en in diesem Verzeichnis. Klicken
Sie im Dialogfenster „Eigenschaf-
Bild 2.4.: Druckwarteschlange: Nur wenn dieser ten von Druckwarteschlange“ auf
Dienst beendet ist, lassen sich beschädigte Dateien „Starten, OK“.
in der Warteschlange löschen

2.6. Schnelltasten
2.6.1. Eingabeaufforderung
Die Eingabeaufforderung von XP und Vista besitzt eine versteckte Befehls-Chronik, mit
der sich bereits verwendete Befehle ohne umständliche erneute Eingabe aufrufen lassen.
Drücken Sie die Taste [F7], wählen Sie mit den Pfeiltasten einen Befehl und führen Sie ihn
mit der Eingabetaste aus (Bild 2.5).

2.6.2. Schnellaufruf der „Eigenschaften“

9
2. Tips und Tricks

Das Dialogfenster „Eigenschaften“ für Da-


teien und Ordner lässt sich auch ohne den
Umweg über das Kontextmenü aufrufen:
Klicken Sie mit gedrückter [Alt]-Taste dop-
pelt auf eine Datei oder einen Ordner.
Das funktioniert nicht nur im Windows-
Explorer, sondern auch auf dem Desktop.

Bild 2.5.: Eingabeaufforderung: Die Tas-


te [F7] ruft eine versteckte Befehls-Chronik
auf.
2.7. Fehlerberichte
verhindern

Wenn ein Programm unter Windows XP


abstürzt, will das Betriebssystem dieses Er-
eignis sofort an Microsoft-Server übermit-
teln. Welche Daten dabei übertragen wer-
den ist nicht bekannt. Um dieses Verhalten
zu deaktivieren, drücken Sie die Tastenkombination [Windows Pause] und klicken auf den
Reiter „Erweitert“. Klicken Sie auf die Schaltfläche „Feh- lerberichterstattung“ und ak-
tivieren Sie „Fehlerberichterstattung deaktivieren“. Entfernen Sie zudem den Haken vor
der Option „Aber bei kritischen Fehlern benachrichtigen“ (Bild 2.6). Bestätigen Sie Ihre
Änderungen mit einem Klick auf „OK“.

2.8. Herstellerhinweise löschen

Bei vielen PCs finden sich im


Startmenü „Herstellerhinweise“. Sie
lassen sich nicht per Rechtsklick
und „Aus Liste entfernen“ löschen.
Ein entsprechender Menüpunkt
fehlt. Dieser Trick hilft: Klicken
Sie mit der rechten Maustaste auf
„Start“. Wählen Sie „Eigenschaf-
ten, Startmenü, Anpassen, Erwei-
tert, Startmenüelemente“. Entfer-
nen Sie den Haken vor „Hersteller-
link“ und bestätigen Sie zwei Mal
mit „OK“.
Bild 2.6.: Fehlerberichterstattung: In diesem Dia-
logfenster deaktivieren Sie die Fehlerberichte an Mi-
10 crosoft
2.9. Symbolleiste aus Ordner

2.9. Symbolleiste
aus Ordner
So erstellen Sie eine Symbolleiste
aus einem Ordner: Minimieren Sie
alle Fenster mit [Windows D]. Zie-
hen Sie den Ordner an den Bildschirmrand. Sein Inhalt erscheint in einer Symbolleiste. Sie
lässt sich per Drag and Drop verschieben. Der Ordnerinhalt wird in einem rechteckigen
Panel angezeigt.

2.10. Tasks schließen


Mehrere geöffnete Ordner und Programmfenster lassen sich mit einem Trick schnell schlie-
ßen. Halten Sie die Taste [Strg] gedrückt und klicken Sie in der Taskleiste die Tasks an, die
Sie schließen wollen. Klicken Sie dann mit der rechten Maustaste auf einen dieser Tasks
und wählen Sie die Einstellung „Gruppe schließen“.

2.11. Dateisystem
Verschiedene Operationen, die das Dateisystem betreffen.

2.11.1. Dateinameerweiterung an ein Programm binden

1. Associate the correct file group with .py scripts:

assoc .py=Python.File

2. Redirect all Python files to the new executable:

ftype Python.File=C:\Path\to\pythonw.exe "%1" %*

2.11.2. NTFS Hardlink erstellen

Ein harter Link ist ein Verzeichniseintrag auf eine Datei. Jede Datei kann mindestens eine
feste Verknüpfung haben. Auf NTFS-Volumes kann jede Datei mehrere feste Verknüpfun-
gen und somit kann eine einzelne Datei in vielen Verzeichnissen (oder sogar im selben
Verzeichnis mit verschiedenen Namen) angezeigt werden. Da alle Links auf dieselbe Datei
verweisen, können Programme einen der Links öffnen und die Datei verändern. Eine Datei
wird aus dem Dateisystem nur entfernt, nachdem alle Links auf sie gelöscht wurden. Nach-
dem Sie eine feste Verknüpfung erstellt haben, können ihn Programme wie jeden anderen
Dateinamen verwenden.

11
2. Tips und Tricks

Syntax
fsutil hardlink create NeuerFilename ExistierenderFilename

Parameter
create: Richtet eine NTFS Hardlink zwischen einer bestehenden Datei und eine neue Da-
tei. Eine NTFS Hardlink ist vergleichbar mit einer POSIX Hardlink.
NeuerFilename: Gibt die Datei, auf die Sie einen Hardlink zu schaffen.
ExistierenderFilename: Gibt die Datei, aus der Sie einen Hardlink zu schaffen.

2.11.3. NTFS Symlink erstellen

Der Windows-Name für einen Symlink ist Junction (Knotenpunkt), aber die Begriffe sind
austauschbar. Während ein harter Link direkt auf Rohblöcke einer Festplatte zeigt, ver-
weist ein Knotenpunkt auf einem Dateinamen. Als solches bleibt die Verbindung nicht
erhalten, wenn der Namen der zugrunde liegenden Datei geändert wird. Die Funktion ei-
ner Junction ist ein Dateisystem-Filter, der die Filesystem I/O Operationen transparent
umleitet. Windows unterstützt Junctions nur für Ordner.
Leider beinhaltet das Betriebssystem keinen Mechanismus, um sie zu erstellen. Sie können
ein Kommandozeilen-Tool wie Sysinternals Junction benutzen:
Mit dem Tool junction von sysinternals lassen sich unter dem Filesystem NTFS Symbolische-
Links erstellen.
Ein solcher Verweis wird mit

junction <Ziel> <Quelle>


junction D:\qt4 D:\LYX\LYXDependencies\lyx-windows-deps-
msvc2008\qt4

erstellt, wobei im Beispiel D:\qt4 der erzeugte Link ist und auf das Zielverzeichnis D:\
LYX\LYXDependencies\lyx-windows-deps-msvc2008\qt4 verweist.

2.11.4. Den letzten Zugriff bei NTFS nicht speichern

Jeder Ordner und jede Datei beinhalten das Attribut „Letzter Zugriff. Dieses zeigt an,
wann zuletzt auf die Datei zugegriffen oder wann sie verändert wurde. Dieser Zeitpunkt
wird zunächst in den Arbeitsspeicher und anschließend an zwei Orte der Festplatte (der
Datei selbst und der MFT) geschrieben. Da dies zu erheblichen Leistungsverlusten führen
kann, empfehlen wir die Deaktivierung des letzten Zugriffes: Klicken Sie hierzu auf „Star-
t/Ausführen und geben Sie „cmd ein. Tippen Sie nun den Befehl fsutil␣behavior␣set
␣disablelastaccess␣1 ein und bestätigen Sie mit Enter. Der Befehl fsutil␣behavior␣
set␣disablelastaccess␣0 macht diese Einstellung wieder rückgängig.

12
2.11. Dateisystem

2.11.5. Die Größe der Master File Table erhöhen

Lesen Sie hier mehr über die MFT. Um zu verhindern, dass die Master File Table frag-
mentiert, reserviert das NTFS-Dateisystem permanent 12,5% der Systempartition für die
Nutzung der MFT. Geht Ihre Festplattenkapazität zur Neige, werden auch Daten in die
MFT geschrieben. Besonders kleinere Dateien mit wenigen Kilobytes werden auch bei ge-
nügend Speicher in der MFT gelagert. Dies führt zu einer Fragmentierung, der Sie mit
folgenden Schritten vorbeugen können:
In der Kommandozeile können Sie den Befehl fsutil␣behavior␣set␣mftzone␣x eingeben,
wobei x Werte von 1 bis 4 annehmen kann.

x Reservierung für die MFT


1 12,5% des Datenträgers
2 25% des Datenträgers
3 37,5% des Datenträgers
4 50% des Datenträgers
Tabelle 2.1.: mftzone Parameter

Je größer die MFT desto geringer ist die Chance der Fragmentierung, wobei natürlich auch
der Speicherplatzverbrauch steigen kann.

2.11.6. Die Unterstützung für alte 8+3 Dateinamen ausschalten

Die Unterstützung für klassische Datein-


amen (8+3 Namen wie z.B. alternam.txt
aus DOS-Zeiten) verursacht, dass auch
bei NTFS sämtliche Dateien intern auch
noch als 8+3 Dateinamen vorliegen. Da
dies Performance kostet, sollten Sie dies
via fsutil␣behavior␣set␣disable8dot3
␣1 deaktivieren. Hinweis: Sollten Sie Pro-
bleme mit 16-Bit-Applikationen bekom-
men, deaktivieren Sie dies am Besten
via fsutil␣behavior␣set␣disable8dot3
␣0 wieder.

Bild 2.7.: Verschiedene Filesystem Tweaks. Die vielen Vorteile der Sicherheit und Ge-
schwindigkeit bringen auch einen kleinen
Nachteil mit sich. Das Lesen und Schreiben
von Daten wird durch die Unterstützung für Windows 3.1/DOS Dateinamen, welche ledig-
lich aus 8 Buchstaben bestehen, leicht verlangsamt. Diesen Hemmschuh können sie getrost
ausziehen, wenn sie kein solches Betriebssystem nebenher verwenden oder nicht Mitglied
eines Netzwerkes mit Windows 3.1/DOS Computern sind.

13
2. Tips und Tricks

2.12. Tastenkombinationen für Windows


Quelle: http://support.microsoft.com/kb/126449.

2.12.1. Tastenkombinationen für das Windows-System

F1 Hilfe
STRG+ESC Öffnen Menü Start
ALT+TAB Zwischen geöffneten Programmen wechseln
ALT+F4 Programm beenden
UMSCHALT+ENTF Objekt dauerhaft löschen
Windows-Logo+L Computer sperren (ohne STRG+ALT+ENTF zu drücken)

2.12.2. Tastenkombinationen für Windows-Programme

STRG+C Kopieren
STRG+X Ausschneiden
STRG+V Einfügen
STRG+Z Rückgängig
STRG+B Fett
STRG+U Unterstreichen
STRG+I Kursiv

2.12.3. Kombination aus Maus- und Tastaturtaste für


Desktopobjekte

UMSCHALT+RECHTE Kontextmenü anzeigen, das alternative Befehle enthält


MAUSTASTE
UMSCHALT+- Alternativen Standardbefehl (zweites Element im Menü)
DOPPELKLICK ausführen
ALT+DOPPELKLICK Eigenschaften anzeigen
UMSCHALT+ENTF Objekt sofort löschen, ohne es im Papierkorb abzulegen

2.12.4. Allgemeine Tastaturbefehle

F1 Windows-Hilfe anzeigen
F10 Optionen der Menüleiste aktivieren
UMSCHALT+F10 Kontextmenü für das ausgewählte Objekt öffnen (entspricht dem
Klicken mit der rechten Maustaste auf ein Objekt)

14
2.12. Tastenkombinationen für Windows

STRG+ESC Das Menü Start öffnen (wählen Sie über die Pfeiltasten ein Objekt
aus)
STRG+ESC oder Wählt die Schaltfläche Start aus (Die TAB-Taste drücken, um die
ESC Taskleiste auszuwählen, oder UMSCHALT+F10 drücken, um ein
Kontextmenü zu öffnen)
STRG+- Windows Task-Manager öffnen
UMSCHALT+ESC
ALT+NACH- Dropdown-Listenfeld öffnen
UNTEN-PFEIL
ALT+TAB Zu einer anderen laufenden Anwendung wechseln (zum Anzeigen
des Programmwechselfensters die ALT-Taste gedrückt halten und
anschließend die TAB-Taste drücken)
UMSCHALTTASTE Die UMSCHALTTASTE beim Einlegen einer CD-ROM gedrückt
halten, um die automatische Wiedergabe zu umgehen
ALT+LEERTASTE Systemmenü des Hauptfensters anzeigen (im Systemmenü können
Sie das Fenster wiederherstellen, verschieben, die Größe ändern,
minimieren, maximieren oder schließen)
ALT+- Systemmenü des untergeordneten MDI-Fensters (Multiple
(ALT+Bindestrich) Document Interface) anzeigen (im Systemmenü des
untergeordneten MDI-Fensters können Sie das untergeordnete
Fenster wiederherstellen, verschieben, die Größe ändern,
minimieren, maximieren oder schließen)
STRG+TAB Zum nächsten untergeordneten Fenster einer MDI-Anwendung
(Multiple Document Interface) wechseln
ALT+unterstrichener Entsprechendes Menü öffnen
Buchstabe im Menü
ALT+F4 Aktuelles Fenster schließen
STRG+F4 Aktuelles MDI-Fenster (Multiple Document Interface) schließen
ALT+F6 Zwischen mehreren Fenstern in der gleichen Anwendung wechseln
(wird beispielsweise im Editor das Dialogfeld Suchen angezeigt,
können Sie mit ALT+F6 zwischen dem Dialogfeld Suchen und
dem Hauptfenster des Editors wechseln)

2.12.5. Tastenkombinationen für Desktop, Arbeitsplatz und Windows


Explorer
Bei einem ausgewählten Objekt:

• F2: Objekt umbenennen


• F3: Alle Dateien suchen
• STRG+X: Ausschneiden
• STRG+C: Kopieren

15
2. Tips und Tricks

• STRG+V: Einfügen
• UMSCHALT+ENTF: Markiertes Element sofort löschen, ohne es im Papierkorb ab-
zulegen
• ALT+EINGABE: Eigenschaftenfenster für das markierte Objekt öffnen

Datei kopieren

Die STRG-Taste gedrückt halten, während die Datei in ein anderes Verzeichnis gezogen
wird.

So erstellen Sie eine Verknüpfung:

Die Tasten STRG+UMSCHALT gedrückt halten, während die Datei auf den Desktop oder
in einen Ordner gezogen wird.

2.12.6. Tastenkombinationen für den Arbeitsplatz

• F4: Dialogfeld Ordner wechseln auswählen und nach unten durch die Einträge im
Dialogfeld bewegen (wenn die Symbolleiste im Windows Explorer aktiviert ist)
• F5: Das aktuelle Fenster aktualisieren
• F6: Zwischen Ausschnitten im Windows Explorer wechseln
• STRG+G: Feld Gehe zu Ordner öffnen (nur im Windows Explorer von Windows 95)
• STRG+Z: Den letzten Befehl rückgängig machen
• STRG+A: Alle Objekte im aktuellen Fenster auswählen
• RÜCKTASTE: Zum übergeordneten Ordner wechseln
• UMSCHALT+KLICKEN auf Schaltfläche Schließen: Bei Ordnern den aktuellen Ord-
ner und alle übergeordneten Ordner schließen

2.12.7. Tasten für die Windows Explorer-Verzeichnisstruktur

• Zehnertastatur *: Alle unter der aktuellen Auswahl untergeordneten Ordner einblen-


den
• Zehnertastatur +: Aktuelle Auswahl einblenden
• Zehnertastatur -: Aktuelle Auswahl ausblenden
• NACH-RECHTS-TASTE: Die aktuelle Auswahl einblenden, falls noch nicht einge-
blendet. Andernfalls erfolgt ein Wechsel zum ersten untergeordneten Objekt
• NACH-LINKS-TASTE: Die aktuelle Auswahl ausblenden, falls eingeblendet. Andern-
falls erfolgt ein Wechsel zum übergeordneten Objekt

16
2.12. Tastenkombinationen für Windows

2.12.8. Tastenkombinationen für das Eigenschaftenfenster

• STRG+TAB/STRG+UMSCHALT+TAB: Durch die Registerkarten des Eigenschaf-


tenfensters bewegen

2.12.9. Tastenkombinationen für Eingabehilfen

• UMSCHALTTASTE fünfmal drücken: Einrastfunktion ein- und ausschalten


• Rechte UMSCHALTTASTE 8 Sekunden lang gedrückt halten: Anschlagverzögerung
ein- und ausschalten
• NUM-Taste 5 Sekunden lang gedrückt halten: Statusanzeige ein- und ausschalten
• Linke ALT-Taste und linke UMSCHALTTASTE+NUM-Taste: Tastaturmaus ein-
und ausschalten
• Linke ALT-Taste und linke UMSCHALTTASTE+DRUCK-Taste: Kontrast ein- und
ausschalten

2.12.10. Microsoft Natural Keyboard-Tastenkombinationen

• Windows-Logo: Menü Start


• Windows-Logo+R: Dialogfeld Ausführen
• Windows-Logo+M: Alle Fenster minimieren
• UMSCHALT+WINDOWS+M: Minimieren aller Fenster rückgängig machen
• Windows-Logo+F1: Hilfe
• Windows-Logo+E: Windows Explorer
• Windows-Logo+F: Dateien oder Ordner suchen
• Windows-Logo+D: Minimiert alle offenen Fenster und zeigt den Desktop an
• STRG+WINDOWS+F: Computer suchen
• STRG+WINDOWS-Logo+TAB: Bewegt den Fokus vom Startmenü zur Schnellstart-
leiste und zur Taskleiste. (NACH-RECHTS- oder NACH-LINKS-TASTE drücken,
um den Fokus auf einzelne Einträge in der Schnellstartleiste und der Taskleiste zu
richten)
• Windows-Logo+TAB: Zwischen Schaltflächen auf der Taskleiste wechseln
• Windows-Logo+UNTBR: Dialogfeld Systemeigenschaften
• Anwendungstaste: Kontextmenü für das ausgewählte Element anzeigen

17
2. Tips und Tricks

2.12.11. Microsoft Natural Keyboard mit installierter


IntelliType-Software
• Windows-Logo+L: Von Windows abmelden
• Windows-Logo+P: Druck-Manager starten
• Windows-Logo+C: Systemsteuerung öffnen
• Windows-Logo+V: Zwischenablage öffnen
• Windows-Logo+K: Dialogfeld Eigenschaften für Tastatur öffnen
• Windows-Logo+I: Dialogfeld Eigenschaften für Maus öffnen
• Windows-Logo+A: Eingabehilfen öffnen (falls installiert)
• Windows-Logo+LEERTASTE: Liste der Microsoft IntelliType-Tastenkombinationen
anzeigen
• Windows-Logo+S: FESTSTELLTASTE ein- und ausschalten

2.12.12. Tastenkombinationen für Dialogfelder


• TAB: Zum nächsten Steuerelement im Dialogfeld bewegen
• UMSCHALT+TAB: Zum vorherigen Steuerelement im Dialogfeld bewegen
• LEERTASTE: Ist das aktuelle Steuerelement eine Schaltfläche, wird auf die Schaltflä-
che geklickt. Ist das aktuelle Steuerelement ein Kontrollkästchen, wird das Kontroll-
kästchen aktiviert oder deaktiviert. Ist das aktuelle Steuerelement ein Optionsfeld,
wird das Optionsfeld markiert
• EINGABETASTE: Entspricht dem Klicken auf die markierte Schaltfläche (Schaltflä-
che mit Umrandung)
• ESC: Entspricht dem Klicken auf die Schaltfläche Abbrechen
• ALT+unterstrichener Buchstabe eines Elements in einem Dialogfeld: Zum entspre-
chenden Objekt bewegen

18
2.12. Tastenkombinationen für Windows

Inhalt
Die Unterstützung für alte 8+3 Dateinamen
ausschalten . . . . . . . . . . . . . . . 13
Arbeitsplatz erweitern . . . . . . . . . . . . . 7
Tastenkombinationen für Windows . . . . . 14
Boot-Dateien defragmentieren . . . . . . . . 7
Tastenkombinationen für das Windows-System 14
Windows-Explorer . . . . . . . . . . . . . . . 7 Tastenkombinationen für Windows-
Absturz verhindern . . . . . . . . . . . . . . . 7 Programme . . . . . . . . . . . . . . . 14
Schneller kopieren . . . . . . . . . . . . . . . 8 Kombination aus Maus- und Tastaturtaste
Windows Installer . . . . . . . . . . . . . . . 9 für Desktopobjekte . . . . . . . . . . . 14
Windows Installer Clean Up . . . . . . . . . . 9 Allgemeine Tastaturbefehle . . . . . . . . . . 14
Druckfunktion reparieren . . . . . . . . . . 9 Tastenkombinationen für Desktop, Arbeits-
Schnelltasten . . . . . . . . . . . . . . . . . . 9 platz und Windows Explorer . . . . . 15
Eingabeaufforderung . . . . . . . . . . . . . . 9 Tastenkombinationen für den Arbeitsplatz . . 16
Schnellaufruf der „Eigenschaften“ . . . . . . . 9 Tasten für die Windows Explorer-
Fehlerberichte verhindern . . . . . . . . . . . 10 Verzeichnisstruktur . . . . . . . . . . . 16
Herstellerhinweise löschen . . . . . . . . . . 10 Tastenkombinationen für das Eigenschaften-
Symbolleiste aus Ordner . . . . . . . . . . . 11 fenster . . . . . . . . . . . . . . . . . . 17
Tasks schließen . . . . . . . . . . . . . . . . . 11 Tastenkombinationen für Eingabehilfen . . . 17
Dateisystem . . . . . . . . . . . . . . . . . . . 11 Microsoft Natural Keyboard-Tastenkombinationen
Dateinameerweiterung an ein Programm binden 11 Microsoft Natural Keyboard mit installierter
NTFS Hardlink erstellen . . . . . . . . . . . . 11 IntelliType-Software . . . . . . . . . . 18
NTFS Symlink erstellen . . . . . . . . . . . . 12 Tastenkombinationen für Dialogfelder . . . . 18
Den letzten Zugriff bei NTFS nicht speichern 12
Die Größe der Master File Table erhöhen . . 13

19
2. Tips und Tricks

20
3. TERROR

3.1. TERROR

3.1.1. Visual Studio Debug Dll’s fehlen


mfc80d.dll
msvcr80d.dll, msvcp80d.dll, msvcm80d.dll usw. installieren ohne den ganzen Visual Studio
mist wieder frisch zu installieren.

Passiert: Wenn man nicht höllisch aufpasst z.B. beim installieren von einem nicht kom-
patiblem vcredistributable. Bei einem neueren Spiel kann das passieren. Beim Windows
Installer 4.1 update könnte es auch diese Probleme geben. Am besten lassen!

Symptome: wenn diese dll’s fehlen:


• depends.exe kann sie nicht auflösen.
• Debug kompilierte C++ Programme starten nicht.
• Debug kompilierte .NET Programme starten nicht, wenn eine unmanaged dll mit
geladen wird.

1. Lösung: http://www.ghacks.net/2008/12/02/microsoft-net-framework-cleanup-tool/cleanup_tool.exe
NET entfernen.
vcredist_x86.exe visual c++ redistributable SP1 installieren.
Ringtones_VEX_article_web_extensions.zip installieren, das installiert und registriert
die fehlenden 80d.dll’s. http://www.botmag.com/articles/
NetFx20SP2_x86.exe installieren.

2. Lösung: Ein Setup Installer Projekt in VS2005 erstellen. Die Merge-Module:


• C:\Program Files\Common Files\Merge Modules\Microsoft_VC80_DebugCRT_x86.msm
• C:\Program Files\Common Files\Merge Modules\Microsoft_VC80_DebugMFC_x86.msm
• C:\Program Files\Common Files\Merge Modules\Microsoft_VC80_DebugOpenMP_x86.msm
• C:\Program Files\Common Files\Merge Modules\policy_8_0_Microsoft_VC80_DebugCRT_x86.
• C:\Program Files\Common Files\Merge Modules\policy_8_0_Microsoft_VC80_DebugMFC_x86.

21
3. TERROR

• C:\Program Files\Common Files\Merge Modules\policy_8_0_Microsoft_VC80_DebugOpenM


einbinden und das Projekt erstellen. Nun sollte ein Installer vorhanden sein, der die Debug-
Dll’s korrekt installiert.

3.1.2. Automatisches ScanDisk ausschalten

Bei jedem Start von Windows wird CHKDSK ausgeführt. Dieses Verhalten schalten Sie
folgendermaßen ab:
Um die Ausführung von chkdsk /f /r zu beenden, wenden Sie die folgende Schritte an:
1. Führen Sie Registrierungs-Editor(Regedt32.exe).
2. Wechseln Sie unter der Teilstruktur HKEY_LOCAL_MACHINE zum folgenden Unter-
schlüssel: \SYSTEM\CurrentControlSet\Control\Session Manager
3. Ändern Sie den Eintrag "BootExecute" von:

autocheck autochk OODBS

In:

autocheck autochk

Wenn Sie ScanDisk für mehrere Laufwerke geplant haben, wird ein Autocheck-Eintrag für
jedes Laufwerke erstellt. Löschen Sie die Zeichenfolge aus den Registrierungswert "BootEx-
ecute" für jedes „ControlSet“ das nicht aktiviert werden soll.

3.1.3. Meine Dateien enden alle mit .vicrypt

Kommt von einer Malware, die den Benutzer erpressen will und Dateien verschlüsselt.
Abhilfe schafft Antivicrypt von Exquisys Software Technology LTD.
Antivicrypt is a FREE tool which recovers all your files damaged by the Vicrypt malware
and tries to remove vicrypt malware completely from your computer. There is a large
number of important files, database files, pictures, documents, emails and lots more which
Antivicrypt has recovered till date and restored to their original state.
Most often, Vicrypt comes by popping a message with the header “Vicrypt error! Please
restart windows” and message body “viCrypt: A problem occurred, Please Restart Win-
dows”. You will also notice that your files damaged by vicrypt will have the extension
".viCrypt". Vicrypt does not spare emails as well. So it is not uncommon that you find
all your emails lost when opening your email application. Many other programs may also
malfunction since Vicrypt damages lots of files.
If you have been a victim of the problems above, the best solution to repair all your damaged
files is by using Antivicrypt developed by Exquisys Software Technology Ltd. Antivicrypt
will repair all your files bearing the “.viCrypt” extension. It will restore back your lost
emails if they have been damaged by Vicrypt and all other files including application files
previously damaged by Vicrypt will be restored back to origin. It is wise not to change the

22
3.1. TERROR

“.viCrypt” extension of the damaged files, otherwise Antivicrypt will not be able to locate
them.
Other than restoring files damaged by Vicrypt, Antivicrypt also cleans your computer from
the Vicrypt malware. You can choose to remove Vicrypt from common known vicrypt
locations or even check every drive of your computer for the presence of vicrypt malware
and remove them completely forever.
If you have any suggestion or discussion about our products, please discuss them in our
forum section or refer to our support section.
A Note on vicrypt:
Vicrypt is a malware which tries to damage file headers rendering them unaccessible.
Vicrypt uses the Rc4 encryption algorithm to encrypt header files. It comes with the file
regdtopt.exe mostly found in program files directory.
Note: Please DO NOT support crack sites, keygens or hacked versions of Antivicrypt since
these may further damage your computer or have your private information stolen such as
user names, passwords, credit cards information etc. There are also some websites which
claim to provide you with Antivicrypt’s registration key for a small fee. Stay away from
these since you may get your credit card information stolen and you will get only a non
working registration key from them. Antivicrypt is a FREE tool, so no need to pay for
registartion keys.
Kindly refer to our news section: http://www.exquisysltd.com/news.php
Download this product at http://www.exquisysltd.com/productinfo.php?p=DA02EX.

23
3. TERROR

24
4. Hilfsprogramme

4.1. Programmieren und Entwicklung

4.1.1. WinMerge

WinMerge ist eine freie Software für Microsoft Windows zum Vergleichen von Dateien
und Verzeichnissen, um die unterschiedlichen Codes von bspw. verschiedener Programm-
versionen zusammenführen (engl. to merge) zu können. Es werden Unterschiede farblich
hervorgehoben und es lassen sich aus dem Vergleich heraus Dateien ändern, verschieben
oder löschen. Ferner ist es möglich, Binärdateien auszublenden, Sicherheitskopien von ge-
änderten Dateien anzulegen und weiteres.
WinMerge bietet, verglichen mit anderen Tools dieser Kategorie, einige Zusatzfunktionen,
unter anderem:
• Unterstützung von 7-Zip zum Vergleichen gepackter Archive
• Integration in den Windows-Explorer (Einträge im Kontextmenü von Dateien und
Ordnern)
• Integration in das SVN-Werkzeug TortoiseSVN
• automatische Erstellung von Patchdateien
• Syntax-Hervorhebung von z.B. Pascal, C

4.1.1.1. Bezugsquelle

Die Homepage von WinMerge: http://winmerge.org/.

4.1.2. GreenShot

Greenshot ist ein auf Produktivität optimiertes Screenshot-Tool.

• Speichere einen Screenshot oder einen Teil des Bildschirms in nur einer Sekunde.
• Füge Text und Zeichnungen in deine Screenshots ein.
• Fotografiere ein Fenster, einen Bereich oder den Ganzen Bildschirm.
• Unterstützt verschiedene Bildformate.

25
4. Hilfsprogramme

Bild 4.1.: greenshot Screenshot-Tool

4.1.2.1. Modi

Bereichsmodus Aktivieren Sie den Bereichsmodus, indem Sie die Druck-Taste auf Ihrer
Tastatur betätigen oder Bereich abfotografieren aus dem Kontextmenü wählen.
Drücken und halten Sie die linke Maustaste gedrückt, um einen rechteckigen Bereich zu
definieren, der abfotografiert werden soll.
Nach dem Loslassen der Maustaste öffnet sich das Bildbearbeitungsfenster zur weiteren
Bearbeitung Ihres Screenshots.
Um den Bereich später noch einmal abzufotografieren, wählen Sie Zuletzt gewählten Be-
reich abfotografieren.

Fenstermodus Aktivieren Sie den FensterModus, indem Sie Alt + Druck auf Ihrer Tas-
tatur betätigen oder Fenster abfotografieren aus dem Kontextmenü wählen.
Klicken Sie auf das Fenster, dass abfotografiern werden soll.
Nachdem Sie geklickt haben öffnet sich das Bildbearbeitungsfenster zur weiteren Bearbei-
tung Ihres Screenshots.

Bildschirmmodus Wenn Sie den gesamten Bildschirm abfotografieren wollen, drücken Sie
einfach Ctrl + Print auf Ihrer Tastatur oder wählen Sie Kompletten Bildschirm abfotogra-
fieren.
Der komplette Bildschirm wird sofort abfotografiert, das Bildbearbeitungsfenster öffnet
sich zur weiteren Bearbeitung Ihres Screenshots.

4.1.2.2. Bildbearbeitungsfenster

Wenn Sie das Bildbearbeitungsfenster nicht nutzen wollen können Sie im Kontextmenü oder
im Einstellungsdialog festlegen, dass es nicht angezeigt werden soll. In diesem Fall wird der
Screenshot sofort in eine Datei gespeichert. Speicherort, Dateiname und Bildformat sind
dann abhängig von den bevorzugten Ausgabedatei-Einstellungen im Einstellungsdialog.

26
4.2. Sicherheit

Datei-Menü
• Speichern: speichert die Grafik unter dem Pfad der beim letzten Speichern unter...
Dialog gewählt wurde
• Speichern unter...: öffnet einen Dialog zur Auswahl des Pfads und Dateinamens unter
dem die Grafik gespeichert werden soll
• Grafik in die Zwischenablage kopieren: kopiert die Grafik in die Zwischenablage, so
dass sie in anderer Software verwendet werden kann

Bearbeiten-Menü
• Gewähltes Element in die Zwischenablage ausschneiden: entfernt das ausgewähltes
Element und kopiert es in die Zwischenablage, so dass es in ein anderes Bildbearbei-
tungsfenster eingefügt werden kann
• Gewähltes Element in die Zwischenablage kopieren: kopiert das ausgewähltes Element
in die Zwischenablage, so dass es in ein anderes Bildbearbeitungsfenster eingefügt
werden kann
• Element aus der Zwischenablage einfügen: fügt ein vorher ausgeschnittenes/kopiertes
Element in das Bildbearbeitungsfenster ein
• Gewähltes Element duplizieren: dupliziert das gewählte Element

Objekt-Menü
• Rechteck hinzufügen: fügt ein Rechteck zur Grafik hinzu
• Ellipse hinzufügen: fügt eine Ellipse zur Grafik hinzu
• Textfeld hinzufügen: fügt ein Textfeld zur Grafik hinzu
• Gewähltes Element löschen: entfernt das gewählte Element aus der Grafik
Klicken Sie ein Element an um es auszuwählen. Anschließend können Sie die Größe oder
Position verändern, oder es kopieren, ausschneiden oder entfernen. Die Größe eines Ele-
ments kann durch Klicken und Ziehen der Anfasser (kleine schwarze Quadrate) an der
linken oberen oder der rechten unteren Ecke geändert werden.

4.1.2.3. Bezugsquelle

Homepage und download unter http://greenshot.sourceforge.net/

4.2. Sicherheit

4.2.1. Sandboxie
Sandboxie ist eine sogenannte Sandbox, ein Computerprogramm, das es ermöglicht, Pro-
gramme isoliert vom Betriebssystem auszuführen. http://de.wikipedia.org/wiki/Sandboxie

27
4. Hilfsprogramme

Funktionsweise Führt man ein Computerprogramm in Sandboxie aus, werden alle Schreib-
zugriffe auf die Festplatte auf einen speziellen, selbst definierbaren Ordner umgeleitet.[1]
Das Programm ist in der Lage, sowohl Schreibzugriffe auf Dateien als auch auf die Registry
umzuleiten.[2] Auf diese Weise wird das eigentliche Computersystem nicht verändert, wenn
Programme in Sandboxie ausgeführt werden.
Ist die betreffende Datei in dem Sandboxie-Ordner bereits vorhanden, werden auch Lese-
zugriffe entsprechend umgeleitet, so dass das in Sandboxie ausgeführte Programm selbst
mit den veränderten Dateien weiterarbeitet. Möchte man die Änderungen verwerfen, leert
man die Sandbox entweder manuell oder automatisch beim Schließen der Sandbox. Der
Benutzer hat jedoch die Möglichkeit, Ordner festzulegen, bei denen die Dateiänderungen
entweder durch ein Dialogfeld gemeldet werden und die geänderten Dateien sofort in den
tatsächlichen Ordner kopiert werden können oder vor dem Löschen des Sandbox-Inhalts
aufgelistet und nach Bedarf kopiert werden können.

Anwendungsbereiche Häufigste Anwendung ist das Ausführen eines Browsers oder E-


Mail-Programms unter Sandboxie. Fängt sich der Internetnutzer Schadprogramme ein,
können sich diese nicht einfach irgendwo auf dem System einnisten, sondern werden in die
Sandbox umgeleitet. Leert man die Sandbox regelmäßig, werden auch die Schadprogramme
gelöscht.
Ein zweiter möglicher Anwendungsbereich ist das Ausprobieren von Computerprogram-
men.[3] Installiert man ein neues Computerprogramm in der Sandbox, kann man es darin
testen und bei Nichtgefallen das Programm durch Leeren der Sandbox entfernen, ohne
dass auf dem System Spuren zurückbleiben, wie das bei einer normalen Deinstallation oft
der Fall ist. Weiterhin kann man auch bereits auf dem System installierte Programme in
der Sandbox ausführen, um die Auswirkungen von veränderten Programmkonfigurationen
zu testen. Software, welche allerdings sehr tief in das System eingreift wie z.B. Antiviren-
programme lassen sich nicht in der Sandbox installieren, da die Installtionsroutinen dieser
Programme mit den eingeschränkten Rechten der Sandbox nicht zurechtkommen und die
Installation abbrechen.

Anpassungsmöglichkeiten In Sandboxie können mehrere Sandboxen verwaltet werden.


Für jede Sandbox lassen sicht getrennt verschiedene Einstellungen vornehmen. So ist es
z.B. möglich, den Lesezugriff auf bestimmte Dateien komplett zu unterbinden oder Da-
teien festzulegen, bei deren Zugriff die Sandbox die Schreibzugriffe nicht in die Sandbox
umleitet.[4] Auch lassen sich über Sandboxie Programme mit eingeschränkten Rechten
ausführen, wenn man selbst mit einem Administratorkonto arbeitet.[5]

Unterschiede der registrierten Version Sandboxie ist für Privatanwender kostenlos. Al-
lerdings erscheint dann nach 30 Tagen ein Erinnerungsfenster, die Software doch zu lizen-
zieren. Kommt man dieser Aufforderung nach, erhält man eine lebenslange Lizenz und es
werden weitere Funktionen freigeschaltet, welche es in der Standardversion nicht gibt. So
kann man z.B. bestimmte Programme und Ordner definieren, welche automatisch in der
Sandbox gestartet werden und Programme in unterschiedlichen Sandboxen laufen lassen.[6]
http://www.sandboxie.com/

28
4.3. Filesystem

4.3. Filesystem

4.3.1. DoubleKiller
DoubleKiller is a fast and easy to use application for finding and removing duplicate files.
http://www.bigbangenterprises.de/en/doublekiller/

4.3.2. DoubleCommander
http://doublecmd.sourceforge.net/
"Double Commander" ist ein kleiner und übersichtlicher Dateibrowser, der viele
vermisste Funktionen des Windows Explorers bietet. (http://www.chip.de/
downloads/Double-Commander_37928981.html)
Der Windows Explorer ist ein schlecht ausgestatteter und ziemlich unpraktischer Datei-
manager. Besser macht es der "Double Commander": Das Tool erleichtert die Ansicht des
Dateisystems mit zwei Fenstern und zusätzlichen Tabs, über die Sie bequem zwischen ge-
öffneten Ordnern wechseln.
ZIP-, RAR- und andere Archive sehen Sie wie normale Ordner, und der "Double Com-
mander" packt und entpackt die Files auch gleich. Andere praktische Funktionen wie der
Datei-Betrachter (mit Text-, Binär- oder Hexwert-Darstellung), das Umbenennen von Da-
teigruppen sowie das Splitten und Zusammenfügen von Dateien, sucht man im Windows-
Pendant ebenfalls vergeblich.

Fazit: Bereits in der Beta-Version kann der "Double Commander" mit nützlichen Featu-
res überzeugen, die der Windows Explorer vermissen lässt. Besonders praktisch: Für fast
jede Funktion steht ein entsprechender Tastatur-Shortcut zur Verfügung. Die Liste finden
Sie unter »Hilfe | Tastatur«.

29
4. Hilfsprogramme

30
5. Firefox

Firefox-Tuning. Wissen Sie, wie man Firefox im Safe-Mode startet? Oder wie man den
ungezügelten Speicherverbrauch des Browsers begrenzt und den Seitenaufbau beschleunigt?

Inhalt
Autovervollständigung kürzen . . . . . . . . . 36
Google-Suche über Adressleiste . . . . . . . . 36
Sicherheit . . . . . . . . . . . . . . . . . . . . 33
Suchergebnisse in neuem Tab . . . . . . . . . 37
Tracking-Cookies ausbremsen . . . . . . . . . 33
Einfügen mit mittlerer Maustaste . . . . . . . 37
Chronik begrenzen . . . . . . . . . . . . . . . 33
Autovervollständigung aufräumen . . . . . . . 37
Supercookies deaktivieren . . . . . . . . . . . 33
Webseite in neuem Tab laden . . . . . . . . . 37
Firefox im Safe-Mode . . . . . . . . . . . . . 34
Noscript bändigen . . . . . . . . . . . . . . . 34 Mehrere Startseiten . . . . . . . . . . . . . . 38
Performance . . . . . . . . . . . . . . . . . . . 34 Autovervollständigung anpassen . . . . . . . . 38
Verzögerung entfernen . . . . . . . . . . . . . 35 Tab-Größe ändern . . . . . . . . . . . . . . . 38
Pipelining aktivieren . . . . . . . . . . . . . . 35 Tipps . . . . . . . . . . . . . . . . . . . . . . . 38
Speicherverbrauch . . . . . . . . . . . . . . . 35 .NET-Add-on löschen . . . . . . . . . . . . . 38
RAM-Cache einstellen . . . . . . . . . . . . . 35 Add-ons . . . . . . . . . . . . . . . . . . . . . 39
Festplatten-Cache festlegen . . . . . . . . . . 36 Adresszeile im Retro-Look . . . . . . . . . . . 39
Offline-Cache begrenzen . . . . . . . . . . . . 36 Zugangsdaten Ex- und Importieren . . . . . . 39
Speicherintervall festlegen . . . . . . . . . . . 36
Bedienung . . . . . . . . . . . . . . . . . . . . 36

31
5. Firefox

1. Adressfeld
Tragen Sie in das Adressfeld about:config ein, um zu den Einstellungen zu gelangen.
2. Filter
Um schneller zu der gesuchten Einstellung zu kommen, verwenden Sie den Filter.

3. Einstellungsname
Diese Spalte zeigt alpha-
betisch alle Einstellun-
gen. Über das Kontext-
menü lassen sich neue an-
legen.
4. Wert
Hier stehen die Werte der
Einstellun- gen. Sie las-
sen sich mit einem Dop-
pelklick ändern.
5. Alles anzeigen
Dieser Button hebt den
Filter auf und zeigt sämt-
liche Einstellungen.
Bild 5.1.: Versteckte
Einstellungen ändern:
So geht’s

32
5.1. Sicherheit

5.1. Sicherheit

Firefox gilt als sicherer Browser, zumal er nicht die anfällige ActiveX-Technik verwendet.
Dennoch lässt sich die Sicherheit weiter verbessern.

5.1.1. Tracking-Cookies ausbremsen

Viele Webseiten sind ohne Cookies kaum zu bedienen. Cookies lassen sich aber dazu miss-
brauchen, Ihr Surfver- halten auszuspionieren. Um dem einen Riegel vorzuschieben und
nur Cookies der ursprünglichen Webseite zu ak- zeptieren, geben Sie in das Adressfeld von
Firefox about:config ein. Über das Feld „Filter“ navigieren Sie zu dem Eintrag network.
cookie.cookieBehavior und klicken ihn doppelt an, um den Wert zu ändern. Mit 0 ak-
zeptieren Sie sämtliche Cookies, mit 1 nur die der ursprünglichen Webseite, und mit 2
weisen Sie alle Cookies ab.

5.1.2. Chronik begrenzen

Die Chronik speichert alle Webseiten, die


Sie im letzten halben Jahr besucht ha-
ben (Bild 5.2 auf dieser Seite). Damit nie-
mand in diesen Daten herumschnüffelt, be-
grenzen Sie die Chronik oder schalten sie
ganz aus. Wechseln Sie über about:config
zu browser.history_expire_days. Tra-
gen Sie dort den Wert in Tagen ein.
0 deaktiviert die Chronik. Geben Sie
den gleichen Wert bei browser.history
_expire_days_min ein.

5.1.3. Supercookies deaktivieren


Bild 5.2.: Chronik: Firefox speichert die be-
Supercookies verwenden nicht die Cookie- suchten Seiten der vergangenen 180 Tage
Funktionen des Browsers, sondern Flash.
Mit den üblichen Löschmethoden ist
den kleinen Spürnasen nicht beizukom-
men. Stattdessen wechseln Sie über about:config
zu dom.storage.enabled. Per Doppelklick
ändern Sie den Wert:
true akzeptiert die Datenablage, die auch die Supercookies nutzen,
false deaktiviert sie.

33
5. Firefox

Bild 5.3.: Abgesicherter Modus: Hier lassen sich Add-ons deaktivieren und Einstellun-
gen zurücksetzen.

5.1.4. Firefox im Safe-Mode

Der Safe-Mode entspricht etwa dem abgesicherten Modus von Windows. So sind beim
Start im Safe-Mode alle Erweiterungen deaktiviert. Das ist zum Beispiel dann hilfreich,
wenn Firefox wegen einer störenden Erweiterung nicht mehr ordnungsgemäß funktioniert.
Themes und Erweiterungen lassen sich im Safe-Mode deinstallieren ( Bild 5.3 auf dieser
Seite ). Um Firefox im Safe-Mode zu starten, schließen Sie zunächst alle Firefox-Instanzen.
Dann geben Sie unter „Start, Ausführen . . . “ den Pfad zu der Datei „firefox.exe“ in An-
führungszeichen ein, gefolgt von dem Parameter -safe-mode, zusammen also beispielsweise
"C:\Programme\Mozilla.Firefox\firefox.exe"·-safe-mode.

5.1.5. Noscript bändigen

Der ansonsten ausgezeichnete Javascript-Blocker Noscript 1.9.3.3 ( www.noscript.net )


nervt bei jedem seiner häufigen Updates damit, dass er automatisch seine Homepage öffnet.
Das lässt sich leicht verhindern.
Öffnen Sie die erweiterten Firefox-Einstellungen, indem Sie about:config in die Adress-
zeile eintippen. Bestätigen Sie die Warnmeldung mit einem Klick auf „Ich werde vorsichtig
sein, versprochen!“ und tippen Sie dann in das Feld hinter „Filter“ den Begriff noscript.
firstRunRedirection ein. Klicken Sie dann in dem Feld darunter doppelt auf den ange-
zeigten Eintrag, um den Wert von „true“ auf „false“ zu setzen. Ab sofort öffnet Noscript
nach einem Update seine Homepage nicht mehr.

5.2. Performance

Firefox ist flott. Mit versteckten Einstellungen kitzeln Sie noch mehr Geschwindigkeit her-
aus und verbessern die Nutzung des Speichers.

34
5.2. Performance

5.2.1. Verzögerung entfernen


Wenn Sie eine Webseite aufrufen, wartet Firefox eine viertel Sekunde, bevor er mit dem
Rendern beginnt. Falls Sie eine schnelle Internetverbindung haben, verringern Sie diesen
Wert und beschleunigen so den Seitenaufbau.
Navigieren Sie über about:config zu nglayout.initialpaint.delay. Klicken Sie den
Eintrag doppelt an und ändern Sie den Wert. Er ist in Millisekunden angegeben. Zu emp-
fehlen ist ein Wert von 50.

5.2.2. Pipelining aktivieren


Pipelining bewirkt, dass Firefox eine Webseite nicht über mehrere HTTP-Verbindungen
anfordert, sondern über eine gemeinsame. Der Effekt: Es werden weniger Protokolldaten
übertragen und die Seite baut sich schneller auf.
Wechseln Sie über about:config zu network.http.pipelining und klicken Sie den Ein-
trag doppelt an. Der Wert true aktiviert die Funktion, false schaltet sie aus.

5.2.3. Speicherverbrauch
Firefox belegt manchmal Unmengen von Ar-
beitsspeicher. Insbesondere dann, wenn Sie viele
Tabs geöffnet haben, frisst Firefox weit über 100
MByte RAM (Bild 5.4).

Um den
Speicherhunger zu begrenzen, ändern Sie drei
Werte in about:config. Setzen Sie config.
trim_on_minimize auf true und browser.
sessionhistory.max_total_viewers auf
0 oder eine kleine Zahl. Stellen Sie außerdem
network.prefetch-next auf false.

5.2.4. RAM-Cache einstellen


Firefox speichert aufgerufene Webseiten nicht
nur auf der Festplatte, sondern auch in ei- Bild 5.4.: Task-Manager: Der
nem Arbeitsspeicher-Cache. Darauf kann Fire- Speicherbedarf von Firefox ist
fox schneller zugreifen, wenn die Seite erneut weit größer als der aller anderen
aufgerufen wird. Die entsprechende Speichergrö- Programme
ße lässt sich frei wählen. Ein großer Wert be-
deutet mehr Speicherverbrauch und schnelleres
Surfen, kleine Werte bewirken das Gegenteil.
Die aktuelle Einstellung sehen Sie, indem
Sie in das Adressfeld about:cache?device=memory

35
5. Firefox

eingeben. Die zuständige Einstellung heißt browser.cache.memory.capacity. Die Anga-


be erfolgt in Kilobyte.

5.2.5. Festplatten-Cache festlegen

Der Festplatten-Cache bewirkt, dass Firefox bereits besuchte Webseiten schneller lädt.
Dafür reserviert der Browser 50 MByte auf der Festplatte. Dieser Wert lässt sich über
about:config beliebig ändern. Tragen Sie die gewünschte Größe in Kilobyte bei browser.
cache.disk.capacity ein.

5.2.6. Offline-Cache begrenzen

Firefox hat einen Offline-Cache, den Webanwendungen nutzen können, um dort Daten
abzulegen. Standardmäßig ist dies bis zu ein halbes Gigabyte. Wem dies zu viel ist, der
setzt den Wert herab.
Suchen Sie dazu über about:config den Eintrag browser.cache.offline.capacity und
tragen Sie dort den gewünschten Wert in Kilobyte ein.

5.2.7. Speicherintervall festlegen

Damit Firefox beendete Sessions wiederherstellen kann, speichert er alle zehn Sekunden
die dafür benötigten Daten im Profil-Ordner ab. Wem dieses Intervall zu kurz ist, der
vergrößert den Wert. Die Angabe erfolgt in Millisekunden.
Navigieren Sie über about:config zu browser.sessionstore.interval und klicken Sie
die Einstellung doppelt an, um den Wert zu ändern.

5.3. Bedienung
Diese neun Tipps erleichtern den Umgang mit Firefox.

5.3.1. Autovervollständigung kürzen

Das Adressfeld von Firefox zeigt beim Eintippen zwölf Vorschläge, die sich aus der Chronik
und den Lesezeichen zusammensetzen (Bild 5.5). Wenn Ihnen dies zu viele oder zu weni-
ge sind, dann ändern Sie über about:config den Wert des Eintrags browser.urlbar.
maxRichResults nach Belieben ab.

5.3.2. Google-Suche über Adressleiste

36
5.3. Bedienung

Wenn Sie mit Google etwas su-


chen, dann tippen Sie norma-
lerweise erst google.de in das
Adressfeld von Firefox und ge-
ben anschließend den Suchbegriff
in Google ein. Das geht deutlich
bequemer: Tragen Sie den Suchbe-
griff direkt in das Adressfeld ein.
Wechseln Sie dazu zu about:config.
Klicken Sie mit der rechten Maustas-
te in das Fenster und wählen Sie
„Neu, String“. Als Eigenschafts-
Bild 5.5.: Autovervollständigung: Firefox macht name tragen Sie keyword.URL
zwölf Vorschläge, die Anzahl lässt sich aber belie- ein. Als Wert geben Sie http:
big ändern //google.de/search?btnG=Google+
Search&q= an.

5.3.3. Suchergebnisse in
neuem Tab
Wenn Sie einen Begriff in das Suchfeld eingeben, zeigt Firefox die Ergebnisse im aktiven
Tab. Sinnvoller wäre es, da- für einen neuen Tab zu verwenden, um die aktive Seite nicht
zu überschreiben.
Wechseln Sie über about:config zu browser.search.openintab. Geben Sie als Wert
true ein, damit Firefox für die Suchergebnisse einen neuen Tab verwendet.

5.3.4. Einfügen mit mittlerer Maustaste


Um einen Text, zum Beispiel eine URL, der sich in der Zwischenablage befindet, schnell
etwa in das Adressfeld einzufügen, können Sie die mittlere Maustaste verwenden.
Dazu suchen Sie über about:config die Einstellung middlemouse.paste. Um die mittlere
Maustaste für das Einfügen zu aktivieren, stellen Sie den Wert auf true.

5.3.5. Autovervollständigung aufräumen


In der Dropdown-Liste der Adresszeile sammelt sich mit der Zeit reichlich Müll in Form ver-
alterter oder unerwünschter Einträge an. Um einen solchen Eintrag schnell und dauerhaft
zu entfernen, markieren Sie ihn und verwenden dann die Tasten- kombination [Umschalt
Entf].

5.3.6. Webseite in neuem Tab laden


Der schnellste Weg, um eine Seite in einem neuen Tab zu laden: Geben Sie die entsprechende
URL in das Adressfeld ein und drücken Sie die Tasten [Alt Eingabe].

37
5. Firefox

5.3.7. Mehrere Startseiten

Im Menü „Extras, Einstellungen


. . . , Allgemein“ legen Sie im Feld
„Startseite“ die Webseite fest, die
Firefox beim Start automatisch
lädt. Um mehrere Startseiten fest-
zulegen, geben Sie diese getrennt
durch das Pipe-Zeichen „|“ ein
(Bild 5.6). Sie erzeugen es mit den
Tasten [Alt Gr <]. Wenn Sie künf-
tig auf das Haus-Symbol klicken
oder Firefox starten, dann öffnen
sich die Startseiten in jeweils eige-
nen Tabs.

5.3.8. AutovervollständigungBild 5.6.: Einstellungen: Hier lassen sich auch meh-


anpassen rere Startseiten festlegen, die Sie getrennt durch das
Pipe-Zeichen eintragen
Die Autovervollständigung von Fi-
refox ergänzt Eingaben in der
Adresszeile auch von der Mit-
te aus. So vervollständigt der
Browser deutsch zum Beispiel zu
www.sueddeutsche.de.
Mit einem Trick erhalten Sie weniger, dafür sinnvollere Ergebnisse. Dazu navigieren Sie
über about:config zu dem Eintrag browser.urlbar.matchBehavior. Ändern Sie dessen
Wert in 2. Damit beginnt die Suche der Autovervollständigung nur am Wortanfang.

5.3.9. Tab-Größe ändern

Die Tabs in Firefox sind sehr breit und nehmen viel Platz ein.
So legen Sie fest, wie stark Firefox die Tabs verkleinert, bevor die Scrollleiste aktiviert wird:
Geben Sie about:config in die Adresszeile ein und bestätigen Sie mit der Eingabetaste.
Klicken Sie doppelt auf „browser.tabs.tabMinWidth“ und geben Sie die gewünschte Min-
destbreite der Tabs an, etwa 80.

5.4. Tipps

5.4.1. .NET-Add-on löschen

38
5.5. Add-ons

Microsoft hat ein Up-


date angekündigt, das
den Fehler beheben soll.
Einstweilen lässt sich das
Add-on nur per Registry-
Eingriff löschen.

Öffnen Sie den Registrie-


Bild 5.7.: Registrierungs-Editor: Das .NET-Add-on für Fi-
rungs-Editor, indem Sie
refox lässt sich nur in der Registry löschen
[Windows R] drücken,
regedit eingeben und
mit „OK“ bestätigen. Na-
vigieren Sie zu „HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Firefox\extensions“. Kli-
cken Sie mit der rechten Maustaste auf den Eintrag „{20a82645-c095-46ed-80e3-
08825760534b}“ und wählen Sie die Option „Löschen“ (Bild 5.7). Starten Sie Fire-
fox, geben Sie in die Adressleiste about:config ein und drücken Sie die Eingabetaste.
Klicken Sie mit der rechten Maustaste auf den Eintrag „general.useragent.extra.
microsoftdotnet“. Wählen Sie „Zurücksetzen“. Löschen Sie anschließend noch die
Programmdateien, indem Sie den Ordner „C:\Windows\Microsoft.NET\Framework\v3.
5\Windows Presentation Foundation\DotNetAssistantExtension\“ samt Inhalt ent-
fernen.

5.5. Add-ons

5.5.1. Adresszeile im Retro-Look

Wenn Sie die Adresszeile von Firefox 3 als Rückschritt empfinden, dann stellen Sie mit
der Erweiterung Old Location Bar 1.3 ( https://addons.mozilla.org/en-US/firefox/
addon/7637 ) wieder das alte Aussehen und Verhalten her. Damit färbt Firefox die Adress-
zeile bei verschlüsselten Verbindungen wieder gelb ein (Bild 5.8), und die Autovervollstän-
digung fällt weniger opulent aus und zeigt nur eine Zeile pro Eintrag.

5.5.2. Zugangsdaten Ex- und Importieren

Password Exporter 1.1 Der Password Exporter 1.1 sichert Ihre gespeicherten Zugangs-
daten und Passwörter und stellt sie bei Bedarf wieder her. Um Daten zu exportieren, rufen
Sie „Extras, Einstellungen . . . “ auf und wechseln auf den Reiter „Sicherheit“. Klicken Sie
auf „Import/Export Passwörter“ und danach auf „Passwörter exportieren“. „Gespeicher-
te Passwörter ansehen“ zeigt alle aktuellen Daten an https://addons.mozilla.org/de/
firefox/addon/2848.

39
5. Firefox

Bild 5.8.: Autovervollständigung: Die Erweiterung


Old Location Bar sorgt dafür, dass das Adressfeld
bei verschlüsselten Verbindungen wieder gelb ist

40
6. Netzwerk

3. Einstellungsname
Diese Spalte zeigt alphabetisch alle Einstellungen. Über das Kontext- menü lassen sich
neue anlegen.

4. Wert
Hier stehen die Werte der Einstellun- gen. Sie lassen sich mit einem Doppelklick ändern.

5. Alles anzeigen
Dieser Button hebt den Filter auf und zeigt sämtliche Einstellungen.

6.1. P2P

6.1.1. Blocklist Manager

Wie Protowall (von http://blocklistpro.com/download-center/) ist Blocklist Mana-


ger (http://blocklistpro.com/the-blocklist-manager-2.7.7.html)eine weitere Soft-
ware von Bluetack. Sie dient zum Verarbeiten von IP-Listen und ist unter anderem in der
Lage, Listen direkt vom Bluetack-Internetportal herunterzuladen und in unzählige Formate
(für verschiedene Programme) zu konvertieren. Ferner werden noch andere Bearbeitungs-
möglichkeiten geboten. Bluetack rät dazu, Protowall und Blocklist Manager kombiniert zu
verwenden, um gewährleisten zu können, dass die IP-Listen stets aktuell sind.

Download unter http://blocklistpro.com/download-center/blocklist-manager/.

Wikipedia Infos unter http://de.wikipedia.org/wiki/Protowall#Bluetack.

Inhalt
Hilfsprogramme . . . . . . . . . . . . . . . . . 42
P2P . . . . . . . . . . . . . . . . . . . . . . . . 41 Fport . . . . . . . . . . . . . . . . . . . . . . 42
Blocklist Manager . . . . . . . . . . . . . . . 41 netstat . . . . . . . . . . . . . . . . . . . . . . 42
Vuze . . . . . . . . . . . . . . . . . . . . . . . 42
Emule . . . . . . . . . . . . . . . . . . . . . . 42

41
6. Netzwerk

6.1.2. Vuze
6.1.2.1. IP-Filter

Unter der Konfigurations-Tab „IP-Filter“ (Bild 6.1 auf dieser Seite) in das Textfeld bei
Automatischem laden der Filterliste „http://www.bluetack.co.uk/config/level1.gz“
eintragen und mit dem Button „Jetzt Laden“ quittieren.

Bild 6.1.: Vuze IP-Filter

6.1.3. Emule
6.1.3.1. IP-Filter

6.2. Hilfsprogramme

6.2.1. Fport
Fport.exe zeigt an, welches Programm exakt welchen Port belegt.

6.2.2. netstat
netstat -a
zeigt wer mit welchen Port-Verbindungen kommuniziert.

42
7. Windows PowerShell

43
7. Windows PowerShell

44
8. Alternativen zu Bordmitteln

8.1. Mediaplayer

8.1.1. VLC media player


Der VLC media player (anfänglich VideoLAN Client) ist ein portabler, freier Mediaplayer
sowohl für diverse Audio-, Videocodecs und Dateiformate als auch DVDs, Video-CDs und
unterstützt unterschiedliche Streaming-Protokolle. Er kann auch als Server zum Streaming
in Uni- oder Multicast in IPv4 und IPv6 oder als Transcoder für die unterstützten Video
und Audio-Formate verwendet werden.
Eine Videodatei zu streamen oder zu konvertieren geht so am Besten: Die Datei aus der
Wiedergabeliste mit der rechten Maustaste anwählen und danach entweder „Stream“ oder
„Speichern“ auswählen.
Verfügbar unter http://www.videolan.org/.

45
8. Alternativen zu Bordmitteln

46
Teil II.

Office

47
9. Microsoft Office Allgemein
Drum prüfe,
wer sich ewig bindet . . .

(Schiller)

9.1. Zertifizieren einer Macro-Anwendung


Wer kennt das nicht. Beim Öffnen einer Office-Datei meldet sich Access, Excel oder Word Form
mit einer Sicherheitswarnung.

Abbildung 9.1.: Microsoft Access: Sicherheitswarnung

Wie deaktiviere ich diese Meldung, bzw. ist das dann überhaupt noch sicher?
Es gibt zwei Möglichkeiten. Die Macro-Sicherheitsabfrage zu deaktivieren:

9.1.1. Sicherheitsstufe auf "Niedrig" setzen.


Im Menu Extras . Makro . Sicherheit stellen Sie die Einstellung wie in Bild 9.3 auf dieser
Seite auf niedrig.
Das bewirkt, das allen Macros vertraut
wird, was hierbei auch der größte Nachteil
ist. Unsicherer Code kann nun frei schal-
ten und walten. Ich würde von dieser Mög-
lichkeit abraten und lieber die zweite, wenn
auch kompliziertere Variante benutzen.
Siehe dazu http://www.donkarl.com/FAQ/
FAQ2Allgemein.htm unter Punkt 2.28.

49

Abbildung 9.3.: Microsoft Office: Sicher-


heitseinstellungen
9. Microsoft Office Allgemein

Abbildung 9.2.: Microsoft Office: Einstellungen zur Macro-Sicherheit

9.1.2. Zertifikat erstellen

Die Sicherheitsstufe "Niedrig" wird von


Microsoft ausdrücklich "nicht empfohlen",
denn es könnte jemand böse Dinge
tun mit den o.a. unsicheren Ausdrücken.
Zudem hilft diese Einstellung nicht gegen
Sicherheitswarnungen, wenn eine Daten-
bank auf einem Kundenrechner installiert
wird, auf dem man die Stufe nicht niedriger
setzen kann oder darf. Für diesen Fall sind sog. Digitale Zertifikate gedacht. Die einfache
Variante ist ein selbst erstelltes Zertifikat.

Dafür gibt es in Office 2003 ein Tool, das


im Start-Menü unter Programme . Office .
Tools . Digitale Signatur für VBA-Projekte
(Bild 9.4 auf dieser Seite) erreichbaer ist1 .
Ein selbst erstelltes Zertifikat gilt aber wie-
der nur auf dem eigenen Rechner. Andere
Formen von Zertifikaten kann man von offi-
ziellen Zertifizierungsfirmen kaufen. Es gibt
Abbildung 9.4.: Microsoft Office: Digitale sog. Class 3 Zertifikate für größere Firmen
Signatur für VBA-Projekte oder Organisationen und Class 2 Zertifikate
für Einzelpersonen. Letztere sind allerdings
noch kaum erhältlich und es gibt damit nur
wenig Erfahrung (wie mit dem ganzen Zertifizieren).

1
oder das Programm SELFCERT.EXE im Office-Ordner direkt starten.

50
9.1. Zertifizieren einer Macro-Anwendung

Im einzelnen: Zuerst wird ein neues Zertifikat erstellt und im System registriert.
• mit Microsoft Office . Microsoft Office Tools . Digital Certificate for VBA
Projects ein Zertifikat erstellen.
• Mit Windowstaste-R und certmgr.msc den Zertifikat-Manager starten und diese
Signatur unter Personal Certificates eintragen. Als trusted publishers . Local Com-
puter und Trusted root certification authorities . local computer, wobei jeweils local
computer nur in der erweiterten Ansicht zu erkennen ist. In der Normal-Ansicht reicht
es auch das Zertifikat unter der jeweiligen Wurzel wie in Bild 9.5 auf dieser Seite
einzutragen.
Danach wird dieses Zertifikat für die Office-
Datei angemeldet.
• Öffnen Sie die Datei, die das zu signie-
rende Macro-Projekt enthält.
• Selektieren sie den Punkt Macro im
Tools-Menu und starten Sie den Vi-
sual Basic Editor.
• Anschließend selektieren Sie im Pro-
ject Explorer des Visual Basic Edi-
tors, das Macro-Projekt, das Sie si-
gnieren wollen.
• Im Tools-Menu, klicken sie auf Digi-
Abbildung 9.5.: Zertifikat-Manager: Ein-
tal Signature.
stellungen für lokales Zertifikat
• Nun wählen Sie eine der folgenden
Optionen:

(a) Option Digitale Signatur. (b) Digitale Signatur auswählen.

Abbildung 9.6.: Visual Basic Editor: Project signieren.

◦ Wenn Sie vorher kein Digitales-


Zertifikat selektiert haben oder ein anderes benutzen wollen, dann klicken Sie
auf Choose, wählen danach ein Zertifikat aus und quittieren dann zweimal mit
Ok.

51
9. Microsoft Office Allgemein

◦ Um das bestehende Zertifikat zu


benutzen, wählen Sie einfach nur
OK.
Siehe auch die Hinweise unter http://office.microsoft.com/en-us/help/HP052495571033.
aspx.

52
10. Microsoft Access

10.1. Rezepte

10.1.1. Mausrad abfragen

53
10. Microsoft Access

54
Teil III.

Visual Studio

55
11. Updates für Visual Studio 2005

11.1. Hotfixes

11.1.1. Editor reagiert nicht mehr bei CDATA[] Tag

Betrifft:
Visual Studio 2005 Service Pack 1

Stellen Sie sich das folgende Szenario vor:


Sie aktivieren die XML-Dokumentation für ein Projekt in Microsoft Visual Studio 2005
und fügen einen

/// <![CDATA[
/// ]]>

Tag in einer XML-Dokumentation ein. Wenn Sie das <-Zeichen oder das >-Zeichen einge-
ben, reagiert der Visual Studio 2005 Editor nicht mehr.

Abhilfe: Um dieses Problem zu umgehen, verwenden Sie den XML code

&lt; statt <

und

&gt; statt <

im <![CDATA[]]> Tag.

Hotfix installieren: Besser ist natürlich ein Hotfix von Microsoft. Dieser ist unter http://code.msdn.micro
zu beziehen. Die Dokumentation erreichen sie unter http://support.microsoft.com/?scid=kb%3Ben-
us%3B940201&x=11&y=11.

Verdammt! Ich hatte die Installer Informationen für VS gelöscht um Platz zu sparen.
Kein Problem. Daten aus dem obigen Hotfix extrahieren:

VS80sp1-KB940201-X86-ENU.exe /extract

MsiX.exe VS80sp1-KB940201-X86-ENU.msp /ext

57
11. Updates für Visual Studio 2005

Dateiname: Cslangsvc.dll
Dateiversion: 8.0.50727.905
Dateigröße: 3,672,064
Datum: 12-Jul-2007
Uhrzeit: 01:11
Tabelle 11.1.: Neue Cslangsvc.dll

Im PCW_CAB_VS_10608.cab Archiv liegt dann eine Datei mit langem Namen und ohne
Erweiterung die auszupacken und umzubenennen ist. Da wir wissen das es sich um eine DLL
handelt geben wir ihr eine .dll Endung und klicken im Explorer recht auf Properties. Unter
Version steht dort cslangsvc.dll (11.1) in die wir sie auch umbenennen. Eine Dateisuche
unter dem Anwendungsverzeichnis von Visual Studio ergibt, das sich die Originaldatei
unter
C:\Programme\Microsoft Visual Studio 8\VC#\VCSPackages
befindet. Nun noch eine Sicherungskopie der Originaldatei erstellen und die neue aus dem
Hotfix in das Verzeichnis VCSPackages kopieren. Nun sollte Visual Studio einwandfrei mit
<![CDATA[]]> Tags umgehen können.

58
12. Updates für Visual Studio 2008

59
12. Updates für Visual Studio 2008

60
13. Erweiterungen
Die Visual Studio Gallery stellt Produkte und Erweiterungen für verschiedene Versionen
von MSVS bereit. Mit den Einstellungen:
• Visual Studio 2005
• Freie Software
• Tools
ist sie codeplex zu erreichen. Auch im Visual Studio Extensibility Developer Center sind
nützliche Erweiterungen und Ressourcen zu finden.

13.1. Source Server - Reference Source Code


Reference Source Code Server für Visual Studio 2005 aufsetzen. In Visual Studio 2008
funktioniert das automatisch.

13.1.1. Installation
Debugging tools -> http://www.microsoft.com/whdc/devtools/debugging/default.mspx
For VS2005 srcsrv.dll & symsrv.dll must be copied from Debugging tools folder to "Visual-
StudioRoot\Common7\IDE folder". Also, .Net Framework 2.0 SP1/SP2 must be installed.
———–

Tool .NET Mass Downloader -> http://www.codeplex.com/NetMassDownloader +


http://www.codeproject.com/KB/dotnet/netmassdownloader.aspx?msg=2591950
If none of the files can be downloaded please download and install the RTM Version of the
.NET Framework 3.5 SP1. Nearly all the problems people have with NetMassDownloader
is that they do not have the appropriate version of the .NET Framework on your machine.
Microsoft only supports the .NET Framework 3.5 and 3.5 SP1 for the .NET Reference
Source. Even if you are only using Visual Studio 2005, you must install the .NET Framework
3.5/3.5 SP1.
http://www.microsoft.com/downloads/details.aspx?FamilyId=AB99342F-5D1A-413D-8319-
81DA479AB0D7&displaylang=en
According to the Shawn Burke’s blog the following DLLs are enabled for the .NET Re-
ference Source Code: Mscorlib.DLL System.DLL System.Data.DLL System.Drawing.DLL
System.Web.DLL System.Web.Extensions.DLL System.Windows.Forms.DLL System.XML.DLL
WPF (UIAutomation.DLL, System.Windows.DLL, System.Printing.DLL, System.Speech.DLL,
WindowsBase.DLL, WindowsFormsIntegration.DLL, Presentation.DLL Microsoft.VisualBasic.DLL

61
13. Erweiterungen

batch datei: C:\Program Files\NetMassDownloader


netmassdownloader.exe -d C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 -output
C:\tmp\RefSym -v
————

13.1.2. VS2005 Setup For NetMassDownloader

Initially, we went down the path of seeing if we could patch the PDB files so Visual
Studio 2005 users could have access to the .NET Reference Source Code. After a lot of
hassle, we realized that there was a much easier way. If you specify the –output switch,
we will put the PDB and the source code into that directory using the build paths ins-
tead of the source server paths. Thus, if your command line to NetMassDownloader.exe is
–d C:\Windows\Microsoft.NET\Framework\v2.0.50727 –output c:\ReferenceSource, the
PDB files are put in C:\ReferenceSource as well as the source files.
To use the .NET Reference Source with Visual Studio 2005, you would need to do the
following three additional steps. The first is in the Options dialog for Visual Studio, De-
bugging, Symbols property page. In the "Symbol file (.pdb) locations" list box, you would
add "c:\ReferenceSource" like the following.
The second setting is in Options dialog, Debugging, General property page, uncheck Re-
quire source files to exactly match the original version.
The final step you’ll have to do in each solution where you want to access the downloaded
.NET Reference Source Code, you’ll go into the solution property pages, Common Proper-
ties, Debugging Source Files, and add C:\ReferenceSources to the top of the "Directories
containing source code" list box as follows:

13.1.2.1. Forum Hinweis

von http://code.google.com/p/scoutplugin/issues/detail?id=4
Did you configure the paths? Go Tools->Options->Debugging->Symbols and add http://referencesourc
as .pdb location. If you already have something here (for example, http://msdl.microsoft.com/download
then set referencesource as first in the list.
Another way is go ReSharper->Options->Scout and set source server here.
Note that MS .Net Framework 3.5 or 3.5 SP1 must be installed on your system. MS .Net
Framework 2.0 which comes with VisualStudio 2005 is not compatible with MS reference
source server.
If nothing helps, please build the plugin from the source in DEBUG configuration and watch
for debug output. DebugView from SysInternals is helpful for such purpose: http://technet.microsoft.com
us/sysinternals/bb896647.aspx
Geht bei mir mit den Einstellungen. Bis auf das man manchmal doppelt auf die Referenzen
klicken muss.

62
13.1. Source Server - Reference Source Code

Der Befehl \newcommand wird zur Definition neuer


Befehle verwendet.Sei \neu die Bezeichnung des
neuen Befehls. Der Inhalt sei die Ausgabe des Textes
Dies ist ein neuer Befehl. So lautet die Anweisung:
\newcommand\neu{Dies ist ein neuer Befehl}.Wird
anschließend der Befehl \neu eingesetzt, bewirkt er als
Ausgabe die Zeile Dies ist ein neuer Befehl.

Hmzwiwiwiwiwwiw.

Note Warning

And another note Remember

63
13. Erweiterungen

Haha

NOTE
This is a simple holded note. Called „note_l“. Let’s see what
it does.

Info
Der Befehl \newcommand wird zur Definition neuer Befehle verwendet.Sei \neu
die Bezeichnung des neuen Befehls. Der Inhalt sei die Ausgabe des Textes Dies ist
ein neuer Befehl. So lautet die Anweisung: \newcommand\neu{Dies ist ein neuer
Befehl}.Wird anschließend der Befehl \neu eingesetzt, bewirkt er als Ausgabe die
Zeile Dies ist ein neuer Befehl.

Hmm mal testen


adad
sdfsf
Hmmm

13.2. Power Toys for Visual Studio


The Pack Installer (Bild 13.1 auf dieser Sei-
te) is a tool that will let you see the latest
Power Toys for Visual Studio, and other
great developer oriented tools. It allows you
to easily mark any tool or set of tools for
download and installation, and streamline
the installation process.
Zu finden unter auf Codeplex. Für Visual
Studio 2008 gibt es die „PowerCommands
for Visual Studio 2008“ hier.
Wichtige Funktionen sind u.a.:

64
13.3. Cool Commands

• VS Command Shell
VSCmdShell provides users with a
shell window inside the Visual Studio
IDE that can be used for Visual Stu-
dio commands as well. Current versi-
on allows user to use either Windows
Command Shell (cmd.exe) or Win-
dows PowerShell.
• Resource Refactoring Tool
Resource Refactoring Tool provides
developers an easy way to extract
hard coded strings from the code to
resourcefiles.
◦ Works with C#, VB.Net languages. Supports all project types that ships with
Visual Studio 2005 including web sites and web application projects.
◦ A preview window to show changes.
◦ Finds other instances of the text being replaced in the project automatically.
◦ Lists existing resources by their similarity level to the text being replaced.
◦ Automatically replaces hard coded string with a reference to resource entry.

• Microsoft ASP.NET 2.0 AJAX Extensions


ASP.NET AJAX integrates client script libraries with the ASP.NET 2.0 server-based
development framework. This new Web development technology extends ASP.NET,
offering the interactive user interface benefits of AJAX with a programming model
that is more familiar to ASP.NET developers, making it very easy to add AJAX to
your applications quickly and with minimal effort. However, ASP.NET AJAX isn’t
just for ASP.NET development. You can take advantage of the rich client framework
to easily build client-centric Web applications that integrate with any backend data
provider.
• VSSDK Visual C++ Snippets
The Visual C++ Code Snippets tool lets you insert snippets in your code by using
a pop-up menu that contains programming keywords. VB.NET and C# languages
have this functionality in Visual Studio 2005.

13.3. Cool Commands

65
13. Erweiterungen

66
14. MSBuild

14.1. Erweiterungen

14.1.1. MSBuild Extension Pack


Der MSBuild Extension Pack ist unter http://www.codeplex.com/MSBuildExtensionPack
verfügbar.

14.1.2. MSBuild Community Tasks Projekt


Die Projektseite der MSBuild Community Tasks ist unter http://msbuildtasks.tigris.
org/ zu erreichen.

14.2. Editor

14.2.1. Microsoft Build Sidekick


Für MSBuild gibt es einen sehr guten Editor, Microsoft Build Sidekick unter http://www.
attrice.info/msbuild/index.htm.
Um mit Visual Studio 2005 die lokalen MSDN-Hilfsdateien zu nutzen, geben sie unter
Tools . Options unter dem Reiter „Application Configuration“ MS.MSDNQTR.v80.en/MS.
MSDN.v80/MS.NETDEVFX.v20.en in die Einstellung für Local MSDN Collection ein und
wählen als Source Lokal an.

67
14. MSBuild

68
15. Eigenes

15.1. CodeXS Custom-Tool


Optionen:
<?xml version="1.0" encoding="UTF-8"?>
<?codegen DoinstantiateProperties="true"
DataSetPropertiesNumericExceptionless="false"
XmlEnumExpand="true" /?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
...

15.2. SHFBRelContent

69
15. Eigenes

70
16. Microsoft SQL Server 2008

71
16. Microsoft SQL Server 2008

72
Teil IV.

Eclipse

73
Nicht vergessen C:\Documents and Settings\root\Application Data\Microsoft\Internet
Explorer\Quick Launch\Docs\Eclipse-3.5.txt einzubinden.

75
16. Microsoft SQL Server 2008

76
17. Wo finde ich Was

17.1. Grundeinstellungen

17.1.1. Author-Namen ändern


some time you need to change the author name of the files you create by eclipse rather
than the system user name.
to do so:
1. Mit einem Commandline switch
• open eclipse.ini file in the eclipse directory.
• add the following line after -vmargs line
-Duser.name=your name
• Gilt für alle Templates aber ein Neustart ist erforderlich.
2. Per Editor Preferences
• Window -> Preferences -> Java -> Code Style -> Code Templates -> Comments
• Im Files-Template Author: ${user} überschreiben.
References: 1. http://dev.eclipse.org/newslists/news.eclipse.newcomer/msg07148.
html 2. http://www.java-forum.org/ides-und-tools/29022-eclipse-author-standard-aendern.
html

17.2. Java

17.2.1. Ant-Build Scripts exportieren


1. Auf eine Package mit Rechtsklick -> Export

Inhalt
Java . . . . . . . . . . . . . . . . . . . . . . . . 77
Ant-Build Scripts exportieren . . . . . . . . . 77
Grundeinstellungen . . . . . . . . . . . . . . 77
Author-Namen ändern . . . . . . . . . . . . . 77

77
17. Wo finde ich Was

2. Im Export-Fenster Java -> Runnable JAR File auswählen.


3. Extract required libraries into generated JAR, damit die dependencies für z.B. SWIG
stimmen.
4. <!wegen den relativen Pfadangaben muss ich noch schauen!>

78
18. Updates und Patches

18.1. Hotfixes

18.1.1. Bla

79
18. Updates und Patches

80
19. Erweiterungen

19.1. Oxygen-XML Editor

19.1.1. Installation

19.1.2. Wissenswertes

81
19. Erweiterungen

82
Teil V.

Programmieren

83
20. C und C++

Überwiegend C++, C kennzeichnen.

20.1. Sprachreferenz

20.2. Rezepte

20.2.1. Mausrad abfragen

Minimale DLL Version keine


Header Deklariert in Winuser.h, include Windows.h
Minimum Betriebssystem Windows 98, Windows NT 4.0
WM_MOUSEWHEEL

WPARAM wParam
LPARAM lParam;

fwKeys = GET_KEYSTATE_WPARAM(wParam);
zDelta = GET_WHEEL_DELTA_WPARAM(wParam);

xPos = GET_X_LPARAM(lParam);
yPos = GET_Y_LPARAM(lParam);

MSH_MOUSEWHEEL
zDelta = (int) wParam; // wheel rotation
xPos = LOWORD(lParam); // horizontal position of pointer
yPos = HIWORD(lParam); // vertical position of pointer

85
20. C und C++

WM_MOUSEWHEEL = &H20A
MK_CONTROL = &H8
MK_LBUTTON = &H1
MK_MBUTTON = &H10
MK_RBUTTON = &H2
MK_SHIFT = &H4
MK_XBUTTON1 = &H20
MK_XBUTTON2 = &H40

[1]

20.3. Libraries

Wenn Sie Bibliotheken, die mit verschiedenen Versionen


des Microsoft Visual C++ Compilers übersetzt wur-
den kombinieren, dann kann das zu unvorhergesehenen
Runtime-Fehlern führen.
• QT4.7.1 Bibliothek mit MSVC 8.0 erstellt ( Visual
Studio 2005 )
• Project in MSVC 9.0 ( Visual Studio 2008 ):
#include <QTCore>
int main(int argc, char** argv) {
QTextStream out(stdout, QIODevice::
WriteOnly);
return 0;
}

Unhandled exception at 0x77b08c19 in


console.exe:
0xC0000005: Access violation writing
location 0x00000014.
In diesem Fall kann stdout nicht richtig aufgelöst
werden und somit kommt es zu einem Runtime Error
der schwer nachvollziehbar ist. Also seien Sie vorsich-
tig und prüfen im Zweifelsfall mit depends.exe die
Laufzeit-Abhängigkeiten.

86
20.3. Libraries

20.3.1. Boost
20.3.1.1. Übersicht

String-und Textverarbeitung
Conversion: Polymorphe und lexikalische casts.
Format: Die Format-Bibliothek stellt eine Klasse für die Formatierung von Argumenten
nach einem Format-String, ebenso wie printf, aber mit zwei wesentlichen Unterschie-
den zur Verfügung: Format sendet die Argumente in einen internen Stream, und ist
so völlig typsicher und unterstützt natürlich alle Benutzer-Typen. Die Ellipse (...)
lässt sich in diesem stark typisierten Kontext nicht benutzen, deshalb wird sie ersetzt
durch aufeinanderfolgende Aufrufe an einem Feeding-Operator (operator%).
Iostreams: Boost.IOStreams bietet einen Rahmen für die Definition von Streams, Stream-
Puffern und I / O-Filtern.
Lexical Cast: Generelle literale Text-Konvertierungen, wie ein int repräsentiert von einem
string, oder umgekehrt, von Kevlin Henney.
Regex: Bibliothek zur Bearbeitung von Regulären Ausdrücken.
Spirit: LL-Parser Framework das EBNF-Grammatiken direkt in inline C++ darstellt.
String Algo: String Algorithmen Bibliothek.
Tokenizer: Verarbeitung eines Strings oder anderer Zeichenfolgen in eine Reihe von To-
kens.
Wave: Die Bibliothek ist Boost.Wave Standards konform, und hoch konfigurierbar durch
die vorgeschriebenen C99 / C + + Präprozessor Funktionalität Schnittstelle verpackt,
hinter einem einfachen Iterator zu verwenden.
Xpressive: Reguläre Ausdrücke, die als Expression geschrieben werden können, als Strings
oder Vorlagen, die sich auf andere beziehen können und sich auf jede und selbst
rekursiv mit der Macht kontextfreier Grammatiken.

Container
Array: STL konformen Container-Wrapper für Arrays konstanter Größe.
Bimap: Bidirektionale Map-Bibliothek für C++. Mit Boost.Bimap erzeugen Sie assozia-
tive Container, in denen beide Arten als Schlüssel verwendet werden können.
Circular Buffer: Ein STL konformer Container auch bekannt als Ringpuffer oder zykli-
scher Puffer.
Disjoint Sets: Disjunkte Mengen. Boost.DisjointSets bietet disjunkte Operationen mit
Vereinigung nach dem Rang und Pfad-Kompression.
Dynamic Bitset: Dynamische Bitset. Die dynamic_bitset Klasse stellt einen Satz von
Bits. Sie bietet Zugriff auf den Wert der einzelnen Bits über einen Operator [] und
stellt alle bitweisen Operatoren die auf builtin Integer angewendet werden können,
wie der operator& und operator<<. Die Anzahl der Bits im Bitset wird zur Laufzeit
über einen Konstruktor-Parameter festgelegt.

87
20. C und C++

GIL: Generic Image Library.


Graph: Die Grafik BGL-Schnittstelle und Grafik-Komponenten sind generisch, im gleichen
Sinne wie die der Standard Template Library (STL).
Intrusive: Intrusive Container und Algorithmen.
* Multi-Array : Boost.MultiArray provides a generic N-dimensional array concept defini-
tion and common implementations of that interface. Multi-Array : Boost.MultiArray
bietet eine generische N-dimensionales Array Konzept Definition und gemeinsame
Implementierungen dieser Schnittstelle.
* Multi-Index : The Boost Multi-index Containers Library provides a class template named
multi_index_container which enables the construction of containers maintaining one
or more indices with different sorting and access semantics. Multi-Index : Der Boost
Multi-Index Container-Bibliothek stellt eine Klasse Vorlage mit dem Namen mul-
ti_index_container die Semantik ermöglicht den Bau von Containern die Führung
eines oder mehrerer Indices mit unterschiedlichen Sortier-und zugreifen.
* Pointer Container : Containers for storing heap-allocated polymorphic objects to ease
OO-programming. Pointer-Container : Container für die Lagerung Heap-Programmierung
zugewiesen polymorphe Objekte zu erleichtern OO.
* Property Map : Concepts defining interfaces which map key objects to value objects.
Übersichtskarte : Konzepte die Definition von Schnittstellen, welche Objekte Karte
Schlüssel zur Wert-Objekte.
* Property Tree : A tree data structure especially suited to storing configuration data.
Immobilien Baum : Ein Baum Datenstruktur besonders geeignet, um Daten Speichern
von Konfigurationsdaten.
* Unordered : Unordered associative containers. Ungeordnete : Ungeordnete assoziative
Container.
* Variant : Safe, generic, stack-based discriminated union container. Variante : Sicher,
generische Stack-basierten diskriminiert Gewerkschaft Container.

20.3.1.2. Installation

Links:
• Getting started guide:
http://boost.org/more/getting_started/windows.html
• Boost.Build documentation:
http://www.boost.org/boost-build2/doc/html/index.html
• Build unter Windows
http://www.boost.org/doc/libs/1_42_0/more/getting_started/windows.html#
or-simplified-build-from-source.
• Using Third-Party Build Tools
http://www.informit.com/articles/article.aspx?p=1405563&seqNum=3

88
20.3. Libraries

• Build Boost on WINCE


http://www.informit.com/articles/article.aspx?p=1405563&seqNum=3

Download: Die Boost Library Downloadseite unter http://www.boost.org/users/download/.


Direkt den SVN-Trunk mit

svn co http://svn.boost.org/svn/boost/trunk boost-trunk

oder eine spezifische Version aus dem http://svn.boost.org/svn/boost/tags/release/


Verzeichnis mit

svn co http://svn.boost.org/svn/boost/tags/release/Boost_1_45_0_beta1 \
boost_1_45_0_beta1

Abhängigkeiten:
• Boost und mpi
http://www.mcs.anl.gov/research/projects/mpich2/downloads/index.php?s=
downloads
http://www.mcs.anl.gov/research/projects/mpich2/downloads/tarballs/1.2.
1rc1/
Beim Benutzen von MPICH2 ist folgendes in der tools\build\v2\user-config.jam
einzutragen:

using mpi : :
<find-static-library>mpi
<library-path>"C:/Program Files/MPICH2/lib"
<include>"C:/Program Files/MPICH2/include"
: "\"C:\\Program Files\\MPICH2\\bin\\mpiexec\"" ;

Für MPI muss ein User-Account mit Passwort konfiguriert werden und die Login-
Daten mit wmpiregister.exe eingerichtet werden. Ein Beispielaufruf eines MPI-
Programms wird dann folgendermaßen initiiert: "C:\Program␣Files\MPICH2\bin\
mpiexec.exe"␣-n␣3␣-noprompt␣"C:\Program␣Files\MPICH2\examples\cpi.exe".
Das Programm cpi.exe wird dann als MPI-Prozess mit 3 Childs unter dem eingerich-
teten User gestartet.
• Boost mit ICU ( Unicode support )
http://www.boost.org/doc/libs/1_37_0/libs/regex/doc/html/boost_regex/install.
html#boost_regex.install.building_with_unicode_and_icu_support
http://www-01.ibm.com/software/globalization/icu/
Mit der bjam Konfigurationsoption -sHAVE_ICU=1 wird der Unicode Support einge-
stellt.

89
20. C und C++

Command line help:


.\bjam --help

Build:
• Alles:
cd D:\boost\boost_1_42_0
bjam --build-dir=../build_1_42_0 toolset=msvc --build-
type=complete stage
• Nur die threaded debug statischen Bibliotheken:
bjam --build-dir=../build_1_42_0 toolset=msvc \
--variant=debug --link=static --threading=multi \
--build-type=minimal stage
• Mit externem build-dir und nur die filesystem library als release
bjam --build-type=complete \
--build-dir="D:\boost\build_1_45_0_beta1" \
--with-filesystem release
• Programmbeispiel mit externem build-dir als release
cd D:\boost\Boost_1_45_0_beta1\libs\graph_parallel\example>
bjam --build-type=complete \
--build-dir="D:\boost\build_1_45_0_beta1" release
• Test mit externem build-dir als release, dynamisch gelinkt
cd D:\boost\Boost_1_45_0_beta1\libs\mpi\test
bjam --runtime-link=dynamic \
--build-dir="D:\boost\build_1_45_0_beta1" \
release
• Dokumentation
cd D:\boost\Boost_1_45_0_beta1\libs\mpi\doc
bjam --build-dir="D:\boost\build_1_45_0_beta1" pdf
Für die Benutzung von Apache-FOP ist folgendes in der tools\build\v2\user-
config.jam einzutragen:
# -----------------
# DOC configuration.
# -----------------
# BoostBook configuration
using boostbook
: C:/docbook/xsl1
1
DocBook sourceforge site

90
20.3. Libraries

Format Description
html HTML output (multiple files). This is the default
onehtml HTML output in a single HTML file.
man Unix man pages.
pdf PDF. Requires Apache FOP.
ps Postscript. Requires Apache FOP.
docbook DocBook.
fo XSL Formatting Objects.
Tabelle 20.1.: BoostBook Ausgabe Formate

: C:/docbook/dtd2
;

Die relative Reihenfolge der Deklarationen in


den User-config.jam / site-config.jam Dateien ist
wichtig. Insbesondere sollte die doxygen Zeile nach
der Angabe der boostbook Deklaration erfolgen.

using doxygen ;
using xsltproc ;
# Apache fop configuration
3
using fop : "C:/docbook/fop-0.20.5/fop.bat"
: "C:/Program Files/Java/jre6"
;

Die Programme doxygen und xsltproc müssen hierbei im Systempfad liegen, können
aber mit

using doxygen : DOXYGEN ;

auch direkt angegeben werden, wobei DOXYGEN mit dem wirklichen Pfad zur An-
wendung ersetzt werden muss.
doxygen ist unter der Adresse http://www.doxygen.org verfügbar und xsltproc von
verschiedenen Quellen:
◦ Windows mit Cygwin: die libxml2 and libxslt packages.
2
OASIS DocBook site
3
FOP downloads unter archive.apache.org. Version 0.20.5 verwenden.

91
20. C und C++

◦ Windows ohne Cygwin: Download der binary packages von Igor Zlatkovic. Sie
brauchen außerdem iconv, zlib, libxml2 and libxslt.
◦ Beliebiges System: libxslt source.
Die korrekte Erzeugung von Bildern in PDF-Dateien besorgt die Jimi Image Biblio-
thek. Damit FOP Jimi verwendet, entpacken Sie die Datei JimiProClasses.zip aus
dem Jimi SDK und benennen Sie sie, wenn sie auf Windows arbeiten, in Jimi-1.
0.jar, oder wenn Sie ein *nix System besitzen in JimiProClasses.jar um. Nun
speichern sie das Ergebnis in das lib/ Unterverzeichnis Ihrer FOP-Installation .
Weitere Infos finden sie in der BoostBook - Getting Started Hilfe online.

20.3.1.3. Module

Boost.Python: http://www.boost.org/doc/libs/1_42_0/libs/python/doc/tutorial/
doc/html/python/embedding.html.

20.3.2. neon
Siehe http://www.webdav.org/neon/.

20.3.3. apr
apr
apr-iconv
apr-util
Download http://ftp.halifax.rwth-aachen.de/apache/apr/.

20.4. Standard Template Library

20.4.1. Streams
20.4.1.1. std::stringstream

Aus dem Thread Wie funktioniert ein stringstream? http://www.c-plusplus.de/forum/


viewtopic-var-t-is-227639.html der C++ Community:
#include <sstream>
#include <iostream>

int main()
{
std::stringstream ss;
ss << "12" << endl << "Bla";

92
20.5. Tutorien

double a;

std::cout << ss.str() << std::endl;


//ss >> a;
std::cout << "Im Stream ist: " << a << std::endl;
ss << "12 mal 2 ist " << 12 * 2 << std::endl;

std::cout << ss.str() << std::endl;


}

20.5. Tutorien
How to begin writing games in C++: Siehe Abschnitt 58.1.2.

20.5.1. Introduction to Classes


Link
C++ offers three techniques of defining a new data type: a structure, a class, and a union.
These are also referred to as composite data types. Learn: Object Creation and Access,
Global Objects, Access to a Member of a Class, Type-Defining a Class, Class Forward
Definition, The Access Levels of a Class, Initializing Each Member of a Class, Initializing
an Object as a Whole, Static Member Variables, Techniques of Creating a Classic C Styles
Object, References, Constant Objects and more.

20.5.2. Constructors and Destructors in C++


Link
Learn about the subtleties of constructors and destructors in C++. The process of creating
and deleting objects in C++ is not a trivial task. Every time an instance of a class is created
the constructor method is called.

20.5.3. Creating a collection class in C++


Link
How to use a template to create a custom collection class and using the C++ std::vector
STL library as well as the operator. I will expect you to understand how pointers, classes,
templates and the operator works

93
20. C und C++

94
21. C++/CLI
Siehe http://de.wikipedia.org/wiki/C%2B%2B/CLI.
Visual C++ Template

21.1. Sprachreferenz
http://msdn.microsoft.com/en-us/library/xey702bw.aspx

21.1.1. ^ (Handle to Object on Managed Heap)

http://msdn.microsoft.com/en-us/library/yk97tc08.aspx oder Pro Visual C++/CLI


and the .NET 3.5 Platform S. 46.

Der Objektzeiger Die augenfälligste Neuerung ist die Syntax ^ für die Objektzeiger
(manchmal auch Handles oder Tracking Handles genannt). Beispiel:
T^ whole_object_pointer = gcnew T(a, b);

Dabei ist gcnew ein Operator zum Allozieren von Objekten, die von der automatischen
Speicherbereinigung verwaltet werden.
Im Vergleich dazu die herkömmliche Syntax für Zeiger:
T* plain_old_pointer = new T(a, b);

Trennung von Deinitialisierung und Speicherfreigabe: Anders als bei gewöhnlichen


Zeigern wird beim Löschen von Objektzeigern (Handles) mittels delete zwar der Destruktor
aufgerufen, nicht aber der Speicher freigegeben. Statt dessen wird der vom Objekt belegte
Speicher durch die automatische Speicherbereinigung an das System zurückgegeben.
Im Unterschied zu anderen Sprachen mit automatischer Speicherbereinigung (z. B. C# oder
Java) wird hier also die problematische Zusammenfassung der Verwaltung von Speicher
und anderen Ressourcen voneinander getrennt: Speicher und andere Ressourcen werden
nicht mehr zusammen mit Hilfe der Speicherbereinigung freigegeben ("deterministische
Deinitialisierung"; siehe Finalisierung).

95
21. C++/CLI

Als automatische Variablen anlegbare CLI-Objekte: Eine weitere technische Neuerung


und einer der wichtigsten Unterschiede zu anderen Sprachen mit automatischer Speicher-
bereinigung sind die als automatische Variablen (d.h. "auf dem Stack") anlegbaren CLI-
Objekte. Die Lebensdauer von automatischen Variablen endet in dem Augenblick, in wel-
chem sie ihren Gültigkeitsbereich verlassen.
Im Zusammenspiel mit den neuartigen Objektzeigern (Handles) bleiben in C++ dadurch
häufig angewandte Programmiertechniken wie RAII (Abkürzung für engl. resource acqui-
sition is initialization) auch für die mit der automatischen Speicherbereinigung verwalteten
CLI-Objekte möglich. Fehleranfällige Kodier-Techniken, wie sie aus anderen Programmier-
sprachen bekannt sind, lassen sich damit vermeiden.
Dazu ein Beispiel in C++/CLI:
void Uebertragung()
{
MessageQueue source("server\\sourceQueue");
String^ mqname = safe_cast<String^>(source.Receive().Body);

MessageQueue dest1("server\\" + mqname), dest2("backup\\" + mqname);


Message^ message = source.Receive();
dest1.Send( message );
dest2.Send( message );
}

Beim Verlassen der Funktion Übertragung (mit return oder beim Auftreten
einer Ausnahme) rufen Objekte implizit ihre Funktion Dispose auf, und zwar in
der umgekehrten Reihenfolge in der sie konstruiert wurden. Im obigen Beispiel
also dest2, dest1 und dann source.

Wenn ein automatisches Objekt seinen Gültigkeitsbereich verlässt, oder beim Löschen mit
delete, wird sein Destruktor aufgerufen. Der Compiler unterdrückt dann den Aufruf der
normalerweise von der automatischen Speicherwaltung angestoßenen Finalisierungsfunkti-
on.
Der Wegfall von Finalisierungsfunktionen kann sich insgesamt positiv auf die Ausführungs-
geschwindigkeit auswirken, hilft aber noch andere Probleme zu vermeiden; zu Problemen
bei Verwendung der Finalisierungsfunktion: siehe Finalisierung.
Im Unterschied zu C++/CLI muss beispielsweise in Java zur Ressourcenfreigabe eine
Dispose-Funktion immer explizit aufgerufen werden. In C# gibt es so genannte Using-
Blöcke, an deren Ende Deinitialisierungen vorgenommen werden. Die Using-Blöcke sind
zwar eine Verbesserung gegenüber dem Dispose-Verfahren von Java, müssen aber immer
mitangegeben werden, daher sind sie der deterministischen Deinitialisierung von C++/CLI
ebenfalls unterlegen.
http://de.wikipedia.org/wiki/C%2B%2B/CLI.
Visual C++ Template

96
21.1. Sprachreferenz

21.1.2. % (Tracking Reference)

http://msdn.microsoft.com/en-us/library/8903062a.aspx
Oder [2, S. 233].
Um einen Methodenparameter in C++/CLI so zu markieren, dass er in anderen .NET-
Sprachen, z.B. C#, als “out” oder “ref” gekenzeichnet wird müssen Sie eine Tracking
Reference verwenden. Um einen klassischen ‘call by reference’-Fall zu erreichen, also einen
Parameter, der sowohl Eingabe, als auch Ausgabewert sein kann, muss man ihn speziell
markieren.
Am Beispiel String^:
public ref class Foo {
public:
// c#: void Bar( ref String woo )
void Bar( String^% woo );
}

Die entsprechende Signatur in C# wäre dann void Bar( ref String woo ).
Möchte man nun einen Parameter explizit als “out”, also ausschließlich zur Ausgabe, mar-
kieren, benötigt man zusätzlich das Attribut [Out] - dieses befindet sich allerdings freund-
licherweise im Namespace

System::Runtime::InteropServices

vergraben.
Also
using namespace System::Runtime::InteropServices;

public ref class Foo {


public:
// c#: void Bar( out String woo )
void Bar( [Out] String^% woo );
}

Und alles ist, wie es sein soll. Falls man dennoch eine Fehlermeldung wie (C3763)

’retval’ and ’out’ can only appear on a data-pointer type

erhält, hat man “Out” ganz simpel - und falsch - in Kleinbuchstaben (“out”) geschrieben.

21.1.3. Properties

C++/CLI Properties - Syntactic sugar for accessor methods http://www.codeproject.


com/KB/mcpp/CppCliProperties.aspx.

97
21. C++/CLI

21.2. Interfacing mit C#

21.2.1. Marshaling
21.2.1.1. Overview of Marshaling in C++

In mixed mode, you sometimes must marshal your data between native and managed types.
Visual Studio 2008 introduced the marshaling library to help you marshal and convert data
in a simple way.
You can use the marshaling library with or without a marshal_context Class. Some con-
versions require a context. Other conversions can be implemented using the marshal_as
function. The following table lists the current conversions supported, whether they require
a context, and what marshal file you have to include:

From type To type Marshal method Include file


System::String^ const char * marshal_context marshal.h
const char * System::String^ marshal_as marshal.h
char * System::String^ marshal_as marshal.h
System::String^ const wchar_t* marshal_context marshal.h
const wchar_t * System::String^ marshal_as marshal.h
wchar_t * System::String^ marshal_as marshal.h
System::IntPtr HANDLE marshal_as marshal_windows.h
HANDLE System::IntPtr marshal_as marshal_windows.h
System::String^ BSTR marshal_context marshal_windows.h
BSTR System::String^ marshal_as marshal.h
System::String^ bstr_t marshal_as marshal_windows.h
bstr_t System::String^ marshal_as marshal_windows.h
System::String^ std::string marshal_as marshal_cppstd.h
std::string System::String^ marshal_as marshal_cppstd.h
System::String^ std::wstring marshal_as marshal_cppstd.h
std::wstring System::String^ marshal_as marshal_cppstd.h
System::String^ CStringT<char> marshal_as marshal_atl.h
CStringT<char> System::String^ marshal_as marshal_atl.h
System::String^ CStringT<wchar_t> marshal_as marshal_atl.h
CStringT<wchar_t> System::String^ marshal_as marshal_atl.h
System::String^ CComBSTR marshal_as marshal_atl.h
CComBSTR System::String^ marshal_as marshal_atl.h

Marshaling requires a context only when you marshal from managed to native data types
and the native type you are converting to does not have a destructor for automatic clean up.
The marshaling context destroys the allocated native data type in its destructor. Therefore,
conversions that require a context will be valid only until the context is deleted. To save

98
21.3. Rezepte

any marshaled values, you must copy the values to your own variables.

Info
If you have embedded NULLs in your string, the result of marshaling the string
is not guaranteed. The embedded NULLs can cause the string to be truncated or
they might be preserved.

The marshaling library is extensible so that you can add your own marshaling types.
For more information about extending the marshaling library, see How to: Extend the
Marshaling Library.
In earlier versions, you could marshal data by using Platform Invoke. For more information
about PInvoke, see Calling Native Functions from Managed Code.

21.3. Rezepte

21.3.1. Passing Arguments by Reference


Von http://functionx.com/cppcli/functions/Lesson10b.htm. Siehe dazu auch die Ab-
schnitte 21.1.1 und 21.1.2.

21.3.1.1. Passing by Native Reference

When you declare a variable in a program, the compiler reserves an amount of space for
that variable. If you need to use that variable somewhere in your program, you call it and
make use of its value. There are two major issues related to a variable: its value and its
location in the memory. The location of a variable in memory is referred to as its address.
If you supply the argument using its name, as we have done so far, the compiler only makes
a copy of the argument’s value and gives it to the calling function. Although the calling
function receives the argument’s value and can use in any way, it cannot (permanently)
alter it. C++ allows a calling function to modify the value of a passed argument if you find
it necessary. If you want the calling function to modify the value of a supplied argument
and return the modified value, you should pass the argument using its reference.
To pass an argument as a reference, when declaring the function, precede the argument
name with an ampersand “&”. You can pass one or more arguments as reference in the
program or pass all arguments as reference. The decision as to which argument(s) should
be passed by value or by reference is based on whether or not you want the called function
to modify the argument and permanently change its value.
Here are examples of passing some arguments by reference:
void Area(double &Side); // The argument is passed by reference
bool Decision(char &Answer, int Age); // One argument is passed by reference
// All arguments are passed by reference
float Purchase(float &DiscountPrice, float &NewDiscount, char &Commission);

99
21. C++/CLI

Once again, the signature of the function is important when declaring the function. The
compiler would not care much about the name of an argument. Therefore, the above
functions can be declared as follows:
void Area(double &);
bool Decision(char &, int );
float Purchase(float &, float &, char &);

You add the ampersand when declaring a function and/or when defining it. When calling
the function, supply only the name of the referenced argument(s). The above would be
called with:
Area(Side);
Decision(Answer, Age);
Purchase(DiscountPrice, NewDiscount, Commission);

You will usually need to know what happens to the value passed to a calling function
because the rest of the program may depend on it.

21.3.1.2. Passing by Constant Reference

We have seen that passing an argument as a reference allows the compiler to retrieve the
real value of the argument at its location rather than sending a request for a value of the
variable. This speeds up the execution of the program. Also, when passing an argument
as a constant, the compiler will make sure that the value of the passed argument is not
modified.
If you pass an argument as reference, the compiler would access the argument from its
location. The called function can modify the value of the argument. The advantage is that
code execution is faster because the argument gives access to its address. The disadvantage
could be that if the calling function modifies the value of the argument, when the function
exits, the value of the argument would have (permanently) changed and the original value
would be lost (actually, this can be an advantage as we have learned). If you do not want the
value of the passed argument to be modified, you should pass the argument as a constant
reference. When doing this, the compiler would access the argument at its location (or
address) but it would make sure that the value of the argument stays intact.
To pass an argument as a constant reference, when declaring the function and when imple-
menting it, type the const keyword, followed by the argument data type, followed by the
ampersand operator "&", followed by a name for the argument. When declaring the func-
tion, the name of the argument is optional. Here is a function that receives an argument
as a constant reference:
double CalculateDiscount(const double &Original, double Rate)
{
return Original * Rate / 100;
}

You can mix arguments passed by value, those passed as reference, those passed by con-
stant, and those passed by constant references. You will decide, based on your intentions,
to apply whatever technique suits your scenario.

100
21.3. Rezepte

The following program illustrates the use of various techniques of passing arguments:

using namespace System;

double CalculateDiscount(const double &MarkedPrice, double = 20);


double PriceAfterDiscount(const double, const double);
double CalculateTaxAmount(const double &, double);
double CalculateNetPrice(const double &, const double &);
void DisplayResult(double, double, double, double, double);

void RequestOriginalPrice(double &Price)


{
Console::Write("Enter the original price: $");
Price = double::Parse(Console::ReadLine());
}

void RequestDiscountRate(double &Discount)


{
Console::Write("Enter discount rate(0.00 to 100.00): ");
Discount = double::Parse(Console::ReadLine());
}

void RequestTaxRate(double& Tax)


{
Console::Write("Enter the tax rate(0.00 to 100.00): ");
Tax = double::Parse(Console::ReadLine());
}

int main()
{
double OriginalPrice, DiscountRate, AfterDiscount, TaxRate;
double DiscountAmount, TaxAmount, NetPrice;

RequestOriginalPrice(OriginalPrice);
RequestDiscountRate(DiscountRate);
RequestTaxRate(TaxRate);

DiscountAmount = CalculateDiscount(OriginalPrice, DiscountRate);


AfterDiscount = PriceAfterDiscount(OriginalPrice, DiscountAmount);
TaxAmount = CalculateTaxAmount(AfterDiscount, TaxRate);
NetPrice = CalculateNetPrice(AfterDiscount, TaxAmount);

DisplayResult(OriginalPrice, DiscountAmount,
AfterDiscount, TaxAmount, NetPrice);

return 0;
}

double CalculateDiscount(const double &Original, double Rate)


{

101
21. C++/CLI

return Original * Rate / 100;


}

double PriceAfterDiscount(const double Original, const double Discount)


{
return Original - Discount;
}

double CalculateTaxAmount(const double &Discount, double Rate)


{
return Discount * Rate / 100;
}

double CalculateNetPrice(const double &Discount, const double &TaxAmt)


{
return Discount + TaxAmt;
}

void DisplayResult(const double OrigPrice, const double DiscAmt,


const double Discount, const double TaxAmt,
const double FinalPrice)
{
Console::WriteLine("\nReceipt");
Console::WriteLine("Original Price: {0:C}", OrigPrice);
Console::WriteLine("Discount Amount: {0:C}", DiscAmt);
Console::WriteLine("After Discount: {0:C}", Discount);
Console::WriteLine("Tax Amount: {0:C}", TaxAmt);
Console::WriteLine("Net Price: {0:C}", FinalPrice);
}

Here is an example of running the program:

Enter the original price: $885.95


Enter discount rate(0.00 to 100.00): 40
Enter the tax rate(0.00 to 100.00): 5.75
Receipt
Original Price: $885.95
Discount Amount: $354.38
After Discount: $531.57
Tax Amount: $30.57
Net Price: $562.14
Press any key to continue . . .

21.3.1.3. Passing by Tracking Reference

When programming in C++/CLI rather than C++, a tracking reference may be your most
regular choice if you want to pass an argument by reference. This is because, as we will learn
with classes, a managed object cannot directly use a C++ regular reference. Fortunately,

102
21.3. Rezepte

as done for a native reference, you can pass an argument using a tracking reference. To do
this, precede the name of the argument with the % operator.
Everything considered, you pass an argument by tracking reference exactly as you would
a native reference: the rules are the same. Here are example:
using namespace System;

void GetHourlySalary(double % salary)


{
Console::Write(L"Hourly Salary: ");
salary = double::Parse(Console::ReadLine());
}

void GetWeeklyHours(double %);


void CalculateWeeklySalary(double %, double, double);
void ShowPaycheck(double hourly, double hours, double weekly);

int main()
{
double HourlySalary, WeeklyHours, WeeklySalary;

Console::WriteLine(L"Payroll Preparation");
Console::WriteLine(L"Enter the following information");
GetHourlySalary(HourlySalary);
GetWeeklyHours(WeeklyHours);
CalculateWeeklySalary(WeeklySalary, HourlySalary, WeeklyHours);

Console::WriteLine();

ShowPaycheck(HourlySalary, WeeklyHours, WeeklySalary);


return 0;
}

void GetWeeklyHours(double % hours)


{
Console::Write(L"Weekly Hours: ");
hours = double::Parse(Console::ReadLine());
}

void CalculateWeeklySalary(double % weekly, double hourly, double hours)


{
weekly = hourly * hours;
}

void ShowPaycheck(double hourly, double hours, double weekly)


{
Console::WriteLine(L"Employee Paycheck");
Console::WriteLine(L"Hourly Salary: {0:C}", hourly);
Console::WriteLine(L"Weekly Hours: {0:F}", hours);
Console::WriteLine(L"Weekly Salary: {0:C}", weekly);

103
21. C++/CLI

This would produce:


Payroll Preparation
Enter the following information
Hourly Salary: 18.42
Weekly Hours: 42.50
Employee Paycheck
Hourly Salary: $18.42
Weekly Hours: 42.50
Weekly Salary: $782.85
Press any key to continue . . .
As mentioned for native references, when an argument is passed by tracking reference, the
argument is modified by the function. That is, when the function closes, the parameter
passed by tracking reference holds the value as it was changed in the function, if it was
changed.
Also, as mentioned for the native references, the ability to pass various parameters by
tracking references allows a single function to return more than one value. Here is an
example:
using namespace System;

void PreparePayroll(double %, double %);

void CalculateWeeklySalary(double %, double, double);


void ShowPaycheck(double hourly, double hours, double weekly);

int main()
{
double HourlySalary, WeeklyHours, WeeklySalary;

Console::WriteLine(L"Payroll Preparation");
Console::WriteLine(L"Enter the following information");
PreparePayroll(HourlySalary, WeeklyHours);
CalculateWeeklySalary(WeeklySalary, HourlySalary, WeeklyHours);

Console::WriteLine();

ShowPaycheck(HourlySalary, WeeklyHours, WeeklySalary);


return 0;
}

void PreparePayroll(double % salary, double % hours)


{
Console::Write(L"Hourly Salary: ");
salary = double::Parse(Console::ReadLine());

Console::Write(L"Weekly Hours: ");

104
21.3. Rezepte

hours = double::Parse(Console::ReadLine());
}

void CalculateWeeklySalary(double % weekly,


const double hourly,
const double hours)
{
weekly = hourly * hours;
}

void ShowPaycheck(double hourly, double hours, double weekly)


{
Console::WriteLine(L"Employee Paycheck");
Console::WriteLine(L"Hourly Salary: {0:C}", hourly);
Console::WriteLine(L"Weekly Hours: {0:F}", hours);
Console::WriteLine(L"Weekly Salary: {0:C}", weekly);
}

Just as done for a native reference, you can pass a tracking reference by constant. The
main rule is to remember, then, is that the called function cannot modify the value of the
argument. Here are examples:
using namespace System;

void PreparePayroll(double %, double %);

void CalculateWeeklySalary(double %, double, double);


void ShowPaycheck(const double %, const double %, const double %);

int main()
{
double HourlySalary, WeeklyHours, WeeklySalary;

Console::WriteLine(L"Payroll Preparation");
Console::WriteLine(L"Enter the following information");
PreparePayroll(HourlySalary, WeeklyHours);
CalculateWeeklySalary(WeeklySalary, HourlySalary, WeeklyHours);

Console::WriteLine();

ShowPaycheck(HourlySalary, WeeklyHours, WeeklySalary);


return 0;
}

void PreparePayroll(double % salary, double % hours)


{
Console::Write(L"Hourly Salary: ");
salary = double::Parse(Console::ReadLine());

Console::Write(L"Weekly Hours: ");

105
21. C++/CLI

hours = double::Parse(Console::ReadLine());
}

void CalculateWeeklySalary(double % weekly,


const double hourly, const double hours)
{
weekly = hourly * hours;
}

void ShowPaycheck(const double % hourly,


const double % hours,
const double % weekly)
{
Console::WriteLine(L"Employee Paycheck");
Console::WriteLine(L"Hourly Salary: {0:C}", hourly);
Console::WriteLine(L"Weekly Hours: {0:F}", hours);
Console::WriteLine(L"Weekly Salary: {0:C}", weekly);
}

21.3.2. next
Visual C++ Template

106
22. C#
Todo Links und zeusch zum bearbeiten :
http://dzaebel.net/Artikel.aspx hat ein paar sehr gute Artikel.
http://www.mycsharp.de/wbb2/thread.php?threadid=63263 Welches Buch über C# ist
empfehlenswert? (mittlere Vorkenntnisse) .
In diesem Kapitel wird Visual Studio 2008 benutzt. In vielen Fällen sind die beschriebenen
Code-Beispiele und Lösungen aber auch mit Visual Studio 2005 verwendbar. Spezifische
Eigenheiten unter den Versionen werden als Fußnote oder als besonderer Verweis angege-
ben.

22.1. Sprachreferenz

22.1.1. Lambda expressions


http://iandykes.blogspot.com/2008/04/beginning-lambda-expressions-in-c.html
Wikipedia: http://de.wikipedia.org/wiki/Lambda-Kalk%C3%BCl

22.2. Coding Guideline

22.2.1. Benutzerschnittstelle zum Code


22.2.1.1. Listen

http://stackoverflow.com/questions/570083/best-practice-when-returning-an-array-of-valu
"Framework Design Guidelines" (2nd ed) in §8.3.1 has quite a lot to say about collections
as return values, summary:
* DO NOT provide settable collection properties. * DO use Collection<T> or a subclass
of Collection<T> for properties or return values representing read/write collections. *
DO use ReadOnlyCollection<T>, a subclass of ReadOnlyCollection<T>, or in rare cases
IEnumerable<T> for properties or return values representing read-only collections.
(and more, but these three capture the core).
The first of those above: don’t return reference to internal collection unless you want the
user to be able to change it (and then likely you should have a custom type so you have a
degree of control).

107
22. C#

I would return IList<T> and ensure I do not define the actual type I am returning, unless
I was returning an iterator (when I would use IEnumerable<T>).

—-

Typically, you should be as general as you can be without causing undue grief to whoever
is going to be calling your method. Prefer interfaces over concrete classes, and pick the
most generic interface you can get away with.

Returning interfaces better encapsulates your implementation, and will make things easier
to change in the future. If you start with a concrete type, you’re committed to always
returning that type.

IEnumerable<T> is the best place to start. With the advent of LINQ, there are very few
things a caller can’t do easily just given an enumeration. If a caller occasionally needs a
list, it’s easy enough to call .ToList().

If callers are likely to have a specific need to index into the returned collection, or if they
are likely going to want to modify the collection themselves (inserting/removing/reordering
items), consider using an IList<T>.

ReadOnlyCollection<T> is another option.

—-

22.2.1.2. Exposing a Generic List

You’re writing a Customer class, and the Customer class contains a collection of Account
objects. Because you want to add and remove accounts with ease, you implement this
collection as a List<T>.

public class Customer


{
private List<Account> accounts = new List<Account>();

public List<Account> Accounts


{
get { return accounts; }
}
}

Life is good. Your tests iterate through the accounts, add new accounts, and remove ac-
counts. However, when you run FxCop, it complains that you shouldn’t expose generic
lists.

108
22.2. Coding Guideline

Do not expose List<T> in object models. Use


Collection<T>, ReadOnlyCollection<T> or Keyed-
Collection<K,V> instead. List<T> is meant to be
used from implementation, not in object model API.
List<T> is optimized for performance at the cost
of long term versioning. For example, if you return
List<T> to the client code, you will not ever be able
to receive notifications when client code modifies the
collection.

FxCop is correct in its assessment as it becomes more difficult to later add underlying func-
tionality. But I feel that it leaves out an important point. You shouldn’t expose too much
about your implementation, and this relays to the world that Employee uses a List<T>.
Consumers of the Customer class don’t care that you’ve implemented List<T>, they only
care about the interface. Expose the public property as the interface the consumer should
be using. In this example, our consumers want to utilize the interface IList<T>. Refacto-
ring this is pretty easy: modify the property to be IList<Account>.
public class Customer
{
private List<Account> accounts = new List<Account>();

public IList<Account> Accounts


{
get { return accounts; }
}
}

In other cases, the consumers may only want to iterate the collection without making
modifications. In that situation, expose the list as IEnumerable<T>. The point is to take
into account the interface that consumers want to utilize, then hide your implementation.
You shouldn’t do it this way if the collection needs to be serialized. In that case, stick with
one of the concrete classes such as Collection<T> like FxCop suggested. [3]

22.2.2. Dokumentation
22.2.2.1. Namespace Summary

Für die Dokumentation von Namespaces ist ein Skeleton zu verwenden. Dieses definiert
den Summary Tag, die Überschrift in der übergeordneten Dokumentation.
#if DEBUG
namespace Jedzia.Objects.structz.Serializers

109
22. C#

{
/// <summary>
/// </summary>
[System.Runtime.CompilerServices.CompilerGenerated()]
sealed class NamespaceDoc
{
}
}
#endif
Bei DocProject gibt es keine Einstellungen um die NamespaceDoc’s zu benutzen. Das muss
manuell erledigt werden.
@"^T:(.*?)\.{0}$"
@"^T:(.*?)\.NamespaceDoc$"
Ging nichts daran vorbei einen Filter selbst zu schreiben.
/// <summary>
/// Called before a <paramref name="step" /> is executed during a help build.
/// </summary>
/// <param name="step"><see cref="IBuildStep" /> implementation to be executed.<
/// <param name="context">Provides information about the build process.</param>
/// <returns><b>true</b> indicates that the process should continue, otherwise,
/// <b>false</b> indicates that the process should skip this step.</returns>
public override bool BeforeExecuteStep(IBuildStep step, BuildContext context)
{
this.m_stepStart = DateTime.Now;

// if (step.Name == "Create Conceptual Build Files")


// {
// cont = false;
// }
return this.cont;
}

/// <summary>
/// Called after a <paramref name="step" />
/// has been executed during a help build.
/// </summary>
/// <param name="step"><see cref="IBuildStep" />
/// implementation that was executed.</param>
/// <param name="context">
/// Provides information about the build process.
/// </param>
public override void AfterExecuteStep(IBuildStep step, BuildContext context)
{
const string namespaceDocClassName = "NamespaceDoc";
const string projectDocClassName = "ProjectDoc";

110
22.2. Coding Guideline

const string fromdirRelative = @"..\..\..\..\REC";


const string toDirRelative = @"Help\" + @"Images";

// context.ProjectDirectory
PathUtil.CopyRelativeContent(context,
fromdirRelative, toDirRelative,
this.TraceMessage, ".svn");

CorrectNamespaceDocs(context,
namespaceDocClassName, projectDocClassName,
this.TraceMessage);

TraceLine();
TraceLine("Step {0} Time Elapsed: {1}",
context.CurrentStepIndex + 1,
DateTime.Now - this.m_stepStart);
}

public static void CorrectNamespaceDocs(


BuildContext context,
string namespaceDocClassName,
string projectDocClassName,
PathUtil.TracerMessage tracerMessageMethod)
{
if (context.CurrentStepIndex != 0) return;

tracerMessageMethod("Step 1b: Renaming NamespaceDocs");


foreach (Source var in context.Sources)
{
if (string.IsNullOrEmpty(var.XmlDocumentation)) continue;

string root = Path.Combine(context.ProjectDirectory,


@"buildhelp\assembler\Comments");
string docpath = Path.Combine(root,
var.XmlDocumentation.FileName);

FileInfo file = new FileInfo(docpath);

bool change = false;


bool projFound = false;

XmlDocument doc = new XmlDocument();


doc.Load(file.FullName);
XmlNodeList memberNodes = doc.SelectNodes("//member[@name]");
if (memberNodes != null)
{
foreach (XmlElement memberElement in memberNodes)

111
22. C#

{
string pattern = string.Format(@"^T:(.*?)\.{0}$",
namespaceDocClassName);

Regex regex = new Regex(


pattern,
RegexOptions.Compiled | RegexOptions.CultureInvariant
| RegexOptions.IgnoreCase |
RegexOptions.IgnorePatternWhitespace);
Match match = regex.Match(memberElement.GetAttribute("name"));
if (match.Success)
{
change = true;
memberElement.SetAttribute("name", match.Result("N:$1"));
tracerMessageMethod("Found Namespace Doc "
+ match.Result("N:$1"));
}

if (projFound) continue;

string projPattern = string.Format(@"^T:{0}$",


projectDocClassName);

Regex projRegex = new Regex(


projPattern,
RegexOptions.Compiled | RegexOptions.CultureInvariant
| RegexOptions.IgnoreCase |
RegexOptions.IgnorePatternWhitespace);
Match projMatch = projRegex.Match(
memberElement.GetAttribute("name"));
if (!projMatch.Success)
{
continue;
}

tracerMessageMethod("Found Project Doc " +


projMatch.Result("R:Project"));
change = true;
memberElement.SetAttribute("name",
projMatch.Result("R:Project"));
projFound = true;

// since only 1 "R:Project" can exist we break;


}
}

if (change) doc.Save(file.FullName);

112
22.3. Snippets

}
}

private void TraceMessage(string message)


{
TraceLine(message);
}

22.2.2.2. Events

Hier eine Vorlage, wie events zu dokumentieren sind.


/// <summary>
/// Represents the method that will handle an event of altering the size in
/// a <see cref="DrawableBase"/> type.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">
/// The <see cref="SizeEventArgs"/> instance containing the event data.
/// </param>
public delegate void SizeEventHandler(object sender, SizeEventArgs e);

22.3. Snippets

22.3.1. Mausrad-Meldungen abfragen


Siehe Abschnitt 20.2.1.
private const int MK_LBUTTON = 0x0001;
private const int MK_RBUTTON = 0x0002;
private const int MK_SHIFT = 0x0004;
private const int MK_CONTROL = 0x0008;
private const int MK_MBUTTON = 0x0010;
private const int MK_XBUTTON1 = 0x0020;
private const int MK_XBUTTON2 = 0x0040;

public static int GetWheelDeltaWParam(int wparam) { return HighWord(wparam); }

public static MouseButtons GetMouseButtonWParam(int wparam)


{
int mask = LowWord(wparam);

if ((mask & MK_LBUTTON) == MK_LBUTTON) return MouseButtons.Left;


if ((mask & MK_RBUTTON) == MK_RBUTTON) return MouseButtons.Right;
if ((mask & MK_MBUTTON) == MK_MBUTTON) return MouseButtons.Middle;
if ((mask & MK_XBUTTON1) == MK_XBUTTON1) return MouseButtons.XButton1;
if ((mask & MK_XBUTTON2) == MK_XBUTTON2) return MouseButtons.XButton2;

113
22. C#

return MouseButtons.None;
}

public static bool IsCtrlKeyPressedWParam(int wparam)


{
int mask = LowWord(wparam);
return (mask & MK_CONTROL) == MK_CONTROL;
}

public static bool IsShiftKeyPressedWParam(int wparam)


{
int mask = LowWord(wparam);
return (mask & MK_SHIFT) == MK_SHIFT;
}

public static int GetXLParam(int lparam) { return LowWord(lparam); }

public static int GetYLParam(int lparam) { return HighWord(lparam); }

public static int LowWord(int word) { return word & 0xFFFF; }

public static int HighWord(int word) { return word >> 16; }

[1]

22.3.2. Threadsicherer Codeaufruf im Control-Kontext (Invoking)


public static void ExecuteThreadSafe(this Control control, Action action)
{
if (control.InvokeRequired)
{
control.Invoke(action);
}
else
{
action.Invoke();
}
}

//Beispiel:
comboBox.ExecuteThreadSafe(() => comboBox.Enabled = true);

comboBox.ExecuteThreadSafe(() =>
{
comboBox.Enabled = true;
comboBox.Items.Add("Threadsicheres");
comboBox.Items.Add("hinzufügen");

114
22.3. Snippets

comboBox.Items.Add("von");
comboBox.Items.Add("Items");
});

Aus http://dotnet-snippets.de/dns/c-threadsicherer-codeaufruf-im-control-kontext-invoki
aspx.

22.3.3. SynchronizationContext
Einen dreiteiligen Artikel zum SynchronizationContext gibt es hier:
1. http://www.codeproject.com/KB/threads/SynchronizationContext.aspx
2. http://www.codeproject.com/KB/threads/SynchronizationContext2.aspx
3. http://www.codeproject.com/KB/threads/SynchronizationContext3.aspx
Er behandelt das Thema ausführlich und beinhaltet praktische Beispiele.

22.3.4. Thread-sicheres Zuweisen von Control-Eigenschaften


Wenn aus einem anderen Thread eine Eigenschaft in einem Form-Control geändert werden
soll, so muss man mit Callbacks und Invoke arbeiten.
Mit diesem generischen Delegate und der dazugehörigen Funktion, kann man eine Menge
Code sparen.
private delegate void SetPropertyValueCallback<ControlType, PropertyType>(
ControlType control, string propertyName, PropertyType value) where
ControlType : Control;

private void SetPropertyThreadSafe<ControlType, PropertyType>(ControlType


control, string propertyName, PropertyType value) where ControlType :
Control
{
−−−−−−→if (control.InvokeRequired)
−−−−−−→{
−−−−−−→−−−−−−→SetPropertyValueCallback<ControlType, PropertyType> cb = new
SetPropertyValueCallback<ControlType, PropertyType>(SetPropertyThreadSafe);
−−−−−−→−−−−−−→control.Invoke(cb, new object[]{ control, propertyName, value });
−−−−−−→}
−−−−−−→else
−−−−−−→{
−−−−−−→−−−−−−→System.Reflection.PropertyInfo property = control.GetType().
GetProperty(propertyName);
−−−−−−→−−−−−−→property.SetValue(control, value, null);
−−−−−−→}
}

//Anwendung

115
22. C#

SetPropertyThreadSafe<ProgressBar, int>(pbState, "Value", (int)syncState.


PercentFinished * 100);
SetPropertyThreadSafe<Label, string>(lblState, "Text", syncMessage);

Perfekt. Die Anwendung geht sogar noch einfacher:

SetControlProperty(pbState, "Value", (int)syncState.PercentFinished);


SetControlProperty(lblState, "Text", syncState.SyncMessage);

Quelle: http://dotnet-snippets.de/dns/threadsicheres-zuweisen-von-control-eigenschafte
aspx.

22.3.5. Ordner mit Inhalt kopieren (rekursiv)

Dieses Snippet kopiert das angegebenen Quellverzeichnis, inklusive enthaltener Dateien, in


das angegebenen Zielverzeichnis.
Dafür muss ein Verweis auf System.IO angelegt werden.
Es wurde mit dem StringBuilder gearbeitet da dieser leichte Performance Vorteile bringen
kann, wenn viele Dateien bzw. Ordner kopiert werden sollen. Denn er erzeugt nicht immer
ein neues Objekt, sondern "ergänzt" das bestehende nur.
#region -CopyDirectoryWithIncludedFiles(string dirCopySource, string
dirCopyTarget)
#region XML-Doku
/// <summary>
/// Kopiert das angegebene Quellverzeichnis mit den beinhaltenden
Verzeichnissen und Dateien in das angegebene Zielverzeichnis.
/// </summary>
/// <param name="dirCopySource">
/// Verzeichnis das kopiert werden soll mit dem gesamten Inhalt
/// </param>
/// <param name="dirCopyTarget">
/// Verzeichnis in dem das Quellverzeichnis kopiert werden soll
/// </param>
#endregion
private void CopyDirectoryWithIncludedFiles(string dirCopySource, string
dirCopyTarget)
{
// alle Unterverzeichnisse des aktuellen Verzeichnisses ermitteln
string[] subDirectories = Directory.GetDirectories(dirCopySource);

// Zielpfad erzeugen
StringBuilder newTargetPath = new StringBuilder();
{
newTargetPath.Append(dirCopyTarget);
newTargetPath.Append(dirCopySource.Substring(dirCopySource.LastIndexOf(@
"\")));

116
22.3. Snippets

␣␣␣␣}

␣␣␣␣//␣wenn␣aktueller␣Ordner␣nicht␣existiert␣->␣ersstellen
␣␣␣␣if(!Directory.Exists(newTargetPath.ToString()))
␣␣␣␣␣␣␣␣Directory.CreateDirectory(newTargetPath.ToString());

␣␣␣␣//␣Unterverzeichnise␣durchlaufen␣und␣Funktion␣mit␣dazu␣gehörigen␣Zielpfad␣
erneut␣aufrufen␣(Rekursion)
␣␣␣␣foreach␣(string␣subDirectory␣in␣subDirectories)
␣␣␣␣{
␣␣␣␣␣␣␣␣string␣newDirectoryPath␣=␣subDirectory;

␣␣␣␣␣␣␣␣//␣wenn␣’’/’’␣an␣letzter␣Stelle␣dann␣entfernen
␣␣␣␣␣␣␣␣if␣(newDirectoryPath.LastIndexOf(@"\")␣==␣(newDirectoryPath.Length␣-␣1))
␣␣␣␣␣␣␣␣␣␣␣␣newDirectoryPath␣=␣newDirectoryPath.Substring(0,␣newDirectoryPath.
Length␣-␣1);

␣␣␣␣␣␣␣␣//␣rekursiever␣Aufruf
␣␣␣␣␣␣␣␣CopyDirectoryWithIncludedFiles(newDirectoryPath,␣newTargetPath.ToString
());
␣␣␣␣}

␣␣␣␣//␣alle␣enthaltenden␣Dateien␣des␣aktuellen␣Verzeichnisses␣ermitteln
␣␣␣␣string[]␣fileNames␣=␣Directory.GetFiles(dirCopySource);
␣␣␣␣foreach␣(string␣fileSource␣in␣fileNames)
␣␣␣␣{
␣␣␣␣␣␣␣␣//␣Zielpfad␣+␣Dateiname
␣␣␣␣␣␣␣␣StringBuilder␣fileTarget␣=␣new␣StringBuilder();
␣␣␣␣␣␣␣␣{
␣␣␣␣␣␣␣␣␣␣␣␣fileTarget.Append(newTargetPath);
␣␣␣␣␣␣␣␣␣␣␣␣fileTarget.Append(fileSource.Substring(fileSource.LastIndexOf(@"\"))
);
␣␣␣␣␣␣␣␣}

␣␣␣␣␣␣␣␣//␣Datei␣kopieren,␣wenn␣schon␣vorhanden␣überschreiben
␣␣␣␣␣␣␣␣File.Copy(fileSource,␣fileTarget.ToString(),␣true);
␣␣␣␣}
}
#endregion

Quelle: http://dotnet-snippets.de/dns/ordner-mit-inhalt-kopieren-rekursiv-SID1214.
aspx.

22.3.6. Custom Generic EventArgs

Quelle: c-sharpcorner.com.

117
22. C#

Source: c-sharpcorner.com
Before .NET 2.0, I found myself frequently creating custom EventArgs classes just to return
a value from an event and would end of with a lot of extra classes bloating my code base
that all basically had the same purpose.

22.3.6.1. Core Classes

In order to harness the awesome power of generics with our events, we just need a few lines
of code creating a class that inherits from EventArgs that will transport a value of some
type:
public class EventArgs<T> : EventArgs
{
public EventArgs(T value)
{
m_value = value;
}

private T m_value;

public T Value
{
get { return m_value; }
}
}

Now we can create an event that returns any type of object and have only one class to
maintin.
Sometimes (but not often), we’ll have a situation where we need two return values from
an event and so we can derive from EventArgs<T> and add another value.
public class EventArgs<T, U> : EventArgs<T>
{

public EventArgs(T value, U value2)


: base(value)
{
m_value2 = value2;
}

private U m_value2;

public U Value2
{
get { return m_value2; }
}
}

118
22.3. Snippets

I have a hard time imagining a situation where we would need three return values, but
I put a EventArgs<T, U, V> class in the sample code just in case following the above
pattern.

22.3.6.2. Implementation

The implementation takes a bit getting used to, expecially if you’re not yet used to looking
at generics, because we’ll have nested generic types, but after a while it will grow on you.
In our event declaration, we’ll specify the type of object returned.
private event EventHandler<EventArgs<Double>> m_doubleEvent

When we fire off the event, we’ll just pass the return value using the constructor we created
earlier in Part I.
if (null != m_doubleEvent)
−−−−−−→m_doubleEvent(this, new EventArgs<Double>(9876.5432));

22.3.6.3. An Example

I have a couple buddies in NewJersey who like fishing and have inspired my sample code.
I’m just going to give you an overview of how the sample code works so you’ll have to
download the project code for this article to see it all work.
We have three classes: Fisherman, DirtyLake, and Fish . The DirtyLake contains a bunch
of stuff floating around and will randomly fire an event when fished in using a "GetSome-
thing()" method.
private event EventHandler<EventArgs<String, Double>> m_stringAndDoubleCaught;
private event EventHandler<EventArgs<Double>> m_doubleCaught;
private event EventHandler<EventArgs<Guid, int, string>>
m_guidAndStringAndIntCaught;
private event EventHandler<EventArgs<Fish>> m_fishCaught;

The Fisherman class listens to all these events so when he casts his line in the lake and
calls GetSomething(), the event is fired off and he receives an event notification. To do all
of this with custom non-generic event args would have required substantially more code.
Download the source code and check it out if you would like to see the whole thing from
beginning to end.

22.3.6.4. Wrap up

This technique can be used with web pages, win forms, or anywhere else we may have
events (including fishing in dirty lakes). I hope you found this article useful and it can help
you simplify and reduce the amount of code needed to make you apps work.

119
22. C#

22.4. Interfaces

22.4.1. IServiceProvider
[4, S. 311ff]

22.5. Klassen

22.5.1. Dictionary
22.5.1.1. Dictionary generisch einschränken

http://dzaebel.net/DictionaryConstraint.htm
Bei einem generischen Dictionary mit einfachem TKey-Typ erscheint beim Hinzufügen glei-
cher "Keys" eine (gewünschte) Fehlermeldung. Will man, dass der Versuch eines Zufügens
eines gleichen Key’s zu einer Exception führen soll, so kann man die Implementation in
diesem Artikel (ganz unten) benutzen. Nebenbei wird eine Methode aufgezeigt, wie man
lokalisierte Fehlermeldungen des Frameworks benutzen kann und Wertgleichheit generisch
implementieren kann. Weiterführend dazu s. Abschnitt 22.5.1.2.
Als Hintergrund-Information zur Implementierung: Methoden wie ContainsKey etc. ge-
hen intern über GetHashCode-Methode des GenericEqualityComparer. Dieser ist Referenz-
orientiert und würde trotz gleicher Eigenschaften-Werte: Ungleichheit zurückgeben. Das ist
auch so definiert (Wertegleichheit, Referenzgleichheit). BTW: Beim Anwenden der where
T : class-Einschränkung wird empfohlen, die Operatoren == und != nicht für den Ty-
pparameter zu verwenden, da diese Operatoren nur die Referenzgleichheit und nicht die
Wertgleichheit prüfen.
• Dictionary mit int-Typ als Schlüssel: ->gewünschter Fehler erscheint.
Dictionary<int, string> di = new Dictionary<int, string>();
di.Add(1, "Test1");
di.Add(1, "Test2"); // -> Gewünschter Fehler: ".. Schlüssel wurde bereits
hinzugefügt".

• Dictionary mit einfachem Person-Typ als Schlüssel: ->kein gewünschter Fehler er-
scheint.
Dictionary<Person, string> di = new Dictionary<Person, string>();
Person p1 = new Person(); p1.Vorname = "Vorname1"; p1.Alter = 42;
Person p2 = new Person(); p2.Vorname = "Vorname1"; p2.Alter = 42;
di.Add(p1, "Test1");
di.Add(p2, "Test2"); // -> Kein Fehler! Gewollt: Vergleich anhand der
öffentlichen Eigenschafts-Werte.

...
class Person
{

120
22.5. Klassen

public string Vorname { get; set; }


public int Alter { get; set; }
}

• Dictionary mit Person-Typ als Schlüssel und Equals-Überschreibung: -> gewünsch-


ter Fehler erscheint. ( unschön: es wird nicht erzwungen, dass Person: Equals und
GetHashCode überschreiben muss )
private void Form1_Load(object sender, EventArgs e)
{
Dictionary<Person, string> dic = new Dictionary<Person, string>();
FülleDaten(dic);
}

private static void FülleDaten(Dictionary<Person, string> dic)


{
Person p1 = new Person("Albert", new DateTime(1962, 6, 1));
Person p2 = new Person("Albert", new DateTime(1962, 6, 1));
dic.Add(p1, "Albert1");
dic.Add(p2, "Albert2"); // gewünschter Fehler erscheint
}

class Person // unschön: es wird nicht erzwungen, dass Person Equals und
GetHashCode überschreiben muss
{
public Person(string vorname, DateTime geburt)
{
this.Vorname = vorname;
this.Geburtsdatum = geburt;
}
public string Vorname { get; set; }
public DateTime Geburtsdatum { get; set; }

public override bool Equals(object obj)


{
return this.ToString() == obj.ToString();
}

public override int GetHashCode()


{
return this.ToString().GetHashCode();
}

public override string ToString()


{
StringBuilder sb = new StringBuilder();
foreach (PropertyDescriptor pd in
TypeDescriptor.GetProperties(typeof(Person)))
{

121
22. C#

string val = pd.GetValue(this).ToString();


sb.AppendFormat("{0},", val);
}
return sb.ToString();
}
}

• UniqueKeyDictionary mit Person-Typ als Schlüssel: -> gewünschter Fehler erscheint.


( Vorteil: es wird erzwungen, class Person: IEquatable<TKey> implementiert. )
private void Form1_Load(object sender, EventArgs e)
{
UniqueKeyDictionary<Person, string> dic =new UniqueKeyDictionary<Person,
string>();
FülleDaten(dic);
}

private static void FülleDaten(UniqueKeyDictionary<Person,string> dic)


{
Person p1 = new Person("Albert",new DateTime(1962, 6, 1));
Person p2 = new Person("Albert",new DateTime(1962, 6, 1));
dic.Add(p1, "Albert1");
dic.Add(p2, "Albert2");// gewünschter Fehler erscheint
}

//<summary> Framework-Exceptions </summary>


static class Exceptions
{
/// <summary>Ein Element mit dem gleichen Schlüssel wurde bereits
hinzugefügt.
/// Vorteil: im Englischen UI gibt es eine analoge übersetzte Meldung.</
summary>
public static readonly string Argument_AddingDuplicate = "
Argument_AddingDuplicate";
}

/// <summary>Dictionary, das ein Einfügen gleicher Keys für


/// Klasseninstanzen (in der Equals-Semantik: Gleichheit aller
/// Eigenschaften-Werte) verhindert.</summary>
class UniqueKeyDictionary<TKey, TValue> : Dictionary<TKey, TValue>
where TKey : IEquatable<TKey>
{
/// <summary>Fügt dem Dictionary einen ’TKey’ mit
/// dem angegebenen ’value’ zu. Bei einem bereits vorhandenen
/// Schlüssel wird eine Exception geworfen.</summary>
public new void Add(TKey key, TValue value)
{
if (this.Keys.Count > 0)

122
22.5. Klassen

{
bool hasDuplicates = IsKeyDuplicate(key);
if (hasDuplicates)
{
ResourceManager rm = new ResourceManager("mscorlib",
typeof(Environment).Assembly);
string msg = rm.GetString("Argument_AddingDuplicate");
throw new ArgumentException(msg); // <<--- wie man Framework-
Meldungen nutzen kann
}
}
base.Add(key, value);
}

public bool IsKeyDuplicate(TKey key)


{
foreach (TKey kyin Keys)
if (ky.Equals(key))
return true;
return false;
}
}

class Person : IEquatable<Person> // Vorteil: IEquatable wird durch den


Constraint erzwungen.
{
public Person(string vorname, DateTime geburt)
{
this.Vorname = vorname;
this.Geburtsdatum = geburt;
}

public string Vorname { get; set; }


public DateTime Geburtsdatum { get; set; }

public override string ToString() // Vorteil: beim Debuggen sind


Eigenschaften-Werte schnell ersichtlich
{
StringBuilder sb = new StringBuilder();
foreach (PropertyDescriptor pd in
TypeDescriptor.GetProperties(typeof(Person)))
{
string val = pd.GetValue(this).ToString();
sb.AppendFormat("{0},", val);
}
return sb.ToString();
}

public bool Equals(Person other) // keine direkte "Überschreibung" von

123
22. C#

Equals oder Hashcode nötig.


{
return this.ToString() == other.ToString();
}
}

22.5.1.2. BinarySearch des dichtesten Elementes in C#

Eine .NET 2.0 Dictionary.ContainsKey-Methode kommt etwa einer O(1)-Komplexität na-


he und ist zum Suchen also eine der performantesten Möglichkeiten. In diesem Fall wird
ein Element gesucht, das am dichtesten an dem zu suchenden Element liegt. Hier ist eine
SortedList eine Möglichkeit, bei der man durch die Sortierung eine Binärsuche [Sorted-
List.ContainsKey] ausführen kann und somit eine Performance von etwa O(log n) erreicht.
Zu überdenken wäre auch die Möglichkeit eines SortedDictionary’s, welches eine Abruf-
Komplexität von O(log n) hat. Unsortierte Daten werden vom SortedDictionary schneller
hinzugefügt und entfernt: O(log n) im Gegensatz zu O(n) bei der SortedList. Wenn die
Liste in einem Vorgang mit sortierten Daten gefüllt wird, ist die SortedList schneller als
das SortedDictionary.
In folgendem Beispiel wird diese Binärsuche aber manuell codiert, um das dichteste Element
zu bekommen. Eine Alternative wäre auch ein zweiter Hashtable, aber das wird nicht
berücksichtigt.
using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace BinarySearchTest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
Properties.Settings Props = Properties.Settings.Default;

private void Form1_Load(object sender,EventArgs e)


{
Personen personen = new Personen();
personen.Add(36,new Person("Gustav","Gans"));
personen.Add(40,new Person("Dagobert","Duck"));
personen.Add(45,new Person("Tick","Duck"));
personen.Add(35,new Person("Donald","Duck"));
int d = personen.NearestKey(42);
MessageBox.Show(d.ToString() + personen[d].ToString()); //Ergebnis: 40[
Name:Dagobert Duck]
}

124
22.5. Klassen

class Person
{
public Person(string vorname,string nachname)
{
Vorname = vorname; Nachname = nachname;
}
public string Vorname;
public string Nachname;
public override string ToString()
{
return "[Name:" + Vorname + "␣" + Nachname + "]";
}
}

class Personen : SortedList<int,Person>


{
/// <summary>Sucht (binär) in der Liste und gibt den Person-Key zurück,
/// dessen Key am dichtesten an ’key’ liegt.</summary>
/// <returns>-1, bei leerer Liste, sonst den (dichtesten) key</returns>
public int NearestKey(int key)
{
int links = 0,mitte,rechts = Keys.Count - 1;
if (this == null || Keys.Count == 0)
return -1;

do
{
mitte = (links + rechts) / 2;
if (Keys[mitte] == key) return Keys[mitte];
else
if (Keys[mitte] > key)
{
rechts = mitte - 1;
if (links > rechts) return nearest(key,rechts);
}
else
{
links = mitte + 1;
if (links > rechts) return nearest(key,links);
}
} while (true);
}

private int nearest(int key,int idx)


{
if (idx < 0) idx = 0;
if (idx >= Keys.Count - 1) idx = Keys.Count - 1;
int diff2,diff1 = key - Keys[idx];

125
22. C#

if (diff1 > 0)
{
if (idx == Keys.Count - 1) return Keys[idx];
diff2 = Math.Abs(key - Keys[idx + 1]);
}
else
{
if (idx == 0) return Keys[idx];
diff2 = Math.Abs(key - Keys[idx - 1]);
}
return Math.Abs(diff1) <= diff2 ? Keys[idx] : Keys[idx + 1];
}
}
}

22.6. Typen

22.6.1. Arrays

Arrays mit dynamischer Länge definieren:


floorPlan = new int[,]
{
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,1,1,0,0,0,1,1,0,0,1,0,1},
{1,0,0,1,1,0,0,0,1,0,0,0,1,0,1},
{1,0,0,0,1,1,0,1,1,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,1,1,0,0,0,1,0,0,0,0,0,0,1},
{1,0,1,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,1,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,1,0,0,0,1,0,0,0,0,1},
{1,0,1,0,0,0,0,0,0,1,0,0,0,0,1},
{1,0,1,1,0,0,0,0,1,1,0,0,0,1,1},
{1,0,0,0,0,0,0,0,1,1,0,0,0,1,1},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
};

Mit [,].

126
22.7. Daten

22.7. Daten

LUXLyX

22.7.1. Serialization

22.7.1.1. SerializationBinder

mal nach ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETDEVFX.v20.en/cpref11/html/T_System_R


schauen.
-> SerializationBinder.

Überlegungen wie das gehen koennte damit solche Typennamen bei denen der Name-
space geändert wurde trotzdem aufgeloesst werden koennen.
Siehe D:\Temp\mono\XXX\bfor\bfor\Formatters\Binary\ObjectReader.cs
Scheint das in der Methode

Jedzia.Objects.structz.Serializers.Formatters.Binary.ObjectReader.
Type GetDeserializationType(long assemblyId, string className)

der Binder abgefragt wird.

if (this.m_binder != null)
{
t = this.m_binder.BindToType(assemblyName, className);
if (t != null)
{
return t;
}
}

Dort müsste es möglich sein auf „kurze“ Typennamen zuzugreifen. Oder einen Typ zu
deserialisieren fuer das

Assembly assembly = Assembly.Load(assemblyName);


t = assembly.GetType(className, true);
if (t != null)
{
return t;
}

Assembly aufloesen kann.

127
22. C#

Beispiel eines Binders, der einfach den Namespace der Assembly ueberschreibt und da-
nach einen Verweiss auf den richtigen Namespace zurueckgibt.
internal class ZappenBinder : SerializationBinder
{
/// <exception cref="SerializationException">
/// <c>SerializationException</c>.
/// </exception>
public override Type BindToType(string assemblyName,
string typeName)
{
Type t;
if (assemblyName == "Jedzia.SnitTests.Formatter")
{
assemblyName = "Jedzia.UnitTests.Formatter";
}
Assembly assembly = Assembly.Load(assemblyName);
t = assembly.GetType(typeName, true);
if (t != null)
{
return t;
}
throw new SerializationException(
"Couldn’t find type ’" + typeName + "’.");
}
}
NUnit

22.7.1.2. Mono Serialization Format

file:///D:/Temp/mono/XXX/bfor/bfor/binary_serialization_format.htm

22.7.2. MS-Access
22.7.2.1. TableAdapter Delete

Ein „Update requires a valid DeleteCommand when passed DataRow collection with deleted
rows.“ Laufzeit-Fehler wird bei einem Datenzugriff auf eine Access-Datenbank angezeigt (
http://www.windows-tech.info/18/3ced24b5104a99b0.php ).
This is probably an old and commonly asked question but here goes.
I’ve created a small database. it contains two collumns: "Title as text", and
"message as text". I’ve draged and droped the table onto an empty form to
create a datagridview and binding navigator.
When I run the application it lets me insert data and save it. When I close
and open the application the data is still there. If I now delete a row the row

128
22.7. Daten

deletes but when I click the save button or close the application I get the error
message:
"Update requires a valid DeleteCommand when passed DataRow collection
with deleted rows."
I have tried creating stored procedures and my own code for the delete event
but non of this is working.
Does anyone know what I am supposed to do ?
Um einem TableAdapter, der mit einer Microsoft Access Datenbank verknüpft ist das
löschen von Daten zu ermöglichen ist unter bestimmten Umständen eine eigene Delete
Methode zu definieren, da die standardmäßig erzeugte Delete-Methode nicht funktioniert.
Siehe dazu die MSDN Beschreibung unter http://msdn.microsoft.com/en-us/library/
system.data.oledb.OleDbdataadapter.deletecommand.aspx.
public static OleDbDataAdapter CreateCustomerAdapter(
OleDbConnection connection)
{
OleDbDataAdapter dataAdapter = new OleDbDataAdapter();
OleDbCommand command;
OleDbParameter parameter;

// Create the SelectCommand.


command = new OleDbCommand("SELECT␣CustomerID␣FROM␣Customers␣" +
"WHERE␣Country␣=␣?␣AND␣City␣=␣?", connection);

command.Parameters.Add("Country", OleDbType.VarChar, 15);


command.Parameters.Add("City", OleDbType.VarChar, 15);

dataAdapter.SelectCommand = command;

// Create the DeleteCommand.


command = new OleDbCommand(
"DELETE␣*␣FROM␣Customers␣WHERE␣CustomerID␣=␣?",
connection);

parameter = command.Parameters.Add(
"CustomerID", OleDbType.Char, 5, "CustomerID");
parameter.SourceVersion = DataRowVersion.Original;

dataAdapter.DeleteCommand = command;

return dataAdapter;
}

Siehe auch dataset and datagrid problems http://social.msdn.microsoft.com/forums/


en-US/Vsexpressvcs/thread/d3baff67-1e61-4b08-b47e-61f6556ae964/ mit Hinweisen
zu Update, Insert und Delete bzw zu dem Runtime-Fehler Update requires a valid De-
leteCommand when passed DataRow collection with deleted rows. im MSDN Forum unter
http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvcs/thread/6c3c0896-2f34-422b-a7
( Googl Suche 1 + Googl Suche 2).

129
22. C#

Aus Filefactory:

this._adapter.DeleteCommand = new global::System.Data.OleDb.


OleDbCommand();
this._adapter.DeleteCommand.Connection = this.Connection;
this._adapter.DeleteCommand.CommandText = "DELETE␣FROM␣Indices\r\
nWHERE␣␣␣␣␣(DocIndex␣=␣?)␣AND␣(IndexText␣=␣?)";
this._adapter.DeleteCommand.CommandType = global::System.Data.
CommandType.Text;
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.
OleDb.OleDbParameter("DocIndex", global::System.Data.OleDb.OleDbType.Integer
, 0, global::System.Data.ParameterDirection.Input, ((byte)(0)), ((byte)(0)),
"DocIndex", global::System.Data.DataRowVersion.Original, false, null));
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.
OleDb.OleDbParameter("IndexText", global::System.Data.OleDb.OleDbType.
Integer, 0, global::System.Data.ParameterDirection.Input, ((byte)(0)), ((
byte)(0)), "IndexText", global::System.Data.DataRowVersion.Original, false,
null));

[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.
TableAdapter")]
public virtual int Update(global::System.Data.DataRow[] dataRows) {
return this.Adapter.Update(dataRows);
}

[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.
TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.
ComponentModel.DataObjectMethodType.Delete, true)]
public virtual int Delete(global::System.Nullable<int> DocIndex, global
::System.Nullable<int> IndexText) {
if ((DocIndex.HasValue == true)) {
this.Adapter.DeleteCommand.Parameters[0].Value = ((int)(DocIndex
.Value));
}
else {
this.Adapter.DeleteCommand.Parameters[0].Value = global::System.
DBNull.Value;
}
if ((IndexText.HasValue == true)) {
this.Adapter.DeleteCommand.Parameters[1].Value = ((int)(
IndexText.Value));
}
else {
this.Adapter.DeleteCommand.Parameters[1].Value = global::System.
DBNull.Value;
}

130
22.8. LINQ

global::System.Data.ConnectionState previousConnectionState = this.


Adapter.DeleteCommand.Connection.State;
if (((this.Adapter.DeleteCommand.Connection.State & global::System.
Data.ConnectionState.Open)
!= global::System.Data.ConnectionState.Open)) {
this.Adapter.DeleteCommand.Connection.Open();
}
try {
int returnValue = this.Adapter.DeleteCommand.ExecuteNonQuery();
return returnValue;
}
finally {
if ((previousConnectionState == global::System.Data.
ConnectionState.Closed)) {
this.Adapter.DeleteCommand.Connection.Close();
}
}
}

22.8. LINQ

22.8.1. Links
• Charlie Calvert’s Community Blog: Links to LINQ.
• Rekursion
‘Recursive’ LINQ calls: stackoverflow topic.
Expressing recursion in LINQ: stackoverflow topic.

22.9. Assembly
http://www.koders.com/csharp/fidAE336E3E7989D027A13ED1D85055A82A278C551B.aspx
Ist von http://sourceforge.net/projects/wintin: Wintin is a scriptable MUD client for Win-
dows

22.10. Bibliotheken

22.10.1. Log4Net
• HowTo: Logging mit Log4Net http://code-inside.de/blog/2009/05/08/howto-logging-mit-lo
• HowTo: Objekte rekursiv durchlaufen - ein ObjectDumper fürs Logging mittels Re-
flection: http://code-inside.de/blog/2009/05/13/howto-objekte-rekursiv-durchlaufen-ei

131
22. C#

• Homepage: http://logging.apache.org/log4net/release/manual/introduction.
html

22.10.2. ICSharpCode
22.10.2.1. ICSharpCode.NRefactory

22.10.3. Tesseract OCR Library


Homepage: http://code.google.com/p/tesseract-ocr/
FAQ: http://code.google.com/p/tesseract-ocr/wiki/FAQ
Download: http://code.google.com/p/tesseract-ocr/downloads/list
Hinweise zum kompilieren unter http://maniish.wordpress.com/2007/03/03/tesseract-ocr-libr
von Manish Pansiniya’s Blog. Siehe auch den Thread Any open source C# OCR library? auf
Stack Overflow: http://stackoverflow.com/questions/744966/any-open-source-c-ocr-li
Den Codeproject Artikel Converting Images to Text using Office 2007 OCR, OpenXML
and Speech Recognition unter http://www.codeproject.com/KB/office/OCRSampleApplication.
aspx um als Alternative die Office 2007 Libraries zu benutzen.

22.11. Domain Driven Design


OmberZombie Sample
• Data-Access Layer: “ThreeTier.Data”
• Business Layer: “ThreeTier.Service”
• Presentation Layer: “ThreeTier.ConsoleApp”
• Unit-Tests: “ThreeTier.Tests”
Meins von OmberZombie
• Data-Access Layer: “orebelts -> db Klassen”
• Data-Provider: „orebelts ->SolarSystemsDataList“
• Business Layer: “verschiedene je nach Anwendung, aber im gleichen Modul wie der
Presentation Layer”
• Presentation Layer: “dbfuck, Infobrauser, Scheduler usw.”
• Unit-Tests: “extra unterprojekte UnitTests”

Links http://en.wikipedia.org/wiki/Domain-driven_design
Model View Controller http://de.wikipedia.org/wiki/Model_View_Controller
Schichtenarchitektur http://de.wikipedia.org/wiki/Schichtenmodell#F.C3.BCnf-Schichten-
Architektur

132
22.12. Fluent Interfaces

Multitier architecture http://en.wikipedia.org/wiki/Multitier_architecture


Three-Tier-Development http://www.dfpug.de/konf%5Ckonf_1998%5C09_tier%5Cd_tier/d_tier.htmhtt
inside.de/blog/2008/07/09/howto-3-tier-3-schichten-architektur/

22.12. Fluent Interfaces


http://code-inside.de/blog/2008/08/05/howto-fluent-interfaces-schne-apis-mit-c-30/
http://www.bjoernrochel.de/2008/08/10/implementing-a-fluent-api-for-the-ribbon/
Wiki: http://de.wikipedia.org/wiki/Fluent_Interface

22.13. Design Patterns


http://de.wikipedia.org/wiki/Kategorie:Entwurfsmuster
Entwurfsmuster der Viererbande
Erzeugungsmuster: Abstrakte Fabrik | Singleton | Builder | Fabrikmethode | Prototyp
Strukturmuster: Adapter | Brücke | Decorator | Facade | Flyweight | Kompositum | Stell-
vertreter
Verhaltensmuster: Observer | Visitor | Interpreter | Iterator | Kommando | Memento |
Schablonenmethode | Strategie | Vermittler | Zustand | Zuständigkeitskette

22.13.1. Structural Patterns


22.13.1.1. Decorator

http://de.wikipedia.org/wiki/Decorator und http://en.wikipedia.org/wiki/Decorator_


pattern.
Der Decorator (auch Dekorierer) ist ein Entwurfsmuster aus dem Bereich der Softwareent-
wicklung und gehört zur Kategorie der Strukturmuster (Structural Patterns). Das Muster
ist eine flexible Alternative zur Unterklassenbildung, um eine Klasse um zusätzliche Funk-
tionalitäten zu erweitern. Es ist ein Entwurfsmuster der sogenannten GoF-Muster (siehe
Viererbande).

Verwendung Die Instanz eines Dekorierers wird vor die zu dekorierende Klasse geschaltet.
Der Dekorierer hat die gleiche Schnittstelle wie die zu dekorierende Klasse. Aufrufe an den
Dekorierer werden dann verändert oder unverändert weitergeleitet (Delegation), oder sie
werden komplett in Eigenregie verarbeitet. Der Dekorierer ist dabei „unsichtbar“, da der
Aufrufende gar nicht mitbekommt, dass ein Dekorierer vorgeschaltet ist.
In einer alternativen Variante kann der Dekorierer als eine Strategie eingebunden und
explizit aufgerufen werden.

133
22. C#

Abbildung 22.1.: UML-Diagramm

Akteure Die abstrakte Komponente definiert die öffentliche Schnittstelle für zu dekorie-
rende Objekte. Die konkrete Komponente definiert Objekte, die dekoriert werden können.
Der abstrakte Dekorierer hält eine Referenz auf eine konkrete Komponente und bietet
dieselbe Schnittstelle wie die abstrakte Komponente. Der konkrete Dekorierer definiert
und implementiert eine oder mehrere spezielle Dekorationen.

Vor und Nachteile Die Vorteile bestehen darin, dass mehrere Dekorierer hintereinander-
geschaltet werden können; die Dekorierer können zur Laufzeit und sogar nach der Instanzie-
rung ausgetauscht werden. Die zu dekorierende Klasse ist nicht unbedingt festgelegt (wohl
aber deren Schnittstelle). Zudem können lange und unübersichtliche Vererbungshierarchien
vermieden werden.
Das Muster hat eine Gefahr: Da eine dekorierte Komponente nicht identisch mit der Kom-
ponente selbst ist (als Objekt), muss man bei Testen auf Objekt-Identität vorsichtig sein.
(Ein Vergleich kann falsch ausgehen, obwohl dieselbe Komponente gemeint ist.)

Beispiele

Verschönern von GUI-Komponenten Ein Textfeld soll mit einer Umrahmung „deko-
riert“ werden.
Zwischen dem Aufrufer und dem Textfeldobjekt wird das entsprechende Dekoriererobjekt
eingefügt. Das Dekoriererobjekt erzeugt die Umrahmung und übergibt den Kontrollfluss
an das Textfeld. Da der Dekorierer dieselbe Schnittstelle hat, ändert sich aus der Sicht des
Aufrufers nichts.

134
22.13. Design Patterns

Erweitern der Funktionalität von GUI-Komponenten Jede Komponente stellt sich ab


dem Ursprungspunkt (0, 0) dar; dies ist die eigentliche, zu dekorierende Klasse. Ein vorge-
schalteter Dekorierer kann die Position verschieben, indem Darstellungs- und Mauskoordinaten-
Aufrufe verändert werden.
Eine Spezialisierung davon ist ein Dekorierer, der zusätzlich eine feste Größe definiert,
außerhalb derer nichts dargestellt werden kann. Eine weitere Spezialisierung erweitert den
Darstellungsaufruf um einen darumliegenden Rahmen.
Ein zusätzlicher Dekorierer, der den ersten Dekorierer nochmals dekoriert, kann die Kompo-
nente unsichtbar oder abgeschaltet werden lassen, indem Darstellungs- und Mausabfrage-
Methoden wahlweise abgeblockt werden.
An diesem Beispiel sieht man auch, dass sich Vererbung und Delegation nicht ausschließen.

Ein Beispiel in C# In einem Abenteuerspiel gibt es Spielfiguren. Jede davon kann Dro-
hungen ausstoßen. Eine konkrete Spielfigur ist beispielsweise ein Monster. Spielfiguren kön-
nen sich zur Laufzeit Schnupfen und Husten einfangen – dann geht ihren Drohungen ein
Schniefen bzw. Husten voraus.
Das folgende Programmbeispiel zeigt, wie das Dekorierer-Muster benutzt wird, um ein
Monster zu verschnupfen und zu verhusten.
Wichtig dabei ist zu verstehen, dass nicht die Unterklassen VerschnupftesMonster, Ver-
hustetesMonster, VerschnupftesVerhustetesMonster und VerhustetesVerschnupftesMonster
gebildet werden. Dieser Ansatz würde bei Hinzunahme weiterer Attribute wie „wahnsin-
nig“ und „feuerspuckend“ zu einer exponentiellen Zunahme der Unterklassen führen – ganz
abgesehen von unerträglichen Klassennamen wie VerhustetesVerschnupftesWahnsinniges-
FeuerspuckendesMonster. Es werden nur die (Reihenfolgen von) Dekorationen erzeugt, die
tatsächlich benötigt werden.
Man sieht zudem, dass der Client-Code von den Dekorierern nichts weiß, nachdem die
dekorierten Objekte erzeugt wurden. Aus Sicht des Client-Codes lautet der Aufruf zum
Drohen immer Spielfigur.Drohe().
using System;

namespace DekoratorMuster
{

public abstract class Spielfigur


{
public abstract void Drohe();
}

public class Monster : Spielfigur


{
public override void Drohe()
{
Console.WriteLine("Grrrrrrrrrr.");
}
}

135
22. C#

public abstract class Dekorierer : Spielfigur


{
private Spielfigur meineFigur;

public Dekorierer(Spielfigur s)
{
meineFigur = s;
}

public override void Drohe()


{
meineFigur.Drohe();
}
}

public class HustenDekorierer : Dekorierer


{
public HustenDekorierer(Spielfigur s)
: base(s)
{ }

public override void Drohe()


{
Console.Write("Hust,␣hust.␣");
base.Drohe();
}
}

public class SchnupfenDekorierer : Dekorierer


{
public SchnupfenDekorierer(Spielfigur s)
: base(s)
{ }

public override void Drohe()


{
Console.Write("Schniff.␣");
base.Drohe();
}
}

public class ClientCode


{
public static void Main()
{
Spielfigur meinMonster = new Monster();
meinMonster.Drohe();

Spielfigur meinVerhustetesMonster = new HustenDekorierer(meinMonster

136
22.13. Design Patterns

);
meinVerhustetesMonster.Drohe();

Spielfigur meinVerschnupftesMonster = new SchnupfenDekorierer(


meinMonster);
meinVerschnupftesMonster.Drohe();

Spielfigur meinVerschnupftesVerhustetesMonster = new


SchnupfenDekorierer(new HustenDekorierer(meinMonster));
meinVerschnupftesVerhustetesMonster.Drohe();

Spielfigur meinVerhustetesVerschnupftesMonster = new


HustenDekorierer(new SchnupfenDekorierer(meinMonster));
meinVerhustetesVerschnupftesMonster.Drohe();
}
}
}

Die Ausgabe dieses Programms ist:

Grrrrrrrrr.
Hust, hust. Grrrrrrrrrr.
Schniff. Grrrrrrrrrr.
Schniff. Hust, hust. Grrrrrrrrrr.
Hust, hust. Schniff. Grrrrrrrrrr.

Ähnlich lassen sich Beispiele in C++ und anderen objektorientierten Programmiersprachen


erstellen.

Verwandte Muster Im Vergleich zum Dekorierer, welcher die tatsächlich zu verwendende


Klasse selbst wählt, muss bei dem Strategie-Muster die aufrufende Instanz explizit wissen,
welche Varianten zur Verfügung stehen und welche daraus verwendet werden soll.
Ähnlich dem Dekorierer ist zudem noch das Composite-Muster.

22.13.2. Creational Patterns

22.13.2.1. Singleton

Lazy Creation Von Lazy Creation spricht man, wenn das einzige Objekt der Klasse erst
erzeugt wird, wenn es benötigt wird. Ziel ist, dass der Speicherbedarf und die Rechenzeit für
die Instantiierung des Objektes nur dann aufgewendet werden, wenn das Objekt wirklich
benötigt wird. Hierzu wird der Konstruktor ausschließlich beim ersten Aufruf der Funktion
getInstance() aufgerufen.
Zugriff über:
Singleton s=Singleton.getInstance();

137
22. C#

Implementation:
internal sealed class Singleton
{
private static volatile Singleton instance = null;

// Hilfsfeld für eine sichere Threadsynchronisierung


private static object m_lock = new object();

private Singleton()
{
}

public static Singleton getInstance()


{
// DoubleLock
if (instance == null)
{
lock (m_lock)
{
if (instance == null)
{
instance = new Singleton();
}
}
}

return instance;
}

// Zugriff über Singleton s=Singleton.getInstance();


}

Hinweise zum Code:


1. Das private Hilfsobjekt m_lock ist in C# unbedingt notwendig. Die frühere gängige
Methode lock(this)␣{..} hat sich als unzureichend herausgestellt, weil fehlerhafter
oder böswilliger Code durch den Aufruf Monitor.Exit(Singleton); die Threadsi-
cherheit einfach aushebeln kann.
2. DoubleLock Methode: Warum zweimal dasselbe if()? Damit nach der Instantiierung
des Objektes die bremsende Synchronisation per lock() wegfällt, wird dieselbe if-
Abfrage zusätzlich vor dem lock-Abschnitt eingesetzt.
3. Das Schlüsselwort volatile ist unbedingt notwendig. (s. The DOTNET Memory Mo-
del).
Falls es keine konkreten Einwände gibt, dass das Singleton-Objekt auch schon etwas früher
instantiiert werden darf, ist der unter Eager Creation22.13.2.1 beschriebene Code einfacher
und schneller und daher in C# vorzuziehen.

138
22.13. Design Patterns

Eager Creation Beschreibung hier


Implementation:
internal sealed class EagerSingleton
{
public static readonly EagerSingleton Instance = new EagerSingleton();

private EagerSingleton()
{
/* ...hier optional Initialisierungscode... */
}

// Zugriff über
// Singleton s = Singleton.Instance;
}

Hinweise zum Code: Wichtig: Der Konstruktor wird von der CLR nicht automatisch
beim Programmstart aufgerufen. Erst beim ersten Zugriff auf eine Klasse werden alle sta-
tischen Member der Klasse initialisiert – in diesem Fall die Instantiierung des einen Ob-
jektes. Wenn also nie auf diese Klasse zugegriffen wird, wird der Konstruktor auch niemals
ausgeführt – und das Objekt wird nie erstellt. Dieser Effekt tritt auch dann noch ein, wenn
die Klasse selbst als statisch deklariert wird.
Möchte man sicher gehen, dass das Singleton-Objekt beim Programmstart erstellt wird, so
muss man einen beliebigen Zugriff in das Hauptprogramm public␣static␣void␣Main()
␣{␣} einbauen.

Varianten:
1. Wenn man seine Klasse wie in o. g. Beispiel nicht von einer anderen Klasse ablei-
ten muss, kann man die Klasse auch einfach als statisch deklarieren – das entspricht
immer noch dem Singleton-Prinzip. Das o. g. Beispiel ist eigentlich nur ein Worka-
round für die Tatsache, dass man in C# statische Klassen nicht von anderen Klassen
ableiten kann.
2. Möchte man eine bestimmte Anzahl Instanzen dieser Klasse (Multiton), so kann man
einfach weitere statische öffentliche Instanzfelder hinzufügen.
<Platzhalter> public static readonly Singleton Instance2 = new Singleton()
;

22.13.3. Grafisch
22.13.3.1. Model-View-ViewModel pattern

Model-View-ViewModel pattern
http://www.codeproject.com/KB/WPF/FirefoxLikeSearchWithMVVM.aspx

139
22. C#

22.14. Rezepte

22.14.1. Datenaustausch mit C++

22.14.1.1. Marshaling

Eine Übersicht von Funktionen zum konvertieren von Datentypen zwishen managed C#
und C++/CLI ist in Abschnitt 21.2.1 aufgeführt.

22.14.1.2. P/Invoke

22.14.2. Threading

Lesenswert sind die Artikel von Sacha Barber auf www.codeproject.com:


• Introduction into threading in .NET
• Lifecyle Of Threads/Threading Opportunities/Traps
• Synchronization
• Thread Pools
• Threading in UIs (Winforms / WPF / Silverlight)
• The Future Of Threading (Task Parallel Library), noch nicht fertig, s. http://www.
codeproject.com/KB/threads/ThreadingDotNet2.aspx für einen Querverweis.
Eine Einfügung zum Multithreading gibt es in The Practical Guide to Multithreading
- Part 1 von Ajay Vijayvargiya auf codeproject. Weiterhin behandeln die Snippets ab
Abschnitt 22.3.2 das Thema Threads.

22.14.2.1. Unterbrechen von Threads

Hauptartikel: http://www.codeproject.com/KB/threads/ThreadingDotNet2.aspx

Pause There used to be a way to pause threads using the Pause() method. But this is now
deprecated, so you must use alternative methods, such as WaitHandles. To demonstrate
this there is a combined application that covers Pause/Resume and Abort of background
threads

Resume There used to be a way to pause threads using the Resume() method. But
this is now deprecated, so you must use alternative methods, such as WaitHandles. To
demonstrate this there is a combined application that covers Pause/Resume and Abort of
background threads

140
22.14. Rezepte

Abort First let me state that there is an Abort() method, but this is not something you
should use likely (an in my own opinion at all). I would just like to first quote 2 reputable
sources on the dangers of using the Abort() method
"A blocked thread can also be forcibly released via its Abort method. This
has an effect similar to calling Interrupt, except that a ThreadAbortException
is thrown instead of a ThreadInterruptedException. Furthermore, the exception
will be re-thrown at the end of the catch block (in an attempt to terminate the
thread for good) unless Thread.ResetAbort is called within the catch block. In
the interim, the thread has a ThreadState of AbortRequested.
The big difference, though, between Interrupt and Abort, is what happens
when it’s called on a thread that is not blocked. While Interrupt waits until
the thread next blocks before doing anything, Abort throws an exception on
the thread right where it’s executing – maybe not even in your code. Aborting
a non-blocked thread can have significant consequences"
Threading in C#, Joseph Albahari.
" A common question that emerges once you have kicked off some concurrent
work is: how do I stop it? Here are two popular reasons for wanting to stop
some work in progress:
You need to shut down the program. The user cancelled the operation. In
the first case, it is often acceptable to drop everything mid flow and not bother
shutting down cleanly, because the internal state of the program no longer
matters, and the OS will release many resources held by our program when
it exits. The only concern is if the program stores state persistently - it is
important to make sure that any such state is consistent when our program
exits. However, if we are relying on a database for such state, we can still
often get away with abandoning things mid flow, particularly if we are using
transactions - aborting a transaction rolls everything back to where it was
before the transaction started, so this should be sufficient to return the system
to a consistent state.
There are of course cases where dropping everything on the floor will not
work. If the application stores its state on disk without the aid of a database,
it will need to take steps to make sure that the on-disk representation is consis-
tent before abandoning an operation. And in some cases, a program may have
interactions in progress with external systems or services that require explicit
cleanup beyond what will happen automatically. However, if you have designed
your system to be robust in the face of a sudden failure (e.g. loss of power)
then it should be acceptable simply to abandon work in progress rather than
cleaning up neatly when shutting the program down. (Indeed there is a school
of thought that says that if your program requires explicit shutdown, it is not
sufficiently robust - for a truly robust program, sudden termination should al-
ways be a safe way to shut down. And given that, some say, you may as well
make this your normal mode of shutdown - it’s a very quick way of shutting
down!)
User-initiated cancellation of a single operation is an entirely different matter
however.

141
22. C#

If the user chooses to cancel an operation for some reason - maybe it is taking
too long - she will expect to be able to continue using the program afterwards.
It is therefore not acceptable simply to drop everything on the floor, because
the OS is not about to tidy up after us. Our program has to live with its
internal state after the operation has been cancelled. It is therefore necessary
for cancellation to be done in an orderly fashion, so that the program’s state is
still internally consistent once the operation is complete.
Bearing this in mind, consider the use of Thread.Abort. This is, unfortuna-
tely, a popular choice for cancelling work, because it usually manages to stop
the target thread no matter what it was up to. This means you will often see
its use recommended on mailing lists and news groups as a way of stopping
work in progress, but it is really only appropriate if you are in the process of
shutting down the program, because it makes it very hard to be sure what state
the program will be in afterwards. "
How To Stop a Thread in .NET (and Why Thread.Abort is Evil), Ian Griffiths.
So with all this in mind, I have created a small application which I believe to be a well
behaved worker thread, that allows the user to carry out some background work, and
Pause/Resume and Cancel it, all safely and easily. Its not the only way to do this, but it’s
a way.
Let see a small example (attached demo ThreadResumePause_StopUsingEventArgs pro-
ject)
Unfortunately I had to include some UI code here, to allow the user to click on different
buttons for Pause/Resume etc etc, but I shall only include the parts of the UI code that I
feel are relevant to explaining the subject
So first here is the worker thread class, one important thing to note is the usage of the
volatile keyword.
The volatile keyword indicates that a field can be modified in the program by something
such as the operating system, the hardware, or a concurrently executing thread.
The system always reads the current value of a volatile object at the point it is requested,
even if the previous instruction asked for a value from the same object. Also, the value of
the object is written immediately on assignment.
The volatile modifier is usually used for a field that is accessed by multiple threads without
using the lock statement to serialize access. Using the volatile modifier ensures that one
thread retrieves the most up-to-date value written by another thread.
using System;
using System.ComponentModel;
using System.Threading;

namespace ThreadResumePause_StopUsingEventArgs
{

public delegate void ReportWorkDoneEventhandler(object sender,


WorkDoneCancelEventArgs e);

142
22.14. Rezepte

/// <summary>
/// This class provides a background worker that finds prime numbers, that
/// are reported to the UI via the ReportWorkDone event. The UI may pause
/// the worker by calling the Pause() method, and may resume the worker by
/// calling the Resume() method. The UI may also cancel the worker by
setting
/// the ReportWorkDone events event args Cancel property to true.
/// </summary>
public class WorkerThread
{

private Thread worker;


public event ReportWorkDoneEventhandler ReportWorkDone;
private volatile bool cancel = false;
private ManualResetEvent trigger = new ManualResetEvent(true);

//ctor
public WorkerThread()
{

//Do the work, start the thread


public void Start(long primeNumberLoopToFind)
{
worker = new Thread(new ParameterizedThreadStart(DoWork));
worker.Start(primeNumberLoopToFind);
}

//Thread start method


private void DoWork(object data)
{

long primeNumberLoopToFind = (long)data;

int divisorsFound = 0;
int startDivisor = 1;

for (int i = 0; i < primeNumberLoopToFind; i++)


{
//wait for trigger
trigger.WaitOne();

divisorsFound = 0;
startDivisor = 1;

//check for prime numbers, and if we find one raise

143
22. C#

//the ReportWorkDone event


while (startDivisor <= i)
{
if (i % startDivisor == 0)
divisorsFound++;
startDivisor++;
}

if (divisorsFound == 2)
{

WorkDoneCancelEventArgs e =
new WorkDoneCancelEventArgs(i);
OnReportWorkDone(e);
cancel = e.Cancel;

//check whether thread should carry on,


//perhaps user cancelled it
if (cancel)
return;
}
}
}

/// <summary>
/// make the worker thread wait on the ManualResetEvent
/// </summary>
public void Pause()
{
trigger.Reset();
}

/// <summary>
/// signal the worker thread, raise signal on
/// the ManualResetEvent
/// </summary>
public void Resume()
{
trigger.Set();
}

/// <summary>
/// Raise the ReportWorkDone event
/// </summary>
protected virtual void OnReportWorkDone(WorkDoneCancelEventArgs e)
{
if (ReportWorkDone != null)

144
22.14. Rezepte

{
ReportWorkDone(this, e);
}
}
}

//Simple cancellable EventArgs, that also exposes


//current prime number found to UI
public class WorkDoneCancelEventArgs : CancelEventArgs
{
public int PrimeFound { get; private set; }

public WorkDoneCancelEventArgs(int primeFound)


{
this.PrimeFound = primeFound;
}
}

And here is the relevant parts of the UI code (Winforms C#). Note that I have not checked
whether an Invoke is actually required before doing an Invoke.
MSDN says the following about the Control.InvokeRequired Property :
Gets a value indicating whether the caller must call an invoke method when making method
calls to the control because the caller is on a different thread than the one the control was
created on.
Controls in Windows Forms are bound to a specific thread and are not thread safe. The-
refore, if you are calling a control’s method from a different thread, you must use one of
the control’s Invoke methods to marshal the call to the proper thread. This property can
be used to determine if you must call an invoke method, which can be useful if you do not
know what thread owns a control.
So one could use this to determine if an Invoke is actually required. Calling InvokeRequi-
red/Invoke/BeginInvoke/EndInvoke are all thread safe
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;

namespace ThreadResumePause_StopUsingEventArgs

145
22. C#

{
public partial class Form1 : Form
{
private WorkerThread wt = new WorkerThread();
private SynchronizationContext context;
private bool primeThreadCancel = false;

public Form1()
{
InitializeComponent();
//obtain the current SynchronizationContext
context = SynchronizationContext.Current;
}

void wt_ReportWorkDone(object sender, WorkDoneCancelEventArgs e)


{

//+++++++++++++++++++++++++++++++++++++++++++++++++++++
//NOTE : This would also work to marshal call to UI thread
//+++++++++++++++++++++++++++++++++++++++++++++++++++++

//this.Invoke(new EventHandler(delegate
//{
// lstItems.Items.Add(e.PrimeFound.ToString());
//}));

//marshal call to UI thread


context.Post(new SendOrPostCallback(delegate(object state)
{
this.lstItems.Items.Add(e.PrimeFound.ToString());
}), null);

//should worker thread be caneclled, has user clicked cancel button?


e.Cancel = primeThreadCancel;
}

private void btnStart_Click(object sender, EventArgs e)


{
//start the worker and listen to its ReportWorkDone event
wt.Start(100000);
wt.ReportWorkDone +=
new ReportWorkDoneEventhandler(wt_ReportWorkDone);
primeThreadCancel= false;
}

146
22.14. Rezepte

private void btnCancel_Click(object sender, EventArgs e)


{
primeThreadCancel= true;
}

private void btnPause_Click(object sender, EventArgs e)


{
wt.Pause();
}

private void btnResume_Click(object sender, EventArgs e)


{
wt.Resume();
}
}
}

And when run this looks like this

Abbildung 22.2.: Pause and Resuming Threads

So how does all this work. There are a few things in here that I has hoping not to get on
to until part4, but there is simply no way they could be avoided so Ill try and cover them
just enough. There are a couple of key concepts here, such as
• Start the worker thread using a input parameter

147
22. C#

• Marshall the worker threads output to UI thread


• Pause the worker thread
• Resume the worker thread
• Cancel the worker thread

Details

Start the worker thread using a input parameter This is easily acheived by the use
of a ParameterizedThreadStart where you simply start the thread, passing in an input
parameter like worker.Start(primeNumberLoopToFind) and then in the actual private void
DoWork(object data) method you can get the parameter value by using the data parameter,
like long primeNumberLoopToFind = (long)data

Marshall the worker threads output to UI thread The worker thread raises the Re-
portWorkDone event which is used by the UI, but when the UI attempts to use this
ReportWorkDone EventArg object properties to add items to the UI owned ListBox con-
trol, you will get a cross thread violation, unless you do something to marshal the thread
to the UI thread. This is know as Thread affinity, the thread that creates the UI controls
owns the contols, so any calls to the UI controls must go through the UI thread.
There are several ways of doing this, I am using the .NET 2.0 version of this which makes
use of a class called SynchronizationContext whicn I obtain with the Forms constructor.
Then I am free to marshall the worker threads results to the UI thread so that that may
be added to the UIs controls. This is done as follows
context.Post(new SendOrPostCallback(delegate(object state)
{
this.lstItems.Items.Add(e.PrimeFound.ToString());
}), null);

Pause the worker thread To pause the worker threac I make use of a Threading object
called a ManualResetEvent which may be used to cause a thread to both wait and resume its
operation, depending on the signal state of the ManualResetEvent. Basically in a signalled
state, the thread that is waiting on the ManualResetEvent will be allowed to continue, and
in a non signalled state the thread that is waiting on the ManualResetEvent will be forced
to wait. If we examine the relavent parts of the WorkerThread clas
We declare a new ManualResetEvent which starts in signalled state
private ManualResetEvent trigger = new ManualResetEvent(true);

We then attempt to wait for the signalled state in the workerThread DoWork method. As
the ManualResetEvent started out in the signalled state the thread proceeds to run

148
22.14. Rezepte

for (int i = 0; i< primeNumberLoopToFind; i++)


{
//wait for trigger
trigger.WaitOne();
....
....

So for the pause all we need to do, is put the ManualResetEvent in the non signalled state
(using the Reset method) which causes the worker to wait for the ManualResetEvent to
be put into a signalled state again
trigger.Reset();

Resume the worker thread The resume is easy, all we need to do, is put the ManualRe-
setEvent in the signalled state (using the Set method) which causes the worker to longer
wait for the ManualResetEvent, as it is in a signalled state again
trigger.Set();

Cancel the worker thread If you read Ian Griffiths article that I quoted above, you’ll
know that he simply suggests keep things as simple as possible, bu the use of a boolean
flag that is visible to both the UI and the worker thread. I have also done this but I use
a CancelEventArgs. Which allows the user to a cancel state for the worker thread directly
into the CancelEventArgs, such that the worker thread can use this to see if it should be
cancelled. Its works like this
1. Worker started
2. Worker raises WorkDone event, with CancelEventArgs
3. if user clicks cancel button, CancelEventArgs cancel is set
4. Worker thread sees CancelEventArgs cancel is set, so breaks out of its work
5. As there is no more work for the worker thread to do, it dies
I just feel this is a little safer than using the Abort() method

Threading Opportunities There are some very obvious threading opportunities, which
are as follows:

BackExecution Order If a task can successfully be run in the background, then it is a


candidate for threading. For example think of a search that needs to search 1000nds of
items for matching items, this would be an excellent choice for a background thread to do.

149
22. C#

External Resources Another example may be when you are using an external resource
such as a database/web service/ remote file system, where there may be a performance
penalty to pay for accessing these resources. By threading access to these sorts of things,
you are alleviating some of the overhead incurred by accessing these resources within a
single thread.

UI Resposiveness We can imagine that we have a User Interface (UI) that allows the user
to do various tasks. Some of these tasks may taks quite a long time to complete. To put
it in a real world context, let us say that the app is a email client application that allows
users to create / fetch emails. Fetching emails may take a while to complete, as the fetching
of emails must interact with a mail server to obtain the current users emails. Threading
the fetch emails code would help to keep the UI resposive to further user interactions. If
we dont thread tasks that take a long time in UIs and simply rely on the main thread, we
could easily end up in a situation where the UI is fairly unresponsive. So this is a prime
candidate for threading. As will see in a subsequent article, there is the issue of Thread
Affinity that needs to be considered when dealing with UIs, but I’ll save that discussion
for the subsequent article.

Socket Programming If you have ever done any Socket programming you may have had
to create a Server that was able to accept Clients. A typical arrangement of this may be a
chat application where the Server is able to accept n-many clients and is able to read from
Clients and write to Clients. This is largely achieved by Threads. Though I am aware that
there is an asycnronous socket API available within .NET, so you may choose to use that
instead of manually created threads. Sockets are still a valid threading example.
The best example of this that I have seen is located here at this link. The basic idea when
working with sockets is that you have a Server and n-many Clients. The server is run (main
thread is active) and then for each client connection request that is made, a new thread is
created to deal with the Client. At the Client end it is typical that a Client should be able
to receive messages from another Client (via the server) and the Client should also allow
the Client user to type messages.
Let us just think about the Client for a minute, the Client is able to send messages to
other Clients (via the Server), so that implies that there is a thread that needs to be able
to respond to data that the user enters. The Client should also be able to show messages
from other Clients (via the Server), so this also implies that this also needs to be on a
Thread. If we use the same Thread to listen to incoming messages from other Clients, we
would block the ability to type new data to send to other Clients.
I don’t won’t to labour on this example as it’s not the main drive of this article, but I
thought it may me worth talking about, just so you can see what sort of things you are up
against when you start to use Threads, and how they can actually be helpful

22.14.2.2. Abbrechen von Threads

Siehe 22.14.2.1.

150
22.14. Rezepte

22.14.2.3. Thread.Suspend()

’System.Threading.Thread.Suspend()’ is obsolete: ’Thread.Suspend has been deprecated...


For time eternal there has been a way to suspend (and by association resume) another
thread. It wasn’t until .NET 2.0 that someone took leadership and conceded that suspen-
ding another thread is not a safe thing to do. .NET 2.0 deprecates System.Threading.Thread.Suspend()
and Resume() (although, Resume() isn’t dangerous by association...).
Basically, Suspend() has no care that the thread may actually be managing one or more
complex invariants that can’t be changed atomically. Normally with complex invariants
synchronization is used to ensure while one thread is modifying the individual components
of an invariant another thread doesn’t try to access it. This is important because the
validity of an invariant is rarely atomic; meaning changing an invariant may take several
steps and may be in an unknown or invalid state between the first and the last step (a date
is a good example, setting the day and month is two steps; until both steps are complete
the date might be invalid). Suspending a thread circumvents the synchronization primitives
and cuts the thread off at the knees.
On a lower level, a thread may be performing a system-wide-synchronized operation like
locking a range of bytes in a file, writing to those bytes, unlocking those bytes, then closing
the file. If a thread is suspended before the unlock, that range of bytes will remain locked for
an indeterminate amount of time until the thread is resumed or the process terminates. Not
a good thing. Most threads don’t do all their work with low-level methods and call various
higher-level helper methods to perform tasks. This means the author of a thread’s routine
really has no way to determine whether their thread is in a "suspendable" state at any
given point in time. .NET complicates this even further by using locks during execution
of class constructors–increasing the likelihood that suspending a thread will cause dire
consequences.
Unfortunately, the documentation for Thread.Suspend() really doesn’t offer much in the
way of guidance on how to get around this issue with your own threads, it just casually
mentions classes Monitor, Mutex, Event and Semaphore; but doesn’t offer any detail on
how to use them to put your thread into a wait state–the equivalent of Suspend.
When I create threads they’re meant simply to let my UI be responsive or make use
of multiple CPUs (i.e. in both cases they’re CPU bound) and don’t have much need to
put a thread into a wait state manually. But, it’s not without merit. There are lots of
circumstances I don’t normally get into that could benefit from being able to put a thread
into a wait state. It’s also a common question; so, the following is small class that I created:
SuspendableThread.
namespace PRI.Threading

using System.Threading;

abstract class SuspendableThread

151
22. C#

#region Data

private ManualResetEvent suspendChangedEvent = new ManualResetEvent(


false);

private ManualResetEvent terminateEvent = new ManualResetEvent(false);

private long suspended;

private Thread thread;

private System.Threading.ThreadState failsafeThreadState = System.


Threading.ThreadState.Unstarted;

#endregion Data

public SuspendableThread ( )

private void ThreadEntry ( )

failsafeThreadState = System.Threading.ThreadState.Stopped;

OnDoWork();

protected abstract void OnDoWork ( );

#region Protected methods

protected Boolean SuspendIfNeeded ( )

Boolean suspendEventChanged = suspendChangedEvent.WaitOne(0, true);

152
22.14. Rezepte

if (suspendEventChanged)

Boolean needToSuspend = Interlocked.Read(ref suspended) != 0;

suspendChangedEvent.Reset();

if (needToSuspend)

/// Suspending...

if (1 == WaitHandle.WaitAny(new WaitHandle[] {
suspendChangedEvent, terminateEvent }))

return true;

/// ...Waking

return false;

protected bool HasTerminateRequest ( )

return terminateEvent.WaitOne(0, true);

#endregion Protected methods

public void Start ( )

153
22. C#

thread = new Thread(new ThreadStart(ThreadEntry));

// make sure this thread won’t be automaticaly

// terminated by the runtime when the

// application exits

thread.IsBackground = false;

thread.Start();

public void Join ( )

if (thread != null)

thread.Join();

public Boolean Join ( Int32 milliseconds )

if (thread != null)

return thread.Join(milliseconds);

154
22.14. Rezepte

return true;

/// <remarks>Not supported in .NET Compact Framework</remarks>

public Boolean Join ( TimeSpan timeSpan )

if (thread != null)

return thread.Join(timeSpan);

return true;

public void Terminate ( )

terminateEvent.Set();

public void TerminateAndWait ( )

terminateEvent.Set();

thread.Join();

public void Suspend ( )

155
22. C#

while (1 != Interlocked.Exchange(ref suspended, 1))

suspendChangedEvent.Set();

public void Resume ( )

while (0 != Interlocked.Exchange(ref suspended, 0))

suspendChangedEvent.Set();

public System.Threading.ThreadState ThreadState

get

if (null != thread)

return thread.ThreadState;

return failsafeThreadState;

156
22.14. Rezepte

} // namespace

This thread class works a little differently than the run-time’s System.Threading.Thread
class in that you can’t just pass it a method from any-old place. Because we don’t want
just anyone getting at the implementation details used to suspend the thread, you have to
derive from SuspendableThread and override OnDoWork so your code can gain access to
helper methods.
This class has another feature. If you’re likely to want to initiate thread suspension exter-
nally, you’re likely to want to initiate thread termination externally as well. To that effect
this thread also has Terminate() and TerminateAndWait() methods that ask the thread to
terminate and will awaken the thread is suspended (something System.Thread.Suspend()
and System.Thread.Abort() won’t do).
Using this class is fairly simple. If you want a suspendable/terminatable thread you simply
create a new SuspendableThread-derived class and override OnDoWork with the following
pattern:
class MyThread : PRI.Threading.SuspendableThread

protected override void OnDoWork ( )

try

while (false == HasTerminateRequest())

Boolean awokenByTerminate = SuspendIfNeeded();

if (awokenByTerminate)

return;

// TODO: replace the following to lines

157
22. C#

Debug.WriteLine("doing␣some␣work...");

Thread.Sleep(450);

finally

// TODO: Replace the following line with thread

// exit processing.

Debug.WriteLine("Exiting␣ThreadEntry()...");

For this class to be useful you generally have to have an iterative algorithm that can test
for suspend/terminate during each iteration (the while loop in the above pattern).
To initiate thread suspension, simply call the SuspendableThread.Suspend() method–which
asynchronously suspend the thread. SuspendableThread.Resume() resumes the thread. For
terminate, generally you want to be able to determine when the thread has terminated.
If you want to do that asynchronously you use the SuspendableThread.Terminate() and
SuspendableThread.Join() methods. To start the terminate process Terminate() is called.
When your asynchronous work is done (i.e. you went on to do something else while the
thread was terminating) call Join() to block until the thread is terminated. If you don’t
need to, or don’t have anything to, do while the thread is terminating, use Suspend-
Thread.TerminateAndWait().
This class gives complete control of suspension and termination to the thread. So, use this
class with great care. You have to write your OnDoWork override in a way that won’t
cause deadlocks. If you don’t have an iterative process, this class isn’t for you. If each
of your iterations takes much time (more than say 500ms) then this class probably isn’t
for you either. If you can’t terminate in the middle of your process, this class also is
not for you. This class will not let the application terminate until the thread routine has
exited; so, be sure you initiate termination of the thread before the application exits or
you’ll get a deadlock. The class is a scaled-down version of System.Threading.Thread. It
doesn’t provide all the same goodies System.Threading.Thread does (partially for .NET
Compact Framework 2.0 support, and partially for readability) and is intended to be used
in limited scenarios. But, you can extend it to mirror some of System.Threading.Thread’s
functionality fairly easily–like Name and Priority properties.

158
22.14. Rezepte

This class was intentionally designed to be compatible with the .NET CF 2.0 (delete
Join(TimeSpan) before compiling) but has not been tested with .NET CF 2.0 (if you use
the class in .NET CF 2.0, please send me a note and I’ll update this post for the benefit
of other readers).
[30-Oct-06 Update: as it turns out, this class is not entirely .NET CF 2.0 compatible, please
contact me if you’re interested in a .NET CF 2.0 compatible version]
Von PeterRitchie bzw. im Google-Cache.
private ManualResetEvent trigger = new ManualResetEvent(true);

private ManualResetEvent trigger = new ManualResetEvent(true);

private ManualResetEvent trigger = new ManualResetEvent(true);

private ManualResetEvent trigger = new ManualResetEvent(true);

22.14.3. Kommandozeilen Programme


22.14.3.1. Die Ausgabe der Konsole umleiten

using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Timers;

namespace Jedzia.SolutionDiagrammer
{
public class ProcessRedirect
{
Collection<string> dieListe = new Collection<string>();

public void function()


{
Timer t = new Timer(150);
t.Elapsed += new ElapsedEventHandler(t_Elapsed);
t.Start();

ProcessStartInfo psi = new ProcessStartInfo("hehe.exe", "/d:␣depp");


psi.CreateNoWindow = true;
psi.UseShellExecute = false;
psi.RedirectStandardOutput = true;

psi.FileName = "ls";
psi.Arguments = "-l␣-R␣/cygdrive/d/Downloads";
Process p = new Process();

159
22. C#

p.StartInfo = psi;
p.OutputDataReceived += new DataReceivedEventHandler(
p_OutputDataReceived);
//string output = p.StandardOutput.ReadToEnd();
p.Start();
p.BeginOutputReadLine();
p.WaitForExit();
p.Dispose();
//Console.Write(output);
}

int lastcount = 0;
void t_Elapsed(object sender, ElapsedEventArgs e)
{
int cnt = 0;

lock (dieListe)
{
cnt = dieListe.Count;
}

if (cnt==lastcount)
{
return;
}

Console.WriteLine(e.SignalTime.Second + ":" + e.SignalTime.


Millisecond + "-T:" + cnt);
lastcount = cnt;
System.Threading.Thread.Sleep(10);

void p_OutputDataReceived(object sender, DataReceivedEventArgs e)


{
//Console.WriteLine(e.Data);
lock (dieListe)
{
dieListe.Add(System.Threading.Thread.CurrentThread.
ManagedThreadId + "!" + e.Data);
}
}

}
}

160
22.14. Rezepte

22.14.4. Quellcode Parsen


Ein Parser auf Basis von NRefactory (Abschnitt 22.10.2.1) ist unter http://code.google.
com/p/o2platform/source/browse/trunk/O2+-+All+Active+Projects/O2+Modules+Using+
3rd+Party+Dlls/O2_External_SharpDevelop/AST/?r=197 verfügbar.
-Anwendungsbeispiel wie in svnRevision-

161
22. C#

162
23. LLBLGen Pro

LLBLGen is a simple open source code generator for generating Microsoft SQL Server
stored procedures and source code in the .NET languages C# or VB.NET, created by
Solutions Design bv. The last version of LLBLGen, v1.21.2003.712, was released on July
12, 2003. The sourcecode of LLBLGen is no longer available online.

In 2003, LLBLGen was replaced by a commercial O/R mapper called LLBLGen Pro,
from the same company. Since the release of LLBLGen Pro, Solutions Design has stopped
the development of the open source tool LLBLGen, to continue the development of the
commercial O/R mapper LLBLGen Pro.

Hilfreiche Links:

• nHibernate versus LLBLGen Pro: http://stackoverflow.com/questions/1114215/


nhibernate-versus-llblgen-pro

• Homepage: http://www.llblgen.com/defaultgeneric.aspx

• Features http://www.llblgen.com/pages/features.aspx

• Download: http://www.llblgen.com/pages/demo.aspx

• Tutorial Videos: http://www.llblgen.com/pages/videos.aspx

LLBLGen Pro generates a complete data-access tier and business objects tier for multiple
target frameworks (in C# or VB.NET*), utilizing powerful O/R mapping technology and
a flexible task-based code generator, allowing you to at least double your productivity!

163
23. LLBLGen Pro

Key Features
' $
' $
Designer Runtime framework
• Most advanced O/RM Designer for .NET • True database independent code
New!
• Full entity type inheritance
• Entity Framework (v1 & v4) support New!
• Custom developer code is preserved
• NHibernate support (hbm & FluentNH)
New! • Linq support

• Linq to SQL support New! • Flexible concurrency mechanism


• Supports Model-first and Database-first de- • Derived table support
velopment New!
• Auditing support
• .NET 4.0 support New!
• Authorization support
• Model views New!
• Dependency injection mechanism
• Grouping of project elements New!
• Fast and compact serialization
• Linq-based project search New!
• Optimal and fast prefetch paths
• Value Type (DDD) support New!
• Hierarchical in-memory projections
• Multiple Database types in single project
New! • DbProviderFactory based New!

• XML based project file New! * Integrated • Support for Entity splitting New!
template editor New!
• Native Enum support New!
• Relational Model Data management New!
• Map Typed View on stored procedure result-
• Fine-grained project validation New! &set New! %
• Update / Create DDL SQL scripts New!

• Fast Text-DSL based Quick model New!


& %

LLBLGen Pro comes with a state-of-the-art visual O/R mapping designer to setup and
manage your project.

Using LLBLGen Pro means:

1. A drastic decrease of development time.

2. No mistakes made in writing ’plumbing’.

3. Using a tool developed by experts.

4. DAL and Business objects are immediately available.

5. More features are offered by default.

6. One designer to target multiple frameworks.

164
Databases supported: MS Access 2000/XP/2003/2007/2010, SQL Server 2000/2005/2008/2008R2/Expr
Server CE Desktop, Oracle 9i/10g/11g, PostgreSql 7.4+/8.x+, Firebird 1.5.x/2.x, IBM
DB2 7.x/8.x/9.x (not on AS/400), MySql 4.x,5.x (using Core Lab’s/DevArt MySql .NET
provider), Sybase Adaptive Server Enterprise (ASE)/SQL iAnywhere (ASA)
Languages supported: Code is generated in C# or VB.NET*. Generated code can be
used from any .NET language. Code is fully CLS compliant and VB.NET option expli-
cit/strict compliant.
O/R mapper frameworks supported: LLBLGen Pro Runtime Framework 3.0, Entity
Framework v1, Entity Framework v4, Linq to Sql, NHibernate 2.x (hbm.xml and Fluent-
NHibernate)
.NET versions supported: .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0

165
23. LLBLGen Pro

166
24. WPF
Windows Presentation Foundation (kurz WPF), auch bekannt unter dem Codenamen Ava-
lon, ist ein Grafik-Framework und Teil des .NET Frameworks 3.0 von Microsoft, das mit
Windows Vista ausgeliefert wird, sich aber auf Windows XP und Server 2003 nachinstal-
lieren lässt.
WPF stellt ein umfangreiches Modell für den Programmierer bereit. Dabei wird die Präsen-
tation und die Geschäftslogik getrennt, dies wird vor allem durch die Auszeichnungsspra-
che XAML (basierend auf XML) unterstützt. XAML beschreibt Oberflächen-Hierarchien
deklarativ als XML-Code. WPF-Anwendungen können sowohl Desktop- als auch Web-
Anwendungen sein und benutzen, wenn möglich, auch Hardwarebeschleunigung. Das Fra-
mework versucht, die verschiedenen Bereiche, die für die Präsentation wichtig sind (Benut-
zerschnittstelle, Zeichnen und Grafiken, Audio und Video, Dokumente, Typographie), zu
vereinen.
Zudem gibt es mit Microsoft Silverlight (ehemals WPF/E) eine Plattform, die explizit
für das Web entwickelt wurde. Silverlight setzt dabei nicht auf das .NET Framework auf,
sondern benutzt eine reduzierte Version dessen. Silverlight kann auch mit XAML entwickelt
werden.
http://de.wikipedia.org/wiki/Windows_Presentation_Foundation

24.1. XAML Editoren

24.1.1. Kaxaml
http://www.kaxaml.com/
Kaxaml is a lightweight XAML editor that gives you a "split view" so you can see both
your XAML and your rendered content (kind of like XamlPad but without the gigabyte of
SDK). Kaxaml is a hobby and was created to be shared, so it’s free! Feel free to download
and try it out. If you don’t like it, it cleans up nicely.
If you’re having problems with the installer or if you’re just a do-it-yourself kind of indivi-
dual, you can download the files you need as a zip.

167
24. WPF

168
25. Silverlight
http://silverlight.net/getstarted/

25.1. Tutorien

25.1.1. Animation in SilverLight, C# and Visual Studio 2008


Link
This article includes:
• To understand the basics of creating a Silverlight application using C# and Visual
studio 2008.
• To work with animations in Silverlight using XAML and C#.
• Identify the types of animations supported by Silverlight 2.0.
• Learn to use various properties of animations to create animated objects.

169
25. Silverlight

170
26. XNA + C#

XNA Creators Club Online: http://creators.xna.com/en-US/SearchResults.aspx?keyword=


Geometry%20Clipmaps

26.1. Begriffserklärungen

26.1.1. Grundlegendes

26.1.1.1. Vertex

Vertex (pl.: Vertices), kommt vom lateinischen vertere: drehen, wenden, und bedeutet zu-
nächst Wendepunkt, Scheitel; ebenso aber allgemeiner Punkt, Knoten – eine Stelle, wo
Richtungen sich treffen. Und noch allgemeiner: Punkt, Vektor, n-Tupel, (technischer) Da-
tensatz.

Rechnergrafik In der 3D-Computergrafik ist ein Vertex ein Eck- bzw. Scheitelpunkt eines
Primitivs und enthält neben einer Positionsangabe in Form eines 3D-Vektors meistens noch
andere Angaben wie zum Beispiel eine Farbe, Transparenz oder eine zweite Positionsanga-
be, die für andere Zwecke verwendet werden kann (z. B. Texturkoordinaten). Die meisten
Daten der Vertices werden durch das Shading über die zugehörigen Primitive interpoliert.
Polygonale Modellierung: Hier ist der Vertex ein Grundbaustein: Zwei Vertices ergeben
zusammen die Endpunkte einer Linie, drei Vertices definieren ein Dreieck, usw.
Die Umrechnung der Koordinaten der Vertices beispielsweise zur Projektion durch die
virtuelle Kamera auf den Bildschirm erfolgt zumeist durch Homogene Koordinaten.

26.1.1.2. Grafisches Primitiv

Der Begriff (grafisches) Primitiv (das, Pl. Primitive) wird in der Computergrafik verwen-
det. Er bezeichnet elementare ein-, zwei- oder dreidimensionale geometrische Formen, die
ein Bestandteil von grafischen Beschreibungssprachen (z. B. PCL oder SVG) sind. Aus
diesen meistens einfachen Primitiven lassen sich kompliziertere Formen zusammensetzen.
Der deutschen Sprache besser angepasste Begriffe sind Grundobjekt, grafische Grundform
oder Raumbezugsgrundform (siehe auch ISO 19107).

171
26. XNA + C#

Beispiele und Anwendungen Welche Formen zu grafischen Grundformen gehören, hängt


vom verwendeten Programm oder der Beschreibungssprache ab. In der 2D-Computergrafik
sind Punkte, Strecken, Polygone, Kreise und Ellipsen gebräuchlich. In der 3D-Computergrafik
sind Dreiecke ( triangles ) oder Polygone ( polygons ) die gebräuchlichsten Primitiven,
wenngleich auch Punktwolken und weitere Formen Verbreitung finden.

Grundformen werden bei vektorgestützter Grafikbearbeitungssoftware und 3D-Modellierungswerkzeuge


verwendet. In der 2D-Computergrafik gibt es für Grundformen Algorithmen zur Rasterung;
in der 3D-Computergrafik werden sie von Renderern verwendet.

26.1.1.3. Polygon

Polygon (v. griech.: polýs = viel + gonía = Winkel) oder auch Vieleck ist ein Begriff aus der
Geometrie und dabei insbesondere der Planimetrie. Ein Polygon erhält man, indem man
mindestens drei voneinander verschiedene Punkte in einer Zeichenebene durch Strecken
miteinander verbindet, sodass durch den entstandenen Linienzug eine zusammenhängen-
de Fläche (Figur) umschlossen wird. Auch diese so entstandene Fläche wird oft Polygon
genannt. Dreiecke, Vierecke und Sechsecke sind aus dem Alltag bekannte Beispiele für
Polygone.

26.1.1.4. Mesh, Polygon mesh

Zur Speicherung von Polygonen und polygonalen Netzen, wie sie in der 3D-Computergrafik
verwendet werden, gibt es eine Reihe bekannter Datenstrukturen. Die bekanntesten Struk-
turen sind die Knotenliste, Kantenliste, Winged Edge und die doppelt verkettete Kanten-
liste (doubly connected halfedge list).

Knotenliste Bei der Knotenliste werden die Punkte in einer separaten Punktliste ab-
gelegt. Eine Fläche wird dann als eine Liste von Zeigern auf die Punkte in dieser Liste
definiert. Dadurch wird eine Trennung zwischen der Geometrie (den Koordinaten der Kno-
ten) und der Topologie (welche Knoten verbinden welche Kanten, welche Kanten begrenzen
welche Flächen) realisiert.

Kantenliste Die Nachteile der Knotenliste werden bei der Kantenliste dadurch umgangen,
dass alle Kanten in einer separaten Liste gespeichert werden. Facetten werden hier als
Zeiger auf die Kantenliste definiert. Neben dem Anfangs- und Endpunkt werden auch die
maximal zwei zugehörigen Facetten für jede Kante abgelegt. Die Reihenfolge der Angabe
der Eckpunkte für Kanten legt eine Orientierung fest und bestimmt bei Facetten, wo Innen
und wo Außen ist.

172
26.1. Begriffserklärungen

Datenstruktur Vorteile Nachteile

• Kanten werden mehrmals durch-


laufen und ausgegeben

• Suche nach zu Kanten gehören-


den Facetten nicht effizient mög-
• Trennung von Geometrie und To- lich (nur mit erschöpfender Suche
pologie möglich) Für alle Kanten in F1 (je-
Knotenliste des Knotenpaar) suchen wir in al-
• minimale Redundanzen (Punkte len weiteren Facetten, ob sie ent-
werden nur 1x abgelegt) halten ist, wenn Nein dann Rand-
kante)

• Suchen nach Facetten welche eine


Kante / Ecke enthalten ist ineffizi-
ent

• Trennung von Geometrie und To-


pologie • Suchen nach Facetten welche eine
Kantenliste • Schnelle Bestimmung von Rand- Kante / Ecke enthalten ist ineffizi-
kanten (Kanten mit nur einem Ver- ent
weis auf Facette)

Generell gilt für Knoten- und Kantenlisten dass die Suche ausgehend von einer Facette
nach untergeordneten Objekten wie Kanten und Knoten sehr effizient durchführbar ist. In
umgekehrter Richtung verhält es sich jedoch gegenteilig. So ist z.B. die Suche nach allen
Facetten welche eine bestimmte Ecke enthalten immer noch nur durch eine erschöpfende
Suche möglich.

Siehe auch http://de.wikipedia.org/wiki/Polygonnetz.

26.1.1.5. Octree

Ein Octree (von lat. oct „acht“, und engl. tree „Baum“) ist eine Datenstruktur der Infor-
matik. Ein Octree ist ein gewurzelter Baum, dessen Knoten jeweils entweder acht direkte
Nachfolger oder gar keine Nachfolger haben.

Octrees werden hauptsächlich in der Computergrafik verwendet, um dreidimensionale Da-


tensätze hierarchisch zu untergliedern. Die Wurzel repräsentiert dabei alle Daten, jeder
andere Knoten repräsentiert einen Oktanten der Daten seines direkten Vorgängers. Sie
eignen sich dadurch zur Umsetzung der Strategie Teile und herrsche.

173
26. XNA + C#

Abbildung 26.1.: Schema eines Octrees. Links die Unterteilung des würfelförmigen Volu-
mens, rechts der resultierende Octree.

Octrees können als Erweiterung von Binärbäumen und Quadtrees angesehen werden: Bi-
närbäume untergliedern eindimensionale Daten, Quadtrees zweidimensionale und Octrees
dreidimensionale; eine Erweiterung auf beliebig-dimensionale Daten ist denkbar, praktisch
aber nicht im Einsatz. Eine verallgemeinerte Version, bei der die Dimensionen nicht fest-
gelegt sind, ist der B-Baum.
Allgemeine Anwendungsgebiete für Octrees sind:
• Bildrepräsentation
• Raumindizierung (z. B. in Geografischen Informationssystemen)
• Gruppierung von Partikeln in Molekulardynamik/DEM-Simulationen
• Hidden Surface Removal von Terraindaten (Abschnitt 26.1.1.6).
• Kollisionserkennung in 3D-Computerspielen
• Hierarchical Splatting
Der TerrainSceneManager (Abschnitt 26.2.1) von Ogre ist z.B. auf einem OctreeScene-
Manager aufbauend.

26.1.1.6. Sichtbarkeitsproblem

Auch „Hidden surface determination“ oder „View frustum culling“ genannt.


Beim Rendern in der Computergrafik ist das Sichtbarkeitsproblem die Fragestellung, wel-
che Teile von Oberflächen in einer 3D-Szene bei der Projektion auf die zweidimensionale

174
26.1. Begriffserklärungen

Anzeigefläche sichtbar sind. Als Verdeckungsberechnung oder Sichtbarkeitsentscheid wird


dementsprechend ein Vorgehen bezeichnet, mit dem nicht sichtbare Oberflächen erkannt
und aussortiert werden und so das Sichtbarkeitsproblem gelöst wird. Das Sichtbarkeitspro-
blem war eines der ersten wichtigen Probleme der Computergrafik.
Die Verdeckungsberechnung ist zum korrekten Rendern einer 3D-Szene notwendig, weil
Oberflächen, die vom Betrachter nicht sichtbar sind, auch nicht dargestellt werden sollten.
Viele Verfahren beschleunigen zusätzlich das Rendern, weil nicht sichtbare Oberflächen von
der weiteren Verarbeitung durch die Grafikpipeline ausgeschlossen werden können.

Verfahren Nach Ivan Sutherland können Algorithmen zur Verdeckungsberechnung in


Objektraumverfahren, Bildraumverfahren und List-Priority-Verfahren eingeteilt werden.[1]
Während bei den Objektraumverfahren die Sichtbarkeiten direkt anhand der Objekte ana-
lytisch und unabhängig vom Ausgabegerät berechnet werden, wird bei den Bildraumver-
fahren die Verdeckungsberechnung für jede einzelne Bild- oder Pixelposition separat durch-
geführt. List-Priority-Algorithmen berechnen zunächst anhand der Objekte eine Sichtbar-
keitsreihenfolge oder „Priorität“ im Voraus und färben anschließend die Pixel des Bildes
ein; sie arbeiten also teils im Objekt- als auch im Bildraum.
Heutige Grafikhardware nutzt zur Verdeckungsberechnung meist den Z-Buffer; bei der
realistischen Bildsynthese wird häufig Raytracing verwendet.
• Objektraumverfahren

◦ Roberts (1963)
Von Roberts[2] stammt das erste bekannte Verfahren zur Verdeckungsberech-
nung.[3] Roberts’ Algorithmus testet jede Polygonkante gegen jedes Polyeder,
um zu testen, ob sie (teilweise oder vollständig) verdeckt wird. Dieser Test wird
durchgeführt, indem ein lineares Gleichungsproblem gelöst wird. Roberts’ Algo-
rithmus funktioniert nur mit konvexen Polyedern.
◦ Appel, Loutrel, Galimberti, Montanari (1967/69)
Appels Algorithmus[4] steht stellvertretend für eine Klasse von Algorithmen,
die die sichtbaren Kantensegmente ermitteln. Im Unterschied zum Roberts-
Algorithmus können sie auch die Verdeckung durch einzelne Polygone, nicht
nur durch ganze Polyeder, berechnen. Appel definiert die quantitative Unsicht-
barkeit eines Punkts als die Anzahl maßgeblicher Polygone, die ihn verdecken.
Wenn eine Kante hinter ein verdeckendes Polygon gleitet, wird die quantita-
tive Unsichtbarkeit um 1 erhöht, und wenn sie vom Polygon nicht mehr ver-
deckt wird, um 1 erniedrigt. Um das Sichtbarkeitsproblem zu lösen, muss die
quantitative Unsichtbarkeit jedes Punkts auf jeder Kante berechnet werden; ein
Punkt ist sichtbar, wenn der Wert 0 beträgt. Die Algorithmen von Loutrel[5]
und Galimberti und Montanari[6] arbeiten sehr ähnlich.
◦ Weiler, Atherton (1977)
Der Weiler-Atherton-Algorithmus[7] bestimmt die Sichtbarkeit, indem er vom a
priori nächstgelegenen Polygon ausgeht und alle Polygone gegen dieses Polygon
clippt. Dadurch werden die Polygone entlang der Grenze vom sichtbaren und

175
26. XNA + C#

unsichtbaren Teil aufgeteilt und die unsichtbaren Teile verworfen. Am Ende


liefert der Algorithmus eine Liste von sichtbaren Polygonteilen zurück.
◦ Haloed Lines (1979)
Der Haloed-Line-Algorithmus von Appel, Rohlf und Stein[8] arbeitet ausschließ-
lich mit Liniensegmenten und ist nicht von den Objekten, die sich aus ihnen
zusammensetzen, abhängig. Es handelt sich also um einen Algorithmus zum
Sichtbarkeitsentscheid von Linien (Visible Line Determination) und nicht von
Oberflächen (Visible Surface Determination). Jedes gezeichnete Liniensegment
erhält auf beiden Seiten eine Kontur („Halo“), die die dahinter liegenden Linien
teilweise verdeckt.
• List-Priority-Verfahren
◦ Schumacker, Brand, Gilliland, Sharp (1969)
Schumackers Algorithmus[9] war die erste Echtzeitlösung des Sichtbarkeitspro-
blems und war für Flugsimulationen optimiert.[10] Er ist nur auf konvexe Po-
lyeder anwendbar. Der Algorithmus verwendet eine Prioritätsliste, die haupt-
sächlich von der Szene und kaum von der Betrachterposition abhängig ist. Aus
Effizienzgründen wird die Geometrie in sogenannte Cluster zusammengefasst.
◦ Depth Sort (1972)
Die Idee des Depth-Sort-Algorithmus von Newell, Newell und Sancha[11] besteht
darin, alle Polygone nach ihrer kleinsten z-Koordinate zu sortieren, eventuelle
Uneindeutigkeiten bei überlappenden Polygonen durch Teilung der Polygone zu
lösen, und schließlich jedes Polygon, beginnend mit dem hintersten, zu rastern.
Eine vereinfachte Version des Algorithmus, bei der uneindeutige Fälle ignoriert
werden, wird oft Maleralgorithmus genannt. Er ist nur für Anwendungen geeig-
net, bei denen die Objekte nicht entlang der z-Achse überlappen.
◦ BSP-Algorithmus (1980)
Der BSP-Algorithmus von Fuchs, Kedem und Naylor[12] ist eine Verbesserung
von Schumackers Algorithmus, bei der die Zusammenfassung von Objekten in
Cluster automatisiert wird. Hierzu wird ein BSP-Baum aufgebaut.
• Bildraumverfahren
◦ Scanline-Algorithmen (Ende 1960er)
Es wurden mehrere ähnliche Scanline-Algorithmen veröffentlicht.[13][14][15][16]
Alle diese Verfahren führen zunächst eine Sortierung entlang der y-Achse und
dann entlang der x-Achse durch, um schließlich für jedes Pixel das sichtbare
Polygon mit der geringsten Entfernung zum Betrachter auszuwählen. Da sich
von Bildzeile zu Bildzeile die Konfiguration der Polygone nur wenig ändert,
werden die für jede Bildzeile „aktiven“ Polygone in einer Liste eingetragen, die
bei Bedarf aktualisiert wird.
◦ Raytracing (Ende 1960er)
Der Raytracing-Algorithmus, veröffentlicht durch Appel, Goldstein und Na-
gel[17][18][19], basiert auf der „Aussendung“ von Strahlen vom Beobachter aus,

176
26.1. Begriffserklärungen

die durch die Bildebene in die Szene geschickt werden. Jeder Strahl wird gegen
alle Primitiven getestet und gegebenenfalls die Entfernung berechnet. Das sicht-
bare Objekt ist dasjenige mit der geringsten Entfernung. Für den Raytracing-
Algorithmus sind zahlreiche Beschleunigungstechniken entwickelt worden, die
die Zahl der zu testenden Objekte drastisch reduzieren. Raycasting ist eine ein-
geschränkte Variante von Raytracing, die sich nur für Szenen eignet, die aus an
den Achsen ausgerichteten, gleich hohen Rechtecken bestehen.
◦ Warnock (1968)
Der Warnock-Algorithmus[20] basiert auf der Annahme, dass das Bild in recht-
eckige Regionen unterteilt werden kann, in denen höchstens ein Polygon den
Bildinhalt bestimmt. Ist dies in einer Region nicht der Fall, so wird sie unter-
teilt. Die Unterteilung setzt sich so lange rekursiv fort, bis die Regionen nur
noch ein Pixel einschließen.
◦ Z-Buffer (1974)
Edwin Catmulls sehr einfacher Z-Buffer-Algorithmus[21] speichert für jedes Pi-
xel eine zusätzliche Tiefeninformation. Beim Rastern jedes Objekts wird der
Pixel-Farbwert sowie der Wert im Z-Buffer aktualisiert, wenn die Entfernung
des entsprechenden Punkts des Objekts geringer als der aktuelle Z-Buffer-Wert
ist.

Siehe Wikipedia - Sichtbarkeitsproblem.

26.1.2. Texturen

26.1.2.1. Mip Mapping

Mip Mapping ist eine Antialiasing-Technik für Texturen. Sie wird in modernen 3D-Grafikchips
zur Verbesserung der Bildqualität, aber auch der Geschwindigkeit eingesetzt.

Probleme bei der Texturskalierung Das Problem beim Texture Mapping von Objekten
besteht darin, dass man diese von nah und fern betrachten können soll. Korrelativ zum
Erscheinungsbild des Objekts muss also auch die Textur ihre Form und Größe verändern:
• Maxifikation - die Textur muss stark vergrößert werden, um das Objekt zu bedecken,
wenn es nah am Betrachter liegt.
• Minifikation - die Textur muss stark verkleinert werden, wenn das Objekt sehr weit
vom Betrachter entfernt ist (im Extremfall ist das Objekt dann nur noch genau 1
Pixel groß)
Werden keine Gegenmaßnahmen ergriffen, treten bei diesen Skalierungen Aliasing-Effekte
auf, die als Artefakte sehr störend sind, besonders bei Mustern mit schrägen oder gerun-
deten Linien, als Verzerrungen oder Flimmern (Moiré-Effekte).

177
26. XNA + C#

MIP-Map MIP ist eine Abkürzung für multum in parvo, was soviel bedeutet wie viel auf
kleinem Platz. Eine MIP-Map (auch Bildpyramide) ist eine Folge von Rasterbildern des-
selben Motivs, jedoch mit abnehmender Auflösung. Die Kantenlänge jedes Bildes ist genau
halb so groß wie die des Vorgängerbildes. Das kleinste Bild hat je nach Implementierung
eine Größe von 1x1 oder 2x2 Pixel. Daraus folgt, dass alle Bilder quadratisch sein müssen
und als Kantenlänge eine 2er-Potenz haben. Man spricht bei diesen Stufen auch von Level
of Detail (LOD).

Abbildung 26.2.: Beispiel für eine MIP-Map. Die Kantenlänge des größten Bildes beträgt
28 = 256 Pixel.

MIP-Maps haben einen höchstens um 1/3 höheren Speicherbedarf als das größte Bild
alleine:


1 1 4 1
( )i =
X
1 = = 1 + (geometrische Reihe)
i=0 4 1− 4
3 3

MIP-Maps können einfach berechnet werden, indem für jedes Pixel des verkleinerten Bil-
des der Mittelwert der vier korrespondierenden Pixel des Ausgangsbildes berechnet wird.
Dies ist rekursiv für alle weiteren Stufen durchzuführen. Dieses Verfahren wird häufig im-
plizit von der Grafikhardware beim Texturladen angewandt, um Speicherbandbreite zu
sparen. Eine aufwändigere aber zu besserer Bildqualität führende Methode zur MIP-Map-
Berechnung bietet die Fouriersynthese.

MIP-Mapping als Texturfilter Bei der Minifikation von Texturen beim Texture Map-
ping wird dasjenige LOD ausgewählt, bei welchem ein Texel groß genug ist, um ein Pixel
vollständig zu überdecken.
Auf diese Weise ist sichergestellt, dass jedes Texel der Ursprungstextur Einfluss auf die
gestauchte Textur hat und somit keine abtastbedingten Alias-Effekte auftreten. Leider
führen gerade die Sprünge zwischen den LODs zu Unstetigkeiten, die als Linien zwischen
den MIP-Bändern deutlich sichtbar sind. Jedes dieser Bänder hat einen Schärfegrad, der

178
26.1. Begriffserklärungen

sich stark von den Nachbarbändern unterscheidet. Außerdem kommt es bei jeder Stau-
chung, die keiner 2er Potenz entspricht, und auch bei anisotropen Verzerrungen immer zu
einem übermäßigen Schärfeverlust.

Weblinks 3DCenter-Artikel "Grafik-Filter: Bilinear bis Anisotrop im Detail"

26.1.2.2. Multi-Texturing, Texture splatting

Diese Technik ermöglicht das Verwenden mehrerer Texturen gleichzeitig für ein und das-
selbe Dreieck. Damit lassen sich z.B. Texturen aufhellen, oder eine Wolkensimulation im-
plementieren. Stellen sie sich eine Wand vor, die mit Pflanzen bewachsen ist. Ohne Multi-
Texturing müsste der Grafiker eine riesige Textur anfertigen, damit die Wand auch nur
halbwegs realistisch aussieht. Danks Multi-Texturing ist es möglich, mehrere Texturen
übereinander zu blenden. Damit kann auch mit kleineren Texturen ein höherer Detail-
grad erreicht werden! Wird Multi-Texturing nicht in Hardware unterstützt (Single-Pass), so
muss man Multi-Pass-Rendering verwenden. Das heisst, der Rendervorgang wird in mehre-
re Passes (‚Durchgänge’) unterteilt. Im ersten Durchgang wird das Dreieck mit der ersten
Textur, im Zweiten mit einer anderen gezeichnet. Wieviele Texturen gleichzeitig gesetzt
werden können hängt vom jeweiligen Grafikadapter ab. Die Texturkoordinaten können da-
bei für jede Schicht einzeln festgelegt werden. Es ist sogar möglich, die Texturkoordinaten
zu transformieren (in Echtzeit!), ohne die Werte erst aus dem Vertex-Buffer lesen zu müs-
sen! Jede Texturschicht hat einen Operator und zwei bis drei Argumente. Außerdem gibt
es zwei so genannte Register – ein temporäres und ein Standardregister- , in welche das
Ergebnis zwischengespeichert werden kann. Das folgende Beispiel sollte den Sachverhalt
verständlich machen:
1. Schicht: 1. Farbargument = Streufarbe
2. Farbargument = Textur
Farboperator = Multiplikation
Zielregister = Standardregister
2. Schicht: 1. Farbargument = Standardregister
2. Farbargument = Textur
Farboperator = Subtraktion
Zielregister = Standardregister
Die Streu- und Texturfarbe der ersten Schicht werden multipliziert und im Standardre-
gister zwischengespeichert. Die Texturfarbe der zweiten Schicht wird von der Farbe im
Standardregister subtrahiert und schlussendlich wieder im Standardregister abgelegt. Die
Farbe, die schlussendlich im Standardregister vorhanden ist, wird am Bildschirm sichtbar.
Dabei gibt es noch zu sagen, dass Farbe und Alphakanäle auch einzeln behandelt werden
können. Bild 26.3 auf der nächsten Seite soll die Funktionsweise von Multi-Texturing noch
einmal verdeutlichen.

26.1.2.3. Volumentexturen

Nebst der vertrauten zweidimensionalen Texturen gibt es auch noch so genannte Volu-
mentexturen. Man kann sie sich eigentlich genau gleich wie herkömmliche Texturen vor-

179
26. XNA + C#

Abbildung 26.3.: Texturschichten bei einer Multi-Textur

stellen, nur dass sie aus verschiedenen Schichten bestehen. Sie haben also zusätzlich eine
w-Koordinate, welche die Tiefe angibt.

26.1.2.4. Tipps und Hinweise

• Texturen sollte man am besten gleich im Grafikkartenspeicher ablegen (sog. Video


RAM), weil dort die Zugriffszeiten sehr gering sind (oft < 3 ns)
• VRAM gut einteilen (nicht 128 MB VRAM voraussetzen!)
• Texturen erst dann laden, wenn sie wirklich benötigt werden. Unnötige Texturen
sofort wieder aus dem VRAM löschen.
• Am besten eine Textur setzen, dann alle Polygone mit dieser Textur rendern, dann
die nächste Textur setzen, usw.
• es ist empfehlenswert, kleine Texturen zu einer Grösseren zusammenzufassen

180
26.1. Begriffserklärungen

• Texturen sollten in der Regel nicht grösser als 1024 x 1024 Pixel sein
• Besser quadratische Texturen verwenden, deren Kantenlängen eine Potenz von zwei
sind (also 512 x 512, 256 x 256, 128 x 128, . . . ), denn einige Grafikkarten unterstützen
nur solche Texturen!
• Nicht vergessen am Ende des Programms die Textur wieder freizugeben und den
Referenzzähler durch IDirect3DDevice9::SetTexture(0, NULL) wieder um eins zu er-
niedrigen, damit keine Speicherlecks entstehen!
• Mittels GetLevelDesc der Schnittstelle IDirect3DTexture9 können die Daten zur Tex-
tur abgefragt werden (Format, Breite, Höhe, . . . )
• Volumen- und Würfeltexturen unter DirectX haben die Endung .dds und können mit
dem DirectX TextureTool erstellt und bearbeitet werden.
• Wenn man mit Volumentexturen arbeitet, sollte man sich auch immer darüber im
Klaren sein, dass erstens nicht jede Grafikkarte dieses Format unterstützt und zwei-
tens – besonders mit Mip- Maps – viel Speicher zu Verfügung stehen muss.
Speicherplatz = u · v · w · BytesP roT exel
Bei 32-bit Farben ist BytesProTexel 4 Bytes groß.

26.1.3. Terrain, Landscape


26.1.3.1. LOD

Mit Level of Detail, Detailstufen, bezeichnet man die verschiedenen Detailstufen bei der
Darstellung virtueller Welten.
Um die Geschwindigkeit von Anwendungen der virtuellen Realität zu steigern, setzt man
meist auf gleichzeitiges Nutzen von hoher Detailgenauigkeit im Nahbereich und niedriger
Detailstufe im Fernbereich. Dies kann die Komplexität (Anzahl der Polygone) der 3D-
Objekte betreffen, aber auch die Auflösung der Texturen. Bei Texturen kommt dann das
Mip Mapping zum Einsatz.
Je nach Entfernung und Position der Objekte zum Beobachter wird automatisch das geeig-
nete LOD gewählt. Stehen nur wenige Detailstufen zur Verfügung, wird der Modellwechsel
eventuell durch das plötzliche Erscheinen und Verschwinden von Details wahrgenommen.
Um diesen Popping-Effekt zu vermeiden, werden zum Teil kontinuierliche LOD eingesetzt
oder die Modelle durch Blending (Überblenden) und Morphing ineinander überführt. Für
Geländemodelle kommen dabei zum Beispiel Progressive Meshes (Abschnitt 26.1.1.5) zum
Einsatz (Abschnitt 26.2.1).
Auch im Bereich der virtuellen dreidimensionalen Landschafts- und Stadtmodelle werden
LOD-Konzepte eingesetzt. Je nach Anwendung werden hier unterschiedliche Detailstufen
benötigt. Folgende Detailstufen wurden für die CityGML-Spezifikation herausgearbeitet
und liegen derzeit vielen deutschen Stadtmodellen zu Grunde:
• LOD 0: Regionalmodell, 2,5-D-Geländemodell mit Luftbild-Textur
• LOD 1: Klötzchenmodell, Gebäudeblock (Grundfläche hochgezogen)

181
26. XNA + C#

• LOD 2: 3D-Modell der Außenhülle und Dachstrukturen und einfachen Texturen


• LOD 3: Architekturmodell, 3D-Modell der Außenhülle mit Textur
• LOD 4: Innenraummodell, 3D-Modell des Gebäudes mit Etagen, Innenräumen, etc.
und Texturen
Amtliches Stadtmodell von Berlin im LoD 2 mit Texturierung
virtuelles 3D-Stadtmodell von Dresden in LoD 2 mit Texturen (kmz-Datei)
# David Luebke u.a.: Level of Detail for 3D Graphpics. Morgan Kaufmann Publishers,
San Francisco 2003, ISBN 1-55860-838-9.
# Dirk Schlender: Anforderungen an die Detailstufenverwaltung in virtuellen Simulations-
umgebungen. VDI-Verlag, Düsseldorf 1999, ISBN 3-18-359710-1.
# Hugues Hoppe: Progressive Meshes. 1996 ([1], abgerufen am 8.12).
# Special Interest Group 3D (Hrsg.): CityGML Specification. 2007, S. 9 ([2], abgerufen
am 8.12).

26.1.3.2. Progressive Meshes

Progressive Meshes sind stufenweise fortschreitend detailgenauer werdende Polygone. Der


Detailgrad (Abschnitt 26.1.3.1) wird dabei umso mehr erhöht, je näher die Kamera dem
darzustellenden Objekt ist. Um das in 26.1.3.1 auf der vorherigen Seite beschriebene Pop-
ping zu vermeiden sollte ein morphing Algorithmus verwendet werden.
Gutes Beispiel unter Smart Terrain Rendering with Xna using Billod algorithm mit per
CPU generiertem progressivem Terrain.

26.1.3.3. Chunked LOD with geomorphing for progressive LOD

Paketweises LOD mit geomorphing für die schrittweise LOD Generierung.


Highly optimized chunk-based terrain rendering
Chunked LOD with geomorphing for progressive LOD

26.2. Szenen Manager

26.2.1. Terrain

Siehe den Terrain Scene Manager von Ogre oder den Paging Scene Manager, der Terrain-
Daten auf Anforderung nachlädt. Siehe auch das Kapitel über die Ogre 3d (58) Render
Engine.

182
26.3. Grafik-Programmierung und Theorie

26.3. Grafik-Programmierung und Theorie

26.3.1. Geoclipmaps vs Geomipmaps


http://www.gamedev.net/community/forums/topic.asp?topic_id=475608

26.3.2. Shader Programmierung


26.3.2.1. Fundamentals of Vertex Shaders

http://www.gamedev.net/columns/hardcore/dxshader1/
We have seen ever-increasing graphics performance in PCs since the release of the first 3dfx
Voodoo cards in 1995. Although this performance increase has allowed PCs to run graphics
faster, it arguably has not allowed graphics to run much better. The fundamental limitation
thus far in PC graphics accelerators has been that they are mostly fixed-function. Fixed-
function means that the silicon designers have hard-coded specific graphics algorithms into
the graphics chips, and as a result the game and application developers have been limited
to using these specific fixed algorithms.
For over a decade, a graphics language known as Photorealistic RenderMan from Pixar
Animation Studio has withstood the test of time and has been the choice of professionals
for high-quality photo-realistic rendering.
Pixar’s use of RenderMan in its development of feature films such as "Toy Story" and "A
Bug’s Life" has resulted in a level of photorealistic graphics which have amazed audiences
worldwide. RenderMan’s programmability has allowed it to evolve as major new rendering
techniques were invented. By not imposing strict limits on computations, RenderMan allows
programmers the utmost in flexibility and creativity. However, this programmability has
limited RenderMan to only software implementations.
Now, for the first time, low-cost consumer hardware has reached the point where it can
begin implementing the basics of programmable shading similar to the RenderMan graphics
language with real-time performance.
The principal 3D APIs (DirectX and OpenGL) have evolved alongside graphics hardware.
One of the most important new features in DirectX Graphics is the addition of a program-
mable pipeline that provides an assembly language interface to the transformation and
lighting hardware (vertex shader) and the pixel pipeline (pixel shader). This programma-
ble pipeline gives the developer a lot more freedom to do things, which have never been
seen in real time applications before.
Shader programming is the new and real challenge for Game-Coders. Face it ...

What You Are Going To Learn This introduction covers the fundamentals of Vertex
Shader and Pixel Shader Programming. You are going to learn here all the stuff necessary
to start programming vertex and pixel shaders for the Windows-family of operating systems
from scratch.
We will deal with

183
26. XNA + C#

• Writing and compiling a vertex shader program


• Lighting with vertex shaders
• Transformation with vertex shaders
• Writing and compiling a pixel shader program
• Texture mapping with the pixel shader
• Texture effects
• Per-pixel lighting with pixel shaders
and much more ...

What You Need to Know/Equipment You need a basic understanding of the math
typically used in a game engine and you need a basic to intermediate understanding of
the DirectX Graphics API. It helps if you know how to use the Transform & Lighting
(T&L) pipeline and the SetTextureStageState() calls. If you need help with these topics,
I recommend working through an introductory level text first. For example "Beginning
Direct3D Game Programming" might help :-).
Your development system should consist of the following hardware and software:
• DirectX 8.1 SDK
• Windows 2000 with at least Service Pack 2 or higher or Windows XP Professional
(the NVIDIA Shader debugger only runs on these operating systems)
• Visual C/C++ 6.0 with at least Service Pack 5 (needed for the DirectX 8.1 SDK) or
higher
• more than 128 MB RAM
• a least 500 MB of hard drive storage
• a hardware accelerated 3D graphics card: To be able to get the maximum visual
experience of this course examples, you need to own relatively new graphics hardware.
The pixel shader examples will only run properly on GeForce3/4TI or RADEON 8x00
board at the time of this writing
• the NEWEST graphics card device-driver
• If you are not a lucky owner of a GeForce3/4TI, RADEON 8x00 or an equivalent gra-
phics card (that supports Shaders in hardware), the standardized assembly interface
will provide highly-tuned software vertex shaders that AMD and Intel have optimized
for their CPUs. These software implementations should jump in, when there is no
vertex shader capable hardware found. There is no comparable software-emulation
fallback path for pixel shaders.

How This Introduction is Organized We work through the fundamentals to a more


advanced level in four chapters, first for vertex shaders and later for pixel shaders. Our
road map looks like this:
• Fundamentals of Vertex Shaders

184
26.3. Grafik-Programmierung und Theorie

• Programming Vertex Shaders


• Fundamentals of Pixel Shaders
• Programming Pixel Shaders
Let’s start by examining the place of vertex shaders in the Direct3D pipeline ...

26.3.2.2. Vertex Shaders in the Pipeline

The following diagram (Bild 26.4 auf der nächsten Seite) shows the Source or Polygon,
Vertex and Pixel Operations level of the Direct3D pipeline in a very simplified way.
On the source data level, the vertices are assembled and tessellated. This is the high-
order primitive module, which works to tessellate high-order primitives such as N-Patches
(as supported by the ATI RADEON 8500 in hardware), quintic Béziers, B-splines and
rectangular and triangular (RT) patches.
A GPU that supports RT-Patches breaks higher-order lines and surfaces into triangles and
vertices.
It appears that, beginning with the 21.81 drivers, NVIDIA no longer supports
RT-patches on the GeForce3/4TI.
A GPU that supports N-Patches generates the control points of a Bézier triangle for each
triangle in the input data. This control mesh is based on the positions and normals of
the original triangle. The Bézier surface is then tessellated and evalueaded, creating more
triangels on chip [Vlachos01].
The N-Patches functionality was enhanced in Direct3D 8.1. There is more
control over the interpolation order of the positions and normals of the genera-
ted vertices. The new D3DRS_POSITIONORDER and D3DRS_NORMALORDER
render states control this interpolation order. The position interpolation order
can be set to either D3DORDER_LINEAR or D3DORDER_CUBIC.
The normal interpolation order can be set to either D3DORDER_LINEAR
or D3DORDER_QUADRATIC. In Direct3D 8.0, the position interpolation
was hard wired to D3DORDER_CUBIC and the normal interpolation was
hard wired to D3DORDER_LINEAR.
Note: If you use N-Patches together with programmable vertex shaders, you
have to store the position and normal information in input registers v0 and v3.
That’s because the N-Patch Tesselator needs to know where these informations
are to notify the driver.
The next stage shown in (26.4) covers the vertex operations in the Direct3D pipeline. There
are two different ways of processing vertices.
1. The "fixed-function" pipeline. This is the standard Transform & Lighting (T&L) pipeline,
where the functionality is essentially fixed. The T&L pipeline can be controlled by setting
render states, matrices, and lighting and material parameters.
2. Vertex Shaders. This is the new mechanism introduced in DirectX 8. Instead of setting
parameters to control the pipeline, you write a vertex shader program that executes on the
graphics hardware.

185
26. XNA + C#

Our focus is on Vertex Shaders. It is obvious from this


simplified diagram in Figure 1 that Face Culling, User
Clip Planes, Frustrum Clipping, Homogenous Divide
and Viewport Mapping operate on pipeline stages after
the vertex shader. Therefore these stages are fixed and
can’t be controlled by a vertex shader. A vertex shader
is also not capable of writing to other vertices than
the one it currently shades. It is also not capable of
creating vertices; it generates one output vertex from
each vertex it receives as input.
So what are the capabilities and benefits of using Ver-
tex Shaders?

Why use Vertex Shaders? If you use Vertex Sha-


ders, you bypass the fixed-function pipeline or T&L
pipeline. Why would you want to skip them?
Because the hardware of a traditional T&L pipeline
doesn’t support all of the popular vertex attribute cal-
culations on its own, processing is often job shared bet-
ween the geometry engine and the CPU. Sometimes,
this leads to redundancy.
There is also a lack of freedom. Many of the effects
used in games look similar with the hard-wired T&L
pipeline. The fixed-function pipeline doesn’t give the
developer the freedom he need to develop unique and
revolutionary graphical effects. The procedural model
used with vertex shaders enables a more general syntax
for specifying common operations. With the flexibility
of the vertex shaders developers are able to perform
operations including: Abbildung 26.4.: Direct3D Pipeline

• Procedural Geometry (cloth simulation, soap


bubble [Isidoro/Gosslin])
• Advanced Vertex Blending for Skinning and Ver-
tex Morphing (tweening) [Gosselin]
• Texture Generation [Riddle/Zecha]
• Advanced Keyframe Interpolation (complex faci-
al expression and speech)
• Particle System Rendering
• Real-Time Modifications of the Perspective View
(lens effects, underwater effect)
• Advanced Lighting Models (often in cooperation
with the pixel shader) [Bendel]

186
26.3. Grafik-Programmierung und Theorie

• First Steps to Displacement Mapping [Calver]


And there are a many more effects possible with vertex shaders, perhaps effects that nobody
thought of before. For example a lot of SIGGRAPH papers from the last couple of years
describe graphical effects, that are realized only on SGI hardware so far. It might be a
great challenge to port these effects with the help of vertex and pixel shaders to consumer
hardware.
In addition to opening up creative possibilities for developers and artists, shaders also at-
tack the problem of constrained video memory bandwidth by executing on-chip on shader-
capable hardware. Take, for example, Bézier patches. Given two floating point values per
vertex (plus a fixed number of values per primitive), one can design a vertex shader to
generate a position, a normal and a number of texture coordinates. Vertex Shaders even
give you the possibility to decompress compressed position, normal, color, matrix and tex-
ture coordinate data and to save a lot of valuable bandwith without any additional cost
[Calver].
And there is also a benefit for your future learning curve. The procedural programming
model used by vertex shaders is very scalable. Therefore the adding of new instructions
and new registers will happen in a more intuitive way for developers.

26.3.2.3. Vertex Shader Tools

As you will soon see, you are required to master a specific RISC-oriented assembly language
to program vertex shaders, because using the vertex shader is taking responsibility for
programming the geometry processor. Therefore, it is important to get the right tools to
begin to develop shaders as quickly and productivly as possible.
I would like to present the tools that I am aware of at the time of this writing.

NVIDIA Effects Browser 2/3 NVIDIA provides their own DirectX 8 SDK, that en-
capsulates all their tools, demos and presentations on DirectX 8.0. All the demos use a
consistent framework called Effects Browser.
The Effects Browser is a wonderful tool to test and develop vertex and pixel shaders. You
can select the effect you would like to see in the left column. The middle column gives you
the ability to see the source of the vertex and/or pixel shader. The right column displays
the effect.
Not all graphics cards will support all the effects available in the Effects Browser. GeFor-
ce3/4TI will support all the effects. Independent of your current graphic card preferences, I
recommend downloading the NVIDIA DirectX 8 SDK and trying it out. The many examp-
les, including detailed explanations, show you a variety of the effects possible with vertex
and pixel shaders. The upcoming NVIDIA EffectsBrowser 3 will provide automatic online
update capabilities.

NVIDIA Shader Debugger Once you have used it, you won’t live without it. The NVI-
DIA shader debugger provides you with information about the current state of the tem-
porary registers, the input streams, the output registers, and the constant memory. This

187
26. XNA + C#

Abbildung 26.5.: NVIDIA Effects Browser

data changes interactively while stepping through the shaders. It is also possible to set
instruction breakpoints as well as specific breakpoint.
A user manual that explains all the possible features is provided. You need at least Windows
2000 with Service Pack 1 to run the Shader Debugger because debug services in DX8 and
DX8.1 are only supplied in Windows 2000 and higher. It is important that your application
use software vertex processing (or you have switched to the reference rasterizer) in the
runtime for the debugging process.
You are also able to debug pixel shaders with this debugger, but due to a bug in DirectX 8.0
the contents of t0 are never displayed correctly and user-added pixel shader breakpoints
will not trigger. DirectX 8.1 fixes these issues and you receive a varning message if the
application finds an installation of DirectX 8.0.

Shader City You can find another vertex and pixel shader tool, along with source code at
http://www.palevich.com/3d/ShaderCity/. Designed and implemented by Jack Palevich,
Shader City allows you to see any modification of the vertex and/or pixel shaders in the
small client window in the left upper edge:
The results of a modification of a vertex and/or pixel shader can be seen after they are
saved and re-loaded. Besides your are able to load index and vertex buffers from a file. The
source code for this tool might help you to encapsulate Direct3D in an ActiveX control ...
so try it.

188
26.3. Grafik-Programmierung und Theorie

Abbildung 26.6.: NVIDIA Shader Debugger

Vertex Shader Assembler To compile a


vertex shader ASCII file (for example ba-
sic.vsh) into a binary file (for example ba-
sic.vso), you must use a vertex shader as-
sembler. As far as I know, there are two ver-
tex shader assemblers: the Microsoft vertex
shader assembler and the NVIDIA vertex
and pixel shader macro assembler. The lat-
ter provides all of the features of the Vertex
Shader Assembler plus many other features,
whereas the Vertex Shader Assembler gives
you the ability to also use the D3DX effect
files (as of DirectX 8.1).

NVIDIA NVASM - Vertex and Pixel Sha-


der Macro Assembler NVIDIA provides
its Vertex and Pixel Shader Macro Assemb-
ler as part of their DirectX 8 SDK. NVASM
has very robust error reporting built into
it. It will not only tell you what line the
error was on, it is also able to back track
errors. Good documentation helps you get Abbildung 26.7.: Jack Palevich Shader City
started. NVASM was written by ShaderX
author Kenneth Hurley, who provides ad-

189
26. XNA + C#

ditional information in his ShaderX article


[Hurley]. We will learn how to use this tool
in one of the upcoming examples in the next chapter.

Microsoft Vertex Shader Assembler The Microsoft vertex shader assembler is delivered
in the DirectX 8.1 SDK in
C:\dxsdk\bin\DXUtils
Note: The default path of the DirectX 8 SDK is c:\mssdk. The default path of DirectX 8.1
SDK is c:\dxsdk.
If you call vsa.exe from the command line, you will get the following options:
usage: vsa -hp012 <files>
-h : Generate .h files (instead of .vso files)
-p : Use C preprocessor (VisualC++ required)
-0 : Debug info omitted, no shader validation performed
-1 : Debug info inserted, no shader validation performed
-2 : Debug info inserted, shader validation performed. (default)
I haven’t found any documentation for the Vertex Shader Assembler. It is used by the
D3DXAssembleShader*() methods or by the effect file method D3DXCreateEffectFromFile(),
that compiles the effect file.
If you want to be hardware-vendor independent you should use the Microsoft Vertex Shader
Assembler.

Shader Studio ShaderX author John Schwab has developed a tool that will greatly aid in
your development of vertex and pixel shaders. Whether you are a beginner or an advanced
Direct3D programmer this tool will save you a lot of time, it will allow you to get right
down to development of any shader without actually writing any Direct3D code. Therefore
you can spend your precious time working on what’s important, the shaders.
The tool encapsulates a complete vertex and pixel shader engine with a few nice ideas. For
a hand on tutorial and detailed explainations see [Schwab]. The newest version should be
available online at www.shaderstudio.com.

NVLink 2.x NVLink is a very interesting tool, that allows you to:
• Write vertex shaders that consists of "fragments" with #beginfragment and the #end-
fragment statements. For example:
#beginfragment world_transform
dp4 r_worldpos.x, v_position, c_world0
dp3 r_worldpos.y, v_position, c_world1
dp4 r_worldpos.z, v_position, c_world2
#endfragment

190
26.3. Grafik-Programmierung und Theorie

• Assemble vertex shader files with NVASM into "fragments"

• Link those fragments to produce a binary vertex shader at run-time

NVLink helps you to generate shaders on demand that will fit into the end-users hardware
limits (registers/instructions/constants). The most attractive feature of this tool is that it
will cache and optimize your shaders on the fly. NVLink is shown in the NVEffects Browser:

Abbildung 26.9.: NVIDIA NVLink

You can choose the vertex shader capabilities in the dialog box and the resulting vertex
shader will be shown in output0.nvv in the middle column.

Note: the NVLink 2.x example shows the implementation of the fixed-function pipeline in
a vertex shader.

NVIDIA Photoshop PlugIns You will find on NVIDIA’s web-site two frequently up-
dated plugin’s for Adobe Photoshop. NVIDIA’s Normal Map Generator and Photoshop
compression plug in. The Normal Map Generator can generate normal maps that can be
used, for example, for Dot3 lighting.

191
26. XNA + C#

Abbildung 26.8.: John Schwab’s Shader


Studio: Phong Lighting
The plugin requires DirectX 8.0 or later to be
installed. The dynamic preview window, loca-
ted in the upper left corner, shows an exam-
ple light that is moved with the CTRL + left-
mouse-button. You are able to clamp or wrap
the edges of the generated normal map by se-
lecting or deselecting the wrap check box. The
height values of the normal map can be scaled
by providing a height value in the Scale entry
field.
There are different options for height generati-
Abbildung 26.10.: NVIDIA Normal Map on:
Generator
• ALPHA - use alpha channel
• AVERAGE_RGB = average R, G, B
• BIASED_RGB - h = average (R, G, B)
- average of whole image
• RED - use red channel
• GREEN - use green channel
• BLUE - use blue channel
• MAX - use max of R, G, B
• COLORSPACE, h = 1.0 - [(1.0 - r) * (1.0
- g) * (1.0 - b)]
This plugin also works with layers. The readme.txt file provides you with more information
about its features.
Another Adobe Photoshop plugin provided by NVIDIA is the Photoshop Compression
Plugin. It is used by choosing <Save As> in Adobe Photoshop and then the <DDS> file
format. The following dialog provides a wide variety of features:

192
26.3. Grafik-Programmierung und Theorie

A 3D preview shows the different quality levels


that result from different compression formats.
This tool can additionally generate mip-maps
and convert a height map to a normal map.
The provided readme file is very instructive and
explains all of the hundreds of features of this
tool. As the name implies, both tools support
Adobe Photoshop 5.0 and higher.

Diffusion Cubemap Tool ShaderX author


Kenneth Hurley wrote a tool, that helps you
producing diffusion cube maps. It aids in ex-
traction of cube maps from digital pictures.
The pictures are of a completely reflective ball.
The program also allows you to draw an exclu-
sion rectangle to remove the picture taker from Abbildung 26.11.: NVIDIA Compression
the cube map. Plugin
To extract the reflection maps first load in the
picture and then use the mouse to draw the
ellipse enclosed in a rectangle. This rectangle
should be stretched and moved so that the ellipse falls on the edges of the ball. Then
set which direction is associated with the picture in the menu options. The following
screenshots use the Negative X and Negative Z direction:

(a) Negative X Sphere Picture Figure (b) Negative Z Sphere Picture

Abbildung 26.12.: Diffusion Cubemap

The Cube maps are generated with the "Generate" menu option. The program, the source
code and much more information can be found at [Hurley].

DLL Detective with Direct3D Plugin ShaderX author Ádám Moravánszky wrote a tool
called DLL Detective. It is not only very useful as a performance analysis tool but also for
vertex and pixel shader programming:
It is able to intercept vertex and pixel shaders, disassemble and write them into a file.
A lot of different graphs show the usage of the Direct3D API under different conditions

193
26. XNA + C#

Abbildung 26.13.: Ádám Moravánszky’s DLL Detective

and help to find performance leaks this way. You can even suppress API calls to simulate
other conditions. To impede the parallelism of the CPU and GPU usage, you can lock the
rendertarget buffer.
DLL Detective is especially suited to instrumenting games, or any other applications which
run in fullscreen mode, preventing easy access to other windows (like DLL Detective,
for example). To instrument such programs, DLL Detective can be configured to control
instrumentation via a multimonitor setup, and even from another PC over a network.
The full source code and compiled binaries can be downloaded from the web-site of the
author at http://n.ethz.ch/student/adammo/DLLDetective/index.html.

3D Studio MAX 4.x / gmax 1.1 The new 3D Studio MAX 4.x gives a graphic artist the
ability to produce vertex shader code and pixel shader code while producing the models
and animations.
A WYSIWYG view of your work will appear by displaying multitextures, true transparency,
opacity mapping, and the results of custom pixel and vertex shaders.
gmax as a derivative of 3D Studio Max 4.x does support vertex and pixel shader program-
ming. However, the gmax free product provides no user interface to access or edit these

194
26.3. Grafik-Programmierung und Theorie

Abbildung 26.14.: 3D Studio Max 4.x/gmax 1.1

controls.

Find more information at discreet.

26.3.2.4. Vertex Shader Architecture

Let’s get deeper into vertex shader programming by looking on a graphical representation
of the vertex shader architecture:

195
26. XNA + C#

Abbildung 26.15.: Vertex Shader Architecture

All data are in a vertex shader is represented by 128-bit quad-floats (4 x 32-bit) like in
Bild 26.16 auf dieser Seite.
A hardware vertex shader
can be seen as a typi-
cal SIMD (Single Instructi-
on Multiple Data) processor
for you are applying one in-
struction and affecting a set
of up to four 32-bit varia-
bles. This data format is ve-
ry useful, because most of
the transformation and ligh-
ting calculations are perfor-
Abbildung 26.16.: 128 bits med using 4x4 matrices or
quaternions. The instructi-
ons are very simple and easy to understand. The vertex shader does not allow any loops,
jumps or conditional branches, which means that it executes the program linearly - one
instruction after the other. The maximum length of a vertex shader program in DirectX
8.x is limited to 128 instructions. Combining vertex shaders to have one to compute the
transformation and the next one to compute the lighting is impossible. Only one vertex
shader can be active at a time and the active vertex shader must compute all required
per-vertex output data.
A vertex shader use up to 16 input registers (named v0 - v15, where each register consists

196
26.3. Grafik-Programmierung und Theorie

of 128 bit (4x32bit) quad-floats) to access vertex input data. The vertex input register
can easily hold the data for a typical vertex: its position coordinates, normal, diffuse and
specular color, fog coordinate and point size information with space for the coordinates of
several textures.
The constant registers (Constant Memory) are loaded by the CPU, before the vertex sha-
der starts executing parameters defined by the programmer. The vertex shader is not able
to write to the constant registers. They are used to store parameters such as light po-
sition, matrices, procedural data for special animation effects, vertex interpolation data
for morphing/key frame interpolation and more. The constants can be applied within the
program and they can even be addressed indirectly with the help of the address register
a0.x, but only one constant can be used per instruction. If an instruction needs more than
one constant, it must be loaded into on e of the temporary regsiters before it its required.
The names of the constant registers are c0 - c95 or in case of the ATI RADEON 8500 c0 -
c191.
The temporary Rgisters consist of 12 registers used to perform intermediate calculations.
They can be used to load and store data (read/write). The names of the temporary registers
are r0 - r11.
There are up to 13 output registers (Vertex Output), depending on the underlying hard-
ware. The names of the output registers always start with o for output. The Vertex Output
is available per rasterizer and your vertex shader program has write-only access to it. The
final result is yet another vertex, a vertex transformed to the "homogenous clip space".
Here is an overview of all available registers:

Registers: Number of Registers Properties


Input (v0 - v15) 16 RO1
Output (o*) GeForce 3/4TI: 9; WO
RADEON 8500: 11
Constants (c0 - c95) vs.1.1 Specification: 96; RO1
RADEON 8500: 192
Temporary (r0 - r11) 12 R1W3
Address (a0.x) 1 (vs.1.1 and higher) WO (W: only with mov)
Tabelle 26.1.: Grafikkarten-Register

An identifier of the streaming nature of this vertex shader architecture is the read-only
input registers and the write-only output registers.

26.3.2.5. High Level View of Vertex Shader Programming

Only one vertex shader can be active at a time. It is a good idea to write vertex shaders
on a per-task basis. The overhead of switching between different vertex shaders is smaller
than for example a texture change. So if an object needs a special form of transformation
or lighting it will get the proper shader for this task. Let’s build an abstract example:
You are shipwrecked on a foreign planet. Dressed in your regular armor, armed only with a
jigsaw, you move through the candle lit cellars. A monster appears and you crouch behind

197
26. XNA + C#

one of those crates one normally find on other planets. While thinking about your destiny
as a hero who saves worlds with jigsaws, you start counting the number of vertex shaders
for this scene.
There is one for the monster to animate it, light it and perhaps to reflect its environment.
Other vertex shaders will be used for the floor, the walls, the crate, the camera, the cand-
lelight and your jigsaw. Perhaps the floor, the walls, the jigsaw and the crate use the same
shader, but the candlelight and the camera might each use one of their own. It depends on
your design and the power of the underlying graphic hardware.
You might also use vertex shaders on a per-object or per-mesh basis. If for example a *.md3
model consists of, let’s say, 10 meshes, you can use 10 different vertex shaders, but that
might harm your game performance.
Every vertex shader-driven program must run through the following steps:
* Check for vertex shader support by checking the D3DCAPS8::VertexShaderVersion field
* Declaration of the vertex shader with the D3DVSD_* macros, to map vertex buffer
streams to input registers
* Setting the vertex shader constant registers with SetVertexShaderConstant()
* Compiling previously written vertex shader with D3DXAssembleShader*() (Alternatives:
could be pre-compiled using a Shader Assembler)
* Creating a vertex shader handle with CreateVertexShader()
* Setting a vertex shader with SetVertexShader() for a specific object
* Delete a vertex shader with DeleteVertexShader()

Check for Vertex Shader Support It is important to check the installed vertex shader
software or hardware implementation of the end-user hardware. If there is a lack of support
for specific features, then the application can fallback to a default behavior or give the user
a hint, as to what he might do to enable the required features. The following statement
checks for support of vertex shader version 1.1:
if( pCaps->VertexShaderVersion < D3DVS_VERSION(1,1) )
return E_FAIL;

The following statement checks for support of vertex shader version 1.0:
if( pCaps->VertexShaderVersion < D3DVS_VERSION(1,0) )
return E_FAIL;

The D3DCAPS8 structure caps must be filled in the startup phase of the application
with a call to GetDeviceCaps(). If you use the Common Files Framework provided with
the DirectX 8.1 SDK, this is done by the framework. If your graphics hardware does
not support your requested vertex shader version, you must switch to software vertex
shaders by using the D3DCREATE_SOFTWARE_VERTEXPROCESSING flag in the
CreateDevice() call. The previously mentioned optimized software implementations made
by Intel and AMD for their respective CPU’s will then process the vertex shaders.

198
26.3. Grafik-Programmierung und Theorie

Supported vertex shader versions are:


Version: Functionality:
0.0 DirectX 7
1.0 DirectX 8 without address register A0
1.1 DirectX 8 and DirectX 8.1 with one address register A0
2.0 DirectX 9
The only difference between the levels 1.0 and 1.1 is the support of the a0 register. The
DirectX 8.0 and DirectX 8.1 reference rasterizer and the software emulation delivered by
Microsoft and written by Intel and AMD for their respective CPUs support version 1.1.
At the time of this writing, only GeForce3/4TI and RADEON 8500-driven boards support
version 1.1 in hardware. No known graphics card supports vs.1.0-only at the time of writing,
so this is a legacy version.

Vertex Shader Declaration You must declare a vertex shader before using it. This de-
claration can be called a static external interface. An example might look like this:
float c[4] = {0.0f,0.5f,1.0f,2.0f};
DWORD dwDecl0[] = {
D3DVSD_STREAM(0),
D3DVSD_REG(0, D3DVSDT_FLOAT3 ), // input register v0
D3DVSD_REG(5, D3DVSDT_D3DCOLOR ), // input Register v5
// set a few constants
D3DVSD_CONST(0,1),*(DWORD*)&c[0],*(DWORD*)&c[1],*(DWORD*)&c[2],*(DWORD*)&c[3],
D3DVSD_END()
};

This vertex shader declaration sets data stream 0 with D3DVSD_STREAM(0). Later,
SetStreamSource() binds a vertex buffer to a device data stream by using this declaration.
You are able to feed different data streams to the Direct3D rendering engine this way.

NOTE
For example, one data stream could hold positions and
normals, while a second held color values and texture
coordinates. This also makes switching between single texture
rendering and multi texture rendering trivial: just don’t
enable the stream with the second set of texture coordinates.

You must declare, which input vertex properties or incoming vertex data has to be map-
ped to which input register. D3DVSD_REG binds a single vertex register to a vertex
element/property from the vertex stream. In our example a D3DVSDT_FLOAT3 value
should be placed into the first input register and a D3DVSDT_D3DCOLOR color va-
lue should be placed in the sixth input register. For example the position data could be
processed by the input register 0 (v0) with D3DVSD_REG(0, D3DVSDT_FLOAT3 )
and the normal data could be processed by input register 3 (v3) with D3DVSD_REG(3,
D3DVSDT_FLOAT3 ).

199
26. XNA + C#

How a developer maps each input vertex property to a specific input register is only import-
ant, if one want to use N-Patches, because the N-Patch Tessellator needs the position data
in v0 and the normal data in v3. Otherwise the developer is free to define the mapping as
they see fit. For example the position data could be processed by the input register 0 (v0)
with D3DVSD_REG(0, D3DVSDT_FLOAT3) and the normal data could be processed
by input register 3 (v3) with D3DVSD_REG(3, D3DVSDT_FLOAT3).
In contrast the mapping of the vertex data input to specific registers is fi-
xed for the fixed-function pipeline. d3d8types.h holds a list of #defines that
predefine the vertex input for the fixed-function pipeline. Specific vertex ele-
ments such as position or normal must be placed in specified registers loca-
ted in the vertex input memory. For example the vertex position is bound by
D3DVSDE_POSITION to Register 0, the diffuse color is bound by D3DVSDE_DIFFUSE
to Register 5 etc.. Here’s the whole list from d3d8types.h:
#define D3DVSDE_POSITION 0
#define D3DVSDE_BLENDWEIGHT 1
#define D3DVSDE_BLENDINDICES 2
#define D3DVSDE_NORMAL 3
#define D3DVSDE_PSIZE 4
#define D3DVSDE_DIFFUSE 5
#define D3DVSDE_SPECULAR 6
#define D3DVSDE_TEXCOORD0 7
#define D3DVSDE_TEXCOORD1 8
#define D3DVSDE_TEXCOORD2 9
#define D3DVSDE_TEXCOORD3 10
#define D3DVSDE_TEXCOORD4 11
#define D3DVSDE_TEXCOORD5 12
#define D3DVSDE_TEXCOORD6 13
#define D3DVSDE_TEXCOORD7 14
#define D3DVSDE_POSITION2 15
#define D3DVSDE_NORMAL2 16

The second parameter of D3DVSD_REG specifies the dimensionality and arithmetic data
type. The following values are defined in d3d8types.h:
// bit declarations for _Type fields
#define D3DVSDT_FLOAT1 0x00 // 1D float expanded to (value, 0., 0., 1.)
#define D3DVSDT_FLOAT2 0x01 // 2D float expanded to (value, value, 0., 1.)
#define D3DVSDT_FLOAT3 0x02 // 3D float expanded to (value, value, value, 1.)
#define D3DVSDT_FLOAT4 0x03 // 4D float

// 4D packed unsigned bytes mapped to 0. to 1. range


// Input is in D3DCOLOR format (ARGB) expanded to (R, G, B, A)
#define D3DVSDT_D3DCOLOR 0x04

#define D3DVSDT_UBYTE4 0x05 // 4D unsigned byte


// 2D signed short expanded to (value, value, 0., 1.)
#define D3DVSDT_SHORT2 0x06
#define D3DVSDT_SHORT4 0x07 // 4D signed short

200
26.3. Grafik-Programmierung und Theorie

GeForce3/4TI doesn’t support


D3DVSDT_UBYTE4, as indicated by the
D3DVTXPCAPS_NO_VSDT_UBYTE4 caps bit.

D3DVSD_CONST loads the constant values into the vertex shader constant memory. The
first parameter is the start address of the constant array to begin filling data. Possible
values range from 0 to 95 or in case of the RADEON 8500 from 0 - 191. We start at
address 0. The second number is the number of constant vectors (quad-float) to load. One
vector is 128 bit long, so we load four 32-bit FLOATs at once. If you want to load a 4x4
matrix, you would use the following statement to load four 128-bit quad-floats into the
constant registers c0 - c3:
float c[16] = (0.0f, 0.5f, 1.0f, 2.0f,
0.0f, 0.5f, 1.0f, 2.0f,
0.0f, 0.5f, 1.0f, 2.0f,
0.0f, 0.5f, 1.0f, 2.0f);
D3DVSD_CONST(0, 4), *(DWORD*)&c[0],*(DWORD*)&c[1],*(DWORD*)&c[2],*(DWORD*)&c[3],
*(DWORD*)&c[4],*(DWORD*)&c[5],*(DWORD*)&c[6],*(DWORD*)&c[7],
*(DWORD*)&c[8],*(DWORD*)&c[9],*(DWORD*)&c[10],*(DWORD*)&c
[11],
*(DWORD*)&c[12],*(DWORD*)&c[13],*(DWORD*)&c[14],*(DWORD*)&c
[15],

D3DVSD_END generates an END token to mark the end of the vertex shader declaration.
Another example can be:
float−→c[4] = {0.0f,0.5f,1.0f,2.0f};
DWORD dwDecl[] = {
D3DVSD_STREAM(0),
D3DVSD_REG(0, D3DVSDT_FLOAT3 ), //input register v0
D3DVSD_REG(3, D3DVSDT_FLOAT3 ), // input register v3
D3DVSD_REG(5, D3DVSDT_D3DCOLOR ), // input register v5
D3DVSD_REG(7, D3DVSDT_FLOAT2 ), // input register v7
D3DVSD_CONST(0,1),*(DWORD*)&c[0],*(DWORD*)&c[1],*(DWORD*)&c[2],*(DWORD*)&c[3],
D3DVSD_END()
};

Data stream 0 is set with D3DVSD_STREAM(0). The position values (value, value, value,
1.0) might be bound to v0, the normal values might be bound to v3, the diffuse color might
be bound to v5 and one texture coordinate (value, value, 0.0, 1.0) might be bound to v7.
The constant register c0 get one 128-bit value.

201
26. XNA + C#

Setting the Vertex Shader Constant Registers You will fill the vertex shader con-
stant registers with SetVertexShaderConstant() and get the values from this registers with
GetVertexShaderConstant():
// Set the vertex shader constants
m_pd3dDevice->SetVertexShaderConstant( 0, &vZero, 1 );
m_pd3dDevice->SetVertexShaderConstant( 1, &vOne, 1 );
m_pd3dDevice->SetVertexShaderConstant( 2, &vWeight, 1 );
m_pd3dDevice->SetVertexShaderConstant( 4, &matTranspose, 4 );
m_pd3dDevice->SetVertexShaderConstant( 8, &matCameraTranspose, 4 );
m_pd3dDevice->SetVertexShaderConstant( 12, &matViewTranspose, 4 );
m_pd3dDevice->SetVertexShaderConstant( 20, &fLight, 1 );
m_pd3dDevice->SetVertexShaderConstant( 21, &fDiffuse, 1 );
m_pd3dDevice->SetVertexShaderConstant( 22, &fAmbient, 1 );
m_pd3dDevice->SetVertexShaderConstant( 23, &fFog, 1 );
m_pd3dDevice->SetVertexShaderConstant( 24, &fCaustics, 1 );
m_pd3dDevice->SetVertexShaderConstant( 28, &matProjTranspose, 4 );

SetVertexShaderConstant() is declared as
HRESULT SetVertexShaderConstant(
DWORD Register,
CONST void* pConstantData,
DWORD ConstantCount);

As stated earlier, there are at least 96 constant registers (RADEON 8500 has 192), that
can be filled with four floating-point values before the vertex shader is executed. The first
parameter holds the register address at which to start loading data into the vertex constant
array. The last parameter holds the number of constants (4 x 32-bit values) to load into
the vertex constant array. So in the first row above, vZero will be loaded into register 0.
matTranspose will be loaded into register 4, 5, 6, and 7. matViewTranspose will be loaded
into 12, 13, 14, 15. The registers 16, 17, 18, 19 are not used. fLight is loaded into register
20. The registers 25, 26, 27 are not used.
So what’s the difference between D3DVSD_CONST used in the vertex shader
declaration and SetVertexShaderConstant() ? D3DVSD_CONST can be used
only once. SetVertexShaderConstant() can be used before every DrawPrimiti-
ve*() call.
Ok ... now we have learned how to check the supported version number of the vertex
shader hardware, how to declare a vertex shader and how to set the constants in the
constant registers of a vertex shader unit. Next we shall learn, how to write and compile a
vertex shader program.

Writing and Compiling a Vertex Shader Before we are able to compile a vertex shader,
we must write one ... (old wisdom :-) ). I would like to give you a high-level overview of
the instruction set first and then give further details of vertex shader programming in the
next chapter named "Programming Vertex Shaders".
The syntax for every instruction is

202
26.3. Grafik-Programmierung und Theorie

HRESULT SetVertexShaderConstant(
DWORD Register,
CONST void* pConstantData,
DWORD ConstantCount);OpName dest, [-]s1 [,[-]s2 [,[-]s3]] ;comment
e.g.
mov r1, r2
mad r1, r2, -r3, r4 ; contents of r3 are negated

There are 17 different instructions:

Instruction Parameters Action


add dest, src1, add src1 to src2 (and the optional negation creates substraction)
src2
dp3 dest, src1, three-component dot product
src2 dest.x = dest.y = dest.z = dest.w =
(src1.x * src2.x) + (src1.y * src2.y) + (src1.z * src2.z)
dp4 dest, src1, four-component dot product
src2 dest.w = (src1.x * src2.x) + (src1.y * src2.y) + (src1.z * src2.z) +
(src1.w * src2.w); dest.x = dest.y = dest.z = unused
What is the difference between dp4 and mul ? dp4 produces a
scalar product and mul is a component by component vector
product.

203
26. XNA + C#

Instruction Parameters Action


dst dest, src1, The dst instruction works like this: The first source operand
src2 (src1) is assumed to be the vector (ignored, d*d, d*d, ignored)
and the second source operand (src2) is assumed to be the vector
(ignored, 1/d, ignored, 1/d).
Calculate distance vector:
dest.x = 1;
dest.y = src1.y * src2.y
dest.z = src1.z
dest.w = src2.w
dst is useful to calculate standard attenuation. Here is a code
snippet that might calculate the attenuation for a point light:
; r7.w = distance * distance = (x*x) + (y*y) + (z*z)
dp3 r7.w, VECTOR_VERTEXTOLIGHT, VECTOR_VERTEXTOLIGHT

; VECTOR_VERTEXTOLIGHT.w = 1/sqrt(r7.w)
; = 1/||V|| = 1/distance
rsq VECTOR_VERTEXTOLIGHT.w, r7.w
...
; Get the attenuation
; d = distance
; Parameters for dst:
; src1 = (ignored, d * d, d * d, ignored)
; src2 = (ignored, 1/d, ignored, 1/d)
;
; r7.w = d * d
; VECTOR_VERTEXTOLIGHT.w = 1/d
dst r7, r7.wwww, VECTOR_VERTEXTOLIGHT.wwww
; dest.x = 1
; dest.y = src0.y * src1.y
; dest.z = src0.z
; dest.w = src1.w
; r7(1, d * d * 1 / d, d * d, 1/d)

; c[LIGHT_ATTENUATION].x = a0
; c[LIGHT_ATTENUATION].y = a1
; c[LIGHT_ATTENUATION].z = a2
; (a0 + a1*d + a2* (d * d))
dp3 r7.w, r7, c[LIGHT_ATTENUATION]
; 1 / (a0 + a1*d + a2* (d * d))
rcp ATTENUATION.w, r7.w
...
; Scale the light factors by the attenuation
mul r6, r5, ATTENUATION.w

204
26.3. Grafik-Programmierung und Theorie

Instruction Parameters Action


expp dest, src.w
Exponential 10-bit precision
------------------------------------------
float w = src.w;
float v = (float)floor(src.w);

dest.x = (float)pow(2, v);


dest.y = w - v;

// Reduced precision exponent


float tmp = (float)pow(2, w);
DWORD tmpd = *(DWORD*)&tmp & 0xffffff00;

dest.z = *(float*)&tmpd;
dest.w = 1;
--------------------------------------------
Shortcut:

dest.x = 2 **(int) src.w


dest.y = mantissa(src.w)
dest.z = expp(src.w)
dest.w = 1.0

205
26. XNA + C#

Instruction Parameters Action


lit dest, src Calculates lighting coefficients from two dot products and a power.

To calculate the lighting coefficients, set up the registers as shown:


src.x = N*L ; The dot product between normal and direction to
light
src.y = N*H ; The dot product between normal and half vector
src.z = ignored ; This value is ignored
src.w = specular power ; The value must be between -128.0 and
128.0

usage:
dp3 r0.x, rn, c[LIGHT_POSITION]
dp3 r0.y, rn, c[LIGHT_HALF_ANGLE]
mov r0.w, c[SPECULAR_POWER]
lit r0, r0
------------------------------------------------
dest.x = 1.0;
dest.y = max (src.x, 0.0, 0.0);
dest.z= 0.0;
if (src.x > 0.0 && src.w == 0.0)
dest.z = 1.0;
else if (src.x > 0.0 && src.y > 0.0)
dest.z = (src.y)src.w
dest.w = 1.0;

206
26.3. Grafik-Programmierung und Theorie

Instruction Parameters Action


logp dest, src.w
Logarithm 10-bit precision
---------------------------------------------------
float v = ABSF(src.w);
if (v != 0)
{
int p = (int)(*(DWORD*)&v >> 23) - 127;
dest.x = (float)p; // exponent

p = (*(DWORD*)&v & 0x7FFFFF) | 0x3f800000;


dest.y = *(float*)&p; // mantissa;

float tmp = (float)(log(v)/log(2));


DWORD tmpd = *(DWORD*)&tmp & 0xffffff00;
dest.z = *(float*)&tmpd;

dest.w = 1;
}
else
{
dest.x = MINUS_MAX();
dest.y = 1.0f;
dest.z = MINUS_MAX();
dest.w = 1.0f;
}
-----------------------------------------------------
Sortcut:
dest.x = exponent((int)src.w)
dest.y = mantissa(src.w)
dest.z = log2(src.w)
dest.w = 1.0

mad dest, src1, dest = (src1 * src2) + src3


src2, src3
max dest, src1, dest = (src1 >= src2)?src1:src2
src2
min dest, src1, dest = (src1 < src2)?src1:src2
src2
mov dest, src move Optimization tip: question every use of mov (try to rap that
!), because there might be methods that perform the desired
operation directly from the source register or accept the required
output register as the destination.

207
26. XNA + C#

Instruction Parameters Action


mul dest, src1, set dest to the component by component product of src1 and src2
src2 ; To calculate the Cross Product (r5 = r7 X r8),
; r0 used as a temp
mul r0,-r7.zxyw,r8.yzxw
mad r5,-r7.yzxw,r8.zxyw,-r0

nop do nothing
rcp dest, src.w
if(src.w == 1.0f)
{
dest.x = dest.y = dest.z = dest.w = 1.0f;
}
else if(src.w == 0)
{
dest.x = dest.y = dest.z = dest.w = PLUS_INFINITY();
}
else
{
dest.x = dest.y = dest.z = m_dest.w = 1.0f/src.w;
}

Division:
; scalar r0.x = r1.x/r2.x
RCP r0.x, r2.x
MUL r0.x, r1.x, r0.x

208
26.3. Grafik-Programmierung und Theorie

Instruction Parameters Action


rsq dest, src reciprocal square root of src
(much more useful than straight ’square root’):
float v = ABSF(src.w);
if(v == 1.0f)
{
dest.x = dest.y = dest.z = dest.w = 1.0f;
}
else if(v == 0)
{
dest.x = dest.y = dest.z = dest.w = PLUS_INFINITY();
}
else
{
v = (float)(1.0f / sqrt(v));
dest.x = dest.y = dest.z = dest.w = v;
}

Square root:
; scalar r0.x = sqrt(r1.x)
RSQ r0.x, r1.x
MUL r0.x, r0.x, r1.x

sge dest, src1, dest = (src1 >=src2) ? 1 : 0


src2 useful to mimic conditional statements:
; compute r0 = (r1 >= r2) ? r3 : r4
; one if (r1 >= r2) holds, zero otherwise
SGE r0, r1, r2
ADD r1, r3, -r4
; r0 = r0*(r3-r4) + r4 = r0*r3 + (1-r0)*r4
; effectively, LERP between extremes of r3 and r4
MAD r0, r0, r1, r4

slt dest, src1, dest = (src1 < src2) ? 1 : 0


src2

You can download this list as a word file from www.shaderx.com. Check out the SDK for
additional information.

The Vertex Shader ALU is a multi-threaded vector processor that operates on quad-float
data. It consists of two functional units. The SIMD Vector Unit is responsible for the mov,
mul, add, mad, dp3, dp4, dst, min, max, slt and sge instructions. The Special Function Unit
is responsible for the rcp, rsq, log, exp and lit instructions. Most of these instructions take
one cycle to execute, rcp and rsq take more than one cycle under specific circumstances.
They take only one slot in the vertex shader, but they actually take longer then one cycle
to execute, when the result is used immediately, because that leads to a register stall.

209
26. XNA + C#

Application Hints rsq is, for example, used in normalizing vectors to be used in lighting
equations. The exponential instruction expp can be used for fog effects, procedural noise
generation (see NVIDIA Perlin Noise example), behavior of particles in a particle system
(see NVIDIA Particle System example) or to implement a system how objects in a game
are damaged. You will use it in any case when a fast changing function is necessary. This
is contrary of the use of logarithm functions with logp, that are useful if an extremely slow
growing is necessary (also they grow at the beginning pretty fast). A log function can be
the inverse of a exponential function, means it undoes the operation of the exponential
function.
The lit instruction deals by default with directional lights. It calculates the diffuse &
specular factors with clamping based on N * L and N * H and the specular power. There
is no attenuation involved, but you can use an attenuation level separately with the result
of lit by using the dst instruction. This is useful for constructing attenuation factors for
point and spot lights.
The min and max instructions allow for clamping and absolute value computation.

Complex Instructions in the Vertex Shader There are also complex instructions, that
are supported by the vertex shader. The term "macro" should not be used to refer to these
instructions, because they are not simply substituted like a C-preprocessor macro. You
should think carefully before using these instructions. If you use them, you might lose
control over your 128-instruction limit and possible optimization path(s). On the other
hand, the software emulation mode provided by Intel or by AMD for their processors is
able to optimize a m4x4 complex instruction (and perhaps others now or in the future). It
is also possible that, in the future some graphics hardware may use gate count to optimize
the m4x4. So, if you need, for example four dp4 calls in your vertex shader assembly source,
it might be a good idea to replace them by m4x4. If you have decided to use for example
a m4x4 instruction in your shader, you should not use a dp4 call on the same data later,
because there are slightly different transformation results. If, for example, both instructions
are used for position calculation, z-fighting could result:
Macro Parameters Action Clocks
expp dest, src1 provides exponential with full precision to at least 1/2 12
frc dest, src1 returns fractional portion of each input component 3
log dest, src1 provides log2(x) with full float precision of at least 1/2 12
m3x2 dest, src1, src2 computes the product of the input vector and a 3x2 matrix 2
m3x3 dest, src1, src2 computes the product of the input vector and a 3x2 matrix 3
m3x4 dest, src1, src2 computes the product of the input vector and a 3x2 matrix 4
m4x3 dest, src1, src2 computes the product of the input vector and a 3x2 matrix 3
m4x4 dest, src1, src2 computes the product of the input vector and a 3x2 matrix 4
You are able to perform all transform and lighting operations with these instructions. If it
seems to you that some instructions are missing, rest assured that you can achieve them
through the existing instructions for example, the division of two numbers can be realized
with a reciprocal and a multiply. You can even implement the whole fixed-function pipeline
by using these instructions in a vertex shader. This is shown in the NVLink example of

210
26.3. Grafik-Programmierung und Theorie

NVIDIA.

Putting it All Together Now let’s see how these registers and instructions are typically
used in the vertex shader ALU.
In vs.1.1 there are 16 input registers, 96 constant registers, 12 temporary registers, 1
address register and up to 13 output registers per rasterizer. Each register can handle
4x32-bit values. Each 32-bit value is accessible via an x, y, z and w subscript. That is,
a 128-bit value consists of a x, y, z and w value. To access these register components,
you must add .x, .y, .z and .w at the end of the register name. Let’s start with the input
registers:

Using the Input Registers The 16 input registers can be accessed by using their names
v0 to v15. Typical values provided to the input vertex registers are:
• Position(x,y,z,w)
• Diffuse color (r,g,b,a) -> 0.0 to +1.0
• Specular color (r,g,b,a) -> 0.0 to +1.0
• Up to 8 Texture coordinates (each as s, t, r, q or u, v , w, q) but normally 4 or 6,
dependent on hardware support
• Fog (f,*,*,*) -> value used in fog equation
• Point size (p,*,*,*)
You can access the x-component of the position with v0.x, the y-component with v0.y and
so on. If you need to know the green component of the RGBA diffuse color, you check v1.y.
You may set the fog value for example into v7.x. The other three 32-bit components, v7.y,
v7.z and v7.w would not be used. The input registers are read-only. Each instruction may
access only one vertex input register. Unspecified components of the input register default
to 0.0 for the x, y and z components and to 1.0 for the w component. In the following
example the four-component dot product between each of c0 - c3 and v0 is stored in oPos:
dp4 oPos.x , v0 , c0
dp4 oPos.y , v0 , c1
dp4 oPos.z , v0 , c2
dp4 oPos.w , v0 , c3

Such a code fragment is usually used to map from projection space, with the help of
the already concatenated world-, view- and projection matrices, to clip space. The four
component dot product performs the following calculation:
oPos.x = (v0.x * c0.x) + (v0.y * c0.y) + (v0.z * c0.z) + (v0.w * c0.w)

Given that we use unit length (normalized) vectors, it is known that the dot product of
two vectors will always range between [-1, 1]. Therefore oPos will always get values in that
range. Alternatively, you could use:
m4x4 oPos, v0 , c0

211
26. XNA + C#

Don’t forget to use those complex instructions consistently throughtout your vertex shader,
because as described above, there might be slight differences between dp4 and m4x4 results.
You are restricted to using only one input register in each instruction.
All data in an input register remains persistent throughout the vertex shader
execution and even longer. That means they retain their data longer than the
life-time of a vertex shader. So it is possible to re-use the data of the input
registers in the next vertex shader.

Using the Constant Registers Typical uses for the constant registers include:
• Matrix data: quad-floats are typically one row of a 4x4 matrix
• Light characteristics, (position, attenuation etc)
• Current time
• Vertex interpolation data
• Procedural data
There are 96 quad-floats (or in the case of the RADEON 8500, 192 quad-floats) for storing
constant data. This reasonably large set of matrices can be used for example, for indexed
vertex blending, more commonly known as "matrix palette skinning".
The constant registers are read-only from the perspective of the vertex shader, whereas
the application can read and write into the constant registers. The constant registers re-
tain their data longer than the life-time of a vertex shader so it is possible to re-use this
data in the next vertex shader. This allows an app to avoid making redundant SetVertex-
ShaderConstant() calls. Reads from out-of-range constant registers return (0.0, 0.0, 0.0,
0.0).
You can use only one constant register per instruction, but you can use it several times.
For example:
; the following instruction is legal
mul r5, c11, c11 ; The product of c11 and c11 is stored in r5

; but this is illegal


add v0, c4, c3

A more complicated-looking, but legal, example is:


; dest = (src1 * src2) + src3
mad r0, r0, c20, c20 ; multiplies r0 with c20 and adds c20 to the result

Using the Address Register You access the address registers with a0 to an (more than
one address register should be available in vertex shader versions higher than 1.1). The
only use of a0 in vs.1.1 is as an indirect addressing operator to offset constant memory.
c[a0.x + n] ; supported only in version 1.1 and higher
; n is the base address and a0.x is the address offset

212
26.3. Grafik-Programmierung und Theorie

Here is an example using the address register:

//Set 1
mov a0.x,r1.x
m4x3 r4,v0,c[a0.x + 9];
m3x3 r5,v3,c[a0.x + 9];

Depending on the value that is stored in temporary register r1.x, different constant registers
are used in the m4x3 and m3x3 instructions. Please not that register a0 only stores whole
numbers and no fractions (integers only) and that a0.x is the only valid component of a0.
Further, a vertex shader may write to a0.x only via the mov instruction.

Beware of a0.x if there is only a software emulation mode: performance can be


significantly reduced [Pallister].

Using the Temporary Registers You can access the 12 temporary registers using r0 to
r11. Here are a few examples:

dp3 r2, r1, -c4 ; A three-component dot product: dest.x = dest.y = dest.z =
; dest.w = (r1.x * -c4.x) + (r1.y * -c4.y) + (r1.z * -c4.z)
...
mov r0.x, v0.x
mov r0.y, c4.w
mov r0.z, v0.y
mov r0.w, c4.w

Each temporary register has single write and triple read access. Therefore an instruction
could have the same temporary register as a source three times. Vertex shaders can not
read a value from a temporary register before writing to it. If you try to read a temporary
register that was not filled with a value, the API will give you an error message while
creating the vertex shader (== CreateVertexShader()).

Using the Output Registers There are up to 13 write-only output registers that can
be be accessed using the following register names. They are defined as the inputs to the
rasterizer and the name of each registers is preceded by a lower case ’o’. The output registers
are named to suggest their use by pixel shaders.

213
26. XNA + C#

Name Value Description


oDn 2 quad-floats Output color data directly to the pixel shader. Required
for diffuse color (oD0) and specular color (oD1).
oPos 1 quad-float Output position in homogenous clipping space. Must be
written by the vertex shader.
oTn up to 8 Output texture coordinates. Required for maximum
quad-floats number of textures simultaneously bound to the texture
Geforce 3: 4 blending stage.
RADEON 8500: 6
oPts.x 1 scalar float Output point-size registers. Only the scalar x-component
of the point size is functional
oFog.x 1 scalar float the fog factor to be interpolated and then routed to the
fog table. Only the scalar x-component is functional.
Here is a typical example, that shows how to use the oPos, oD0 and oT0 registers:
dp4 oPos.x , v0 , c4 ; emit projected x position
dp4 oPos.y , v0 , c5 ; emit projected y position
dp4 oPos.z , v0 , c6 ; emit projected z position
dp4 oPos.w , v0 , c7 ; emit projected w position
mov oD0, v5 ; set the diffuse color
mov oT0, v2 ; outputs the texture coordinates to oT0 from input register v2

Using the four dp4 instructions to map from projection to clip space with the already
concatenated world-, view- and projection matrices was already shown above. The first
mov instruction moves the content of the v5 input register into the color output register
and the second mov instruction moves the values of the v2 register into the first output
texture register.
Using the oFog.x output register is shown in the following example:
; Scale by fog parameters :
; c5.x = fog start
; c5.y = fog end
; c5.z = 1/range
; c5.w = fog max
dp4 r2, v0, c2 ; r2 = distance to camera
sge r3, c0, c0 ; r3 = 1
add r2, r2, -c5.x ; camera space depth (z) - fog start
mad r3.x, -r2.x, c5.z, r3.x ; 1.0 - (z - fog start) * 1/range
; because fog=1.0 means no fog, and
; fog=0.0 means full fog
max oFog.x, c5.w, r3.x ; clamp the fog with our custom max value

Having a fog distance value permits more general fog effects, than using the position’s z or
w values. The fog distance value is interpolated before use as a distance in the standard
fog equations used later in the pipeline.
Every vertex shader must write at least to one component of oPos or you will get an error
message by the assembler.

214
26.3. Grafik-Programmierung und Theorie

When using vertex shaders the D3DTSS_TCI_* flags of D3DTSS_TEXCOORDINDEX


are ignored. All texture coordinates are mapped in numerical order.
Optimization tip: emit to oPos as early as possible to trigger parallelism in
the pixel shader. Try to reorder the vertex shader instructions to make this
happen.
All iterated values transferred out of the vertex shader are clamped to [0..1]. If you need
signed values in the pixel shader, you must bias them in the vertex shader, and then
re-expand them in the pixel shader by using _bx2.

Swizzling and Masking If you use the input, constant and temporary registers as source
registers, you can swizzle the .x, .y, .z and .w values independently of each other. If you
use the output and temporary registers as destination registers you can use the .x, .y, .z
and .w values as write-masks. Here are the details:

Swizzling (only source registers: vn, cn, rn) Swizzling is very useful for efficiently, where
the source registers need to be rotated - like cross products. Another use is converting
constants such as (0.5, 0.0, 1.0, 0.6) into other forms such as (0.0, 0.0, 1.0, 0.0) or (0.6, 1.0,
-0.5, 0.6).
All registers, that are used in instructions as source registers can be swizzled. For example
mov R1, R2.wxyz;

Abbildung 26.17.: Swizzling

The destination register is R1, where R could be a write-enabled register like the output
(o*) or any of the temporary registers (r). The source register is R2, where R could be a
input (v), constant (c) or temporary register (source registers are located on the right side
of the destination register in the instruction syntax).
The following instruction copies the negation of R2.x into R1.x, the negation of R2.y into
R1.y and R1.z and the negation of R2.z into R1.w. As shown, all source registers can be
negated and swizzled at the same time:

215
26. XNA + C#

mov R1, -R2.xyyz

Abbildung 26.18.: Swizzling #2

Masking (only destination registers: on, rn) A destination register can mask which
components are written to it. If you use R1 as the destination register (acutally any write-
enabled registers : o*, r), all the components are written from R2 to R1. If you choose for
example
mov R1.x, R2

only the x component is written to R1, whereas


mov R1.xw, R2

writes only the x and w components of R2 to R1. No swizzling or negation is supported


on the destination registers.
Here is the source for a 3-vector cross-product:
; r0 = r1 x r2 (3-vector cross-product)
mul r0, r1.yzxw, r2.zxyw
mad r0, -r2.yzxw, r1.zxyw, r0

This is explained in detail in [LeGrand].


The following table summarizes swizzling and masking:
Component Modifier Description
R.[x][y][z][w] Destination mask
R.xwzy (for example) Source swizzle
-R Source negation
Since any source can be negated, there is no need for a subtract instruction.

216
26.3. Grafik-Programmierung und Theorie

Guidelines for Writing Vertex Shaders The most important restrictions you should
remember when writing vertex shaders are the following:
• They must write to at least one component of the output register oPos
• There is a 128 instruction limit
• Every instruction may source no more than one constant register, e.g. add r0, c4, c3
will fail
• Every instruction may source no more than one input register, e.g. add r0, v1, v2
will fail
• There are no C-like conditional statements, but you can mimic an instruction of the
form r0 = (r1 >= r2) ? r3 : r4 with the sge instruction
• All iterated values transferred out of the vertex shader are clamped to [0..1]
There are several ways to optimize vertex shaders. Here are a few rules of thumb:
• Read the paper from Kim Pallister on optimizing software vertex shaders [Pallister]
• When setting vertex shader constant data, try to set all data in one SetVertexSha-
derConstant() call
• Pause and think about using a mov instruction; you may be able to avoid it
• Choose instructions that perform multiple operations over instructions that perform
single operations
mad r4,r3,c9,r4
mov oD0,r4
==
mad oD0,r3,c9,r4

• Collapse (remove complex instructions like m4x4 or m3x3 instructions) vertex shaders
before thinking about optimizations
• A rule of thumb for load-balancing between the CPU/GPU: Many calculations in
shaders can be pulled outside and reformulated per-object instead of per-vertex and
put into constant registers. If you are doing some calculation which is per object
rather than per vertex, then do it on the CPU and upload it on the vertex shader as
a constant, rather than doing it on the GPU
One of the most interesting methods to optimize your applications band-
width usage, is the usage of compressed vertex data [Calver].
Now that you have an abstract overview, of how to write vertex shaders, I would like to
mention at least three different ways to compile one.

Compiling a Vertex Shader Direct3D uses byte-codes, whereas OpenGL implementati-


ons parses a string. Therefore the Direct3D developer needs to assemble the vertex shader
source with an assembler. This might help you find bugs earlier in your development cycle
and it also reduces load-time.
I see three different ways to compile a vertex shader:

217
26. XNA + C#

• write the vertex shader source into a separate ASCII file for example test.vsh and
compile it with a vertex shader assembler into a binary file, for example test.vso.
This file will be opened and read at game start up. This way, not every person will
be able to read and modify your vertex shader source.
Don’t forget that NVLink can link together already compiled shader
fragments at run-time.
• write the vertex shader source into a separate ASCII file or as a char string in-
to your *.cpp file and compile it "on the fly" while the app starts up with the
D3DXAssembleShader*() functions.
• write the vertex shader source in an effects file and open this effect file when the
app starts up. The vertex shader can be compiled by reading the effect files with
D3DXCreateEffectFromFile(). It is also possible to pre-compile an effects file. This
way, most of the handling of vertex shaders is simplified and handled by the effect
file functions.
Another way is to use the opcodes shown in d3dtypes.h and build your own
vertex assembler/disassembler.
Let’s review, what we have examined so far. After we ...
• checked the vertex shader support with the D3DCAPS8::VertexShaderVersion field
• we declared a vertex shader with the D3DVSD_* macros
• then we set the constant registers with SetVertexShaderConstant() and
• wrote and compiled the vertex shader
Now we need to get a handle to call it.

Creating a Vertex Shader The CreateVertexShader() function is used to create and


validate a vertex shader:
HRESULT CreateVertexShader(
CONST DWORD* pDeclaration,
CONST DWORD* pFunction,
DWORD* pHandle,
DWORD Usage);

This function takes the vertex shader declaration (which maps vertex buffer streams to
different vertex input registers) in pDeclaration as a pointer and returns the shader handle
in pHandle. The second parameter pFunction gets the vertex shader instructions compiled
by D3DXAssembleShader() / D3DXAssembleShaderFromFile() or the binary code pre-
compiled by a vertex shader assembler. With the fourth parameter you can force software
vertex processing with D3DUSAGE_SOFTWAREPROCESSING. It must be used, when
D3DRS_SOFTWAREVERTEXPROCESSING is set to TRUE. By setting the software
processing path explicitly, vertex shades are simulated by the CPU by using the software
vertex shader implementation of the CPU vendors. If a vertex shader-capable GPU is
available, using hardware vertex processing should be faster. You must use this flag or the
reference rasterizer for debugging with the NVIDIA Shader Debugger.

218
26.3. Grafik-Programmierung und Theorie

Setting a Vertex Shader You set a vertex shader for a specific object by using Set-
VertexShader() before the DrawPrimitive*() call of this object. This function dynamically
loads the vertex shader between the primitive calls.
// set the vertex shader
m_pd3dDevice->SetVertexShader( m_dwVertexShader );

The only parameter you must provide is the handle of the vertex shader created by Crea-
teVertexShader(). The overhead of this call is lower than a SetTexture() call, so you are
able to use it often.
Vertex Shaders are executed with SetVertexShader() as many times as there are vertices.
For example if you try to visualize a rotating quad with four vertices implemented as an
indexed triangle list, you will see in the NVIDIA Shader Debugger, that the vertex shader
runs four times, before the DrawPrimitive*() function is called.

Free Vertex Shader Resources When the game shuts down or when the device is chan-
ged, the resources taken by the vertex shader must be released. This must be done by
calling DeleteVertexShader() with the vertex shader handle:
// delete the vertex shader
if (m_pd3dDevice->m_dwVertexShader != 0xffffffff)
{
m_pd3dDevice->DeleteVertexShader( m_dwVertexShader );
m_pd3dDevice->m_dwVertexShader = 0xffffffff;
}

26.3.2.6. Conclusion

Summarize We have now stepped through the vertex shader creation process on a high-
level ... let’s summarize what was shown so far:
• To use vertex shaders, you must check the vertex shader support of the software or
hardware vertex shader implementation installed on the computer of your end-user
with the D3DCAPS8::VertexShaderVersion field.
• You must declare, which input vertex properties or incoming vertex data have to be
mapped to which input register. This mapping is done with the D3DVSD_* macros.
You are able to fill the constant registers of the vertex shader with values by using
the provided macros or by using the SetVertexShaderConstant() function.
• After you have prepared everything this way and you have written a vertex shader,
you are able to compile it, retrieve a handle to it by calling CreateVertexShader()
and make it for execute by using SetVertexShader().
• To release the resources that are allocated by the vertex shader you should call
DeleteVertexShader() at the end of your game.

What happens next? In the next chapter "Programming Vertex Shaders" we will start
writing our first vertex shader. We will discuss basic lighting algorithms and how to im-
plement them.

219
26. XNA + C#

References [Bendel] Steffen Bendel, "Smooth Lighting with ps.1.4", ShaderX, Wordware
Inc., pp ?? - ??, 2002, ISBN 1-55622-041-3

[Calver] Dean Calver, "Vertex Decompression in a Shader", ShaderX, Wordware Inc., pp


?? - ??, 2002, ISBN 1-55622-041-3

[Gosselin] David Gosselin, "Character Animation with Direct3D Vertex Shaders", ShaderX,
Wordware Inc., pp ?? - ??, 2002, ISBN 1-55622-041-3

[Hurley] Kenneth Hurley, "Photo Realistic Faces with Vertex and Pixel Shaders", ShaderX,
Wordware Inc., pp ?? - ??, 2002, ISBN 1-55622-041-3

[Isidoro/Gosslin], John Isidoro, David Gosselin, "Bubble Shader", ShaderX, Wordware Inc.,
pp ?? - ??, 2002, ISBN 1-55622-041-3

[LeGrand] Scott Le Grand, Some Overlooked Tricks for Vertex Shaders, ShaderX, Word-
ware Inc., pp ?? - ??, 2002, ISBN 1-55622-041-3

[Pallister] Kim Pallister, "Optimizing Software Vertex Shaders", ShaderX, Wordware Inc.,
pp ?? - ??, 2002, ISBN 1-55622-041-3

[Riddle/Zecha] Steven Riddle, Oliver C. Zecha, "Perlin Noise and Returning Results from
Shader Programs", ShaderX, Wordware Inc., pp ?? - ??, 2002, ISBN 1-55622-041-3

[Schwab] John Schwab, "Basic Shader Development with Shader Studio", ShaderX, Word-
ware Inc., pp ?? - ??, 2002, ISBN 1-55622-041-3

[Vlachos01] Alex Vlachos, Jörg Peters, Chas Boyd and Jason L. Mitchell, "Curved PN Tri-
angles", ACM Symposium on Interactive 3D Graphics, 2001 (http://www.ati.com/na/pages/resource_c

Additional Ressources A lot of information on vertex shaders can be found at the web-
sites of NVIDIA (developer.nvidia.com) and ATI (www.ati.com). I would like to name a
few:

220
26.3. Grafik-Programmierung und Theorie

Author Article Published at


Richard Huddy Introduction to NVIDIA web-site
DX8 Vertex
Shaders
Erik Lindholm, SIGGRAPH 2001 NVIDIA Web-Site
Mark J Kilgard, – A User
Henry Moreton Programmable
Vertex Engine
Evan Hart, Dave Vertex Shading ATI Web-Site
Gosselin, John with Direct3D
Isidoro and OpenGL
Jason L. Mitchell Advanced Vertex ATI Web-Site
and Pixel Shader
Techniques
Philip Taylor Series of articles http://msdn.microsoft.com/directx
on Shader
Programming
Keshav B. Geometry http://www.flipcode.com/tutorials/tut_
Channa Skinning / dx8shaders.shtml
Blending and
Vertex Lighting
Konstantin Introduction to http://www.reactorcritical.com/
Martynenko Shaders review-shadersintro/review-shadersintro.
shtml

Acknowledgements I’d like to recognize a couple of individuals that were involved in


proof-reading and improving this paper (in alphabetical order):
• David Callele (University of Saskatchewan)
• Jeffrey Kiel (NVIDIA)
• Jason L. Mitchell (ATI)
From http://www.gamedev.net/columns/hardcore/dxshader1/page6.asp

26.3.2.7. Programming Vertex Shaders

http://www.gamedev.net/columns/hardcore/dxshader2/

26.3.2.8. Fundamentals of Pixel Shaders

http://www.gamedev.net/columns/hardcore/dxshader3/

26.3.2.9. Programming Pixel Shaders

http://www.gamedev.net/columns/hardcore/dxshader4/

221
26. XNA + C#

26.3.2.10. Diffuse & Specular Lighting with Pixel Shaders

http://www.gamedev.net/columns/hardcore/dxshader5/

26.4. Tutorien

26.4.1. RB Whitaker’s Wiki A Game Development Launchpad


Siehe auch NVidia’s GPU Gems 2 Online Buch, Kapitel 2, „Terrain Rendering Using GPU-
Based Geometry Clipmaps“: http://http.developer.nvidia.com/GPUGems2/gpugems2_
chapter02.html.
Effects and HLSL Tutorials
These tutorials are an introduction to HLSL and effect files. HLSL is a programming
language that can be used to program modern graphics cards. It allows you to do everything
from lighting, to texturing, to bump, normal, and environment mapping, and just about
anything else you can dream up.
HLSL can be tough for beginners, so I’ve tried to make it as gentle of an introduction as
possible. Having said that, though, HLSL is, in fact, a very advanced topic with XNA. So
before you start going through these tutorials, please make sure that you understand the
concepts in the 3D tutorials. These tutorials should get you started with HLSL.
Trust me though, once you get ahold of the basic ideas, you’ll love HLSL. Ever since I
learned it, I sit around saying, "Ooh! I could write a shader to do that!"
hlsl shader tutorials
1 - Introduction to Shaders
This tutorial explains what a shader is and how it works. It is important to understand
what exactly we are trying to do when we create effect files, and this tutorial will give us
the background that we need.
1 - Introduction to Shaders
effects100.png
2 - Our First Shader: Ambient Lighting
In this tutorial, we will make our first shader. This tutorial covers how to create a new
effect file, as well as the important parts of an effect file. Finally, we will actually write the
shader for simple ambient lighting. The next tutorial will cover how to use an effect file in
an XNA game.
2 - Our First Shader: Ambient Lighting
effects100.png
3 - Shaders in XNA
This tutorial will discuss how to use an effect file in an XNA game. This tutorial uses the
effect file that we created in the previous tutorial, but feel free to use another effect file if
you want.

222
26.4. Tutorien

3 - Shaders in XNA
effects100.png HLSL-Diffuse.png
4 - Creating a Diffuse Lighting Shader
Now that we have created a simple ambient lighting shader and applied it to an XNA game,
it is time to try something a little more complicated. In this tutorial, we will cover the
steps to make a shader that does diffuse lighting. Diffuse lighting is the main component
of lighting, and you will notice a big difference in your shader when you get done with this
tutorial.
4 - Creating a Diffuse Lighting Shader
effects100.png HLSL-Specular.png
5 - Creating a Specular Lighting Shader
The third step in our lighting shader is to add specular lighting to it. Specular lighting, or
specular highlights, are the shiny spots of light that reflect directly off of an object. Without
specular lighting, objects tend to look kind of dull, like chalk. After we have added specular
lighting, they will appear more reflective, like plastic or metal.
5 - Creating a Specular Lighting Shader
effects100.png HLSL-Texturing.png
6 - Creating a Texturing Shader
In the previous tutorials, we have done ambient, diffuse, and specular lighting. In this
tutorial we will move away from lighting and work with textures, which are images that
are drawn on models. Texturing is a pretty simple thing to do in HLSL, especially after all
of the work we have already done.
6 - Creating a Texturing Shader
effects100.png HLSL-Bump.png
7 - Creating a Bump Map Shader
In all of the previous tutorials, we have covered a lot of things. However, you all probably
realize that they could have been done with the BasicEffect class, and it could have been
done much faster. In this tutorial we will cover our first topic that the BasicEffect class
can’t do. We will go over bump mapping, which is a process where you can use a special
texture to add in lots of detail to a model, without having to actually render lots of extra
polygons.
7 - Creating a Bump Map Shader
effects100.png HLSL-Skybox.png
8 - Creating a Skybox Shader
In this tutorial, we will create a skybox shader. A skybox is a simple way of drawing a
nice backdrop to your entire game world by surrounding it with a cube and texturing it
in a particular way that looks very nice. Skyboxes are very useful by themselves, but in
addition, we’ll want to use skyboxes when we do reflection and refraction shaders later on,
so this is a good place to start.

223
26. XNA + C#

8 - Creating a Skybox Shader


effects100.png HLSL-Reflection.png
9 - Creating a Reflection Shader
In this tutorial we will create a reflection shader, using an environment map. We will rely
heavily on the stuff in the skybox shader, so be sure to do that one first.
9 - Creating a Reflection Shader
effects100.png HLSL-Toon.png
10 - Creating a Toon Shader
In this tutorial, we will create a simple toon shader (sometimes called a cel shader), which
makes our 3D rendering look like it is a cartoon. It is a pretty simple shader, though there
are other ways to do toon shading that are more complicated and give somewhat better
results. In this tutorial, rather than building off of the shader from the previous tutorial,
we just start from scratch. I’ll just give you the code and we’ll discuss it. This tutorial also
discusses multi-pass rendering.
10 - Creating a Toon Shader
effects100.png HLSL-Transparency.png
11 - Adding Transparency to a Shader
This tutorial discusses how to add transparency to a shader. Transparency will allow ob-
jects, or parts of objects to be see-through, which can be useful in a number of situations.
You’ll see that it is extremely easy to add in transparency to any existing shader.
11 - Adding Transparency to a Shader
effects100.png HLSL-Sepia.png
12 - Post-Processing Effects
There is a whole category of shaders that we haven’t talked about yet: post-processing
effects. Occasionally, game designers want to apply certain effects to the entire screen
(rather than just objects in the scene). Usually the game window will be rendered to a
texture, and then the texture will be drawn to the screen with a shader applied to it. This
tutorial will go over the basic process of doing this, and in it, we’ll create a shader that does
nothing but draw the texture as it should be, and then we’ll go on to create a shader that
makes your scene black and white, as well as give it a sepia tone. Note that post-processing
effects can be performed on any 2D texture, not just ones that have been created from
drawing the scene to a texture.
12 - Post-Processing Effects

26.4.2. xnadevelopment.com
http://www.xnadevelopment.com/tutorials.shtml
#
Getting started with XNA development (XNA 3.0 BETA)

224
26.4. Tutorien

Everything you need to know to get starting making your game with the XNA framework.
#
Creating a new XNA Windows Game Project (XNA 3.0 BETA)
Getting a new game going with XNA starts with creating a new game project. This XNA
tutorial walks you through setting up a new XNA Windows game project and seeing that
first Cornflower Blue screen.
#
Adding an Image to the Game Project (XNA 3.0 BETA)
Before you can start displaying your graphics and images on the screen, you first need
to add them to the game project and make them available through the Content Pipeline.
This XNA tutorial walks you through the steps required to add an image or images to your
game.
#
Creating a 2D Sprite (XNA 3.0 BETA)
Creating a 2D sprite. Tutorial covers, creating a sprite, drawing it to the screen and intro-
duces some object oriented programming.
#
Scrolling a 2D background (XNA 3.0 BETA)
Tutorial covers loading background sprites and auto-scrolling them horizontally in a con-
tinuous loop.
#
The Wizard - Part 1: Moving a Sprite (XNA 3.0 BETA)
This is part one of a four part series covering sprite movement. Part one covers gathering
input from the player via the keyboard and using it to move a sprite around on the screen.
#
The Wizard - Part 2: Making a Sprite Jump (XNA 3.0 BETA)
This is part two of a four part series covering sprite movement. Part two covers adding the
code to the project to make the Wizard sprite jump around the screen.
#
The Wizard - Part 3: Making a Sprite Duck (XNA 3.0 BETA)
This is part three of a four part series covering sprite movement. Part three covers adding
the code to the project to make the Wizard sprite duck. This code introduces the concepts
of frames and using a spritesheet.
#
The Wizard - Part 4: Making a Sprite Shoot Fireballs(XNA 3.0 BETA)
This is part four of a four part series covering sprite movement. Part four covers adding
the code to the project to make the Wizard sprite shoot fireballs. This tutorial covers the
basics of creating and maintaing projectiles.

225
26. XNA + C#

#
Fade In, Fade Out (XNA 3.0 BETA)
A tutorial developed to show how to achieve a fade in, fade out effect with a a 2D image.
This tutorial walks you through creating a game project, adding an image to that project,
displaying the image and adding the effect of fading the image in and out of the scene.
Along with the tutorial and it’s source code, there is an enhanced sample showing multiple
images fading in and out of the scene Cheshire cat style which can be downloaded from
within the tutorial.
#
You have been Selected! (XNA 3.0 BETA)
A tutorial developed to show how to create an RTS style selection box. This tutorial walks
you through creating a game project, adding an image to that project, displaying the image,
making the mouse pointer visible and using the mouse to create a selection box. Along with
the tutorial and it’s source code, there is an enhanced sample showing how you can use the
selection box to select some simple "units" and move them around the game window. This
"One Step Further" tutorial can be downloaded from within the "You have been Selected!"
tutorial.
#
Not so Healthy... (XNA 3.0 BETA)
A tutorial developed to show the basics of how to create a Health bar. This tutorail will
walk you through creating a game project, adding an image to that project, tracking the
current health level and displaying that appropriately with a health bar.
#
CoDe Magazine Article: Introducing XNA Game Studio Express (XNA 3.0 BETA)
This is the images and source code for the article I wrote for the Sept/Oct 2007 issue of
CoDe magazine. If you’re following the code along in the book, the images and source code
provided here should help you finish the project out.
#
The Road Not Taken (XNA 3.0 BETA)
This tutorial walks through step by step using a color key to do path collision. The example
used is for a super sprint style track, but the code could be used for a variety of projects.
By the end of the tutorial, the reader should be familiar with moving and rotating a
sprite, using GetData() to get pixel information and have an introductory understanding
of RenderTarget2D objects and how they can be used.
#
The State of Things? (XNA 3.0)
This tutorial walks you through three different solutions for managing screen state in your
game. From the basic of the basic to a final intermediate level sample. You’re sure to pick
up other neat litlee XNA game development tips along the way as well. This tutorial is a
doozy!

226
27. Java

27.1. FAQ

227
27. Java

228
28. Perl

229
28. Perl

230
29. Die Autoconf und Automake
Toolchain

29.1. FAQ

231
29. Die Autoconf und Automake Toolchain

232
30. CMAKE

30.1. FAQ

233
30. CMAKE

234
31. Unit Testing

31.0.1. abchecken:

Tutorial: http://code-inside.de/blog/2008/08/05/howto-unittests-und-einfhrung-in-mocking-
mit-rhinomocks/
Mock-Objekt: http://de.wikipedia.org/wiki/Mock-Objekt
Rhino Mocks Introduction: http://ayende.com/wiki/Rhino+Mocks+Introduction.ashx

31.1. NUnit

31.1.1. NUnit: A tutorial Jump to Comments

http://selvasamuel.wordpress.com/2007/05/02/nunit-a-tutorial/
Purpose of this article:
Till a few months back, I used to be one of those guys who think that testing is the worst
thing a software developer could do under the sun. But then, I got introduced to NUnit
recently and my perception about testing changed. In this article, I wish to sum up my
learning and provide the list of resources that I used.
What is unit testing?
According to Jeff Canna, unit testing ensures that a particular method of a class successfully
performs a set of specific tasks. Each test confirms that a method produces the expected
output when given a known input.
What is NUnit?
NUnit is an open source framework that facilitates unit testing for all .NET languages.
How do I get NUnit?
Download the appropriate file from here and install it. That’s it!!
Writing NUnit tests
One question that crossed my mind when I was learning NUnit was whether I should
create my test project as an executable or as a class library. I finally decided to use a class
library because I wouldn’t be running my test project in a stand-alone manner anyway.
But, creating a test project as an executable would cause no problems. It’s up to you to
decide.

235
31. Unit Testing

Now, let’s get going. Let us first write the class for which we would write unit test cases.
Our class would be called Arithmetica. It would contain four methods to perform the basic
arithmetic operations – Add, Subtract, Multiply and Divide.
using System;
namespace Arithmetica { public class Arithmetica { public int Add(int augend, int addend)
{ return augend + addend; }
public int Subtract(int minuend, int subtrahend) { return minuend - subtrahend; }
public int Multiply(int firstFactor, int secondFactor) { return firstFactor * secondFactor;
}
public int Divide(int dividend, int divisor) { return dividend / divisor; } } }
The above code should be placed in a separate project and compiled into a separate assem-
bly. That’s how unit testing is performed. The test cases are not a part of the production
code. Implementing unit test within the main assembly not only bloats the actual code,
it will also create additional dependencies to NUnit.Framework. Secondly, in a multi-team
environment, a separate unit test assembly provides the ease of addition and management.
[3]
Now, let’s write the test cases for the Arithmetica class. This would involve the following
steps:
1. Create a new project of “Class Library” type (see discussion above) and name it Arith-
metica.UnitTests.
2. Add the project containing the Arithmetica class into the solution of Arithmetica.UnitTests.
3. Add reference to nunit.framework.dll. This DLL is located in a directory called bin under
the directory where NUnit is installed.
4. Add the following lines in the class in which you are writing the unit test cases:
using System; using NUnit.Framework;
5. The class which contains the tests must be declared public and decorated with the
TestFixture attribute as follows:
namespace Arithmetica { [TestFixture] public class ArithmeticaUnitTests { } }
6. Now, you may want to do setup activities which are performed before executing any test.
In our case, we want to create an object of the Arithmetica class. This is done by decorating
the method in which you want to perform the setup activities with the TestFixtureSetup
attribute as follows:
[TestFixture] public class ArithmeticaUnitTests { private Arithmetica arithmetica;
[TestFixtureSetUp] public void SetUp() { arithmetica = new Arithmetica(); } }
Note that a TestFixture can have at most one TestFixtureSetup method.
7. You may also want to perform a set of clean up activities after executing all the tests.
The method which does this is decorated with the TestFixtureTearDown attribute.
namespace Arithmetica { [TestFixture] public class ArithmeticaUnitTests { private Arith-
metica arithmetica;

236
31.1. NUnit

[TestFixtureSetUp] public void SetUp() { arithmetica = new Arithmetica(); }


[TestFixtureTearDown] public void TearDown() { arithmetica = null; } } }
Again, a TestFixture can contain at most one TestFixtureTearDown method. Other setup
and teardown attributes for NUnit include SetUp, TearDown, SetUpFixture and TearDow-
nFixture. You may refer NUnit documentation for these.
8. Now, let’s write the test for the Add method. Every test method must be decorated with
the Test attribute. You can have as many test methods in a test fixture as you desire.
[Test] public void TestAdd() { int result = arithmetica.Add(2, 3); Assert.AreEqual(result,
5); }
Here, the Add method of Arithmetica class is called with the parameters 2 and 3 and the
sum is stored in result. Then, we check whether result is equal to 5. You can read more
about assertions in NUnit documentation.
9. If you are expecting an exception to be thrown in the test method, you can decorate it
with the ExpectedException attribute as follows:
[Test, ExpectedException(typeof(DivideByZeroException))] public void TestDivide() { int
result = arithmetica.Divide(2, 0); }
It must be noted here that the precise type of the exception must be specified in the Ex-
pectedException attribute. Using Exception instead of DivideByZeroException will cause
the test to fail.
10. Similarly, you may write the other test cases. Here is the listing of the tests that I
wrote:
using System; using NUnit.Framework;
namespace Arithmetica { [TestFixture] public class ArithmeticaUnitTests { private Arith-
metica arithmetica;
[TestFixtureSetUp] public void SetUp() { arithmetica = new Arithmetica(); }
[TestFixtureTearDown] public void TearDown() { arithmetica = null; }
[Test] public void TestAdd() { int result = arithmetica.Add(2, 3); Assert.AreEqual(result,
5); }
[Test] public void TestSubtract() { int result = arithmetica.Subtract(3, 2); Assert.AreEqual(result,
1);
result = arithmetica.Subtract(2, 3); Assert.AreEqual(result, -1); }
[Test] public void TestMultiply() { int result = arithmetica.Multiply(2, 3); Assert.AreEqual(result,
6); }
[Test, ExpectedException(typeof(DivideByZeroException))] public void TestDivide() { int
result = arithmetica.Divide(4, 2); Assert.AreEqual(result, 2);
result = arithmetica.Divide(2, 0); } } }
After this, build the assembly. Please note that the TestFixtureSetUp, TestFixtureTear-
Down and Test methods must be defined with the following method signature:
public void MethodName()

237
31. Unit Testing

Executing the tests


There are two ways for executing the tests:
1. Using nunit-console
I haven’t used this method very much. So, I do not know much about it. To use this method,
make sure that the bin directory under the NUnit installation directory is in your PATH
environment variable. Go to Start > Run and type cmd to open the command prompt.
Then, type the following:
nunit-console <path of the assembly containing the tests> e.g. nunit-console D:\NUnitTutorial\bin\Rel
nunit-console.png
For more information on nunit-console, you may refer NUnit documentation.
2. Using nunit-gui
To start nunit-gui, go to Start > Programs > NUnit <version> and select NUnit-Gui. In
the NUnit GUI, select File > Open or press Ctrl + O. This would show the Open Project
dialog. Browse to the folder which contains the assembly containing your tests and open
it.
nunit-gui1.png
To execute the tests, simply press the Run button. If the test cases are executed successfully,
they would be indicated in green. Failed test cases would be indicated in red. The cause
of a failed test can be determined from the Result tab of the Properties window which
is displayed by right-clicking on the test and selecting Properties from the context menu.
Test cases which are not run would be indicated in yellow.
nunit-gui2.png
FAQs
1. NUnit GUI doesn’t load my test fixture. What do I do?
Solution – The test fixture class must be declared public.
2. How can I run NUnit GUI from within Visual Studio.NET?
Solution – This involves the following steps:
(i) From the Tools menu in VS.NET, select External Tools. . . (ii) In the dialog box that
opens, specify the values for Title, Arguments and Initial Directory fields as shown below:
nunit-within-vsdotnet.png
(iii) The Command field should contain the path of nunit-gui.exe. Click OK. (iv) Now, you
can run nunit-gui by selecting NUnit from the Tools menu in VS.NET. (v) You can also set a
keyboard shortcut for this by setting a keyboard shortcut for Tools.ExternalCommand<command-
number>. For more information on setting keyboard shortcuts for VS.NET, see Creating
custom keyboard shortcuts in VS.NET.
When I tried running my tests in this manner, I got an error which said:
Arithmetica.ArithmeticaUnitTests (TestFixtureSetUp) : Could not load file or assembly
‘Arithmetica, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’ or one of its de-
pendencies. The system cannot find the file specified.

238
31.1. NUnit

The reason for this is that $(TargetPath) refers to the obj\Release directory under the
project folder. The referenced assembly (Arithmetica.dll in this case) is not copied to this
directory. Hence, I get this error.
One solution could be to copy the referenced assembly manually to this directory. The tests
would run fine in that case. But, there is a problem. Everytime I change the referenced
assembly, I would have to copy it again. And I’m too lazy to do it this way. So, I prefer
to use the nunit-gui outside VS.NET by loading the assembly in one of the folders under
the bin folder in the project directory. This way NUnit watches the assemblies for changes
and reloads them as soon as they are changed.
3. How do I test private methods?
Solution – Refer [4].
4. How can I debug my NUnit tests?
Solution – Well, all I know is that you can do this. You can use Google to find information
on this. As I use the Express Edition of VS.NET, the facility of attaching to an external
process is unavailable. So, I couldn’t try this one out. But, I’m sure a lot of good resources
are available on the net. So, use Google.
Hope this article helps in your exploration of NUnit.
References:
1. Testing, fun? Really? 2. Crash course in using NUnit 3. Unit testing with NUnit frame-
work 4. How to test private and protected methods 5. Advanced unit testing
Possibly related posts: (automatically generated)
* How and Why Test Driven Development (TDD) and NUnit? * Unit Testing in Visual
Studio 2008 – part 1 * Unit Testing: Examples, Concepts and Frameworks
13 Comments
Filed under NUnit, Tutorials
13 Comments
* Shujaat Bukhari July 20, 2007 at 5:36 am
Hello, I have gone through your article and would accept that it is a very good article
for beginners. I am currently working at a local company in Pakistan and I am working
on Microsoft Dynamcis AX. My team had this idea of integrating Windows Workflow
with AX, and for our learning purpose, we started working on an ATM example. Since
Workflow’s code was written in C#.Net, I thought about writing the unit tests. Following
all the procedure that you have mentioned in your article, I finally ran my test. But the
result was shocking. When I loaded the assembly of my project and clicked the Run button,
NUnit disappeared. The method been tested performed an account verification by taking
an account number as input from the user and matching it with the account number of
CustTable in Dynamics AX. I am still confused about what might have caused this. If you
have any suggestions, please email me at the address that I’ve provided. Thankyou. Reply
* developers.toolstage.de July 26, 2007 at 12:33 pm
[...] Umfangreiches Einsteiger Tutorial für NUnit Tags:.NET, NUnit, Unit Tests, Visual
Studio [...] Reply * Prashanthi February 7, 2008 at 6:26 am

239
31. Unit Testing

Really Good stuff,but look the code below:


public void TestAdd() { int result = arithmetica.Add(2, 3); Assert.AreEqual(result, 5); }
* The Assert.AreEqual(result,5) , is not a valid statement. It Should be Assert.AreEqual(5,result);
As the syntax is Assert.AreEqual(Expected,Actual) *Assert statement should be modified
to all the methods. Reply * ne0 February 8, 2008 at 3:30 pm
@Prashanthi: Yes, you are right. Thanks for pointing out. Reply * Bryan March 15, 2008
at 5:49 pm
Nice tutorial. However, the tutorial implies that your start with a class and start writing
tests for that class.
In TDD (test driven development), the goal is to create your test FIRST before any code
is written.
This has several advantages. It allows you to design how a system will interact with your
class regardless of class implementation.
This makes for more robust design..
Here’s one way it could go.
Come up with a test case
Create your test fixture
Try to compile — it won’t because the class to be tested hasn’t been coded yet.
Add just enough code to get it to compile.
Now NUnit will run but the tests will fail (because of no class implementation).
Implement the part of your class that you are testing until the test passes.
Repeat — Refactor Reply * ne0 March 24, 2008 at 1:28 pm
@Bryan: I agree with you. But the point of this article was not to show how to do TDD.
In this article, I intended to show how to quickly get started with NUnit. Reply * Kashan
August 22, 2008 at 3:16 pm
I recently shifted to C# world from Java, and couldn’t get rid of minor problems, but your
tutorial helped me setup the environment for future tests perfectly! Reply * rani November
3, 2008 at 4:51 pm
please tell me the difference between [testsetup] and [testfixturesetup] Reply * marc De-
cember 2, 2008 at 9:12 am
Debugging tests functions and classes can be done by using the Debug->Attach to Process
menu option. Choose Nunit.exe Put breakpoints wherever you need Reply * ne0 December
26, 2008 at 11:46 am
@Kashan: Thanks
@Rani: I guess you are asking the difference between [Setup] and [TestFixtureSetup]. A
TestFixtureSetup method is executed once before any of the test methods are executed. A
Setup method is executed before the execution of each test method in the test fixture. For
more information, you can refer to the NUnit documentation.

240
31.1. NUnit

@Marc: Thanks. I have mentioned that in the article. But, as I have mentioned in the
article, I was unable to do this as I was working with the Express edition of VS.NET 2005
which does not provide this facility. Reply

241
31. Unit Testing

242
32. SVN
Quellen von SVN: http://subversion.tigris.org/servlets/ProjectDocumentList?
folderID=260&expandFolder=260&folderID=10339

32.1. SVN aus dem Quellcode erstellen


subversion build
http://subversion.tigris.org/downloads/subversion-1.6.9.tar.bz2
nach subversion als rootdir entpacken
http://www.sqlite.org/sqlite-amalgamation-3_6_22.zip
ins subversion dir entpacken
(http://www.webdav.org/neon/neon-0.26.1.tar.gz geht ned)
http://www.webdav.org/neon/neon-0.29.3.tar.gz
ins subversion dir entpacken
die apr-utils
http://ftp.halifax.rwth-aachen.de/apache/apr/apr-1.3.9-win32-src.zip, http:
//ftp.halifax.rwth-aachen.de/apache/apr/apr-util-1.3.9-win32-src.zip und http:
//ftp.halifax.rwth-aachen.de/apache/apr/apr-iconv-1.2.1-win32-src-r2.zip
jeweils nach
apr
apr-util
apr-iconv unter subversion
entpacken und in apr-util die datei aprutil.dsw öffnen und mit visual
studio 2008 konvertieren. ( es reicht wohl die apr.dsw unter dem verzeichnis apr ).
http://www.zlib.net/zlib123.zip
nach subversion\zlib entpacken
D:\Eigene Dateien\Projects\SVN\iservice\neu\OmberZombie\trunk\Dist\svnRevision\subversion>
//python gen-make.py -t vcproj –vsnet-version=2008 –with-apr=C:\Temp\aprbuild\apr
–with-apr-util=C:\Temp\aprbuild\apr-util
python gen-make.py -t vcproj --vsnet-version=2008 --disable-
shared

243
32. SVN

danach ins neon dir und neon build


build libsvn_client

244
33. SQL
Siehe auch den Bereich zu MySQL unter Abschnitt 39.2.

33.1. Rezepte

33.1.1. JOIN - Normalisierte Tabellen für eine Abfrage wieder


zusammenfassen
s. http://www.sql-und-xml.de/sql-tutorial/tabellen-verknuepfen-mit-join.html

33.1.2. Zwei Spalten aus zwei Tabellen zu einer zusammenfügen


UNION ist das Stichwort. Du möchtest ja die Ergebnisse hintereinander haben, nicht ne-
beneinander in vier Spalten.
SELECT tbl1.Datum as [Datum], tbl1.Name as [Name]
FROM tbl1
UNION
SELECT tbl2.Datum as [Datum], tbl2.Name as [Name]
FROM tbl2

245
33. SQL

246
34. Tools
34.1. Help Authoring Tools
Help Authoring Systeme vergleichen unter http://hat-matrix.com/compare_hats/.

34.2. File Tools


34.2.1. AptDiff
http://www.aptedit.com/aptdiff.htm

34.2.2. AptDiff - Visual Files Comparison and Merging Utility


AptDiff is a visual text / binary files comparison and merging utility for Windows 2000/X-
P/2003/Vista. It is highly useful for web designers, software developers, and other profes-
sionals. AptDiff features a double-pane view that allows for side-by-side comparisons, with
customizable color-coding indicating whether each line/byte is added, deleted, or changed.
AptDiff can also export the side-by-side comparison to a nicely formatted HTML page
for publishing on the web. AptDiff can be installed on FLASH or other portable drives.
All user configurations are saved in the movable drive. You can carry AptDiff with you
wherever your travels or business take you and run it on almost any computer.
• Compares directly from Windows Explorer.
• Easy navigation through the differences.
• Automatically detects file changes.
• Customizable keyboard shortcuts.
• Adjustable pane splitter with smooth synchronized scrolling.
• Synchronized horizontal and vertical scroll. * Command Line Support.
• Automatically move to the first difference when loading.
• Merge all for text comparison.
• Switch the comparison type between text and binary.
• Add the shell menu items ("Select First Item to Compare...", "Compare As Text",
"Comapre As Binary") if enabled in options.
• Multilingual User Interface, now support English, Spanish and Simplified Chinese
(Options | UI Languages).
• Customize Toolbars.

247
34. Tools

34.3. Debugging
Todo:
C:\Programme\Microsoft Visual Studio 8\Common7\Tools
spyxx.exe
Spy++ (SPYXX.EXE) is a Win32-based utility that gives you a graphical view of the
system’s processes, threads, windows, and window messages. With Spy++
——–
C:\Programme\Microsoft Visual Studio 8\Common7\Tools\Bin
Depends.Exe
Have you ever...
...wondered why an application or module was failing to load? ...wondered what minimum
set of files are required to run a particular application or load a particular DLL? ...wondered
why a certain module was being loaded with a particular application? ...wanted to know
what functions are exposed by a particular module, and which ones are actually being
called by other modules? ...wanted to know the parameter and return types of exported
C++ functions?
...wanted to remove all dependencies for a given module? ...wanted to know the complete
path of all the modules being loaded for a particular application? ...wanted to know all
the base addresses of each module being loaded for a particular application? What about
versions? Or maybe CPU types?
...received one of the following errors...
——–
WinDiff.Exe
——-
C:\Programme\Microsoft Visual Studio 8\SDK\v2.0\Bin
———–
fxcop
———-
??? dotnetfx.exe /t:c:\temp /c:"msiexec.exe /fvecms c:\temp\netfx.msi" ????
—-

34.3.1. Fuslogvw
Fuslogvw ist ein assembly resolution logger.
C:\Programme\Microsoft Visual Studio 8\SDK\v2.0\Bin\FUSLOGVW.exe
——

248
34.3. Debugging

34.3.2. NtCore - Explorer Suite


Created by Daniel Pistelli, a freeware suite of tools including a PE editor called CFF
Explorer and a process viewer. The PE editor has full support for PE32/64. Special fields
description and modification (.NET supported), utilities, rebuilder, hex editor, import
adder, signature scanner, signature manager, extension support, scripting, disassembler,
dependency walker etc. First PE editor with support for .NET internal structures. Resource
Editor (Windows Vista icons supported) capable of handling .NET manifest resources. The
suite is available for x86, x64 and Itanium.

Abbildung 34.1.: http://www.ntcore.com/exsuite.php

34.3.2.1. Features:

• Process Viewer
• Drivers Viewer
• Windows Viewer
• PE and Memory Dumper
• Full support for PE32/64
• Special fields description and modification (.NET supported)
• PE Utilities
• PE Rebuilder (with Realigner, IT Binder, Reloc Remover, Strong Name Signature
Remover, Image Base Changer)
• View and modification of .NET internal structures
• Resource Editor (full support for Windows Vista icons)
• Support in the Resource Editor for .NET resources (dumpable as well)
• Hex Editor
• Import Adder
• PE integrity checks
• Extension support
• Visual Studio Extensions Wizard
• Powerful scripting language
• Dependency Walker
• Quick Disassembler (x86, x64, MSIL)
• Name Unmangler * Extension support
• File Scanner
• Directory Scanner

249
34. Tools

• Deep Scan method


• Recursive Scan method
• Multiple results
• Report generation
• Signatures Manager
• Signatures Updater
• Signatures Collisions Checker
• Signatures Retriever

34.3.2.2. Download und Installation

http://www.ntcore.com/exsuite.php

34.3.2.3. Test

Bla tralala, lalala, und nix wie sonnst, eheheheh. Und testweise testen wir mal das absolut
Tolle. Noch ein Test vom Besten der benäßten.

34.3.2.4. CFF Explorer

The CFF Explorer was designed to make PE editing as easy as possible, but without
losing sight on the portable executable’s internal structure. This application includes a
series of tools which might help not only reverse engineers but also programmers. It offers
a multi-file environment and a switchable interface.

Abbildung 34.2.: http://www.ntcore.com/exsuite.php

250
34.3. Debugging

Form

251
34. Tools

252
35. Ida Professional

35.1. Tools

35.1.1. pyemu
PyEmu tries to provide a fully scriptable IA-32 emulator in python. The aim is for security
researchers and malware analysis. By having a flexible community driven emulator in a high
level language one can roll their own purpose driven scripts to solve common problems.
http://code.google.com/p/pyemu/.
http://code.google.com/p/pyemu/source/browse/#svn/trunk
siehe .... ida buch. ist dort gut beschrieben

253
35. Ida Professional

254
Teil VI.

Developer Express Produktfamilie

255
35.1. Tools

http://www.devexpress.com/Products/

257
35. Ida Professional

258
36. DXperience
http://www.devexpress.com/Products/NET/DXperience/editions.xml

36.1. WinForms

36.2. eXpressApp Framework

36.2.1. Tipps und Tricks

36.2.1.1. MySQL als Datenbank-Server

Um das eXpressApp Framework ( XAF ) mit MySQL zu betreiben sind einige Vorberei-
tungen und Schritte notwendig.
Download Connector/Net oder vom Support der Developer Express Webseite als Attach-
ment.

Konfiguration des Datenbank Treibers: Der ADO.Net driver für MySQL kann von
der obigen MySQL-Website heruntergeladen werden. Dabei ist darauf zu achten, das der
MySQL-Treiber dem in der DevExpress.Xpo.vx.x.Providers.dllreferenzierten Version
entspricht. Beim derzeitigen Stand und der DevExpress Version 9.3 wurde ’MySql.Data,
Version=5.2.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d’ benutzt.

1. Fügen sie dem Projekt eine Referenz auf die MySql.Data.dll und DevExpress.Xpo.
v9.3.Providers.dll Assembly hinzu. 1
2. Öffnen sie die eXpressApp Konfiguration mit einem Doppelklick auf WinApplicati-
on.cs.
3. Wenn nötig in der Toolbox die MySql.Data Connection mit „Choose Items“ einfügen.
4. Danach wie in Bild 36.1 auf der nächsten Seite diesen Connector über das Feld
„Connection“ rechts oben im Designer ziehen und das Ersetzen quittieren.

Nun konfigurieren wir die erstellte Datenbankverbindung mit einem Connectionstring:


Database=xaftest;Data Source=localhost;User Id=root;Password=12345
1
Nur als Hinweis: MySql.Data.dll würde auch automatisch als Referenz hinzu gefügt werden wenn sie
bei Schritt 4 die Connection abändern.

259
36. DXperience

Abbildung 36.1.: MySQL Data Provider in der expressApp Konfiguration

Dabei bedeuten die Optionen folgendes:


Connection String Token Wert im Beispiel
Datenbankname Database= xaftest
Server Data Source= localhost, lokaler Rechner
Benutzername User Id= root
Password Password= 12345

Initialisieren und Überprüfen der Datenbank zur Laufzeit: Die Vorlage einer XAF An-
wendung ist so implementiert, dass die Datenbank erstellt wird, wenn die Anwendung zum
ersten mal ausgeführt wird, und aktualisiert, wenn die Versionsnummer der Anwendung
wächst.
Bei dem Start einer Anwendung, wird ihre Version auf Kompatibilität zur Datenbank
überprüft. Bei diesem Vorgang wird das System versuchen, auf die Datenbank zuzugreifen.
Starten Sie eine Anwendung zum ersten Mal, kann die Datenbank noch nicht existieren.
Es wird dabei das XafApplication.DatabaseVersionMismatch-Ereignis ausgelöst, um
Ihnen die Möglichkeit zu geben die Datenbank zu erstellen. Sie müssen sich also nicht um die
richtige Datenbankerstellung kümmern, sondern können dies zur Laufzeit der Anwendung
vornehmen. Dieser event wird in der XAF-Anwendungs-Vorlage behandelt. Sehen Sie sich
die XXXApplication.cs (XXXApplication.vb)-Datei in Ihrem Anwendungsprojekt an. Der
Event-Handler sieht wie folgt aus:
public partial class MySolutionWindowsFormsApplication : WinApplication {
//...
private void MySolutionWindowsFormsApplication_DatabaseVersionMismatch(
object sender, DevExpress.ExpressApp.DatabaseVersionMismatchEventArgs e) {

260
36.2. eXpressApp Framework

if(System.Diagnostics.Debugger.IsAttached) {
e.Updater.Update();
e.Handled = true;
}
else {
throw new InvalidOperationException(
"The␣application␣cannot␣connect␣to␣the␣specified␣database,␣" +
"because␣the␣latter␣doesn’t␣exist␣or␣its␣version␣is␣older␣" +
"than␣that␣of␣the␣application.\r\n" +
"The␣automatic␣update␣is␣disabled,␣because␣the␣application␣" +
"was␣started␣without␣debugging.\r\n" +
"You␣should␣start␣the␣application␣under␣Visual␣Studio,␣or␣modify␣the␣" +
"source␣code␣of␣the␣’DatabaseVersionMismatch’␣event␣handler␣" +
"to␣enable␣automatic␣database␣update,␣" +
"or␣manually␣create␣a␣database␣using␣the␣’DBUpdater’␣tool.");
}
}
}
}

Nach diesem Code wird eine Ausnahme ausgelöst werden, wenn Sie die Anwendung im
Release-Modus ausführen werden. Im Debug-Modus wird die DatabaseUpdater.Update-
Methode aufgerufen. Diese Methode erstellt die Datenbank, wenn sie nicht vorhanden ist.
In der Datenbank ist die ModulesInfo Tabelle erstellt worden, zusätzlich zu den entspre-
chenden Tabellen zu persistenten Klassen. Die ModulesInfo Tabelle ist dazu da, um die
Version der Module zu speichern. Beim ersten Anwendungsstart wird die aktuelle Versi-
on von Modulen der Anwendung in dieser Tabelle gespeichert. Falls die Überprüfung der
Datenbank-Versionen erfolgreich durchlaufen wird, startet die Anwendung.

Manuelle Initialisierung der Datenbank: Wenn Sie eine Datenbank von Hand erstellen
oder aktualisieren wollen, benutzen Sie dazu das DBUpdater-Werkzeug. Installieren sie
dazu den DBUpdater auf die Workstation oder den Server den Sie aktualisieren möch-
ten. Starten Sie die Windows-Kommandozeile und geben Sie "cd␣C:\Program␣Files\
DBUpdater"2 ein und drücken Sie die Eingabetaste, um ins Verzeichnis des Tools zu wech-
seln. Geben Sie nun "DBUpdater.exe <Pfad zur App.config des XAF-Projekts>" ein
und drücken Sie die Eingabetaste ( s. Bild 36.2 auf der nächsten Seite). Folgen Sie den
Anweisungen des Werkzeugs und drücken Sie die Eingabetaste erneut um die Datenbank
zu erstellen oder falls vorhanden, die Datenbank zu aktualisieren.

Weitere Informationen:
• Wie kann ich Mysql als meinen Datenbank-Server benutzen?: http://www.devexpress.
com/Support/Center/p/Q218894.aspx?searchtext=mysql&p=T4|P2|54.
2
Haben Sie den Quellcode von XAF installiert befindet sich das selbst erstellte DBUpdate-Tool im \
eXpressApp Framework\Sources\DevExpress.DLL\ Verzeichnis.

261
36. DXperience

Abbildung 36.2.: Datenbank-Update mit dem DBUpdater-Tool

• Suchanfrage über mysql im DevExpress Support Center: http://www.devexpress.


com/Support/Center/SearchResults.aspx?searchtext=mysql&p=T4|P2|54.
DBUpdater.exe <Pfad zur App.config des XAF-Projekts>
DBUpdater.exe <Pfad zur App.config des XAF-Projekts>
DBUpdater.exe <Pfad zur App.config des XAF-Projekts>

262
Teil VII.

Cygwin

263
36.2. eXpressApp Framework

CREATE TABLE ‘general_log‘ ( ‘event_time‘ timestamp NOT NULL DEFAULT CUR-


RENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, ‘user_host‘ medium-
text, ‘thread_id‘ int(11) DEFAULT NULL, ‘server_id‘ int(11) DEFAULT NULL, ‘com-
mand_type‘ varchar(64) DEFAULT NULL, ‘argument‘ mediumtext ) ENGINE=CSV DEFAULT
CHARSET=utf8 COMMENT=’General log’

265
36. DXperience

266
37. Befehlsreferenz
Todo Links und Zeugs zum bearbeiten:

37.1. Bash

37.1.1. Find

37.1.1.1. Rekursiv in Dateien suchen

Um ein Verzeichnis mit Unterverzeichnissen zu durchsuchen ist der find Befehl zu verwen-
den:

find . -name *.cs -print0 | xargs -0 -iFILENAME \


grep -THni ReverseRange "FILENAME"

oder

find . -name "*.cs" -print0 | xargs -0 -iFILENAME \


grep -THni "IAssemblyCache" "FILENAME"

Es wird nach den Dateien mit der Endung *.cs gesucht und die gefundenen Dateien nach
dem String ReverseRange durchsucht. Falls der Suchstring gefunden wurde erfolgt eine
Ausgabe. Mit -T wird diese horizontal mit einem Tab formatiert und mit -H der Filename
vorangestellt. Der Schalter -n gibt die Zeilennummer des gesuchten Strings aus und -i
ignoriert Groß/Kleinschreibung.
http://www.wagoneers.com/UNIX/FIND/find-usage.html

37.1.1.2. Bla

37.2. Hilfsprogramme

37.2.1. bsdiff

Binary diff/patch utility


bsdiff and bspatch are tools for building and applying patches to binary files. By using
suffix sorting (specifically, Larsson and Sadakane’s qsufsort) and taking advantage of how
executable files change, bsdiff routinely produces binary patches 50-80% smaller than those

267
37. Befehlsreferenz

produced by Xdelta, and 15% smaller than those produced by .RTPatch (a $2750/seat
commercial patch tool).
These programs were originally named bdiff and bpatch, but the large number of other
programs using those names lead to confusion; I’m not sure if the "bs" in refers to "bina-
ry software" (because bsdiff produces exceptionally small patches for executable files) or
"bytewise subtraction" (which is the key to how well it performs). Feel free to offer other
suggestions.
bsdiff and bspatch use bzip2; by default they assume it is in /usr/bin.
bsdiff is quite memory-hungry. It requires max(17*n,9*n+m)+O(1) bytes of memory, where
n is the size of the old file and m is the size of the new file. bspatch requires n+m+O(1)
bytes.
bsdiff runs in O((n+m) log n) time; on a 200MHz Pentium Pro, building a binary patch for
a 4MB file takes about 90 seconds. bspatch runs in O(n+m) time; on the same machine,
applying that patch takes about two seconds.
Providing that off_t is defined properly, bsdiff and bspatch support files of up to 2^61-1
= 2Ei-1 bytes.
Version 4.3 is available here with MD5 hash e6d812394f0e0ecc8d5df255aa1db22a. Version
4.2 is available in the FreeBSD, NetBSD, and OpenBSD ports trees as misc/bsdiff, in
Darwinports as devel/bsdiff, and in gentoo as dev-util/bsdiff. It has also been made into a
Python extension module, and there is a Windows port available.
The algorithm used by BSDiff 4 is described in my (unpublished) paper Naive differences
of executable code; please cite this in papers as
Colin Percival, Naive differences of executable code, http://www.daemonology.net/bsdiff/,
2003.
A far more sophisticated algorithm, which typically provides roughly 20% smaller patches,
is described in my doctoral thesis.
Siehe: http://www.daemonology.net/bsdiff/.

37.2.2. X1
37.2.2.1. X11

37.2.2.2. Mono Serialization Format

file:///D:/Temp/mono/XXX/bfor/bfor/binary_serialization_format.htm

37.3. Y
http://www.koders.com/csharp/fidAE336E3E7989D027A13ED1D85055A82A278C551B.aspx
Ist von http://sourceforge.net/projects/wintin: Wintin is a scriptable MUD client for
Windows

268
38. Rezepte

38.1. HMMunter

38.1.1. Dateilisten erstellen


Hier so ein find + * oder ? Separator -> ls -la script.
Danach das suchscript.

269
38. Rezepte

270
Teil VIII.

XAMPP

271
38.1. HMMunter

Webserver für lau.

273
38. Rezepte

274
39. MySQL
Todo Links und Zeugs zum bearbeiten:

39.1. Wissenswertes

39.1.1. Die utf8_unicode_ci Collation

http://dev.mysql.com/doc/refman/5.1/de/charset-unicode-sets.html
MySQL implementiert die Sortierfolge utf8_unicode_ci entsprechend dem UCA (Un-
icode Collation Algorithm, Unicode Sortierfolgenalgorithmus ), der unter http://www.
unicode.org/reports/tr10/ beschrieben ist. Die Sortierfolge verwendet die UCA Ge-
wichtungsschlüssel nach Version 4.0.0 (siehe http://www.unicode.org/Public/UCA/4.0.
0/allkeys-4.0.0.txt). Die folgende Beschreibung verwendet utf8_unicode_ci, gilt aber
für ucs2_unicode_ci gleichermaßen:
Zurzeit bietet die Sortierfolge utf8_unicode_ci nur teilweise Unterstützung für den UCA.
Einige Zeichen werden noch nicht unterstützt. Gleiches gilt für diakritische Zeichen. Dies
betrifft in erster Linie das Vietnamesische und einige Minderheitensprachen in Russland
wie etwa das Udmurtische, das Tatarische, das Baschkirische und Mari.
Die bedeutsamste Funktion in utf8_unicode_ci besteht darin, dass Erweiterungen unter-
stützt werden, d. h., wenn ein Zeichen mit einer Kombination anderer Zeichen gleichgesetzt
wird. Beispielsweise wird im Deutschen und einigen anderen Sprachen ‘ß’ mit ‘ss’ gleichge-
setzt.
utf8_general_ci ist eine ältere Sortierfolge, die Erweiterungen nicht unterstützt. Hier
können nur 1 : 1-Vergleiche zwischen Zeichen durchgeführt werden: Vergleiche für die
utf8_general_ci-Sortierfolge sind also schneller, aber unter Umständen weniger korrekt
als Vergleiche für utf8_unicode_ci.

39.2. SQL & Co

39.2.1. Logging

Diese CSV Engine laeuft nur wenn HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\m


der Service Name von MySQL auf mysqld gesetzt ist.

275
39. MySQL

39.2.1.1. General log in CSV Tabelle

http://northernmost.org/blog/mysql-query-profiling/
When you begin designing, implementing and testing an application, you obviously have
a very clear picture of what queries are executed where and roughly how often. Following
every rule in the book, you design your schema and spec your servers accordingly. However,
as the application grows, becomes more dynamic, get more users, new functionality, get
tweaked etc. your initial clear overview might be quite a bit off from the truth. Therefore
it is quite good to every now and then run a query profiler on your DBs.
It is really quite simple, first step is to enable the general log which you do by putting this
in my.cnf:
general_log=1
log_output=TABLE
You can chose to log to both a table and a file, or just a file as well for that matter. To log to
both, set log_output to TABLE,FILE. It will then be logged to the mysql.general_log table
as well as whatever file you specify with the log= statement. If you omitt the log_output
variable in MySQL 5.0, the default is to log to file, this has however changed in versions
> 5.1.6 where a table is the default. There is obviously a slight overhead in this as each
statement along with some other information is written on each query. The structure of
the general_log table looks like this:
CREATE TABLE ‘general_log‘ (
‘event_time‘ timestamp NOT NULL DEFAULT
‘CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
‘user_host‘ mediumtext,
‘thread_id‘ int(11) DEFAULT NULL,
‘server_id‘ int(11) DEFAULT NULL,
‘command_type‘ varchar(64) DEFAULT NULL,
‘argument‘ mediumtext
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT=’General log’;
Wobei das Absolut falsch ist und nicht geht. Folgende NOT-NULLerei Anordnung geht:
CREATE TABLE ‘general_log‘ (
‘event_time‘ timestamp NOT NULL DEFAULT
‘CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
‘user_host‘ mediumtext NOT NULL,
‘thread_id‘ int(11) NOT NULL,
‘server_id‘ int(11) NOT NULL,
‘command_type‘ varchar(64) NOT NULL,
‘argument‘ mediumtext NOT NULL
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT=’General log’;
To get MySQL logging without having to restart the server, you simply issue these com-
mands:
SET GLOBAL log_output=’TABLE’; SET GLOBAL general_log=’ON’;

276
39.2. SQL & Co

which has the same effect (note that this is only possible in 5.1) Then let it run for an
adequate amount of time, an hour or two during or around peak hours is usually sufficient
to get a good statistically significant data set. When you feel that you’ve got enough queries
and that they portray normal usage you need to dump the general_log table such as this:

mkdir /dump
chown mysql.mysql /dump
mysqldump --skip-lock-tables -K --tab=/dump/ \
--fields-terminated-by=’,’ --fields-enclosed-by=’"’ \
--database mysql --table general_log > general_log.sql

This will give you two files in the /dump directory, general_log.sql and general_log.txt.
The latter is a CSV formatted file which we will feed to a program called MyProfi. This is
just a zipped PHP script. You run this script on the general_log.txt, like this for instance:

/usr/bin/php parser.php -csv -top 20 \


-type "select, update, delete, insert" \
/dump/general_log.txt

This will give you the top 20 most common queries executed on your DBs. You can of
course change the arguments to -type to just say “select” to get the 20 most common
select queries etc. Very useful!

39.2.1.2. Slog slow log

xxx.

CREATE TABLE ‘slow_log‘ (


‘start_time‘ timestamp NOT NULL DEFAULT
‘CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
‘user_host‘ longtext NOT NULL,
‘query_time‘ time NOT NULL,
‘lock_time‘ time NOT NULL,
‘rows_sent‘ int(11) NOT NULL,
‘rows_examined‘ int(11) NOT NULL,
‘db‘ varchar(512) NOT NULL,
‘last_insert_id‘ int(11) NOT NULL,
‘insert_id‘ int(11) NOT NULL,
‘server_id‘ int(11) NOT NULL,
‘sql_text‘ longtext NOT NULL
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT=’Slow log’;

277
39. MySQL

39.3. PHP Scripts

39.3.1. Datenbank

39.3.1.1. Collation aller Tabellen ändern

Von http://kb.siteground.com/article/How_to_change_the_collation_for_all_tables_
in_db_to_UTF8.html : Um die Kollation für alle Tabellen in einer MySQL Datenbank zu
ändern kann es von Vorteil sein das folgende kleine PHP-Script zu benutzen. Es ändern
die Kollation für alle Tabellen in einer Datenbank auf einmal:
<?php
$db = mysql_connect(’localhost’,’root’,’’);
if(!$db) echo "Cannot␣connect␣to␣the␣database␣-␣incorrect␣details";

mysql_select_db(’bugtracker’); $result=mysql_query(’show␣tables’);

while($tables = mysql_fetch_array($result)) {
−−−−−−→foreach ($tables as $key => $value) {
−−−−−−→mysql_query("ALTER␣TABLE␣$value␣COLLATE␣utf8_unicode_ci");
}}

echo "The␣collation␣of␣your␣database␣has␣been␣successfully␣changed!";
?>

Listing 39.1: lst:mysql-collation

TODO
Jetzt brauch ich nur noch eins das die Collationen von den Feldern ändert.

39.4. Tools
Dieses Kapitel enthält Hinweise zu verschiedenen Datenbank Management Tools. Siehe
dazu auch die Wikipedia Seite Comparison of database tools.

39.4.1. mysqldiff

mysqldiff ist ein Perl-Skript Front-End für das CPAN Modul MySQL::Diff, das die Da-
tenstrukturen vergleicht. Dabei vergleicht es die Tabellendefinitionen von zwei MySQL-
Datenbanken, und gibt die Unterschiede als Folge von MySQL-Befehlen aus, die wieder an
mysql weitergeleitet werden können um die Struktur der Ursprungsdatenbank mit der Ver-
gleichsdatenbank zu synchronisieren (vgl. diff und patch). Dabei können Datenbankstruk-
turen verglichen werden, deren Quelle Dateien mit Tabellendefinitionen oder bestehende
Datenbanken, lokal oder remote sind.

278
39.4. Tools

Das Programm macht dabei keinen Versuch, die Daten, die in den Datenbanken gespeichert
sind, zu vergleichen. Es werden lediglich Tabellendefinitionen verglichen. Allerdings gibt es
das Programm coldiff, welches dies tut.
mysqldiff ist auf CPAN und unter http://adamspiers.org/computing/mysqldiff/ ver-
fügbar.

Optionen
Usage: mysqldiff.pl [ options ] <database1> <database2>
Options:
-?, --help show this help
-A, --apply interactively patch database1 to match database2
-B, --batch-apply non-interactively patch database1 to match database2
-d, --debug[=N] enable debugging [level N, default 1]
-o, --only-both only output changes for tables in both databases
-k, --keep-old-tables don’t output DROP TABLE commands
-n, --no-old-defs suppress comments describing old definitions
-t, --table-re=REGEXP restrict comparisons to tables matching REGEXP
-i, --tolerant ignore DEFAULT and formatting changes
-h, --host=... connect to host
-P, --port=... use this port for connection
-u, --user=... user for login if not current user
-p, --password[=...] password to use when connecting to server
-s, --socket=... socket to use when connecting to server
for <databaseN> only, where N == 1 or 2,
-hN, --hostN=... connect to host
-PN, --portN=... use this port for connection
-uN, --userN=... user for login if not current user
-pN, --passwordN[=...] password to use when connecting to server
-sN, --socketN=... socket to use when connecting to server

Databases can be either files or database names.


If there is an ambiguity, the file will be preferred;
to prevent this prefix the database argument with ‘db:’.

Anwendung
./mysqldiff.pl --host1=localhost --host2=localhost --
user=root dbo dbo2
Vergleich zweier Tabellendefinitions Dateien:

$ mysqldiff db1.defs db2.defs

Vergleich einer Tabellendefinitions Datei mit einer Datenbank names db2:

$ mysqldiff db1.defs db2

Vergleich der Tabellendefinitionen zweier Datenbanken auf einem entfernten Rechner:

$ mysqldiff --host=remote.host.com --user=myaccount db1 db2

279
39. MySQL

Vergleich der Tabellendefinitionen einer lokalen Datenbank foo mit einer Datenbank bar
auf einem entfernten Rechner, wobei die Datei foo bereits im aktuellen Verzeichnis existiert.
Dabei wird der debugging level auf 4 eingestellt.
$ mysqldiff --debug 4 db:foo --host2=remote.host.com \
--password=secret bar

39.4.2. maatkit
Maatkit besteht aus einer Reihe von hochwertigen Kommandozeilen-Tools für Open-
Source-Datenbanken wie MySQL und PostgreSQL. Die Tools ermöglichen Power-Usern
ihre Arbeit sicherer und schneller zu tun, indem sie sich auf getestete Software statt Scrip-
ting stützen. Das Toolkit enthält Funktionalität, wie Tabellen-Prüfsummen, ein Abfrage-
Profiler und ein Visual Explain-Tool. Es bietet auch fehlende Funktionen wie die Überprü-
fung, ob Slaves die gleichen Daten wie der Master haben.
Maatkit ist in Perl geschrieben und von http://code.google.com/p/maatkit/ herun-
terladbar. Die Maatkit Website http://www.maatkit.org/ stellt Dokumentation und
Support bereit.

Scripts:
Maatkit Essential command-line utilities for MySQL.
mk-archiver Archive rows from a MySQL table into another table or a file.
mk-checksum-filter Filter checksums from mk-table-checksum.
mk-deadlock-logger Extract and log MySQL deadlock information.
mk-duplicate-key-checker Find duplicate indexes and foreign keys on MySQL tables.
mk-error-log Find new and different MySQL error log entries.
mk-fifo-split Split files and pipe lines to a fifo without really splitting.
mk-find Find MySQL tables and execute actions, like GNU find.
mk-heartbeat Monitor MySQL replication delay.
mk-index-usage Read queries from a log and analyze how they use indexes.
mk-kill Kill MySQL queries that match certain criteria.
mk-loadavg Watch MySQL load and take action when it gets too high.
mk-log-player Replay MySQL query logs.
mk-merge-mqd-results Merge multiple mk-query-digest reports into one.
mk-parallel-dump Dump MySQL tables in parallel.
mk-parallel-restore Load files into MySQL in parallel.
mk-profile-compact Compact the output from mk-query-profiler.
mk-purge-logs Purge binary logs on a master based on purge rules.

280
39.4. Tools

mk-query-advisor Analyze queries and advise on possible problems.


mk-query-digest Parses logs and more. Analyze, transform, filter, review and report on
queries.
mk-query-profiler Execute SQL statements and print statistics, or measure activity caused
by other processes.
mk-show-grants Canonicalize and print MySQL grants so you can effectively replicate,
compare and version-control them.
mk-slave-delay Make a MySQL slave server lag behind its master.
mk-slave-find Find and print replication hierarchy tree of MySQL slaves.
mk-slave-move Move a MySQL slave around in the replication hierarchy.
mk-slave-prefetch Pipeline relay logs on a MySQL slave to pre-warm caches.
mk-slave-restart Watch and restart MySQL replication after errors.
mk-table-checksum Perform an online replication consistency check, or checksum MySQL
tables efficiently on one or many servers.
mk-table-sync Synchronize MySQL tables efficiently.
mk-upgrade Execute queries on multiple servers and check for differences.
mk-variable-advisor Analyze MySQL variables and advise on possible problems.
mk-visual-explain Format EXPLAIN output as a tree.

39.4.3. Toad® for MySQL

Toad for MySQL ist ein Freeware-Tool, das die Produktivität von Entwicklern und
Administratoren, die unter Windows mit MySQL arbeiten verbessert.
Toad for MySQL hilft bei Abfragen zu automatisiertem Datenbank-Objekt-Management
und beim Entwickeln von effizientem SQL-Code.
Toad for MySQL bietet die Möglichkeit Daten zu vergleichen, zu extrahieren und nach
Objekten zu suchen, Projekte zu verwalten, Import / Export von Daten und Datenbanken
zu verwalten. Der Zugang zu einer aktiven User Community steigert Ihre Produktivität
und Möglichkeiten.
Toad for MySQL von Quest Software ist unter http://www.quest.com/toad-for-mysql/
frei zu beziehen.

39.4.4. MySQL Workbench

http://dev.mysql.com/doc/workbench/en/wb-intro.html
Download: http://dev.mysql.com/downloads/workbench/5.2.html

281
39. MySQL

39.4.5. Liquibase
http://www.liquibase.org/
Download: http://www.liquibase.org/download
Quick-Start Guide: http://www.liquibase.org/quickstart
Liquibase is an open source (Apache 2.0 Licensed), database-independent library for tracking,
managing and applying database changes. It is built on a simple premise: All database
changes are stored in a human readable yet trackable form and checked into source con-
trol. Liquibase ist in Java geschrieben, an einem .NET-Port wird gearbeitet.
• Extensibility
• Merging changes from multiple developers
• Code branches
• Multiple Databases
• Managing production data as well as various test datasets
• Cluster-safe database upgrades
• Automated updates or generation of SQL scripts that can be approved and applied
by a DBA
• Update rollbacks
• Database ”diff“s
• Generating starting change logs from existing databases
• Generating database change documentation

282
40. Mantis Bugtracker
GIT-Repository: http://git.mantisbt.org/ .

283
40. Mantis Bugtracker

284
41. LifeType
LifeTypeis an open-source blogging platform with support for multiple blogs and users in
a single installation.

285
41. LifeType

286
Teil IX.

Grafik

287
42. Cinema 4d

42.1. Displacements maps


DE-JCGK-EACADA-4D_D32

Der Befehl \newcommand wird zur Definition neuer


Befehle verwendet.Sei \neu die Bezeichnung des
neuen Befehls. Der Inhalt sei die Ausgabe des Textes
Dies ist ein neuer Befehl. So lautet die Anweisung:
\newcommand\neu{Dies ist ein neuer Befehl}.Wird
anschließend der Befehl \neu eingesetzt, bewirkt er als
Ausgabe die Zeile Dies ist ein neuer Befehl.

Hmzwiwiwiwiwwiw.

Note Warning

289
42. Cinema 4d

And another note Remember

Haha

NOTE
This is a simple holded note. Called „note_l“. Let’s see what
it does.

Info
Der Befehl \newcommand wird zur Definition neuer Befehle verwendet.Sei \neu
die Bezeichnung des neuen Befehls. Der Inhalt sei die Ausgabe des Textes Dies ist
ein neuer Befehl. So lautet die Anweisung: \newcommand\neu{Dies ist ein neuer
Befehl}.Wird anschließend der Befehl \neu eingesetzt, bewirkt er als Ausgabe die
Zeile Dies ist ein neuer Befehl.

Trallalaaaaaaah Parameter
Der Befehl \newcommand wird zur Definition neuer Befehle verwendet.Sei \neu
die Bezeichnung des neuen Befehls. Der Inhalt sei die Ausgabe des Textes Dies ist
ein neuer Befehl. So lautet die Anweisung: \newcommand\neu{Dies ist ein neuer
Befehl}.Wird anschließend der Befehl \neu eingesetzt, bewirkt er als Ausgabe die
Zeile Dies ist ein neuer Befehl.

hmmmmmmmmmm

290
42.2. Import/Export

Exportieren sie ein Modell mit den Einstel-


lungen aus Abb. 42.1 mit Riptide [6]. Da-
nach kann es in ZBrush bearbeitet werden.
Dazu wird das Plugin Displacement Expor-
ter and Multi Displacement 2 [8]benötigt
das Teil von ZBrush 3.1 ist.
Importieren Sie das Mesh danach mit Tool-
>Import. Bla
Eine Greyed Note
Sachen gibts
jahaha

42.2. Import/Export
Abbildung 42.1.: Displacement Export Ein-
stellungen
42.2.1. Collada
Collada ist ein standartisiertes Austausch-
format fuer 3D Daten.
Website: http://www.maxon.net/pages/dyn_files/dyn_htx/htx/welcome_e.html
Collada Plugin: Native (R11), also Exports
to FBX
Animation: Yes
Current Version: R11 Price: $895
CINEMA 4D Release 11 [7]
Starting with release 11, Cinema now features native COLLADA export and import. The
exporter handles geometry, UV-coordinates, texture map links, joints, skinning and ani-
mation data. Bones are slowly being deprecated, so in order to take advantage of the
COLLADA export, only joints should be used for rigging and skinning.

Older CINEMA 4D versions Cinema 4D versions prior to R11 (i.e. R10.5 or lesser) do
not write COLLADA, but support FBX export. The resulting files can be converted using
the Autodesk FBX converter 1 .
Joints-based type of animation and rigs do not export properly to FBX in R10.5 or older.
Instead use the old style Cinema bones for your rigging, and matching restriction tags to
weight the bones.
• Rig your mesh with old bone deformers (not the new Mocca 3 Joints)
1
FBX Converter Transfer project data from one application to another quickly and easily with the FBX
Converter. This utility lets you convert OBJ, DXF™, and 3DS files to and from the FBX format.
http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=10775855 ->
http://images.autodesk.com/adsk/files/fbx20100_2_converter_win.exe

291
42. Cinema 4d

• Bind the bones using restriction tags and point weight maps
• Create animation
• Export to FBX
• Use the Autodesk FBX converter to convert to .dae
• Import result into C4

42.3. Tutorials

42.3.1. Creating a Renderer in Cinema4D using a VideoPost plugin


http://www.tutcity.com/tutorial/creating-a-renderer-in-cinema4d-using-a-videopost-pl
21954.html
—– und mehr:

42.3.2. Getting
started with the Cinema4D
SDK and Visual Studio
C++ 2008 Express Edition
http://www.tutcity.com/tutorial/getting-started-with-the-cinema4d-sdk-and-visual-stu
21956.html
In this tutorial you will learn how to compi-
le the sample plugins that ship with Cine-
ma4D using Visual Studio C++ 2008 Ex-
press Edition. You will also learn how to
create your own plugin project template to
Displacement use for other plugins, a simple bitmap saver
plugin and also how to ensure your plugin
will not clash with other plugins by obtai-
ning a unique ID for your plugin.

42.3.3. Using
RakNet in Cinema4D
to connecting 2 "players"
to control objects in the scene
Link
This tutorial will demonstrate how to connect
2 or more copies of Cinema4D together and

292
42.3. Tutorials

let each copy of Cinema4D have its own


"player" cube object that they can move
around in the scene. All other copies of Ci-
nema4D that are also connected will also
see the cube moving around the screen. This
could be thought of as a very simple Multi-
player room where the each Cinema4D user
has a cube as their "avatar" that they can
move around the world.

42.3.4. Importing
Quake files into Cinema4D
and preview levels using Irrlicht
http://www.tutcity.com/tutorial/importing-quake-files-into-cinema4d-and-preview-levels-
21953.html
This tutorial will show you how to using
the Irrlicht graphics engine to load in quake
levels into Cinema4D (including the mesh,
materials and textures) and then export that
back out again to the Irrlicht graphics engi-
ne to preview how your game level will look
in Irrlicht. You will learn about creating po-
lygon objects, materials and textures in Ci-
nema4D and how to access the data again
for exporting.

293
42. Cinema 4d

294
43. Lightwave3d 9.6
xxxxxx

295
43. Lightwave3d 9.6

296
44. Messiah

44.1. Morph Targets erstellen

Zbrush oder Cinema 4d Objekte

Modell in einer extra Datei für späteres Nachbearbeiten separieren und um den Faktor 100
verkleinern. Mit Riptide ein Obj-File mit den Einstellungen von Abb.(44.1) exportieren.
Nur die Option Normalen exportieren ver-
wenden. Es ist auch möglich das Objekt aus
Messiah zu exportieren und nachträglich in
C4D oder anderen Programmen zu bearbei-
ten. Dann hat es die richtige Größe.

In Messiah anschließend das Modell impor-


tieren und im Setup-Tab auswählen Abb. .
Unter Effects einen MorphBlender erstel-
len.Unter Cluster-Create einen neuen Sli-
der erstellen und diesen auswählen. Die ex-
portierten Morph Targets können nun mit Abbildung 44.1.: Exportier-Einstellungen
„Load Object For Current Channel” hinzu-
geladen werden (Abb. 44.2)

297
44. Messiah

Sind mehrere Effekte für ein Objekt aktiv


so ist der MorphBlender im Gruppierungs-
Tab als erstes voranzustellen (Abb. 44.3).

Abbildung 44.2.: Exportier-Einstellungen

Abbildung 44.3.: Gruppierung der Effekte

298
44.2. Mehrere Effekte auf einem Objekt

Abbildung 44.4.: MorphBlender Einstellun-


gen

44.2. Mehrere Effekte auf einem Objekt


Um eine korrekte Arbeitsweise bei z.B.
MorphBlender und BoneDeform zu errei-
chen muss folgendes beachtet werden:
• Unter der Animate-Tab muss der
MorphBlender wie in Abb. 44.4 ein-
gestellt werden. Dies sollten die Stan-
dardeinstllungen sein.
• Unter der Animate-Tab muss der Bo-
neDeformer wie in Abb. 44.5 ein-
Abbildung 44.5.: BoneDeformer Einstellun-
gestellt werden. „Use Pre-Deformed
gen
Points” ist einzuschalten, wenn ge-
wünscht ist, das sich das Skelett auf
die Deformationen auswirkt. Andern-
falls stimmt das Morphsource nicht mehr überein, da es ja durch den BoneDeformer
verändert wurde und führt zu unschönen Ergebnissen.
• Im Setup die richtige Reihenfolge der
Effekte unter Gruppierungen wie in
Abb. 44.3 eingestellt sein. Zuerst wird
Das Grundobjekt gemorphed, danach
verändern die Bones die Struktur.

44.3. Mehrere Effekte auf einer Objekthierarchie


Wenn das Modell z.B. einen extra Kopf mit Morphs hat.

44.4. Animate Immediate


Ursprünglich ist das Bewegen von Bones ein zweistufiger Prozess:
1. Bone selektieren

299
44. Messiah

2. Bone-Lage verändern.
. Mit der Funktion „Animate Immediate“ (Bild 44.6 auf dieser Seite) lassen sie sich ohne
den ersten Schritt bewegen. Schalten Sie „Animate Immediate“ mit Animate . Animate
Immediate ein. Damach wird, wenn Sie mit der Maus über einen Bone zeigen, dieser her-
vorgehoben. Ein einfacher Links-Klick reicht um den Bone festzuhalten und zu verändern.

44.5. Box Controller


GRrr

Abbildung 44.6.: Messiah: Animate Imme-


diate

300
45. 3d Studio max

45.1. Plugins

45.2. Scripting

45.3. Import/Export
Ressourcen: http://www.maxplugins.de/.

45.3.1. MD3
Von Katsbits http://www.katsbits.com/htm/
tools_utilities.htm#md3, der „MD3 - 3DS Max
v6 export“. Geht auch bei v8. Fuegt im Menupunkt
File . Export „Quake III, md3“ hinzu (Bild 45.1
auf dieser Seite).

45.3.2. MD5
MD5 export/import scripts (Bild 45.2 auf dieser
Seite)and tools http://www.katsbits.com/htm/
tools_utilities.htm#md5 von Katsbits. Ist ein
script und sollte nach C:\Programme\Autodesk\
3dsMax8\Scripts\MD5Exporter.mzp kopiert wer-
den. Wird unter MAXScript . Run Script aufgeru-
Abbildung 45.1.: 3dsMax8:
fen.
MD3Exporter
MD5 - 3DS Max export - Berserker
An export tool for use with 3DS Max allowi-
ng export of custom models to Doom 3’s MD5
format. Supports *.md5mesh, *.md5anim and
*.md5camera.
MD5 - 3DS Max import - Berserker
3DS Max importer for Doom 3’s MD5 format. Supports *.md5mesh,
*.md5anim and *.md5camera.

301
45. 3d Studio max

302
46. Render Engines
Hier Geht es um Render-Engines die zusaetzlich eingebaut werden koennen.

46.1. Externe Cinema 4D Renderer

46.1.1. Luxrender

LuxRender is a new, open-source, free software rendering system for physically correct,
unbiased image synthesis. Rendering with LuxRender means simulating the flow of light
according to physical equations. This produces realistic, photographic-quality images.
• It’s an authorized fork of the PBRT project, focusing on production rendering and
artistic efficiency.
• Please read our Features and Goals and philosophy pages for more information.
• Why another unbiased renderer? Read our FAQs page for details.
• LuxRender comprises an interactive GUI, a command line tool and Blender exporter
plugins.
• We also provide a C/C++ API that allows embedding LuxRender into third-party
applications.
• LuxRender runs on GNU/Linux, MS-Windows(R) and MacOS X(R) platforms.
Homepage: http://www.luxrender.net/
Download: http://www.luxrender.net/wiki/index.php/Download
Intro: http://www.luxrender.net/wiki/index.php/Introduction_to_LuxRender

46.1.1.1. Installation

After downloading the plugin extract it into the plugins folder of CINEMA 4D (usually
../maxon/cinema 4d/plugins).

46.1.1.2. Preferences

The preferences are quite simple at the moment: You can only specify the path of the
LUXLyX Render executable which will be executed when you use "

303
46. Render Engines

LUXLyX C4D Export + Render". You should set this right in the beginning which makes
the workflow a lot easier.
To change the preferences select "Plugins" -> "
LUXLyX C4D" -> "
LUXLyX C4D Preferences ...". After setting the
LUXLyX Render path, click OK and you are ready to go.

46.1.1.3. Lights

LUXLyX tries to automatically convert C4D lights to


LUXLyX lights, but this will in most of the cases not work sufficiently as
LUXLyX is physically based and unbiased while C4D gives you a lot more artistic freedom,
but often quite unrealistic results. This is the conversion table:
• Omni -> Point
• Spot, Square Spot -> Spot
• Infinite, Parallel, Parallel Spot, Square Parallel Spot -> Distant
• Area -> Area
Keep in mind that in
LUXLyX all lights have an inverse square falloff.
To give you more control over the exported light and to allow you to specify
LUXLyX light types like sun and sky you can assign a
LUXLyX C4D Light Tag to it. Changes done there are not changing the rendering of the
scene in C4D.
If the scene contains no light,
LUXLyX C4D will always export an auto light, even if it’s disabled in C4D.

46.1.1.4. Scene and Render Settings

LUXLyX C4D exports the scene by default using the low discrepancy sampler and path
integrator. To let you specify this and a lot more other things, open the C4D render settings
dialog and add the post-effect "
LUXLyX C4D Scene Settings".
A more detailed description of the render parameters can be found here: LuxRender_Render_settings
(http://www.luxrender.net/wiki/index.php/LuxRender_Render_settings).
As the possibilities of
LUXLyX are changing all the time, not all current options are available, but the most
important ones can be set there. It’s planned to update
LUXLyX C4D every now and then to the new options.

304
46.1. Externe Cinema 4D Renderer

46.1.1.5. Material Conversion

The biggest change is the conversion of C4D standard materials to


LUXLyX materials. At the moment I export only materials that are not restricted to a
polygon selection and of those only the first material of an object. That means if you mix
materials or if put different materials over different parts of an object, they will not be
exported. At least the automatic splitting of objects into parts with different materials will
be implemented in the next release. For now you have to do it manually. Sorry for that.
At the moment the plugin also only supports UV mapping and no shaders. That means
you have to do everything with bitmaps and colors.
As the material system of C4D and
LUXLyX are quite different, the conversion is also not straight forward and not all effects
of
LUXLyX are accessible that way and not all possibilities of C4D materials can be converted
to
LUXLyX . I hope that this first implementation is good enough to start learning
LUXLyX and to do some nice renders with C4D scenes.
This is the conversion map from depending on the activation of the C4D material channels
"Color" (== "D"), "Transparency" (== "T") and "Reflection" (== "R"): D: The material
will become a
LUXLyX matte material. If the illumination model is Oren-Nayar, the illumination rough-
ness will be exported as sigma value.
T or T+R or D+T+R: The material will become a
LUXLyX glass material, if the dispersion is set to 0, or become a
LUXLyX rough glass if the dispersion is set to >0. You will see that mixing reflectivity
and transparency works quite different in
LUXLyX compared to C4D. There is not much I can do about. The diffuse channel is
ignored and not exported.
R: The material will become a
LUXLyX mirror material if the dispersion is set to 0 and a shiny metal metal if not. If it’s
a shiny metal material the reflection channel (Kr) will be turned of and only the specular
reflection channel (Ks) will be set .
DR: The material will become a
LUXLyX glossy material.
DT: The material will become a
LUXLyX matte translucent material. This can be used for some SSS-like effects. The
material will look very different in
LUXLyX compared to C4D.

305
46. Render Engines

If none of these 3 channels is activated or the material is not a standard material, the
plugin exports a dummy matte material with the average color of the material.
If at least one of these 3 channels is enabled, and there is also bump enabled, it will be
exported, too.
I hope this very short introduction helps you to start using
LUXLyX with C4D. If you have questions/problems - feel free to ask. At some point we
need to document the plugin. It would be nice if someone else could do that, as my time
budget is quite limited (as you already know...). Her you can find some general information
about
LUXLyX materials: http://www.luxrender.net/wiki/index.php/LuxRender_Materials.

306
47. Terragen

307
47. Terragen

308
48. Tools

48.1. Vektorisieren
Das Vektorisieren von Grafiken ist entweder mit Photo Impact oder mit Inkscape möglich.

48.1.1. Inkscape
Ein jpeg oder anderes Pixelbild auf ein leeres Arbeitsblatt importieren, oder per drag’n
drop einfügen. Danach mit Pfad -> Bitmap vektorisieren das Bild vektorisieren.

48.2. Fraktale

48.2.1. Apophysis
Apophysis is a freeware Windows program for designing and rendering fractal flames .
It was created by Mark Townsend and has since been improved and updated by Peter
Sdobnov, Piotr Borys and Ronald Hordijk. Fractal Flames were originally developed in
1992 by Scott Draves . This Wiki is intended to be a central location for information about
Apophysis and resources for Apophysis users.
Siehe http://apophysis.wikispaces.com/.

48.3. Icons

48.3.1. IconForge
IconForge is simply the best, most complete suite to create or change icons, cursors, ani-
mated cursors and icon libraries for Windows. Optimized for editing small images, you will
find a full set of painting tools at your disposal. You can import from and export to a
variety of other image, icon and animation types, so you can take advantage of work which
you’ve already created or scanned from other sources.
IconForge is also an excellent tool for other graphics, such as producing bookmark/favorites
icons for a web site, repeating tiles for wallpaper backgrounds, animated GIF bullets to
make listings stand out, or cursors for various projects.
http://www.cursorarts.com/ca_if.html

309
48. Tools

310
Teil X.

Spiele

311
49. Eve Online

49.1. Externe Tools

49.1.1. EVE-MEEP
EVE-MEEP Eve-Online Multiuse Economic Efficiency Planner
Eve-MEEP is a tool for industrialists in Eve-Online that brings together the full potential
of the Eve API with calculators and metrics to provide the greatest advantage possible.
Track your in-game transactions and finances, know your assets to a greater degree than
the actual game can provide, plan your future investments, and more all from the same
application. Want to see how your market orders are doing throughout the day? Eve-MEEP
collects data from Eve-Metrics and Eve-Central to show you all the currently open orders
and where you are in relation to them, along with historical price trends.
Home http://sites.google.com/site/evemeep/
Download http://sites.google.com/site/evemeep/downloads
Project https://sourceforge.net/projects/evemeep/

49.1.2. Eve Mon


EVEMon is a lightweight, easy-to-use standalone Windows application designed to assist
you in keeping track of your EVE Online character progression. You can view your current
skills and attributes, what you’re currently training, and your ISK balance. EVEMon can
track multiple characters across multiple accounts, so all your alts can be monitored through
the same, simple interface.
You can also plan your future character progression, by setting up a skill training plan; or
even just play "what if" with detailed listings of all skills and training times. Put Learning
skills into your training plans and the times adjust automatically. EVEMon will even look
over your plans for you and suggest Learning skills to reduce your overall training time!
EVEMon can save your character information in XML format, or as a text file. Your skill
plans can be saved as EMP (EVEMon Plan File), XML, or text formats; and can easily
be shared with other EVEMon users for easy skill build suggestions and sharing. EVEMon
automatically adds or removes skills from the plan when a plan file is loaded by another
user as appropriate to fulfill skill prerequisites, or to remove skills the user already knows.
When your character’s currently training skill completes, EVEMon can notify you with
your choice of a desktop tray balloon, a sound effect, or even an email sent automatically.
Your skill plans will automatically update to account for the newly completed skill, as well!

313
49. Eve Online

Home http://evemon.battleclinic.com/
Download http://evemon.battleclinic.com/
Snapshot http://evemon.battleclinic.com/builds/snaps/EVEMon_2352_2010-07-01.
zip
Project http://evemon.battleclinic.com/source_code.php
Fittings-Website http://eve-live.com/setup/

49.1.3. Eve Fitting Tool

Version Eve Fitting Tool v2.12.4 - Tyrannis

Ein offline ship fitter. Ich sehe keine offenen sourcen, hmmmm.
Home http://www.eveonline.com/ingameboard.asp?a=topic&threadID=548883
Download http://sharingmatrix.com/file/6913359/EFT2.12.4.zip
Project ???
Fittings-Website http://eve-live.com/setup/

49.2. EVE Development Information

Forum-Thread http://www.eveonline.com/ingameboard.asp?a=topic&threadID=1006676

49.2.1. EVE API Documentation

Den EVE API Documentation Index unter http://www.eveonline.com/api/doc/ und


http://wiki.eve-id.net/APIv2_Page_Index vom Eve-Development Network.

49.2.2. The EVE-Dev Wiki

Homepage http://wiki.eve-id.net/Main_Page

49.2.2.1. CCP Database Dump Resources

URL http://wiki.eve-id.net/CCP_Database_Dump_Resources

314
49.3. Ships und Module

49.3. Ships und Module


Aus dem Ships and Modules Resource Thread von http://www.eveonline.com/ingameboard.
asp?a=topic&threadID=1107573.
Siehe das Eve Fitting Tool unter Abschnitt 49.1.3. Eine alternative dazu ist die Battle
Clinic fitting application von http://eve.battleclinic.com/ship_loadout.php zu der
man sich anmelden muss. Die von den Usern eingegebenen Fittings können aber unter
http://eve.battleclinic.com/browse_loadouts.php angesehen werden.

49.3.1. Meta / Named Modules


Download http://home.comcast.net/~tyrattica/meta.html.
Forum-Thread http://www.eveonline.com/ingameboard.asp?a=topic&threadID=182956

49.3.2. Best Named Versus Tech II


Unter der Seite Module Wars - Best Named Versus Tech II
URL http://www.eve-tribune.com/index.php?no=3_16&page=1

49.4. Guides

49.4.1. Industry
49.4.1.1. Planetary Interaction Guide

Homepage https://docs.google.com/View?docid=dhnp447p_57hdrkf2g6

315
49. Eve Online

316
50. Enemy Territory
Edit mit GTKRadiant. http://qeradiant.com/cgi-bin/trac.cgi und Wikipedia:http:
//de.wikipedia.org/wiki/GtkRadiant.
Bei den Gamepacks https://zerowing.idsoftware.com/svn/radiant.gamepacks/, die
pk3’s und models, usw ins et Home-Verzeichnis.
http://en.wikibooks.org/wiki/GtkRadiant.
Tutorien: http://alientrap.org/forum/viewtopic.php?t=9, http://www.richdiesal.
map-craft.com/tutorials/index.html.
//␣ETWOLF

bind␣r␣"exec␣autoexec.cfg"
//bind␣a␣"cg_drawgun␣0;␣cg_drawTeamOverlay␣0;␣cg_drawStatus␣0;␣cg_drawcompass␣"0
";␣seta␣cg_noVoiceText␣"1";␣clear;␣wait␣5;␣screenshotJPEG;␣toggle␣cg_drawgun
;␣toggle␣cg_drawTeamOverlay;␣toggle␣cg_drawStatus;␣toggle␣drawcompass;␣
toggle␣cg_noVoiceText"

//bind␣KP_INS␣"weaponbank␣4;wait␣4;+attack;wait␣90;-attack;wait␣10;weaponbank␣3"
exec␣punkb.cfg
exec␣varconf.cfg

seta␣cl_timenudge␣0

seta␣r_gamma␣"2"
condump␣"ET-console.log"
seta␣logging␣1
seta␣r_mode␣"6"

bind␣KP_INS␣"vstr␣qnade"
//bind␣MOUSE4␣"+zoom"
bind␣SHIFT␣"+zoom"
//bind␣MOUSE5␣"+vstr␣mouser5␣mouser5off"

bind␣CAPSLOCK␣"+speed"
bind␣UPARROW␣"+forward"
bind␣DOWNARROW␣"+back"
bind␣LEFTARROW␣"+moveleft"
bind␣RIGHTARROW␣"+moveright"

317
50. Enemy Territory

set␣sprinter1␣"+sprint;␣bind␣3␣"vstr␣sprinter2";echo␣"sp1""
set␣sprinter2␣"-sprint;␣bind␣3␣"vstr␣sprinter1";echo␣"sp2""
vstr␣sprinter2

bind␣-␣"vstr␣irre"
set␣irre␣"+moveleft;␣wait␣30␣;␣-moveleft;␣+attack␣;␣wait␣50;␣-attack␣;␣"

//bind␣MOUSE5␣"+vstr␣mauserl5␣mauserl5off"
bind␣pgup␣"vstr␣mauserl5"
set␣mauserl5␣"weapalt;␣bind␣MWHEELDOWN␣"zoomout";␣bind␣MWHEELUP␣"zoomin";␣bind␣
pgup␣"vstr␣mauserl5off""
set␣mauserl5off␣"weapalt;␣vstr␣qn_bind;␣bind␣pgup␣"vstr␣mauserl5""

set␣qn_weaplast3␣"vstr␣resetswitcher;␣wait␣2;␣weaponbank␣3␣;␣wait␣5␣;␣-attack"
set␣qn_weaplast2␣"vstr␣resetswitcher;␣wait␣2;␣weaponbank␣2␣;␣wait␣5␣;␣-attack"
set␣qn_weaplast1␣"vstr␣resetswitcher;␣wait␣2;␣weaponbank␣1␣;␣wait␣5␣;␣-attack"

set␣weaplast_sw1␣"set␣qn_weaplast␣vstr␣qn_weaplast1"
set␣weaplast_sw2␣"set␣qn_weaplast␣vstr␣qn_weaplast2"
set␣weaplast_sw3␣"set␣qn_weaplast␣vstr␣qn_weaplast3"

set␣wep_01␣"vstr␣weaplast_sw1;␣set␣wep_f␣vstr␣wep_02;␣set␣wep_b␣vstr␣wep_03;␣set
␣wep␣vstr␣nade_01;vstr␣resetswitcher;␣weaponbank␣1"
set␣wep_02␣"vstr␣weaplast_sw2;␣set␣wep_f␣vstr␣wep_03;␣set␣wep_b␣vstr␣wep_01;␣set
␣wep␣vstr␣nade_02;vstr␣resetswitcher;␣weaponbank␣2"
set␣wep_03␣"vstr␣weaplast_sw3;␣set␣wep_f␣vstr␣wep_01;␣set␣wep_b␣vstr␣wep_02;␣set
␣wep␣vstr␣nade_03;vstr␣resetswitcher;␣weaponbank␣3"

vstr␣wep_03␣//␣Default
vstr␣wep_02␣//␣Default
vstr␣wep_01␣//␣Default
vstr␣wep_03␣//␣Default

//set␣qn_bind␣"bind␣mouse1␣"+attack";␣bind␣MWHEELDOWN␣"vstr␣wep_b";␣bind␣
MWHEELUP␣"vstr␣wep_f";"
set␣qn_bind␣"bind␣mouse1␣"+vstr␣aton␣atof";␣bind␣MWHEELDOWN␣"vstr␣wep_b";␣bind␣
MWHEELUP␣"vstr␣wep_f";"

set␣aton␣"+attack;+sprint"
set␣atof␣"-attack;-sprint;␣bind␣3␣"vstr␣sprinter1""

set␣qnade␣"vstr␣qn_message;weaponbank␣4;␣wait␣15;␣+attack;␣bind␣mouse1␣"vstr␣
qn_throw";␣vstr␣qn_deactiv"
set␣qn_throw␣"-attack;␣␣vstr␣qn_Normalize"
set␣qn_deactiv␣"bind␣MWHEELDOWN␣"vstr␣qn_Normalize";␣bind␣MWHEELUP␣"vstr␣
qn_Normalize""
set␣qn_Normalize␣"vstr␣qn_bind;␣vstr␣qn_weaplast;␣-attack;"

318
set␣qn_message␣"say_team␣^3␣----␣Grenade!!!␣----"

vstr␣qn_bind

bind␣backspace␣"vstr␣googleswitch"
set␣googleswitch␣"vstr␣google1"
set␣google1␣"vstr␣qn_deactiv;␣weaponbank␣8;␣wait␣80␣;␣weapalt;␣wait␣10;␣-weapalt
;echo␣^7googles␣^1on␣;␣set␣googleswitch␣vstr␣google2"
set␣google2␣"vstr␣qn_weaplast;␣echo␣^7googles␣^2off;␣set␣googleswitch␣vstr␣
google1"

bind␣del␣"vstr␣g2switch"
set␣g2switch␣"vstr␣g2g1"
set␣g2g1␣"vstr␣qn_deactiv;␣weaponbank␣5;␣set␣g2switch␣vstr␣g2g2"
set␣g2g2␣"vstr␣qn_weaplast;␣set␣g2switch␣vstr␣g2g1"

bind␣end␣"vstr␣g3switch"
set␣g3switch␣"vstr␣g3g1"
set␣g3g1␣"vstr␣qn_deactiv;␣weaponbank␣6;␣set␣g3switch␣vstr␣g3g2"
set␣g3g2␣"vstr␣qn_weaplast;␣set␣g3switch␣vstr␣g3g1"

bind␣pgdn␣"vstr␣g4switch"
set␣g4switch␣"vstr␣g4g1"
set␣g4g1␣"vstr␣qn_deactiv;␣weaponbank␣7;␣set␣g4switch␣vstr␣g4g2"
set␣g4g2␣"vstr␣qn_weaplast;␣set␣g4switch␣vstr␣g4g1"

bind␣ins␣"vstr␣g5switch"
set␣g5switch␣"vstr␣g5g1"
set␣g5g1␣"vstr␣qn_deactiv;␣weaponbank␣9;␣set␣g5switch␣vstr␣g5g2"
set␣g5g2␣"vstr␣qn_weaplast;␣set␣g5switch␣vstr␣g5g1"

set␣resetswitcher␣"set␣g2switch␣"vstr␣g2g1";␣set␣g3switch␣"vstr␣g3g1";␣set␣
g4switch␣"vstr␣g4g1";␣set␣g5switch␣"vstr␣g5g1";␣set␣googleswitch␣"vstr␣
google1""

//SPAWN␣Toggle
//
bind␣home␣"vstr␣spawnswitch"
set␣spawnswitch␣"vstr␣spawn1"
set␣spawn1␣"setspawnpt␣0;␣echo␣^7spawning␣^1Default␣Spawn␣;␣set␣spawnswitch␣vstr
␣spawn2"
set␣spawn2␣"setspawnpt␣1;␣echo␣^7spawning␣^2Spawn␣Point␣1␣;␣set␣spawnswitch␣vstr
␣spawn3"
set␣spawn3␣"setspawnpt␣2;␣echo␣^7spawning␣^3Spawn␣Point␣2␣;␣set␣spawnswitch␣vstr
␣spawn4"
set␣spawn4␣"setspawnpt␣3;␣echo␣^7spawning␣^4Spawn␣Point␣3␣;␣set␣spawnswitch␣vstr
␣spawn5"
set␣spawn5␣"setspawnpt␣4;␣echo␣^7spawning␣^5Spawn␣Point␣4␣;␣set␣spawnswitch␣vstr
␣spawn1"

319
50. Enemy Territory

//
//Ducken
//
set␣aduck␣"sensitivity␣3;cg_fov␣100;cg_drawcrosshair␣3;cg_crosshairsize␣55;echo␣
^2____duck____"
set␣astand␣"sensitivity␣4;cg_fov␣90;cg_drawcrosshair␣5;cg_crosshairsize␣50;echo␣
^1[---STAND---]"
set␣Toggle␣"vstr␣duck"
set␣jump␣"-movedown␣-prone;wait␣10;␣+moveup;␣wait␣10;␣-moveup;␣vstr␣md_02"
set␣md_01␣"set␣crouch␣vstr␣md_02;␣+movedown;␣vstr␣aduck;␣bind␣MOUSE2␣"vstr␣jump"
"␣//ducken
set␣md_02␣"set␣crouch␣vstr␣md_01;␣-movedown;␣vstr␣astand;bind␣MOUSE2␣"+moveup""␣
//stehen
vstr␣md_02
bind␣#␣"vstr␣crouch"␣//␣Crouch␣Toggle
bind␣CTRL␣+prone

bind␣7␣"vstr␣fpstoggle"
set␣fps1␣"com_maxfps␣72;set␣fpstoggle␣vstr␣fps2"
set␣fps2␣"com_maxfps␣200;set␣fpstoggle␣vstr␣fps1"
set␣fpstoggle␣"vstr␣fps1"

//
//␣Demo-Script␣&␣Screenshot
//
bind␣f12␣"vstr␣demotoggle"
set␣startdemo␣"record;␣set␣demotoggle␣vstr␣stopdemo"
set␣stopdemo␣"stoprecord;set␣demotoggle␣vstr␣startdemo"
set␣demotoggle␣"vstr␣startdemo

bind␣F11␣"screenshotJPEG"

//␣KlassenScript
//␣Ideen␣von␣www.planetwolfenstein.de,␣coded␣by␣.:T:.␣Leviathan

//␣
====================================================================================

//␣verfügbare␣Klassen␣:

//␣0␣=␣Soldat
//␣1␣=␣Medic

320
//␣2␣=␣Engineer
//␣3␣=␣Field␣Ops
//␣4␣=␣Covert␣Ops

//␣
====================================================================================

//␣verfügbare␣Waffen␣:

→−−−−−−→−−−−−−→−−−−−−→−−−−−−→//␣MP40␣(nur␣Axis)
//␣3␣=␣wp_mp40−
//␣5␣=␣wp_pa−−→−−−−−−→−−−−−−→−−−−−−→−−−−−−→//␣Panzerfaust␣(nur␣Soldaten)
//␣6␣=␣wp_ft−−→−−−−−−→−−−−−−→−−−−−−→−−−−−−→//␣Flamenwerfer␣(nur␣Soldaten)
//␣8␣=␣wp_thompson−−−−→−−−−−−→−−−−−−→−−−−−−→//␣Thompson␣(nur␣Allies)

− −−−−−−→−−−−−−→−−−−−−→−−−−−−→//␣Sten␣(nur␣Covert␣Ops)
//␣10␣=␣wp_sten
//␣23␣=␣wp_kar98−−−−−−→−−−−−−→−−−−−−→−−−−−−→//␣Karabiener␣98␣mit␣Granataufsatz␣
(nur␣Engineers␣der␣Axis)
//␣24␣=␣wp_carbine−−−−→−−−−−−→−−−−−−→−−−−−−→//␣M1␣Gerand␣mit␣Granataufsatz␣(nur
␣Engineers␣der␣Allies)
//␣25␣=␣wp_garand−−−−−→−−−−−−→−−−−−−→−−−−−−→//␣M1␣Gerand␣mit␣Zielfernrohr␣(nur␣
Covert␣Ops␣der␣Allies)
→−−−−−−→−−−−−−→//␣Maschinengewehr␣42␣(nur␣Soldat)
//␣31␣=␣wp_mobile_mg42−
→−−−−−−→−−−−−−→−−−−−−→−−−−−−→//␣K43␣mit␣Zielfernrohr␣(nur␣Covert
//␣32␣=␣wp_k43−
␣Ops␣der␣Axis)

− −−−−−−→−−−−−−→−−−−−−→−−−−−−→//␣FG42␣mit␣Zielfernrohr␣(nur␣
//␣33␣=␣wp_fg42
Covert␣Ops)
//␣35␣=␣wp_mo−→−−−−−−→−−−−−−→−−−−−−→−−−−−−→//␣Mortar␣(Soldat)

//␣
====================================================================================

//␣Farbcodes
//␣0␣=␣schwarz
//␣1␣=␣rot
//␣2␣=␣grün
//␣3␣=␣gelb
//␣4␣=␣blau
//␣5␣=␣hellblau
//␣6␣=␣rosa
//␣7␣=␣weiss
//␣8␣=␣orange
//␣9␣=␣grau

//␣
====================================================================================

//␣Binds

321
50. Enemy Territory

bind␣F4␣"vstr␣teamtoggle"−−−−−→−−−−−−→−−−−−−→−−−−−−→−−−−−−→//␣Wechsel␣Axis␣<=>␣
Allies
bind␣F5␣"echo␣Noch␣keine␣Seite␣ausgewaehlt␣(F4)"−−−−−−→−−−−−−→//␣Später␣Soldat
bind␣F6␣"echo␣Noch␣keine␣Seite␣ausgewaehlt␣(F4)"−−−−−−→−−−−−−→//␣Später␣
Engineer
bind␣F7␣"echo␣Noch␣keine␣Seite␣ausgewaehlt␣(F4)"−−−−−−→−−−−−−→//␣Später␣Field␣
Ops
bind␣F8␣"echo␣Noch␣keine␣Seite␣ausgewaehlt␣(F4)"−−−−−−→−−−−−−→//␣Später␣Medic
bind␣F9␣"echo␣Noch␣keine␣Seite␣ausgewaehlt␣(F4)"−−−−−−→−−−−−−→//␣Später␣Covert␣
Ops

− −−−−−−→−−−−−−→−−−−−−→−−−−−−→−−−−−−→//␣Klassenwechsel␣im
bind␣F10␣"vstr␣confirm"
␣Teamsay␣ausgeben␣und␣Klasse␣wechseln

//␣
====================================================================================

//␣Axis␣Cycle

//␣Soldat
set␣SOLDIER_r␣"vstr␣SOLD_r_1"

− vstr␣
set␣SOLD_r_1␣"set␣SOLDIER_r␣vstr␣SOLD_r_2;set␣change_class␣team␣r␣0␣31;
def_SOLD_r;␣echo␣^4Seite:␣^1AXIS␣^4Klasse:␣^1SOLDAT␣^4Waffe:␣^1MG42"

− vstr␣
set␣SOLD_r_2␣"set␣SOLDIER_r␣vstr␣SOLD_r_3;set␣change_class␣team␣r␣0␣5;␣
def_SOLD_r;␣echo␣^4Seite:␣^1AXIS␣^4Klasse:␣^1SOLDAT␣^4Waffe:␣^1PANZERFAUST"

− vstr␣
set␣SOLD_r_3␣"set␣SOLDIER_r␣vstr␣SOLD_r_4;set␣change_class␣team␣r␣0␣6;␣
def_SOLD_r;␣echo␣^4Seite:␣^1AXIS␣^4Klasse:␣^1SOLDAT␣^4Waffe:␣^1FLAMMENWERFER
"

− vstr␣
set␣SOLD_r_4␣"set␣SOLDIER_r␣vstr␣SOLD_r_1;set␣change_class␣team␣r␣0␣35;
def_SOLD_r;␣echo␣^4Seite:␣^1AXIS␣^4Klasse:␣^1SOLDAT␣^4Waffe:␣^1MOERSER"
set␣res_SOLD_r␣"set␣ENGIE_r␣vstr␣ENG_r_1;␣set␣COVERTOPS_r␣vstr␣COV_r_1"
set␣def_SOLD_r␣"set␣confirm_selection␣say_team␣spawn␣as␣^4.:^1SOLDIER^4:.;␣vstr␣
res_SOLD_r"

//␣Medic
set␣MEDIC_r␣"set␣confirm_selection␣say_team␣spawn␣as␣^4.:^1MEDIC^4:.;␣vstr␣
res_MEDIC_r;set␣change_class␣team␣r␣1␣3;␣echo␣^4Seite:␣^1AXIS␣^4Klasse:␣^1
MEDIC␣^4Waffe:␣^1MP40"
set␣res_MEDIC_r␣"set␣SOLDIER_r␣vstr␣SOLD_r_1;␣set␣ENGIE_r␣vstr␣ENG_r_1;␣set␣
COVERTOPS_r␣vstr␣COV_r_1"

//␣Engineer
set␣ENGIE_r␣"vstr␣ENG_r_1"
set␣ENG_r_1␣"set␣ENGIE_r␣vstr␣ENG_r_2;set␣change_class␣team␣r␣2␣3;␣␣vstr␣
def_ENG_r;␣echo␣^4Seite:␣^1AXIS␣^4Klasse:␣^1ENGINEER␣^4Waffe:␣^1MP40"
set␣ENG_r_2␣"set␣ENGIE_r␣vstr␣ENG_r_1;set␣change_class␣team␣r␣2␣23;␣vstr␣
def_ENG_r;␣echo␣^4Seite:␣^1AXIS␣^4Klasse:␣^1ENGINEER␣^4Waffe:␣^1KARABIENER␣
98"
set␣res_ENG_r␣"set␣SOLDIER_R␣vstr␣SOLD_r_1;␣set␣COVERTOPS_r␣vstr␣COV_r_1"
set␣def_ENG_r␣"set␣confirm_selection␣say_team␣spawn␣as␣^4.:^1ENGINEER^4:.;␣vstr␣

322
res_ENG_r"

//␣Field␣Ops
set␣FIELDOPS_r␣"set␣confirm_selection␣say_team␣spawn␣as␣^4.:^1FIELD␣OPS^4:.;␣
vstr␣res_FIELD_r;set␣change_class␣team␣r␣3␣3;␣echo␣^4Seite:␣^1AXIS␣^4Klasse:
␣^1FIELD␣OPS␣^4Waffe:␣^1MP40"

− "set␣SOLDIER_r␣vstr␣SOLD_r_1;␣set␣ENGIE_r␣vstr␣ENG_r_1;␣set␣
set␣res_FIELD_r
COVERTOPS_r␣vstr␣COV_r_1"

//␣Covert␣Ops
set␣COVERTOPS_r␣"vstr␣COV_r_1"
set␣COV_r_1␣"set␣COVERTOPS_r␣vstr␣COV_r_2;set␣change_class␣team␣r␣4␣10;␣vstr␣
def_COV_r;␣echo␣^4Seite:␣^1AXIS␣^4Klasse:␣^1COVERT␣OPS␣^4Waffe:␣^1STEN"
set␣COV_r_2␣"set␣COVERTOPS_r␣vstr␣COV_r_3;set␣change_class␣team␣r␣4␣32;␣vstr␣
def_COV_r;␣echo␣^4Seite:␣^1AXIS␣^4Klasse:␣^1COVERT␣OPS␣^4Waffe:␣^1K43"
set␣COV_r_3␣"set␣COVERTOPS_r␣vstr␣COV_r_1;set␣change_class␣team␣r␣4␣33;␣vstr␣

− echo␣^4Seite:␣^1AXIS␣^4Klasse:␣^1COVERT␣OPS␣^4Waffe:␣^1FG42"
def_COV_r;

− ENGIE_r
set␣res_COV_r␣"set␣SOLDIER_r␣vstr␣SOLD_r_1;␣set →
− vstr␣ENG_r_1"
set␣def_COV_r␣"set␣confirm_selection␣say_team␣spawn␣as␣^4.:^1COVERT␣OPS^4:.;␣
vstr␣res_COV_r"

//␣
====================================================================================

//␣Allies␣Cycle

//␣Soldat
set␣SOLDIER_b␣"vstr␣SOLD_b_1"
set␣SOLD_b_1␣"set␣SOLDIER_b␣vstr␣SOLD_r_2;set␣change_class␣team␣b␣0␣31;␣vstr␣
def_SOLD_b;␣echo␣^4Seite:␣^1ALLIES␣^4Klasse:␣^1SOLDAT␣^4Waffe:␣^1MG42"

− vstr␣
set␣SOLD_b_2␣"set␣SOLDIER_b␣vstr␣SOLD_r_3;set␣change_class␣team␣b␣0␣5;␣
def_SOLD_b;␣echo␣^4Seite:␣^1ALLIES␣^4Klasse:␣^1SOLDAT␣^4Waffe:␣^1PANZERFAUST
"

− vstr␣
set␣SOLD_b_3␣"set␣SOLDIER_b␣vstr␣SOLD_r_4;set␣change_class␣team␣b␣0␣6;␣
def_SOLD_b;␣echo␣^4Seite:␣^1ALLIES␣^4Klasse:␣^1SOLDAT␣^4Waffe:␣^1
FLAMMENWERFER"

− vstr␣
set␣SOLD_b_4␣"set␣SOLDIER_b␣vstr␣SOLD_r_1;set␣change_class␣team␣b␣0␣35;
def_SOLD_b;␣echo␣^4Seite:␣^1ALLIES␣^4Klasse:␣^1SOLDAT␣^4Waffe:␣^1MOERSER"
set␣res_SOLD_b␣"set␣ENGIE_b␣vstr␣ENG_b_1;␣set␣COVERTOPS_b␣vstr␣COV_b_1"
set␣def_SOLD_b␣"set␣confirm_selection␣say_team␣spawn␣as␣^4.:^1SOLDIER^4:.;␣␣vstr
␣res_SOLD_b"

//␣Medic
set␣MEDIC_b␣"set␣confirm_selection␣say_team␣spawn␣as␣^4.:^1MEDIC^4:.;␣vstr␣
res_MEDIC_b;set␣change_class␣team␣b␣1␣8;␣echo␣^4Seite:␣^1ALLIES␣^4Klasse:␣^1
MEDIC␣^4Waffe:␣^1THOMPSON"
set␣res_MEDIC_b␣"set␣SOLDIER_b␣vstr␣SOLD_b_1;␣set␣ENGIE_b␣vstr␣ENG_b_1;␣set␣
COVERTOPS_b␣vstr␣COV_b_1"

323
50. Enemy Territory

//␣Engineer
set␣ENGIE_b␣"vstr␣ENG_b_1"
set␣ENG_b_1␣"set␣ENGIE_b␣vstr␣ENG_b_2;set␣change_class␣team␣b␣2␣8;␣␣vstr␣
def_ENG_b;␣echo␣^4Seite:␣^1ALLIES␣^4Klasse:␣^1ENGINEER␣^4Waffe:␣^1THOMPSON"
set␣ENG_b_2␣"set␣ENGIE_b␣vstr␣ENG_b_1;set␣change_class␣team␣b␣2␣23;␣vstr␣
def_ENG_b;␣echo␣^4Seite:␣^1ALLIES␣^4Klasse:␣^1ENGINEER␣^4Waffe:␣^1M1␣GERAND"
set␣res_ENG_b␣"set␣SOLDIER_b␣vstr␣SOLD_b_1;−−−→set−−−→COVERTOPS_b−−−→vstr␣
COV_b_1"
set␣def_ENG_b␣"set␣confirm_selection␣say_team␣spawn␣as␣^4.:^1ENGINEER^4:.;␣vstr␣
res_ENG_b"

//␣Field␣Ops
set␣FIELDOPS_b␣"set␣confirm_selection␣say_team␣spawn␣as␣^4.:^1FIELD␣OPS^4:.;␣
vstr␣res_FIELD_b;set␣change_class␣team␣b␣3␣8;␣echo␣^4Seite:␣^1ALLIES␣^4
Klasse:␣^1FIELD␣OPS␣^4Waffe:␣^1THOMPSON"

− "set␣SOLDIER_b␣vstr␣SOLD_b_1;␣set␣ENGIE_b␣vstr␣ENG_b_1;␣set␣
set␣res_FIELD_b
COVERTOPS_b␣vstr␣COV_b_1"

//␣Covert␣Ops
set␣COVERTOPS_b␣"vstr␣COV_b_1"
set␣COV_b_1␣"set␣COVERTOPS_b␣vstr␣COV_b_2;set␣change_class␣team␣b␣4␣10;␣vstr␣
def_COV_b;␣echo␣^4Seite:␣^1ALLIES␣^4Klasse:␣^1COVERT␣OPS␣^4Waffe:␣^1STEN"
set␣COV_b_2␣"set␣COVERTOPS_b␣vstr␣COV_b_3;set␣change_class␣team␣b␣4␣23;␣vstr␣
def_COV_b;␣echo␣^4Seite:␣^1ALLIES␣^4Klasse:␣^1COVERT␣OPS␣^4Waffe:␣^1M1␣
GERAND"
set␣COV_b_3␣"set␣COVERTOPS_b␣vstr␣COV_b_1;set␣change_class␣team␣b␣4␣33;␣vstr␣

− echo␣^4Seite:␣^1ALLIES␣^4Klasse:␣^1COVERT␣OPS␣^4Waffe:␣^1FG42"
def_COV_b;
set␣res_COV_b␣"set␣SOLDIER_b␣vstr␣SOLD_b_1;−−−→set−−−→ENGIE_b→
− vstr␣ENG_b_1"
set␣def_COV_b␣"set␣confirm_selection␣say_team␣spawn␣as␣^4.:^1COVERT␣OPS^4:.;␣
vstr␣res_COV_b"

//␣
====================================================================================

//␣SideSwitch

set␣teamtoggle␣"vstr␣toggle_Axis"
set␣toggle_Axis␣␣␣"set␣teamtoggle␣vstr␣toggle_Allies;␣vstr␣bind_Axis;␣set␣
confirm_selection␣echo␣^7noch␣keine␣Klasse␣ausgewaehlt;␣echo␣^4Sei.:^1T^4:.
enwechsel␣zu␣den␣^1A^7XI^0S"
set␣toggle_Allies␣"set␣teamtoggle␣vstr␣toggle_Axis;␣vstr␣bind_Allies;␣set␣
confirm_selection␣echo␣^7noch␣keine␣Klasse␣ausgewaehlt;␣echo␣^4Sei.:^1T^4:.
enwechsel␣zu␣den␣^4AL^7LI^1ES"
set␣bind_Axis␣␣␣"vstr␣reset_r;␣bind␣F5␣vstr␣SOLDIER_r;␣bind␣F8␣vstr␣MEDIC_r;␣
bind␣F6␣vstr␣ENGIE_r;␣bind␣F7␣vstr␣FIELDOPS_r;␣bind␣F9␣vstr␣COVERTOPS_r"
set␣bind_Allies␣"vstr␣reset_b;␣bind␣F5␣vstr␣SOLDIER_b;␣bind␣F8␣vstr␣MEDIC_b;␣
bind␣F6␣vstr␣ENGIE_b;␣bind␣F7␣vstr␣FIELDOPS_b;␣bind␣F9␣vstr␣COVERTOPS_b"
set␣reset_r␣"set␣SOLDIER_r␣vstr␣SOLD_r_1;␣set␣ENGIE_r␣vstr␣ENG_r_1;␣set␣
COVERTOPS_r␣vstr␣COV_r_1"

324
50.1. Wissenswertes

set␣reset_b␣"set␣SOLDIER_b␣vstr␣SOLD_b_1;␣set␣ENGIE_b␣vstr␣ENG_b_1;␣set␣
COVERTOPS_b␣vstr␣COV_b_1"

//␣
====================================================================================

//␣ConfirmSwitch

set␣confirm␣"vstr␣change_class;␣vstr␣confirm_selection;kill"
set␣confirm_selection␣"echo␣^7Noch␣keine␣Seite␣ausgewaehlt!!!"
set␣change_class␣"echo␣^7Fehler␣in␣der␣Benutzung!!!"

//␣voice

bind␣kp_del␣−−→−−−−−−→−−−−−−→"vsay_team␣incoming"
bind␣kp_end␣−−→−−−−−−→−−−−−−→"vsay_team␣allclear"
bind␣kp_downarrow␣−−−−→−−−−−−→"vsay_team␣needbackup"
bind␣kp_pgdn␣−→−−−−−−→−−−−−−→"vsay_team␣medic"
bind␣kp_leftarrow−−−−−→−−−−−−→"vsay_team␣coverme"
bind␣kp_5␣−−−−→−−−−−−→−−−−−−→"vsay_team␣followme"
bind␣kp_rightarrow−−−−→−−−−−−→"vsay_team␣ClearPath"
bind␣kp_home␣−→−−−−−−→−−−−−−→"vsay_team␣Affirmative"
bind␣kp_uparrow␣−−−−−−→−−−−−−→"vsay_team␣Negative"
bind␣kp_pgup␣−→−−−−−−→−−−−−−→"vsay_team␣Move"
bind␣*␣␣␣␣−−−−→−−−−−−→−−−−−−→"vsay_team␣Thanks"
bind␣kp_minus−→−−−−−−→−−−−−−→"vsay_team␣Sorry"
bind␣kp_enter−→−−−−−−→−−−−−−→"vsay_team␣NeedEngineer"

Listing 50.1: Das ist ein Listing

50.1. Wissenswertes

50.1.1. autoexec2.cfg

Ist die Map ??? geladen, wird eine interne autoexec.cfg ausgeführt und nach Außen eine
autoexec2.cfg erwartet. Es gibt leider keinen Fix für dieses Problem. Benennen Sie einfach
ihre alte Konfigurationsdatei um.

50.1.2. varconfig.cfg
// ETWOLF VARS

// SYSTEM SETTINGS
seta com_hunkmegs "192" // 128
seta com_soundmegs "32" // 16

325
50. Enemy Territory

seta com_zonemegs "32" // 16


seta cg_weaponcycledelay "0" // default - 150

// NETWORK SETTINGS
seta cl_maxpackets "60" //DSL
seta cl_packetdup "1"
seta snaps "40"
seta cg_predictitems "0"
seta rate "10000"
seta cl_timenudge "-20"
seta cg_smoothClients "1"

// GRAF SETTINGS

seta r_customheight "768"


seta r_customwidth "1024"
seta r_fullscreen "0"

seta cg_drawTeamOverlay "3"


seta cg_teamChatTime "999999"
seta r_mapoverbrightbits "2"
seta com_maxfps "125"
seta pmove_fixed "0"
seta cg_bobroll "0"
seta cg_bobpitch "0"
seta cg_bobup "0"
seta cg_runpitch "0"
seta cg_runroll "0"

50.2. Befehle und Schalter

Inhalt
Dummy . . . . . . . . . . . . . . . . . . . . .
Befehle definieren . . . . . . . . . . . . . . . .
Wissenswertes . . . . . . . . . . . . . . . . . . 325 Variablen . . . . . . . . . . . . . . . . . . . .
autoexec2.cfg . . . . . . . . . . . . . . . . . . 325 Rezepte . . . . . . . . . . . . . . . . . . . . .
varconfig.cfg . . . . . . . . . . . . . . . . . . . 325
Befehle und Schalter . . . . . . . . . . . . . . 326

326
50.2. Befehle und Schalter

50.2.1. Dummy
Verwendung

Optionen

Beispiele

Fehlermeldungen

Verwandte Befehle

Links

50.2.2. Befehle definieren


Es gilt hier zwei unterschiedliche Situationen zu unterscheiden. Existiert das Kommando,
das ich definieren will schon, oder noch nicht? Falls ein Kommando mit dem gewählten
Namen schon existiert, muss der Befehl umdefiniert werden. Falls so ein Kommando nicht
existiert, muss es neu definiert werden.

50.2.2.1. \newcommand

Die Definition eines eigenen Befehls mittels \newcommand funktioniert folgendermaßen:


\newcommand{\Name }[Parameter] [Default]{Definition}
Name ist naheliegenderweise der Name des zu definierenden neuen Befehls und muß den
Regeln für alle Befehle in LATEX (dem sog. Befehlsformat) entsprechen, d.h. entweder
aus einem Sonderzeichen oder mehreren Buchstaben bestehen. Mit Parameter kann, falls
nötig, angegeben werden, wieviele Parameter der Befehl bekommt, wobei diese Anzahl
auf maximal 9 beschränkt ist. Wird der Parameter Default angegeben, so bewirkt er,
daß das erste Argument des neuen Befehls optional wird und gibt, für den Fall daß es
nicht angeben wird, den Standardwert vor. In der Definition des Befehls steht letztlich
der Text und die Befehle, die anstelle des Befehls eingesetzt werden. Dabei kann auf die
Parameter mit #1 bis #9 zugegriffen werden. Einige Beispiele sollen dabei helfen, diese
etwas komplizierte Materie zu verdeutlichen. So etwa definiert das folgende Beispiel einen
neuen Befehl \werbung und wendet Ihn gleich an.
Siehe ?? auf Seite ??

50.2.2.2. \renewcommand

Siehe ?? auf Seite ??

327
50. Enemy Territory

50.2.2.3. \providecommand

\providecommand definiert einen neuen Befehl nur, wenn dieser noch nicht existiert. Sie-
he ?? auf Seite ??, oder anders gesagt:
Damit wird ein neuer Befehl nur dann neu definiert, wenn es ihn noch nicht gibt.

50.2.2.4. Anmerkungen

Zusätzlich existiert von jedem der drei Befehle noch eine *-Variante, die als Argumente
jeweils nur max. einen Absatz akzeptiert und einem damit in der Regel eine ganze Menge
Fehlersuche abnimmt, denn wenn ein Befehl mehr als einen einzelnen Absatz als Argu-
ment bekommt, ist zumeist ohnehin irgendetwas gründlich schief gegangen. Daher sollte
\newcommand* der Normalfall sein.

50.2.3. Variablen
50.2.3.1. Zähler

\newcounter

Verwendung

Optionen

Beispiele

Fehlermeldungen

Verwandte Befehle

Links

50.2.3.2. Längenangaben

\setlength

50.2.4. Rezepte
50.2.4.1. Hmmm.

328
51. GtkRadiant

51.1. Plugins

51.2. Scripting

51.3. Import benutzerdefinierter Modelle

51.3.1. MD3
Tut: http://www.richdiesal.map-craft.com/tutorials/vol_cm.html. Siehe Abschnitt 45.3.1.

51.3.2. MD5
MD5 export/import scripts siehe (Abschnitt 45.3.2).

51.4. Links
1. http://en.wikibooks.org/wiki/GtkRadiant
2. http://www.richdiesal.map-craft.com/tutorials/vol_cm.html
3. http://www.richdiesal.map-craft.com/tutorials/index.html
4. http://alientrap.org/forum/viewtopic.php?t=9

329
51. GtkRadiant

330
52. X3-Reunion

52.1. Xtended-Mod

52.2. Schiffs Reviews

52.3. Waffen

52.4. Scripts
Eine Übersicht der unsignierten Erweiterungen ist auf der Egosoft-Homepage in deutsch
und english verfügbar.

52.4.1. Kampfskripte

52.4.1.1. ACC: Anarkis Carrier Commands

Version: 1.40
Download: http://www.xai-corp.net/en/node/1601.
Forum: http://forum.egosoft.com/viewtopic.php?t=128294.

This script adds various commands for TL and M1 class ships to simplify the handling of
the docked ships . It allows you to mass (un)assign an homebase and turret orders to your
docked fighters, to launch offensive and defensive fighter wings and to easily resupply your
ships and carrier. The Fight Software Mk2 must be installed on the carrier. This script
also add 2 shortcut keys (that can be set in you Control menu) to dock all ships or clean
the current sector when the player is flying a M1 or a TL.

Notizen
• Ist der Träger IS so wird das erste, verfügbare und gedockte Schiff als Formations-
führer zugewiesen. OOS wird ein M3 oder M6 als Staffelführer der Angriffsstaffel
erwartet.
if ( $hull >= $hullmax ) AND ( ( $OOS == [FALSE] ) OR ( $OOS == [TRUE] AND (
$class == {M3} OR $class == {M6} ) ) )
if $wing.current == 0

331
52. X3-Reunion

$ship−>start task 50 with script ’anarkis.cmd.attackandland’ and prio 30: arg1=


$target arg2=null arg3=null arg4=null arg5=null
$leader = $ship
else
$ship−>add to formation with leader $leader
$ship−>start task 50 with script ’anarkis.cmd.attacksameandland’ and prio 30:
arg1=$target arg2=$leader arg3=null arg4=null arg5=null
end
$ship−>set fire missile probability to $missile
inc $wing.current =
end

52.5. X3 Bonus-Packet

52.5.1. Satelliten-Warnservice

Um die nervtötende stündliche Benachrichtigung abzuschalten sind im Script plugin.QRF.


monthlybill.xml zwei Zeilen auszukommentieren:
$msg = sprintf: pageid=8813 textid=12, $pname, $owed, null, null, null
Billing message disabled by Jedzia, comment the following two lines out!
∗ play sample: incoming transmission 1, from object $anull
∗ write to player logbook $msg
set global variable: name=’QRF.stopnetwork’ value=null

52.5.2. Commodity Logistics Software MK1

52.5.2.1. A Bug

In plugin.goods.delivery.main existiert ein Bug, der verhindert, dass die Einstellung


der Konfigurationsoption „Mindestlagerbestand Lieferanten einstellen“ beachtet wird 1 .
Wenn es für ein Transportschiff möglich ist den Laderaum voll zu laden wird der Mindest-
lagerbestand nicht in Betracht gezogen.

The scenario for External Commodity Logistics: Dolphin Super Freighter XL. Versorgt
ein Argon Equipment Dock vom Complex mit der Ware Meatsteak Cahoonas.
Setze Threashold auf 80%. Max Meatsteak Cahoonas = 50000. Mit Threashold sollte das
40000 sein. Laderaumkonstante-max ist 13xxxsonstwas. Wird schon ueber 13xxxsonstwas
angefangen zu transportieren. Das is falsch...
1
Input - {2} {4} {X}
The Mk1 pilot collects ware from producer only if the producer has at least X% in stock. (X = 0 use
default of 5%)

332
52.5. X3 Bonus-Packet

Folgende Änderungen beheben diesen Fehler:


517 ∗
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

518 ∗ Waren abholen


519 ∗
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

520 $ShipName = [THIS]−>get name


521 $NameCheck = ’Moo’
522 $NameCheck = find position of pattern $NameCheck in $ShipName
523 $Defender = $NameCheck >= 0
524 $DEBUG = $Defender
525
526
527 $While = 0
528 $WhileMax = size of array $Array.StationSourceClone
529 while $While < $WhileMax
530 $Station = $Array.StationSourceClone[$While]
531
532 $Flight = [FALSE]
533 $While2 = size of array $Array.ProductClone
534 $Array.ProductDeliver = array alloc: size=$While2
535 while $While2
536 dec $While2 =
537 $Product = $Array.ProductClone[$While2]
538 $ProductSupply = $Array.ProductSupply[$While2]
539 $WareCargo = $Station−>get amount of ware $Product in cargo bay
540 skip if not $DEBUG
541 write to log file 8199 append=[TRUE] printf: fmt=’[%s](%s)␣$WareCargo:␣%s’, $Station,
$Product, $WareCargo, null, null
542 $WareCargoMax = $Station−>get max amount of ware $Product that can be stored in
cargo bay
543 $WareCargoFree = [THIS]−>get free amount of ware $Product in cargo bay
544 $Array.ProductDeliver[$While2] = [FALSE]
545
546 $MainType = get maintype of ware $Product
547 $SubType = get subtype of ware $Product
548 $WareIDSlot = ’dockware.manager.cargo.’ + ( ( $MainType ∗ 100 ) + $SubType )
549 if $Station−>get local variable: name=$WareIDSlot
550 $WareCargoMax = $Station−>get local variable: name=$WareIDSlot
551 skip if $WareCargoMax − $WareCargo > $WareCargoFree
552 $WareCargoFree = $WareCargoMax − $WareCargo
553 skip if $WareCargoFree > 0
554 $WareCargoFree = 0
555 end
556
557
558 $WareCargoMin = [THIS]−>get local variable: name=’goods.dev.min.cargo’
559 skip if $WareCargoMin

333
52. X3-Reunion

560 $WareCargoMin = 5
561 skip if not $DEBUG
562 write to log file 8199 append=[TRUE] printf: fmt=’[%s](%s)␣$WareCargoMin:␣%s’, [
THIS], $Product, $WareCargoMin, null, null
563 if $Station−>trades with ware $Product
564 if not $Station−>uses ware $Product as primary resource
565 $SecondRes = $Station−>uses ware $Product as secondary resource
566 $IsProduct = $Station−>uses ware $Product as product
567 skip if not $DEBUG
568 write to log file 8199 append=[TRUE] printf: fmt=’[%s]␣$ProductSupply␣:␣%s␣
WareCargo␣:␣%s␣WareCargoMax␣:␣%s␣WareCargoMin␣:␣%s’, [THIS], $ProductSupply,
$WareCargo, $WareCargoMax, $WareCargoMin
569 $Ttemp = $WareCargo ∗ 100 / $WareCargoMax
570 skip if not $DEBUG
571 write to log file 8199 append=[TRUE] printf: fmt=’[%s]␣$WareCargoFree:␣%s,␣Ttemp
␣:␣%s␣(SecondRes=%s,IsProduct=%s)’, [THIS], $WareCargoFree, $Ttemp, $SecondRes,
$IsProduct
572 ∗ if $ProductSupply > 0 AND $Ttemp >= $WareCargoMin OR $WareCargo >=
$WareCargoFree
573 ∗ if $ProductSupply > 0 AND $Ttemp >= $WareCargoMin AND $WareCargo >=
$WareCargoFree
574 $HasProductSupply = $ProductSupply > 0
575 $HasEnoughStored = $Ttemp >= $WareCargoMin
576 $ProductEnough = $IsProduct AND ( $WareCargo >= $WareCargoFree )
577 skip if not $DEBUG
578 write to log file 8199 append=[TRUE] printf: fmt=’[%s]%s:␣HasProductSupply=%s␣
HasEnoughStored=%s␣ProductEnough=%s)’, [THIS], $Product, $HasProductSupply,
$HasEnoughStored, $IsProduct
579
580 ∗ ProductEnough disabled. This part overrides the 2−4 minimum storage level
581 ∗ setting. $ProductEnough counts only for products. I think this wasnt in reflection of
the inventor.
582 ∗ HasEnoughStored is true when the storage percentage is over the limit. (Jed)
583 $ProductEnough = [FALSE]
584 if $HasProductSupply AND ( $HasEnoughStored OR $ProductEnough )
585 if [THIS]−>get free amount of ware $Product in cargo bay
586 $Flight = [TRUE]
587 $Array.ProductDeliver[$While2] = [TRUE]
588 end
589 end
590 end
591 end
592 $doDeliver = $Array.ProductDeliver[$While2]
593 skip if not $DEBUG
594 write to log file 8199 append=[TRUE] printf: fmt=’RES:[%s](%s)␣$doDeliver␣=␣%s’, [
THIS], $Product, $doDeliver, null, null
595 end
596
597 skip if not $DEBUG

334
52.5. X3 Bonus-Packet

598 write to log file 8199 append=[TRUE] printf: fmt=’−−−End−␣%s␣%s␣Flight=%s’, [THIS


], $Product, $Flight, null, null
599
600 if $Flight
601
602 $Command = {COMMAND_SIGN_SDS_WAIT}
603 gosub FlightRoutine
604
605 if [ENVIRONMENT] == $Station
606
607 $While2 = 0
608 $WhileMax2 = size of array $Array.ProductClone
609 while $While2 < $WhileMax2
610 $Product = $Array.ProductClone[$While2]
611 $ProductPrice = $Array.ProductPriceClone[$While2]
612 $ProductSupply = $Array.ProductSupply[$While2]
613 $doDeliver = $Array.ProductDeliver[$While2]
614 if not $doDeliver
615 skip if not $DEBUG
616 write to log file 8199 append=[TRUE] printf: fmt=’[%s]Not␣Delivering−␣␣%s␣(%s␣
units)␣%s,−␣’, [THIS], $Product, $ProductSupply, $ProductPrice, null
617 inc $While2 =
618 continue
619 end
620 if $Station−>trades with ware $Product
621 if not $Station−>uses ware $Product as primary resource
622
623 if $Station == [HOMEBASE]
624 skip if not $DEBUG
625 write to log file 8199 append=[TRUE] printf: fmt=’[%s]Loading−␣%s␣units␣of␣%
s␣’, [THIS], $ProductSupply, $Product, $Flight, null
626 $WareLoad = [THIS]−>load $ProductSupply units of $Product
627 $ProductSupply = $ProductSupply − $WareLoad
628 $Array.ProductSupply[$While2] = $ProductSupply
629 else
630
631 $WareCargo = $Station−>get amount of ware $Product in cargo bay
632 $WareCargoFree = [THIS]−>get free amount of ware $Product in cargo bay
633 skip if not $WareCargo > $ProductSupply
634 $WareCargo = $ProductSupply
635 skip if not $WareCargo > $WareCargoFree
636 $WareCargo = $WareCargoFree
637
638 $CreditPerUnit = $ProductPrice
639 skip if not $ProductPrice == −1
640 $CreditPerUnit = $Station−>get price of ware $Product
641 if $CreditPerUnit > 0
642 $CreditTransfer = $WareCargo ∗ $CreditPerUnit
643 $Credit = [HOMEBASE]−>get money
644 if $CreditTransfer > $Credit

335
52. X3-Reunion

645 = [THIS]−>call script ’plugin.goods.delivery.message’ : MessageNumber=510


Value=$Station
646 [THIS]−>set command: {COMMAND_IDLE} target=null target2=null par1=
null par2=null
647 [THIS]−>set destination to null
648 = wait 300000 ms
649 $Credit = [HOMEBASE]−>get money
650 if $CreditTransfer > $Credit
651 $WareCargo = $Credit / $CreditPerUnit
652 $CreditTransfer = $WareCargo ∗ $CreditPerUnit
653 end
654 end
655 $Station−>add money: $CreditTransfer
656 $CreditTransfer = ( −$CreditTransfer )
657 [HOMEBASE]−>add money: $CreditTransfer
658 end
659 skip if not $DEBUG
660 write to log file 8199 append=[TRUE] printf: fmt=’[%s]Loading−␣%s␣units␣of␣%
s␣’, [THIS], $ProductSupply, $Product, $Flight, null
661 $WareLoad = [THIS]−>load $WareCargo units of $Product
662 $ProductSupply = $ProductSupply − $WareLoad
663 $Array.ProductSupply[$While2] = $ProductSupply
664
665 end
666
667 end
668 end
669 inc $While2 =
670 end
671
672 end
673
674 end
675
676 inc $While =
677 end
678
679 ∗
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

680 ∗ Waren anliefern


681 ∗
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

Um das Logging für ein Schiff einzuschalten ist dem Schiffsnamen „Moo“ hinzuzufügen.
Die Informationen werden danach in die Datei log08199.txt im X3-Hauptverzeichnis ge-
schrieben. Zum Nachvollziehen meiner Änderungen kann durch auskommentieren der Zeile
583 ( $ProductEnough = [FALSE] ) der Ursprungszustand mit fehlerhafter Lieferanten-

336
52.5. X3 Bonus-Packet

Routine erreicht werden.

52.5.3. Commodity Logistics Software MK2


52.5.3.1. A Bug

Hello friends. Seems that i have found a bug.

The scenario for External Commodity Logistics: My Faunus with the name "Faunus
02" has 0 Energy Cells on board. A Hauler with the name "CLS Dolphin SFXL EXT Red
Faunus02 Moo" should deliver energy cells with Commodity Logistics Software MK2
to it.
Waypoint Setup
• Loading in my Complex:
◦ Waypoint Energy Cells WayPointWarePrice=16 WayPointTransfer=104550

• Deliver to my Faunus:
◦ Waypoint Energy Cells WayPointWarePrice=16 WayPointTransfer=-100999

The Problem: All of the Energy Cells in the TS cargo ( a Dolphin SFXL ) are unloaded
into the Faunus cargo bay, but only 999 units should be transfered.
I changed the plugin.goods.delivery.main.wp script to spit out some debug informa-
tion. If you want to do debugging on yourselves, you can have mine in the attachements.
To enable debugging for a Ship simply put the string "Moo" somewhere in the ships name.
The debug data will be logged to X3 Reunion\log98765.txt.

Going Deeper: At this point the Faunus has, hmmm 5233 Energy Cells in its cargo bay.
A state that shouldn’t exist cause 999 is the maximum.

WayPoint=Your Faunus 02 (17%) WayPointWare=Energy Cells WayPointWarePrice=0 WayPointTransfer=-100999


CLS Dolphin SFXL EXT Red Faunus02 Moo A)WayPointTransfer=-100999 WayPoint=Your Faunus 02 (17%)
CLS Dolphin SFXL EXT Red Faunus02 Moo A)WayPointTransfer=100999 WayPoint=Your Faunus 02 (17%)
CLS Dolphin SFXL EXT Red Faunus02 Moo B)WayPointTransfer=100999, $WareCargo=5233
CLS Dolphin SFXL EXT Red Faunus02 Moo C)WayPointTransfer=0, $WareCargo=5233

If the Energy Cells drop below 999 than the fatal affair begins. For this purpose i moved to
my Faunus freight menu and dropped all but 66 Energy Cells into the cold dark of space.
Please forgive me :)

WayPoint=Your Faunus 02 (17%) WayPointWare=Energy Cells WayPointWarePrice=0 WayPointTransfer=-100999


CLS Dolphin SFXL EXT Red Faunus02 Moo A)WayPointTransfer=-100999 WayPoint=Your Faunus 02 (17%)
CLS Dolphin SFXL EXT Red Faunus02 Moo A)WayPointTransfer=100999 WayPoint=Your Faunus 02 (17%)
CLS Dolphin SFXL EXT Red Faunus02 Moo B)WayPointTransfer=100999, $WareCargo=66
CLS Dolphin SFXL EXT Red Faunus02 Moo C)WayPointTransfer=933, $WareCargo=66
CLS Dolphin SFXL EXT Red Faunus02 Moo D)WayPointTransfer=933, $WareCargo=4550

337
52. X3-Reunion

We are now in gosub FlightRoutine and the hauler starts his way to deliver commodity
to the Faunus, exactly 966 units are calculated. This is correct.
CLS Dolphin SFXL EXT Red Faunus02 Moo [ENVIRONMENT]=Your Faunus 02 (22%),
$WayPoint=Your Faunus 02 (22%) WayPointTransfer=933
CLS Dolphin SFXL EXT Red Faunus02 Moo E)WayPointTransfer=933, $WareCargo=4530
,WareCargoFree=13730, $CreditPerUnit=null

All okay, till now. But then comes the


512 skip if $WayPointTransfer > $WareCargo
513 $WayPointTransfer = $WareCargo
514 skip if $WayPointTransfer > $WareCargoFree
515 $WayPointTransfer = $WareCargoFree

check for
• transfer volume is bigger than cargo volume and,
• space of the recipient is smaller than the transfer volume.
After that the variables show
CLS Dolphin SFXL EXT Red Faunus02 Moo F)WayPointTransfer=13730, $WareCargo=4530
,WareCargoFree=13730, $CreditPerUnit=0

, that comes to
CLS Dolphin SFXL EXT Red Faunus02 Moo Unload WayPointTransfer=13730, $WareCargo=4530

unloading not existant 13730 units of Energy Cells into the Faunus cargo hold ( That
means effectively all stored hauler-cargo is transfered to the recipient ) :
533 = [THIS]−>unload $WayPointTransfer units of $WayPointWare

no x-mas presents here, unloading is done with the


unload instruction.

Research: Looking a little down in the script i found exactly the same [I]transfer volume
checks[/I] like the first above, but with a little difference:
561 skip if $WayPointTransfer < $WareCargo
562 $WayPointTransfer = $WareCargo
563 skip if $WayPointTransfer < $WareCargoFree
564 $WayPointTransfer = $WareCargoFree

Lesser than instead of greater than!

338
52.6. Zu Bearbeiten

Solution: I changed the code to


511 ∗ jed: error, when transfer is bigger than cargo in bay. transfer = cargo
512 skip if $WayPointTransfer < $WareCargo
513 $WayPointTransfer = $WareCargo
514 ∗ jed: error, when transfer is bigger than the room for cargo. transfer = room for cargo
515 skip if $WayPointTransfer < $WareCargoFree
516 $WayPointTransfer = $WareCargoFree

and got this log:

WayPoint=Your Faunus 02 (17%) WayPointWare=Energy Cells WayPointWarePrice=0 WayPointTransfer=-100999


CLS Dolphin SFXL EXT Red Faunus02 Moo A)WayPointTransfer=-100999 WayPoint=Your Faunus 02 (17%)
CLS Dolphin SFXL EXT Red Faunus02 Moo A)WayPointTransfer=100999 WayPoint=Your Faunus 02 (17%)
CLS Dolphin SFXL EXT Red Faunus02 Moo B)WayPointTransfer=100999, $WareCargo=66
CLS Dolphin SFXL EXT Red Faunus02 Moo C)WayPointTransfer=933, $WareCargo=66
CLS Dolphin SFXL EXT Red Faunus02 Moo D)WayPointTransfer=933, $WareCargo=4550
CLS Dolphin SFXL EXT Red Faunus02 Moo [ENVIRONMENT]=Your Faunus 02 (22%),
$WayPoint=Your Faunus 02 (22%) WayPointTransfer=933
CLS Dolphin SFXL EXT Red Faunus02 Moo E)WayPointTransfer=933, $WareCargo=4530
,WareCargoFree=13730, $CreditPerUnit=null
CLS Dolphin SFXL EXT Red Faunus02 Moo F)WayPointTransfer=933, $WareCargo=4530
,WareCargoFree=13730, $CreditPerUnit=0
CLS Dolphin SFXL EXT Red Faunus02 Moo Unload WayPointTransfer=933, $WareCargo=4530

Yeaahaaaa, all is working nice, now.

Conclusion: Hanging around, debugging eve scripts on x-mas does not only give you nice
glances from your girl friend or kids, it gives you some successful experience, hehe.
Sure, i meant that this is a problem with xtended. So i put it here in this forum. Docking
with a TL is checked in the script at
550 if $WayPoint−>is of class {Moveable Ship}

But on a Faunus from the X-Tended Mod TS -class ships can dock. Maybe this is the
problem. But at all the greater than/lesser than bug exist.

52.6. Zu Bearbeiten
-X-X-X-X- Mittwoch, 16. Dezember 2009 07:31 ——————————————————
Boron Angel mission : http://www.thexuniverse.com/forum/showthread.php?t=5652
Split Raptor als traeger ...65 schiffe!

Cerb als Patroulie.
Der Cerberus hat andere Augaben als die Jägerabwehr zähl mal durch, mit wievielen
B-PIK der feuern kann... er hat einen Hangar für M3... die übernehmen die Jägerabwehr,
nicht der Cerberus selber... der ist ein Grosswildjäger. http://www.thexuniverse.com/
forum/showthread.php?t=5106&page=2

339
52. X3-Reunion


Oder Reaver ... nachschauen http://www.thexuniverse.com/forum/showthread.php?t=
10521&highlight=pirat+reaver

Goner aran besorgen: http://www.thexuniverse.com/forum/showthread.php?t=4956
Boron Angel besorgen: http://www.thexuniverse.com/forum/showthread.php?t=6319
Sohnen Oriax capture fuer carrier flotte: http://www.thexuniverse.com/forum/showthread.
php?t=7650
den Thor http://www.thexuniverse.com/forum/showthread.php?t=4989 mal anschau-
en. seghr gutes schield, aber langsam.
— http://seizewell.de/x3waffen.htm Waffenstaerke
LX fuer carrier flotte: Nemesis ist es also 8-9 B-EPW
LX 8-10 A-EPW - 2 B-PBK/PS
http://www.egosoft.com/admin/forum/viewtopic.php?p=2273200&sid=3ee31b44eb3cb6fd13271b

This is a coloring test
$anull = null

$gametime = playing time


$i = get global variable: name=’QRF.gtime’

skip if $i != null
$i = 1

skip if $i <= $gametime


return $anull

$biltime = get global variable: name=’QRF.billtime’


skip if $biltime != null
$biltime = 3600

$gametime = $gametime + $biltime


set global variable: name=’QRF.gtime’ value=$gametime

∗ $i = get global variable: name=’QRF.costs’


∗ skip if $i == $anull
∗ return $anull

∗ set global variable: name=’QRF.costs’ value=1


$psec = [PLAYERSHIP]−>get sector
$gametime = playing time
$i = 0
$pname = [PLAYERSHIP]−>get pilot name

340
52.6. Zu Bearbeiten

$QRF.fee = get global variable: name=’QRF.fee’

skip if $QRF.fee != null


return $anull

∗ $QRF.fee = $QRF.fee ∗ 6

$cash = get player money


$owed = $QRF.fee

set global variable: name=’QRF.fee’ value=1

if $cash < $owed


$penalty = −$cash
add money to player: $penalty
$owed = $owed − $cash
$msg = sprintf: pageid=8813 textid=13, $pname, $QRF.fee, null, null, null
send incoming message $msg to player: display it=[TRUE]
set global variable: name=’QRF.stopnetwork’ value=1
$i = 0
while $cash < $owed
skip if $i != 2
START [THIS]−>call script ’plugin.QRF.debt’ :
= wait 240000 ms
$cash = get player money
inc $i =
end
end

$msg = sprintf: pageid=8813 textid=12, $pname, $owed, null, null, null


∗ Bill message disabled by Jedzia
∗ play sample: incoming transmission 1, from object $anull
∗ write to player logbook $msg
set global variable: name=’QRF.stopnetwork’ value=null

∗ send message will monthly bill


$payment = −$owed
add money to player: $payment

set global variable: name=’QRF.costs’ value=null

return $anull

Listing 52.1: X3 colored Listing test

OOS Combat Resolution (Was: OOS Missile firing test.) http://forum.egosoft.com/


viewtopic.php?t=182101

341
52. X3-Reunion

**********
1) 10 Thor
2) 10 Pirate Kea
3) 10 LX
———————————————————————————————–
-X-X-X-X- Mittwoch, 16. Dezember 2009 07:18 ——————————————————
waffen wiki: http://www.thexuniverse.com/forum/showwiki.php?title=Weapons
http://x-lexikon.xibo.at/wiki/index.php/Waffen_X3
jumpdrive kits fix: http://one.freespace.jp/adach00/html/jdk.html
X3 Fighting Tips
You are in: Home › Gaming › PC Games › X3: Reunion › My Mini-site › Help › Fighting
Tips
Know your enemy
Before attacking an group of enemy ships, first check to see what they are and how many
there are. Sometimes the groups are so big, even a M1/M2 would have problems. Often
the best rule to follow is that you can take on around 3/4 lower class ships than your own,
however depending on how skilled you are or not you may want to increase or lower that
number, ie. Attack 3/4 M4’s if your in a M3, 3/4 M5 if you have a M4 or 3/4 M3’s if you
have a M6 ship. So really you need to have the next class of ship up to deal with a group
of lesser ships.
1 on 1
If your lucky enough to get a 1 on 1 fight (lone enemy) then you can normally stay behind
them all the time by keeping them in the middle of your crosshair and matching speed.
Most ships don’t have a rear turret so you can simply stay behind and keep shooting. If
you get a 1 on 1 it is worth trying to capture the ship.
Front Lasers and turrets
Front lasers are lasers mounted forward and can not move, to move the laser you have to
move the whole ship - not an problem for smaller ships. A turret on the other hand can
move in a 180 degree arc and can hit targets without turning the whole ship around - which
is very useful on larger ships. Turrets are normally only used on larger ships because slow
turning speed. Turrets are also used on a select amount of M3 ships, TS and TP ships.
Turrets can be a bit wasteful with laser engery, as many of the shots will miss, using laser
energy from your other guns.
The Ion Disruptor
The Ion Disruptor is a gun which can only deal shield damage to a target. The Ion Disruptor
can also damage equipment onboard a attacker when the shields are down. You can use a
Ion Disruptor to totally dis-arm a ship as it will destroy lasers, shields and ship extensions
on any type of ship.
The Mass Driver

342
52.6. Zu Bearbeiten

The Mass Driver is like the Ion Disruptor in one way but it will only do hull damage. The
Mass Driver requires Mass Driver Ammunition to fire. This cost around 3,000 credit an
box, however a box of ammo will normally last a fair amount of time. The Mass Driver does
not even need the shields down to do hull damage however the damage which it inflicts is
fairly low. Due to its very fast moving bullets and insane fire rate, the Mass Driver is often
used to defend agaisnt missiles.
Enemy rear turret
An enemy rear turret can make life very difficult, specially on the Nova (M3) and Pirate
Nova (M3). If your shields are very strong then you can simply stay behind these ships.
The turret is also set to defend the ship from missiles, so using a missile can be a bad idea
as the turret will shoot the missile out. The best way of fighting these ships is do as much
damage as you can from the first frontal attack and finish them off from either the side or
if you have too - the rear.
Your fighters rear turret
If your fighter ship carries a rear turret, then I think the best option is to use it to defend
your ship against missiles, mainly because it will have a lot of trouble killing ships and will
waste much of your important laser engery. You can save using any energy in a rear turret
by equipping a Mass Driver (if you can) into the rear turret and order it to defend against
missiles.
Find your nearest attacker
In X2 you could press ’e’ and automatically the nearest attacker would be selected. In X3
it still exist however its a capital ’T’ to active it. I highly recommend that you change this
by going into the keyboard setup and removing ’T’, then assigning ’e’ to it. When your in
a battle all you have to do now is press ’e’ and your have nearest attacker selected, with
no fuss.
Missiles
Missiles are mostly over-looked because they cost money. Missiles can be very useful in a
battle as they can deal a lot of extra damage to enemy ships. You will need to buy missiles
around the 5,000 credit range or higher because the weaker missiles really too weak. I
however wouldn’t spend more than 15k on one missile mainly because the cost will mount
up quite heavily and often missiles can get destroyed or miss completely.
Attacking larger ships
You have to be very careful and have a fairly powerful ship (M6+) to take on a larger ship
(TL/M1/M2). Many of the larger ships do have a ’blind’ spot where none of the turrets can
hit you. You have to find a ’blind’ spot fairly quickly, stay there and keep firing. You will
often notice the larger ships cant out-run an smaller ship so staying in the ’blind’ position
isn’t too hard to do but finding can be a problem.
Your tips
Share your tips with everyone by posting them in my forum:
Your X3 trading tips
———————————————————————————————–

343
52. X3-Reunion

-X-X-X-X- Montag, 14. Dezember 2009 15:19 ——————————————————


plugin.XTM.AL.ShipCheck
return 0 am anfang ... sohnen kapern moeglich machen.
———————————————————————————————–
-X-X-X-X- Sonntag, 13. Dezember 2009 03:55 ——————————————————
http://www.thexuniverse.com/forum/showthread.php?t=5400&highlight=missiles&page=
3
http://www.thexuniverse.com/forum/showthread.php?t=4188
———————————————————————————————–
-X-X-X-X- Donnerstag, 10. Dezember 2009 11:08 ——————————————————
Anarkis carrier cmds
$ grep -c -i "501" *.xml | grep -v ":0" | grep -i anark
anarkis.cmd.attackwing.xml:2
anarkis.cmd.defensewing.xml:2
geaendert damit die doofe meldung nicht mehr kommt
———————————————————————————————–
-X-X-X-X- Montag, 7. Dezember 2009 01:25 ——————————————————
http://www.thexuniverse.com/forum/showthread.php?t=12814
There is a way to get any ship in the XTM mod I think.
You need two things:
1. The Shipbroker script
2. a few billion credits^^
Mod ships (added by any mod) are only available at the mobile shipbrokers
(2 are spawned for every race) roaming the universe.
Just search for them and maybe you are lucky and he makes you an offer
Sohnen Mantis:ca. 688.000.000 Cr
Sohnen Bassilisk: ca 900.000.000 Cr
Sohnen Scylla: ca 1.400.000.000 Cr
—-
Capture guide
Sohnen: http://www.thexuniverse.com/forum/showwiki.php?title=Reviews:Mantis+
Capture+Guide+Guide&&highlight=capture+sohnen
HCF guide:
1. http://www.thexuniverse.com/forum/showwiki.php?title=Reviews:HCF+Capture+
Guide+Main+and+Part+1+Guide&&highlight=capture+sohnen

344
52.6. Zu Bearbeiten

2. http://www.thexuniverse.com/forum/showwiki.php?title=Reviews:HCF+Capture+
Guide+Part+2+Guide&&highlight=capture+sohnen
3. http://www.thexuniverse.com/forum/showwiki.php?title=Reviews:HCF+Capture+
Guide+Part+3+Guide&&highlight=capture+sohnen
Schiffe:
http://www.thexuniverse.com/forum/showthread.php?t=10670
http://www.thexuniverse.com/forum/showthread.php?t=4990
Capship fitting
http://apricotmappingservice.com/X3forum/viewtopic.php?p=316&sid=cd1053988c2f9fcc0d8433d
Castrum besorgen
SirusShipFind.xml um Schiffe zu finden ( ins Log )
———————————————————————————————–
-X-X-X-X- Sonntag, 6. Dezember 2009 14:10 ——————————————————
MEFOS http://forum.egosoft.com/viewtopic.php?t=168182
MARS http://forum.egosoft.com/viewtopic.php?t=207091
Command slot: COMMAND_TYPE_TURRET_46 (Defense)
Command slot: COMMAND_TYPE_TURRET_47 (Standby)
Command slot: COMMAND_TYPE_TURRET_48 (Offense)
Command slot: COMMAND_TYPE_SHIP_51 (Collect cargo)

CODEA http://forum.egosoft.com/viewtopic.php?t=183264
erstma codea ohne probieren. dann warscheins mars. das hat nen kapermodus
———————————————————————————————–
-X-X-X-X- Sonntag, 6. Dezember 2009 09:26 ——————————————————
XTENDED MISSIONS
http://www.thexuniverse.com/forum/showthread.php?t=5614
Ship Reviews
Deutsch: http://www.thexuniverse.com/forum/showthread.php?t=10670
http://www.thexuniverse.com/forum/showthread.php?t=4990
http://www.thexuniverse.com/forum/showthread.php?t=7578
Uebersicht diverser Scripte
http://www.seizewell.de/viewtopic.php?t=3571
Pirate Reaver
——

345
52. X3-Reunion

GTS: Target Threat - If the currently targeted ship fly in formation, the key will now aim
the strongest ship of this formation. If nothing (or a station) is targeted it will
first search for the nearest enemy ship. If no enemy ship is found it will try with the nearest
ship.
GTS: Target Next - will target the next ship in the selected formation.
GTS: Missile Assault - will launch a missile against each ship of the selected formation.
It will use the currently selected missile, and will wait 2 seconds between each missile.
——-
“ Beast of Imminent destruction” - M7
http://www.thexuniverse.com/forum/showthread.php?t=7383
—————————–
Pandora Engine tuning http://www.thexuniverse.com/forum/showthread.php?t=13055&highligh
pandora+tunings
spoiler: change your name to bonus.package .top.secret
then save and reload and check your log book
Or simply watch the BBS for reports from the ship Pandora that has found some
stuff far away from the ecliptic in a certain sector.
—————————–
The OTAS Custodian´s Group Shield ability also works very well to keep OOS patrols
alive, as once one
of the patrolling ships takes shield damage it will suck the hostile ships´shields away and
add the
power to the damaged friendlies.
The T0 class ships floating around the Universe can be hired just like any normal TL so if
you want
to cap one without anybody interfering just send it to a quiet sector (or even to an opposing
race like
a Paranid Faunus to Argon space)
Capital race ships can be captured without losing ANY rep if you manage not to kill
anything. So just
lure your target away from the tradelanes/ patrols, go for the cap and ignore the escorts
(deactivate
the HCF´s turrets). After your target turns green set the race back to friendly and apologize
to any
defenders/ patrol ships that turned red.
——————————

346
Teil XI.

Spiele Engines

347
52.6. Zu Bearbeiten

In Teil XXX .. blabla


Eine Spiel-Engine (engl. Game Engine ["geIm­EndZIn]) ist ein Computerprogramm, das den
Spielverlauf steuert und für die visuelle Darstellung des Spieleablaufs verantwortlich ist.
Bestandteile
Die Engine besteht, je nach Spiel, unter anderem aus folgenden Bereichen:
[Bearbeiten] Basisfunktionalitäten
[Bearbeiten] Grafik-Engine
Die Grafik-Engine ist für die grafische Darstellung auf dem Bildschirm verantwortlich. Eine
Grafik-Engine beinhaltet meistens folgende Werkzeuge:
* Funktionen zum Laden, Verwalten und Anzeigen von Texturen bzw. Sprites
* Textausgabe
Im Falle einer 3D-Engine kommen oftmals folgende Werkzeuge hinzu:
* Funktionen zum Laden, Verwalten, Darstellen und Animieren von 3D-Modellen
* Shader-System zur möglichst realistischen Darstellung der Wirkung von Licht und Schat-
ten auf verschiedene Materialien (Metall, Holz, Haut)
* Effekte wie Feuer, Explosionen, Wasser, Schnee, Nebel
[Bearbeiten] Physiksystem
Aktuelle Spiele werden mit zusehends realistischeren Physiksystemen (Physikengine) aus-
gestattet. Neben höherem visuellen Realismus kann das Physiksystem auch Auswirkung
auf das Spielgeschehen haben, wenn beispielsweise ein fallendes Objekt (z. B. eine geworfe-
ne Handgranate) einen Hügel herunterkullert, anstatt darauf liegen zu bleiben. Man kann
zwischen verschiedenen Arten von Physik unterscheiden:
* Weit verbreitet ist Rigid-Body-Physik, das heißt die Simulation der Newton’schen Me-
chanik für feste Körper.
* Ein Teilaspekt von Rigid-Body-Physik ist Ragdoll-Physik: Virtuelle Charaktere können
physikalisch korrekt fallen.
* Manche Spiele simulieren auch das realistische Verhalten von z.B. Fahnen (etwa in der
Prince of Persia - The Sands of Time Trilogie), Kleidung oder Wasser.
Physikengines bekamen im Jahr 2005 auch eine Hardwareunterstützung spendiert, soge-
nannte Physikbeschleuniger, um physikalische Effekte genauer und in größerem Ausmaß
berechnen zu können.
[Bearbeiten] Soundsystem
Nahezu alle aktuellen Spiele unterstützen 5.1 oder 7.1-Raumklang und Technologien wie
z.B. EAX, entsprechende PC-Hardware und Boxen vorausgesetzt. Dadurch wird der räum-
liche Eindruck der Spielwelt verstärkt, indem ein differenzierter Raumklang entsteht und
man auch die Position von Gegnern orten kann.
[Bearbeiten] Zustandsspeicherung
Um den aktuellen Spielstand abzuspeichern und wieder zu laden gibt es zwei Ansätze:

349
52. X3-Reunion

* Serialisierung des Objektbaums: Alle Objekte, deren Zustände und Beziehungen werden
gespeichert.
* Nur bestimmte Daten werden gespeichert. Vorteil sind kleine Dateien, und die Spielzu-
stände können etwa auch auf Speicher-Modulen von Konsolen gespeichert werden. Nachteil
ist ein größerer Programmieraufwand, weil die Programmierer genau programmieren müs-
sen, was abgespeichert wird. Aufgrund dieser Komplexität greifen Spiel-Engines daher oft
auf einfachere Verfahren zurück, etwa, dass man den Spielzustand nur an bestimmten Stel-
len im Spiel abspeichern kann.
[Bearbeiten] Steuerung
Unpräzise Steuerung führt schnell zu Frustration. Haben die Entwickler früherer PC-Spiele
noch auf die Pfeiltasten der Tastatur gesetzt, so gibt es heute für verschiedene Genres
andere, besser geeignete Lösungen. In der Sparte Rennspielen ist dies das Lenkrad, eventuell
mit Force-Feedback-Unterstützung. Bei Sportspielen, z.B. der FIFA-Reihe, greifen viele
Spieler zum Gamepad. Für Flugsimulationen werden in der Regel Joysticks verwendet.
Strategie- und Aufbauspiele werden normalerweise per Maus gesteuert. Bei Ego-Shootern
hat sich eine Kombination aus Maus und Tastatur durchgesetzt.
[Bearbeiten] Netzwerk-Code
Der Netzwerk-Code bestimmt die Voraussetzungen für den Multiplayer-Teil eines Spiels,
z. B. wieviele Spieler gleichzeitig am Spiel teilnehmen können oder ob ein 56k-Modem
ausreichend ist oder ein Breitbandinternetanschluss wie xDSL oder TV-Kabel benötigt
wird.
[Bearbeiten] Datenmanagement
Zum Laden und Speichern von Spielständen, Benutzer- und Leveldaten sowie zur Spei-
cherverwaltung ist ein Datenmanagement erforderlich. Spiel-Engines verfügen deshalb über
folgende Funktionen:
* Laden von Dateien aus Datenpaketen (z. B. verschlüsselte ZIP-Dateien)
* Speichermanagement
[Bearbeiten] Skripting
Skriptsprachen dienen der Programmierung der Spielabläufe. Grundsätzlich sind Spielab-
läufe auch in der Entwicklungssprache programmierbar, dennoch bieten Skriptsprachen
folgende Vorteile:
* Skriptsprachen sind für den Anwenderkreis der Spieledesigner, die nicht notwendigerweise
professionelle Programmierer sind, leichter zu erlernen als reine Entwicklungssprachen.
* Skriptsprachen können oftmals iterativ während der Programmausführung vorgenommen
werden, was die Entwicklungszeit verkürzt; eine Neucompilierung des Engine-Codes ist
hierbei nicht erforderlich.
Eine Scriptsprache ist meistens langsamer als andere Programmiersprachen wie etwa C++.
Die Spiel-Engine selbst ist daher meistens nicht in einer Scriptsprache programmiert, son-
dern in aller Regel in C++. Die Spiel-Engine stellt aber meistens eine Scriptsprache zur Ver-
fügung. Insbesondere für größere Spieleproduktionen hat sich daher eine Zwei-Schichten-
Architektur etabliert: Das eigentliche Spiel wird in der Scriptsprache entwickelt, welche
von der zugrundeliegenden Spiel-Engine zur Verfügung gestellt wird.

350
52.6. Zu Bearbeiten

Manche Spiel-Engines greifen auf vorhandene Skriptsprachen zurück, etwa Lua. Aufgrund
der besonderen Anforderungen besitzen viele Spiel-Engines eine eigene Skriptsprache, bei-
spielsweise UnrealScript in der Unreal-Engine, C-Script bzw. Lite-C im 3D Gamestudio,
oder Perch in der Shark 3D-Engine.
http://de.wikipedia.org/wiki/Game_Engine

351
52. X3-Reunion

352
53. UDK, Unreal Engine 3
Unreal Development Kit.
Homepage: http://www.udk.com/
Download: http://www.udk.com/download.html

53.1. Features
http://www.udk.com/features.html

53.1.1. Complete Editing Environment

53.1.2. Pure Rendering Power

53.1.3. State-of-the-Art Animation

53.1.4. Powerful Scripting

53.1.5. Real World Physics

53.1.6. Lighting and Shadows


• Illuminate
UDK gives you all the options to perfectly light any scene. Ambient occlusion, per-
pixel lighting, fill lighting and fully dynamic specular lighting and reflections are all
possible with UE3.
• Unreal Lightmass
Unreal Lightmass is an advanced global illumination solver. Light your world with a
single sun, giving off soft shadows, and let the diffuse interreflection (color bleeding)
do the work.
• Detailed Shadows
Advanced shadowing with support for four techniques:
◦ Dynamic stencil shadow volumes.
◦ Dynamic characters casting dynamic soft shadows.

353
53. UDK, Unreal Engine 3

◦ Ultra high-quality and high-performance pre-computed shadow masks.

◦ Directional light mapping with static shadowing and diffuse normal-mapped


lighting. An unlimited number of lights can be pre-computed and stored in a
single set of texture maps.

53.1.7. Gorgeous Cinematics

53.1.8. Terrain

• Terrain building and editing tool

◦ Uses a dynamically deformable base height map extended by multiple layers


of smoothly blended materials including displacement maps, normal maps and
arbitrarily complex materials, dynamic LOD-based tessellation and vegetation
layers with procedurally-placed meshes.

◦ Terrain is considered an actor in UDK, and therefore its shape is easily controlled
via a height map in a paintbrush-like manner. Painting and sculpting geography
is a simple task handled with the sweep of the mouse.

• Artist-controlled layers of procedural weathering

◦ For example, you can place grass and vegetation on the flat areas of terrain,
rock on high slopes and snow atop peaks.

◦ Grass and other foliage can be added either as a material or as decorations called
DecoLayers. Materials allow foliage to be instantly added to entire map sections
while DecoLayers offer deeper placement control.

• Advanced controls over lighting and collision

◦ Lightmaps, shadowmaps and collision properties can be edited in detail in order


to make the terrain look and perform realistically.

354
53.2. Installation

53.1.9. Built-in Networking

53.1.10. Real-time Shaders

53.1.11. Broad Audio Support

53.1.12. Particle Effects

53.1.13. Artificial Intelligence

53.1.14. Distributed Computing

53.1.15. Destructible Environments

53.1.16. Bink Video Codec

53.1.17. SpeedTree Foliage Editor


http://www.udk.com/features-speedtree.html
UDK is fully integrated with SpeedTree, the industry’s leading foliage editing software.
• Take advantage of SpeedTree’s forest rendering capabilities.
• Leverage SpeedTree’s excellent rendering quality with support built-in for shadow
mapping, translucency, ambient occlusion, per-pixel lighting, alpha-to-coverage and
more.
• Need a mountainous vista, a dramatic valley, or a peaceful meadow? UDK’s SpeedTree
integration includes abundant terrain engines.

53.1.18. FaceFX Facial Animation

53.2. Installation

53.3. Preferences

53.4. Bla

53.5. Ble

355
53. UDK, Unreal Engine 3

356
54. Vision 7 Game Engine
Trinigy ist ein im schwäbischen Eningen ansässiges Unternehmen, das sich auf die Entwick-
lung von 3D-Grafiktechnologien und Echtzeit-3D-Applikationen (Game Engines) speziali-
siert hat. Trinigys Vision Engine kommt in Spielen für PC und Konsolen z. B. bei Echtzeit-
Strategiespielen, Rollenspielen, Ego-Shootern, Jump ’n’ Runs und Massive-Multiplayer-
Online (MMORPG) Spielen zum Einsatz.
Trinigy ist Mitglied der Verbände G.A.M.E. und Tiga sowie der International Game Devel-
opers Association (IGDA), und ist außerdem Mitorganisator der IGDA-Chapter-Konferenz
in Frankfurt am Main.
http://de.wikipedia.org/wiki/Trinigy

54.1. Features

54.1.1. Overview

The Vision Engine – Engineered for Freedom


Every feature in the Vision Engine has been carefully engineered to empower game devel-
opers like you with more technical and creative freedom.
Freedom of Choice
Now in use on over 100 projects, the Vision Engine gives you the freedom to create the
type of game you want (MMOs, FPS, RPG, casual, serious, etc) on the platform of your
choice. It has been carefully optimized to efficiently utilize all available hardware resources
on all major platforms (PC, Xbox360®, PLAYSTATION®3 and Nintendo Wii®).
Freedom of Workflow
The Vision Engine boosts productivity and creativity by removing the technical limitations
so often imposed on your design, art and programming departments. Superior run-time
rendering, state-of-the-art exporters for the latest versions of Max and Maya, a WYSIWYG
scene editor with a myriad of useful tools and fully integrated middleware technologies,
a lighting editor, as well as model, scene and resource viewers help you quickly integrate,
explore and visualize new ideas and push the limits of game design.
Freedom from Risk
In addition to mature and proven game engine technology, you receive a reliable technolo-
gy partner that provides immediate, skilled support, helpful samples and documentation,
continuous software updates and access to our secure Vision Developer’s Site.

357
54. Vision 7 Game Engine

54.1.2. Engine
Optimized for Performance and Flexibility
Vision Engine 7 provides a powerful and versatile multi-platform runtime technology ideally
suited for all types of games and capable of rendering extremely complex scenes at smooth
frame rates. Providing a well-designed, clean and object-oriented C++ API, the technology
includes a wide variety of features that break through technical barriers and open up a
range of possibilities for game developers.
Large, Fully Customizable Feature Set
Engineered with creative and technical freedom in mind, the Vision Engine allows you
to easily create your own rendering pipeline, integrate the physics system of your choice,
or write your own animation code. Additionally, Trinigy´s game engine provides a large
set of convenient high-level and low-level helper classes to make customization as easy as
possible.
At the same time, an extensive set of out-of-the-box features reduces the development time
and cost of your project. Lights and shadows, radiosity, animations, normal maps, particles,
post-processing and much more - all these features are right at your fingertips once you
have installed the Vision SDK.
High-Performance, Highly Stable Rendering
The Vision Engine´s rendering core has been designed for performance and stability, allo-
wing highly detailed, realistic scenes to be rendered with maximum visual fidelity.
Shipped with complete source code, the default rendering pipeline serves as an ideal starting
point for your game project, providing an extensive set of fully integrated features such as:
• Normal maps, specular color and specular exponent maps, and virtual displacement
maps
• Radiosity-based, normal-mapped illumination with light grid and light maps
• Dynamic illumination with advanced dynamic shadowing techniques, configurable
attenuation, projected lights, and much more
• Shadow maps, variance shadow maps, and cascaded shadow maps
• Powerful multi-threaded particle engine
• Overlay and GUI rendering
• HDR and post-processing
• Efficient instancing system for static and dynamic geometry
• Powerful large terrain solution for vast, streamed landscapes, including Level of Detail
support, holes in terrain, and seamless integration with complex indoor scenes.
The Vision Engine uses a combination of efficient visibility culling techniques - including
hardware occlusion query, portals, and quadtrees/octrees - to achieve consistently high
frame rates.
Engine Extensibility
The SDK ships with many plug-ins that extend the core engine´s feature set. These plug-ins
can easily be customized and extended and include:

358
54.1. Features

• Physics bindings, i.e. the Vision Engine´s own physics system can easily be replaced
by 3rd party physics using the game engine´s physics interface
• Other 3rd party middleware integrations such as Kynapse AI or IDV SpeedTree
• Advanced visual effects such as volumetric lights and volumetric shadows
• Particle and cloth simulation including forces, many emitter types, customizable cons-
traint types, and collision geometry
• Cinematic playback
• Sound modules with full support for 3D sound and sound occlusion as well as strea-
ming on all platforms.
• A comprehensive LUA-based scripting solution, which is fully integrated into the
SDK´s WYSIWYG workflow.
Powerful Animation
The Vision Engine´s powerful animation system provides support for many of the ani-
mation methods in Autodesk 3ds Max and Maya. Optimized quaternion-based skeletal
animations, morphing deformers, and vertex animations provide the basis for smooth, li-
felike character animations. Skeletons and animation setups can be shared across meshes
in order to save memory, while the sharing of animation results across entities allows for
high-performance mass scenes with little performance impact.
Fully configurable animation trees makes dynamic layering and blending of arbitrary ani-
mations extremely easy. In keeping with the philosophy of creative and technical freedom,
the Vision Engine additionally allows you to define your own vertex and bone modifiers,
resulting in an extremely flexible animation setup.
Depending on the requirements of your game, animation can either be performed on the
CPU, the GPU or the PlayStation 3´s SPUs, with many platform-specific optimizations
ensuring optimal performance characteristics.
Customizable Streaming
The Vision Engine provides a powerful yet easily customizable streaming solution that is
an ideal solution for vast yet highly detailed landscapes and large indoor/outdoor environ-
ments. Almost all resource types can be streamed in the background, including geometries,
terrain, textures, shader libraries, animations, and much more.
Streaming is fully integrated into the Vision Engine´s scene editor, vForge, with its com-
pletely intuitive WYSIWYG workflow.
Optimized Platform Performance
The Vision Engine has been designed to provide exceptional high performance with a
small memory footprint on all supported hardware platforms. A hand-tuned system of
platform-specific optimizations ensures that both modern PCs and game consoles realize
their maximum potential. Among the features accounting for the Vision Engine´s high
performance are:
• Batching of primitives and elimination of redundant state changes
• Scalable effects and Level of Detail

359
54. Vision 7 Game Engine

• Efficient visibility culling system


• CPU-specific optimizations (ISSE, 3DNow!, AltiVec)
• GPU-specific optimizations (memory export, vertex fetch, instancing, etc.)
• Efficient cross-platform multi-threading architecture makes it possible to fully utilize
the potential of current and future multi-core platforms, including multi-core PCs,
Xbox360, and PlayStation 3.
The game engine´s multi-threading systems allow easy distribution of computing tasks
across multiple CPUs/SPUs or hardware threads with very little overhead, thus taking full
advantage of modern symmetric and asymmetric multi-core processors. Demo applications
based on the Vision Engine have been chosen by Intel to demonstrate the performance
benefits of computers with four and more CPU cores, yielding an almost linear performance
gain.
In order to facilitate game-specific memory and performance optimizations, the Vision En-
gine ships with a convenient runtime profiling framework and provides a powerful resource
management and analysis system. Performance bottlenecks can be easily identified and
removed, while unused resources can be automatically purged and recreated.

54.1.3. tools & workflow

54.1.4. 3rd party integration

To simplify your workflow and provide you with more creative options out-of-the-box,
Vision Engine 7 ships with a wide range of integration plug-ins for popular 3rd party
middleware solutions:
SpeedTree Vegetation Rendering
The de facto standard for rendering realistic tree and vegetation is available as a plugin
for the Vision Engine. This makes it very easy to add rendering of complete forests to your
application without long development time or sacrificing performance. Populating whole
forests is a matter of a few mouse clicks with our WYSIWYG editor vForge.
PhysX™ by NVIDIA
PhysX™ is one of the premier physics solutions. The PhysX™ integration provided as
part of the Vision SDK allows you to easily add ultra-realistic physics to your application.
You can interactively test and tweak physics settings in vForge´s "Play The Game" mode
directly in the scene editor.
Kynapse AI
Kynapse for games is the most widely used A.I. middleware within the game development
community and brings innovation like 3D dynamic topology analysis and efficient produc-
tion tools for automatic path-finding to the Vision engine. A Kynapse plugin and multiple
Kynapse engine samples make it easy to start working with Kynapse AI and Vision.
Scaleform GFx

360
54.1. Features

Scaleform GFx is a high-performance media Flash® vector graphics engine. Using Scaleform
GFx, companies can change from a programmer-centric static UI development environment
to an artist-driven dynamic UI and animated texture production pipeline..
Quazal Net-Z
Quazal Net-Z® is the most advanced distributed game state engine available on the market,
providing game developers with an easy-to-use SDK that packs all the features required for
videogames, from real-time data propagation for fast-paced games to synchronized game
inputs for deterministic simulations.
FMOD Ex
FMOD is a cross platform audio library and toolset to let artists easily implement the
latest audio technologies into a title. The Vision binding allows artists to place 3D sounds
in the vForge WYSIWYG environment and to define sound collision geometry.
ProFX 2
ProFX is the leading middleware for authoring and on-the-fly rendering of procedural
textures. This is the ideal solution for games that have a limited bandwidth for content
download. Vision smoothly integrates loading procedural texture definitions into the re-
source management system.
Bullet physics
Bullet is an open source software physics engine, developed by Erwin Coumans and pu-
blished under the zlib license. Bullet is available on Playstation 3, XBox 360, Wii and
Windows PC.
OpenAL
OpenAL (Open Audio Library) is a software cross-platform audio API, hosted (and largely
developed) by Creative Technology. It is designed for efficient rendering of multichannel
three dimensional positional audio and available on Xbox 360 and Windows PC.
morpheme™
NaturalMotion´s morpheme™, is the industry´s first graphically authorable animation
engine designed to give animators full control over the look of their animations in-game
by allowing them to author and preview blends, blend trees and transition graphs in real
time.
DMM (Digital Molecular Matter)
DMM is a technology to simulate "material physics", or the dynamic behavior of objects
made of realistic materials. DMM handles soft-body, plastically deforming (e.g., bending
metal) and breakable objects all within the same system. These capabilities distinguish
DMM from rigid-body systems, which are limited to idealized rigid materials and are
unable to simulate the deformation and fracture of real-world objects with the kind of
kinetic fidelity that makes things seem real.
NetDog MMO network solution
NetDog is an out-of-the-box, highly scalable networking solution for developers of Massively
Multiplayer Online Games and Virtual Worlds. NetDog is easy-to-use, flexible, and game-
engine independent, helping developers bring worlds to market faster, easier and cheaper
by creating scalable, high performance networks that support millions of users.

361
54. Vision 7 Game Engine

Havok Physics™
Havok Physics™ is the proven leader in real-time collision detection and physical simulation
solutions. Havok Physics offers the fastest, most robust simulation technology available,
which is why it has become the gold standard within the games industry. Havok Physics
has been chosen by leading game developers in over 200 launched titles and hundreds more
in development.
xaitment
A partner of the German Research Center for Artificial Intelligence, xaitment has served
customers with AI and game design tools since 2004. Their mission - to create lifelike AI
for games and simulations - led to the development of the xaitment AI game tools, highly
customizable and highly modular development solutions that save production costs while
helping development teams effectively reach their creative potential.
Mixamo
Mixamo is an online 3D animation service that accelerates the character production process
up to five times. 3D game studios can create AAA-quality character animations much faster
than traditional motion-capture and keyframing processes require. Mixamo provides game
artists with real-time, director-level customization controls, automatic retargeting, and the
highest-quality motion data that has been cleaned and looped. Mixamo is currently being
used by top-talent 3D game developers around the world.
Fork Particle
Fork Particle is the leading real-time particle effects middleware for video games. The Fork
Particle SDK and Trinigy´s Vision Engine integration is an out-of-box solution for runtime
and scene editor vForge which lets you forgo programming considerations and enables focus
on content development. Artists can easily create fantastic particle effects with the Fork
Particle Studio effects editor. The runtime integration is cross platform and utilizes
Vision Engine´s runtime multi-threaded architecture.

54.1.5. multiplatform

54.1.6. support & documentation

54.1.7. serious games

54.1.8. five good reasons

54.1.9. evaluation kit


http://www.trinigy.net/evaluation-kit

362
55. Unity

363
55. Unity

364
56. Torque_3D

365
56. Torque_3D

366
57. Truevision3D
http://en.wikipedia.org/wiki/Truevision3D

367
57. Truevision3D

368
58. Ogre 3d

58.1. Tutorien

58.1.1. Creating a 3D game with Ogre - Adding the Player


Link
In this tutorial we add a ship that can be controlled by the player.

58.1.2. How to begin writing games in C++


http://www.tutcity.com/tutorial/how-to-begin-writing-games-in-c.1126.html
This is a tutorial about how to start writing games with C++. It also explains the important
steps of creating the game.

369
58. Ogre 3d

370
59. Editoren

59.1. Worldweaver.DX.Studio.Commercial.Pro.v3.2.7.0
DX Studio ist ein Autorensystem von WorldWeaver. Es ist in einer kostenlosen und in zwei
kostenpflichtigen Versionen erhältlich. Die Engine ist für 3D Videospiele, Simulationen und
Präsentationen geeignet. DX Studio Projekte können entweder als selbstständige Program-
me ausgeführt werden oder aber auch im Browser, Microsoft Office Produkten oder Visual
Studio eingebettet werden.
http://de.wikipedia.org/wiki/DX_Studio

59.2. 3D World Studio


3D World Studio offers a feature set just as powerful as UnrealEd, yet is friendly enough
for beginners to use. New users can often start building in the program without reading a
manual.
3D World Studio is the map editor of choice for use with DarkBASIC Professional, Torque
Game Engine, Blitz3D, and other 3D engines. The program is ideal for game environments,
3D presentations and commercial applications.
http://3dworldstudio.thegamecreators.com/

371
59. Editoren

372
60. Libs
http://www.trinigy.net/vision-game-engine-3rd-party

60.1. Wissenswertes

60.1.1. ABC
60.1.1.1. XYZ

373
60. Libs

374
61. Ressourcen

61.1. Weblinks
• DevMaster
DevMaster ist eine Wissensdatenbank und ein Forum rund um die Spieleentwicklung.
Es werden Tutorien abgedeckt und ein weiter Bereich von Programmiersprachen un-
terstützt.
Welcome to the Wiki pages of DevMaster.net!
DmWiki is a community-driven knowledge base about everything related to game
development that is written collaboratively by many of its readers. Due to the open
nature of a wiki, content can be added and modified by any user. You are highly
encouraged to participate and share your knowledge with others, as well as fix any
errors and enhance the content. Every page contains an ’edit’ link from which pages
can be modified. If you are interested in writing content for DmWiki, please see the
most-wanted pages for a list of pages people are interested in seeing.
http://www.devmaster.net/
Engine-Liste: http://www.devmaster.net/engines/list.php?fid=26&sid=6

375
61. Ressourcen

376
Literaturverzeichnis
[1] “WM_MOUSEWHEEL notification,” http://msdn.microsoft.com/en-
us/library/ms645617(VS.85).aspx, 2009. [Online]. Available: http:
//msdn.microsoft.com/en-us/library/ms645617(VS.85).aspx
[2] I. Horton, Ivor Horton’s Beginning Visual C++ 2008. Wrox, 2008.
[3] KodefuGuru, “Exposing a generic list,”
http://geekswithblogs.net/Shadowin/archive/2008/09/30/exposing-a-generic-
list.aspx, Sep. 2008. [Online]. Available: http://geekswithblogs.net/Shadowin/
archive/2008/09/30/exposing-a-generic-list.aspx
[4] J. Henry, Developing . NET Custom Controls and Designers Using C#. BlueVision,
LLC, Jan. 2005. [Online]. Available: http://books.google.de/books?id=f2lcvqNAeo4C
[5] A. Abarca, P. Gómez-Sal, A. Martín, M. Mena, J. M. Poblet, and C. Yélamos,
“Ammonolysis of mono(pentamethylcyclopentadienyl) titanium(iv) derivatives,” In-
org. Chem., vol. 39, no. 4, pp. 642–651, 2000.
[6] F. A. Cotton, G. Wilkinson, C. A. Murillio, and M. Bochmann, Advanced Inorganic
Chemistry, 6th ed. Chichester: Wiley, 1999.
[7] M. J. Frisch, G. W. Trucks, H. B. Schlegel, G. E. Scuseria, M. A. Robb, J. R. Chee-
seman, Montgomery, Jr., J. A., T. Vreven, K. N. Kudin, J. C. Burant, J. M. Millam,
S. S. Iyengar, J. Tomasi, V. Barone, B. Mennucci, M. Cossi, G. Scalmani, N. Rega,
G. A. Petersson, H. Nakatsuji, M. Hada, M. Ehara, K. Toyota, R. Fukuda, J. Hase-
gawa, M. Ishida, T. Nakajima, Y. Honda, O. Kitao, H. Nakai, M. Klene, X. Li, J. E.
Knox, H. P. Hratchian, J. B. Cross, V. Bakken, C. Adamo, J. Jaramillo, R. Gomperts,
R. E. Stratmann, O. Yazyev, A. J. Austin, R. Cammi, C. Pomelli, J. W. Ochterski,
P. Y. Ayala, K. Morokuma, G. A. Voth, P. Salvador, J. J. Dannenberg, V. G. Za-
krzewski, S. Dapprich, A. D. Daniels, M. C. Strain, O. Farkas, D. K. Malick, A. D.
Rabuck, K. Raghavachari, J. B. Foresman, J. V. Ortiz, Q. Cui, A. G. Baboul, S. Clif-
ford, J. Cioslowski, B. B. Stefanov, G. Liu, A. Liashenko, P. Piskorz, I. Komaromi,
R. L. Martin, D. J. Fox, T. Keith, M. A. Al-Laham, C. Y. Peng, A. Nanayakkara,
M. Challacombe, P. M. W. Gill, B. Johnson, W. Chen, M. W. Wong, C. Gonzalez,
and J. A. Pople, Gaussian 03, Gaussian, Inc., Wallingford, CT, USA, Gaussian, Inc.,
Wallingford, CT, 2004.
[8] goLaTeX.de, “goLaTeX-Wiki, deutschsprachiges LaTeX forum,
http://www.golatex.de/wiki/index.php?title=Kategorie:goLaTeX-Wiki,”
http://www.golatex.de/wiki/index.php?title=Kategorie:goLaTeX-Wiki. [Online].
Available: http://www.golatex.de/wiki/index.php?title=Kategorie:goLaTeX-Wiki
[9] M. Community, “Latex - textformatierung (Seitenzah-
len, Überschriften),” http://www.macuser.de/forum/f19/latex-textformatierung-

377
Literaturverzeichnis

seitenzahlen-51253/. [Online]. Available: http://www.macuser.de/forum/f19/


latex-textformatierung-seitenzahlen-51253/
[10] Wikibooks, “LaTeX-Wörterbuch: setlength, wikibooks, sammlung freier lehr-,
sach- und fachbücher,” http://de.wikibooks.org/wiki/LaTeX-Wörterbuch:_setlength.
[Online]. Available: http://de.wikibooks.org/wiki/LaTeX-Wörterbuch:_setlength
[11] D. J. Jobson, Z. Rahman, and G. A. Woodell, “Retinex image processing: Improved
fidelity to direct visual observation,” in Proceedings of the IS&T Fourth Color Imaging
Conference: Color Science, Systems, and Applications, vol. 4. The Society for Imaging
Science and Technology, 1995, pp. 124–125.
[12] “XNA animation component library - home 10,”
http://animationcomponents.codeplex.com/Wiki/View.aspx?title=Blending%20Between%20Idle%
[Online]. Available: http://animationcomponents.codeplex.com/Wiki/View.aspx?
title=Blending%20Between%20Idle%20and%20Walk&referringTitle=Tutorial%
20Home
[13] “Red gate forums :: View topic - disable .net reflector update,” http://www.red-
gate.com/messageboard/viewtopic.php?t=9068. [Online]. Available: http://www.
red-gate.com/messageboard/viewtopic.php?t=9068
[14] “NCover, mbunit, command line profiler connection can not connect? - stack overflow,”
http://stackoverflow.com/questions/1284777/ncover-mbunit-command-line-profiler-
connection-can-not-connect. [Online]. Available: http://stackoverflow.com/questions/
1284777/ncover-mbunit-command-line-profiler-connection-can-not-connect
[15] “CodeProject: .NET internals and native compi-
ling. free source code and programming help,”
http://www.codeproject.com/KB/dotnet/internals_native.aspx?msg=2577674#xx2577674xx.
[Online]. Available: http://www.codeproject.com/KB/dotnet/internals_native.aspx?
msg=2577674#xx2577674xx
[16] “CodeProject: XsdTidy beautifies the xsd.exe output *with full Doc-
Book .NET wrapper*. free source code and programming help,”
http://www.codeproject.com/KB/cs/xsdtidy.aspx. [Online]. Available: http://www.
codeproject.com/KB/cs/xsdtidy.aspx
[17] “Stuart preston’s blog : Using MSBuild with the visual studio IDE and source
control,” http://blogs.conchango.com/stuartpreston/archive/2007/07/29/Using-
MSBuild-with-the-Visual-Studio-IDE-and-Source-Control.aspx. [Online].
Available: http://blogs.conchango.com/stuartpreston/archive/2007/07/29/
Using-MSBuild-with-the-Visual-Studio-IDE-and-Source-Control.aspx
[18] “NCover - frequently asked questions,” http://docs.ncover.com/ref/2-
0/frequently-asked-questions/. [Online]. Available: http://docs.ncover.com/ref/2-0/
frequently-asked-questions/
[19] “devAdvantage features : Enforcing c# coding standards,”
http://www.anticipatingminds.com/Content/products/devAdvantage/devAdvantageFeatures.asp
[Online]. Available: http://www.anticipatingminds.com/Content/products/
devAdvantage/devAdvantageFeatures.aspx

378
Literaturverzeichnis

[20] “CodeProject: refly, makes the CodeDom’er life easier. free source code and pro-
gramming help,” http://www.codeproject.com/KB/cs/refly.aspx. [Online]. Available:
http://www.codeproject.com/KB/cs/refly.aspx
[21] “CodeProject: dynamic creation of Assemblies/Apps. free source code and
programming help,” http://www.codeproject.com/KB/cs/CodeDomCompile.aspx.
[Online]. Available: http://www.codeproject.com/KB/cs/CodeDomCompile.aspx
[22] “msbuildtasks.tigris.org,” http://msbuildtasks.tigris.org/. [Online]. Available: http:
//msbuildtasks.tigris.org/
[23] “LaTeX umflossene abbildungen mit floatflt,”
http://www.jkrieger.de/tools/latex/floatflt.html, 2009, jkrieger. [Online]. Available:
http://www.jkrieger.de/tools/latex/floatflt.html
[24] “jkrieger.de/ LaTeX/ floatflt,” http://www.jkrieger.de/tools/latex/floatflt.html. [On-
line]. Available: http://www.jkrieger.de/tools/latex/floatflt.html

379
Literaturverzeichnis

380
Literaturverzeichnis
[1] J. W. Barrett and J. F. Blowey (1995), An error bound for the finite
element approximation of the Cahn-Hilliard equation with logarith-
mic free energy, Numerische Mathematics, 72, pp 1–20.
[2] J. W. Barrett and J. F. Blowey (1997), Finite element approximation
of a model for phase separation of a multi-component alloy with non-
smooth free energy, Numerische Mathematics, 77, pp 1–34.
[3] J. W. Barrett and J. F. Blowey (2001), An improved error bound
for finite element approximation of a model for phase separation
of a multi-component alloy with a concentration dependent mobility
matrix, Numerische Mathematics, 88, pp 255–297.
[4] G. Birkhoff and G. C. Rota (1969), Ordinary Differential Equa-
tions, Second Ed., Xerox College Publishing, Lexington, Massachu-
setts
[5] V. Thomé (1997), Galerkin Finite Element Methods for Pa-
rabolic Problems, Springer-Verlag, Berlin-Heidelberg.
[6] Keith Young, Riptide Plugin for Cinema 4d
http://skinprops.com/download.php
[7] C4 Engine Wiki:http://www.terathon.com/wiki/index.php?title=Cinema_4D
[8] Pixologic Release - Displacement Ex-
porter (Now included in ZBrush 3.1)
http://www.zbrushcentral.com/zbc/showthread.php?t=029789.
[9] Amanda Knight, ZBrush to Cinema4D. ZBrush Info,
http://www.pixologic.com/docs/index.php/ZBrush_to_Cinema4D#The_ADE_p

381
Literaturverzeichnis

382
Teil XII.

Appendix

383
Stichwortverzeichnis

Ant, 77 Octree, 173


AptDiff, 247 Polygon, 172
Arguments by Reference, 99 Texturfilter, 178
Arrays, 126 Vertex, 171
Assembly, 131 Grafisches Primitiv, 171
Autoconf, 231
Automake, 231 Handles, 95

Bildraumverfahren, 176 Invoking, 114


Boost, 87
Kantenliste, 172
CFF Explorer, 250 Kaxaml, 167
CLI, 95 Knotenliste, 172
CMAKE, 233 Konsole umleiten, 159
Coding Guideline, 107
Log4Net, 131
Collation, 278
CSharp, 107 Marshaling, 140
CSV, 276 Mausrad, 53, 85
Cubemap, 193 Mausrad-Meldungen, 113
Cygwin, 263 Mesh, 172
Progressiv, 182
Dateien suchen, 267
Microsoft Management Console, 5
DBUpdater, 261
MIP-Map, 178
Decorator, 133
MMC, 5
Dictionary, 120
Disassembler, 249 Namespaces, 109
NET Mass Downloader, 61
Eclipse, 73
NUnit, 235
EVE
NVASM, 189
EVE-MEEP, 313
O/R mapping, 163
find, 267
Objektraumverfahren, 175
Fluent Interfaces, 133
Ordner kopieren, 116
Fuslogvw, 248
Oxygen-XML, 81
Generic List, 108
GPU Gems, 222 P/Invoke, 140
Grafik Photoshop, 191
Chunked LOD, 182 RenderMan, 183
LOD, 181
Mip Mapping, 177 Serialization, 127

385
Stichwortverzeichnis

SerializationBinder, 127
Shader, 183
Shader Debugger, 187
SIMD, 209
Singleton, 137
Source Code Server, 61
Spy++, 248
STL, 92
std::stringstream, 92
subversion, 243
SuspendableThread, 157
SVN, 243
Swizzling, 215
Systemwiederherstellungspunkt, 5

TableAdapter, 128
Terrain, 181, 182
Texturen, 177
Texturskalierung, 177
Thread
Abort, 141
Pause, 140
Resume, 140
Threading, 140
Threads, 140
Tracking Reference, 102

VCSPackages, 58
Vertex Shader, 195
Vertex Shaders, 186, 217
Visual Studio, 55
Volumentexturen, 179

Webserver, 273
WinDiff, 248
Windows, 1
Explorer, 7
WPF, 167

XAF, 259
XAML, 167
XNA, 171

386
A. Basic and Auxiliary Results

A.1. Basic Results

387
A. Basic and Auxiliary Results

388
B. Testbereich

A∗X

389
B. Testbereich

390
C. Nomenklatur

391
C. Nomenklatur

392
Nomenclature
Firefox Der Name Firefox bezeichnet einen freien Webbrowser.

393
C. Nomenklatur

394

You might also like